< prev index next >

src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/OptimisticTypesCalculator.java

Print this page




 113     }
 114 
 115     @Override
 116     public boolean enterCatchNode(final CatchNode catchNode) {
 117         // Condition is never optimistic (always coerced to boolean).
 118         tagNeverOptimistic(catchNode.getExceptionCondition());
 119         return true;
 120     }
 121 
 122     @Override
 123     public boolean enterExpressionStatement(final ExpressionStatement expressionStatement) {
 124         final Expression expr = expressionStatement.getExpression();
 125         if(!expr.isSelfModifying()) {
 126             tagNeverOptimistic(expr);
 127         }
 128         return true;
 129     }
 130 
 131     @Override
 132     public boolean enterForNode(final ForNode forNode) {
 133         if(forNode.isForIn()) {
 134             // for..in has the iterable in its "modify"
 135             tagNeverOptimistic(forNode.getModify());
 136         } else {
 137             // Test is never optimistic (always coerced to boolean).
 138             tagNeverOptimisticLoopTest(forNode);
 139         }
 140         return true;
 141     }
 142 
 143     @Override
 144     public boolean enterFunctionNode(final FunctionNode functionNode) {
 145         if (!neverOptimistic.isEmpty() && compiler.isOnDemandCompilation()) {
 146             // This is a nested function, and we're doing on-demand compilation. In these compilations, we never descend
 147             // into nested functions.
 148             return false;
 149         }
 150         neverOptimistic.push(new BitSet());
 151         return true;
 152     }
 153 




 113     }
 114 
 115     @Override
 116     public boolean enterCatchNode(final CatchNode catchNode) {
 117         // Condition is never optimistic (always coerced to boolean).
 118         tagNeverOptimistic(catchNode.getExceptionCondition());
 119         return true;
 120     }
 121 
 122     @Override
 123     public boolean enterExpressionStatement(final ExpressionStatement expressionStatement) {
 124         final Expression expr = expressionStatement.getExpression();
 125         if(!expr.isSelfModifying()) {
 126             tagNeverOptimistic(expr);
 127         }
 128         return true;
 129     }
 130 
 131     @Override
 132     public boolean enterForNode(final ForNode forNode) {
 133         if(forNode.isForInOrOf()) {
 134             // for..in has the iterable in its "modify"
 135             tagNeverOptimistic(forNode.getModify());
 136         } else {
 137             // Test is never optimistic (always coerced to boolean).
 138             tagNeverOptimisticLoopTest(forNode);
 139         }
 140         return true;
 141     }
 142 
 143     @Override
 144     public boolean enterFunctionNode(final FunctionNode functionNode) {
 145         if (!neverOptimistic.isEmpty() && compiler.isOnDemandCompilation()) {
 146             // This is a nested function, and we're doing on-demand compilation. In these compilations, we never descend
 147             // into nested functions.
 148             return false;
 149         }
 150         neverOptimistic.push(new BitSet());
 151         return true;
 152     }
 153 


< prev index next >