Java Code Examples for jdk.nashorn.internal.ir.BinaryNode#isSelfModifying()
The following examples show how to use
jdk.nashorn.internal.ir.BinaryNode#isSelfModifying() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: OptimisticTypesCalculator.java From TencentKona-8 with GNU General Public License v2.0 | 6 votes |
@Override public boolean enterBinaryNode(final BinaryNode binaryNode) { if(binaryNode.isAssignment()) { final Expression lhs = binaryNode.lhs(); if(!binaryNode.isSelfModifying()) { tagNeverOptimistic(lhs); } if(lhs instanceof IdentNode) { final Symbol symbol = ((IdentNode)lhs).getSymbol(); // Assignment to internal symbols is never optimistic, except for self-assignment expressions if(symbol.isInternal() && !binaryNode.rhs().isSelfModifying()) { tagNeverOptimistic(binaryNode.rhs()); } } } else if(binaryNode.isTokenType(TokenType.INSTANCEOF)) { tagNeverOptimistic(binaryNode.lhs()); tagNeverOptimistic(binaryNode.rhs()); } return true; }
Example 2
Source File: OptimisticTypesCalculator.java From jdk8u60 with GNU General Public License v2.0 | 6 votes |
@Override public boolean enterBinaryNode(final BinaryNode binaryNode) { if(binaryNode.isAssignment()) { final Expression lhs = binaryNode.lhs(); if(!binaryNode.isSelfModifying()) { tagNeverOptimistic(lhs); } if(lhs instanceof IdentNode) { final Symbol symbol = ((IdentNode)lhs).getSymbol(); // Assignment to internal symbols is never optimistic, except for self-assignment expressions if(symbol.isInternal() && !binaryNode.rhs().isSelfModifying()) { tagNeverOptimistic(binaryNode.rhs()); } } } else if(binaryNode.isTokenType(TokenType.INSTANCEOF)) { tagNeverOptimistic(binaryNode.lhs()); tagNeverOptimistic(binaryNode.rhs()); } return true; }
Example 3
Source File: OptimisticTypesCalculator.java From openjdk-jdk8u with GNU General Public License v2.0 | 6 votes |
@Override public boolean enterBinaryNode(final BinaryNode binaryNode) { if(binaryNode.isAssignment()) { final Expression lhs = binaryNode.lhs(); if(!binaryNode.isSelfModifying()) { tagNeverOptimistic(lhs); } if(lhs instanceof IdentNode) { final Symbol symbol = ((IdentNode)lhs).getSymbol(); // Assignment to internal symbols is never optimistic, except for self-assignment expressions if(symbol.isInternal() && !binaryNode.rhs().isSelfModifying()) { tagNeverOptimistic(binaryNode.rhs()); } } } else if(binaryNode.isTokenType(TokenType.INSTANCEOF)) { tagNeverOptimistic(binaryNode.lhs()); tagNeverOptimistic(binaryNode.rhs()); } return true; }
Example 4
Source File: OptimisticTypesCalculator.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 6 votes |
@Override public boolean enterBinaryNode(final BinaryNode binaryNode) { if(binaryNode.isAssignment()) { final Expression lhs = binaryNode.lhs(); if(!binaryNode.isSelfModifying()) { tagNeverOptimistic(lhs); } if(lhs instanceof IdentNode) { final Symbol symbol = ((IdentNode)lhs).getSymbol(); // Assignment to internal symbols is never optimistic, except for self-assignment expressions if(symbol.isInternal() && !binaryNode.rhs().isSelfModifying()) { tagNeverOptimistic(binaryNode.rhs()); } } } else if(binaryNode.isTokenType(TokenType.INSTANCEOF)) { tagNeverOptimistic(binaryNode.lhs()); tagNeverOptimistic(binaryNode.rhs()); } return true; }
Example 5
Source File: OptimisticTypesCalculator.java From openjdk-jdk9 with GNU General Public License v2.0 | 6 votes |
@Override public boolean enterBinaryNode(final BinaryNode binaryNode) { if(binaryNode.isAssignment()) { final Expression lhs = binaryNode.lhs(); if(!binaryNode.isSelfModifying()) { tagNeverOptimistic(lhs); } if(lhs instanceof IdentNode) { final Symbol symbol = ((IdentNode)lhs).getSymbol(); // Assignment to internal symbols is never optimistic, except for self-assignment expressions if(symbol.isInternal() && !binaryNode.rhs().isSelfModifying()) { tagNeverOptimistic(binaryNode.rhs()); } } } else if(binaryNode.isTokenType(TokenType.INSTANCEOF) || binaryNode.isTokenType(TokenType.EQ_STRICT) || binaryNode.isTokenType(TokenType.NE_STRICT)) { tagNeverOptimistic(binaryNode.lhs()); tagNeverOptimistic(binaryNode.rhs()); } return true; }
Example 6
Source File: OptimisticTypesCalculator.java From hottub with GNU General Public License v2.0 | 6 votes |
@Override public boolean enterBinaryNode(final BinaryNode binaryNode) { if(binaryNode.isAssignment()) { final Expression lhs = binaryNode.lhs(); if(!binaryNode.isSelfModifying()) { tagNeverOptimistic(lhs); } if(lhs instanceof IdentNode) { final Symbol symbol = ((IdentNode)lhs).getSymbol(); // Assignment to internal symbols is never optimistic, except for self-assignment expressions if(symbol.isInternal() && !binaryNode.rhs().isSelfModifying()) { tagNeverOptimistic(binaryNode.rhs()); } } } else if(binaryNode.isTokenType(TokenType.INSTANCEOF)) { tagNeverOptimistic(binaryNode.lhs()); tagNeverOptimistic(binaryNode.rhs()); } return true; }
Example 7
Source File: OptimisticTypesCalculator.java From jdk8u_nashorn with GNU General Public License v2.0 | 6 votes |
@Override public boolean enterBinaryNode(final BinaryNode binaryNode) { if(binaryNode.isAssignment()) { final Expression lhs = binaryNode.lhs(); if(!binaryNode.isSelfModifying()) { tagNeverOptimistic(lhs); } if(lhs instanceof IdentNode) { final Symbol symbol = ((IdentNode)lhs).getSymbol(); // Assignment to internal symbols is never optimistic, except for self-assignment expressions if(symbol.isInternal() && !binaryNode.rhs().isSelfModifying()) { tagNeverOptimistic(binaryNode.rhs()); } } } else if(binaryNode.isTokenType(TokenType.INSTANCEOF)) { tagNeverOptimistic(binaryNode.lhs()); tagNeverOptimistic(binaryNode.rhs()); } return true; }
Example 8
Source File: LocalVariableTypesCalculator.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
@Override public boolean enterBinaryNode(final BinaryNode binaryNode) { // NOTE: regardless of operator's lexical associativity, lhs is always evaluated first. final Expression lhs = binaryNode.lhs(); final LvarType lhsType; if (!(lhs instanceof IdentNode && binaryNode.isTokenType(TokenType.ASSIGN))) { lhsType = visitExpression(lhs); } else { // Can't visit IdentNode on LHS of a simple assignment, as visits imply use, and this is def. // The type is irrelevant, as only RHS is used to determine the type anyway. lhsType = LvarType.UNDEFINED; } final boolean isLogical = binaryNode.isLogical(); final Label joinLabel = isLogical ? new Label("") : null; if(isLogical) { jumpToLabel((JoinPredecessor)lhs, joinLabel); } final Expression rhs = binaryNode.rhs(); final LvarType rhsType = visitExpression(rhs); if(isLogical) { jumpToLabel((JoinPredecessor)rhs, joinLabel); } joinOnLabel(joinLabel); final LvarType type = toLvarType(binaryNode.setOperands(lhsType.typeExpression, rhsType.typeExpression).getType()); if(binaryNode.isAssignment() && lhs instanceof IdentNode) { if(binaryNode.isSelfModifying()) { onSelfAssignment((IdentNode)lhs, type); } else { onAssignment((IdentNode)lhs, type); } } typeStack.push(type); return false; }
Example 9
Source File: LocalVariableTypesCalculator.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
@Override public boolean enterBinaryNode(final BinaryNode binaryNode) { // NOTE: regardless of operator's lexical associativity, lhs is always evaluated first. final Expression lhs = binaryNode.lhs(); final LvarType lhsType; if (!(lhs instanceof IdentNode && binaryNode.isTokenType(TokenType.ASSIGN))) { lhsType = visitExpression(lhs); } else { // Can't visit IdentNode on LHS of a simple assignment, as visits imply use, and this is def. // The type is irrelevant, as only RHS is used to determine the type anyway. lhsType = LvarType.UNDEFINED; } final boolean isLogical = binaryNode.isLogical(); final Label joinLabel = isLogical ? new Label("") : null; if(isLogical) { jumpToLabel((JoinPredecessor)lhs, joinLabel); } final Expression rhs = binaryNode.rhs(); final LvarType rhsType = visitExpression(rhs); if(isLogical) { jumpToLabel((JoinPredecessor)rhs, joinLabel); } joinOnLabel(joinLabel); final LvarType type = toLvarType(binaryNode.setOperands(lhsType.typeExpression, rhsType.typeExpression).getType()); if(binaryNode.isAssignment() && lhs instanceof IdentNode) { if(binaryNode.isSelfModifying()) { onSelfAssignment((IdentNode)lhs, type); } else { onAssignment((IdentNode)lhs, type); } } typeStack.push(type); return false; }
Example 10
Source File: LocalVariableTypesCalculator.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
@Override public boolean enterBinaryNode(final BinaryNode binaryNode) { // NOTE: regardless of operator's lexical associativity, lhs is always evaluated first. final Expression lhs = binaryNode.lhs(); final LvarType lhsType; if (!(lhs instanceof IdentNode && binaryNode.isTokenType(TokenType.ASSIGN))) { lhsType = visitExpression(lhs); } else { // Can't visit IdentNode on LHS of a simple assignment, as visits imply use, and this is def. // The type is irrelevant, as only RHS is used to determine the type anyway. lhsType = LvarType.UNDEFINED; } final boolean isLogical = binaryNode.isLogical(); final Label joinLabel = isLogical ? new Label("") : null; if(isLogical) { jumpToLabel((JoinPredecessor)lhs, joinLabel); } final Expression rhs = binaryNode.rhs(); final LvarType rhsType = visitExpression(rhs); if(isLogical) { jumpToLabel((JoinPredecessor)rhs, joinLabel); } joinOnLabel(joinLabel); final LvarType type = toLvarType(binaryNode.setOperands(lhsType.typeExpression, rhsType.typeExpression).getType()); if(binaryNode.isAssignment() && lhs instanceof IdentNode) { if(binaryNode.isSelfModifying()) { onSelfAssignment((IdentNode)lhs, type); } else { onAssignment((IdentNode)lhs, type); } } typeStack.push(type); return false; }
Example 11
Source File: LocalVariableTypesCalculator.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
@Override public boolean enterBinaryNode(final BinaryNode binaryNode) { // NOTE: regardless of operator's lexical associativity, lhs is always evaluated first. final Expression lhs = binaryNode.lhs(); final LvarType lhsType; if (!(lhs instanceof IdentNode && binaryNode.isTokenType(TokenType.ASSIGN))) { lhsType = visitExpression(lhs); } else { // Can't visit IdentNode on LHS of a simple assignment, as visits imply use, and this is def. // The type is irrelevant, as only RHS is used to determine the type anyway. lhsType = LvarType.UNDEFINED; } final boolean isLogical = binaryNode.isLogical(); final Label joinLabel = isLogical ? new Label("") : null; if(isLogical) { jumpToLabel((JoinPredecessor)lhs, joinLabel); } final Expression rhs = binaryNode.rhs(); final LvarType rhsType = visitExpression(rhs); if(isLogical) { jumpToLabel((JoinPredecessor)rhs, joinLabel); } joinOnLabel(joinLabel); final LvarType type = toLvarType(binaryNode.setOperands(lhsType.typeExpression, rhsType.typeExpression).getType()); if(binaryNode.isAssignment() && lhs instanceof IdentNode) { if(binaryNode.isSelfModifying()) { onSelfAssignment((IdentNode)lhs, type); } else { onAssignment((IdentNode)lhs, type); } } typeStack.push(type); return false; }
Example 12
Source File: LocalVariableTypesCalculator.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
@Override public boolean enterBinaryNode(final BinaryNode binaryNode) { // NOTE: regardless of operator's lexical associativity, lhs is always evaluated first. final Expression lhs = binaryNode.lhs(); final LvarType lhsType; if (!(lhs instanceof IdentNode && binaryNode.isTokenType(TokenType.ASSIGN))) { lhsType = visitExpression(lhs); } else { // Can't visit IdentNode on LHS of a simple assignment, as visits imply use, and this is def. // The type is irrelevant, as only RHS is used to determine the type anyway. lhsType = LvarType.UNDEFINED; } final boolean isLogical = binaryNode.isLogical(); final Label joinLabel = isLogical ? new Label("") : null; if(isLogical) { jumpToLabel((JoinPredecessor)lhs, joinLabel); } final Expression rhs = binaryNode.rhs(); final LvarType rhsType = visitExpression(rhs); if(isLogical) { jumpToLabel((JoinPredecessor)rhs, joinLabel); } joinOnLabel(joinLabel); final LvarType type = toLvarType(binaryNode.setOperands(lhsType.typeExpression, rhsType.typeExpression).getType()); if(binaryNode.isAssignment() && lhs instanceof IdentNode) { if(binaryNode.isSelfModifying()) { onSelfAssignment((IdentNode)lhs, type); } else { onAssignment((IdentNode)lhs, type); } } typeStack.push(type); return false; }
Example 13
Source File: LocalVariableTypesCalculator.java From hottub with GNU General Public License v2.0 | 5 votes |
@Override public boolean enterBinaryNode(final BinaryNode binaryNode) { // NOTE: regardless of operator's lexical associativity, lhs is always evaluated first. final Expression lhs = binaryNode.lhs(); final LvarType lhsType; if (!(lhs instanceof IdentNode && binaryNode.isTokenType(TokenType.ASSIGN))) { lhsType = visitExpression(lhs); } else { // Can't visit IdentNode on LHS of a simple assignment, as visits imply use, and this is def. // The type is irrelevant, as only RHS is used to determine the type anyway. lhsType = LvarType.UNDEFINED; } final boolean isLogical = binaryNode.isLogical(); final Label joinLabel = isLogical ? new Label("") : null; if(isLogical) { jumpToLabel((JoinPredecessor)lhs, joinLabel); } final Expression rhs = binaryNode.rhs(); final LvarType rhsType = visitExpression(rhs); if(isLogical) { jumpToLabel((JoinPredecessor)rhs, joinLabel); } joinOnLabel(joinLabel); final LvarType type = toLvarType(binaryNode.setOperands(lhsType.typeExpression, rhsType.typeExpression).getType()); if(binaryNode.isAssignment() && lhs instanceof IdentNode) { if(binaryNode.isSelfModifying()) { onSelfAssignment((IdentNode)lhs, type); } else { onAssignment((IdentNode)lhs, type); } } typeStack.push(type); return false; }
Example 14
Source File: LocalVariableTypesCalculator.java From jdk8u_nashorn with GNU General Public License v2.0 | 5 votes |
@Override public boolean enterBinaryNode(final BinaryNode binaryNode) { // NOTE: regardless of operator's lexical associativity, lhs is always evaluated first. final Expression lhs = binaryNode.lhs(); final LvarType lhsType; if (!(lhs instanceof IdentNode && binaryNode.isTokenType(TokenType.ASSIGN))) { lhsType = visitExpression(lhs); } else { // Can't visit IdentNode on LHS of a simple assignment, as visits imply use, and this is def. // The type is irrelevant, as only RHS is used to determine the type anyway. lhsType = LvarType.UNDEFINED; } final boolean isLogical = binaryNode.isLogical(); final Label joinLabel = isLogical ? new Label("") : null; if(isLogical) { jumpToLabel((JoinPredecessor)lhs, joinLabel); } final Expression rhs = binaryNode.rhs(); final LvarType rhsType = visitExpression(rhs); if(isLogical) { jumpToLabel((JoinPredecessor)rhs, joinLabel); } joinOnLabel(joinLabel); final LvarType type = toLvarType(binaryNode.setOperands(lhsType.typeExpression, rhsType.typeExpression).getType()); if(binaryNode.isAssignment() && lhs instanceof IdentNode) { if(binaryNode.isSelfModifying()) { onSelfAssignment((IdentNode)lhs, type); } else { onAssignment((IdentNode)lhs, type); } } typeStack.push(type); return false; }