< prev index next >

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

Print this page
rev 1521 : 8143304: Random failures when script size exceeds token limits
Reviewed-by: sundar, attila, lagergren


3306         assert identSymbol != null : "variable node " + varNode + " requires a name with a symbol";
3307         final boolean needsScope = identSymbol.isScope();
3308 
3309         if (init == null) {
3310             if (needsScope && varNode.isBlockScoped()) {
3311                 // block scoped variables need a DECLARE flag to signal end of temporal dead zone (TDZ)
3312                 method.loadCompilerConstant(SCOPE);
3313                 method.loadUndefined(Type.OBJECT);
3314                 final int flags = getScopeCallSiteFlags(identSymbol) | (varNode.isBlockScoped() ? CALLSITE_DECLARE : 0);
3315                 assert isFastScope(identSymbol);
3316                 storeFastScopeVar(identSymbol, flags);
3317             }
3318             return false;
3319         }
3320 
3321         enterStatement(varNode);
3322         assert method != null;
3323 
3324         if (needsScope) {
3325             method.loadCompilerConstant(SCOPE);
3326         }
3327 
3328         if (needsScope) {
3329             loadExpressionUnbounded(init);
3330             // block scoped variables need a DECLARE flag to signal end of temporal dead zone (TDZ)
3331             final int flags = getScopeCallSiteFlags(identSymbol) | (varNode.isBlockScoped() ? CALLSITE_DECLARE : 0);
3332             if (isFastScope(identSymbol)) {
3333                 storeFastScopeVar(identSymbol, flags);
3334             } else {
3335                 method.dynamicSet(identNode.getName(), flags, false);
3336             }
3337         } else {
3338             final Type identType = identNode.getType();
3339             if(identType == Type.UNDEFINED) {
3340                 // The initializer is either itself undefined (explicit assignment of undefined to undefined),
3341                 // or the left hand side is a dead variable.
3342                 assert init.getType() == Type.UNDEFINED || identNode.getSymbol().slotCount() == 0;
3343                 loadAndDiscard(init);
3344                 return false;
3345             }
3346             loadExpressionAsType(init, identType);
3347             storeIdentWithCatchConversion(identNode, identType);
3348         }




3306         assert identSymbol != null : "variable node " + varNode + " requires a name with a symbol";
3307         final boolean needsScope = identSymbol.isScope();
3308 
3309         if (init == null) {
3310             if (needsScope && varNode.isBlockScoped()) {
3311                 // block scoped variables need a DECLARE flag to signal end of temporal dead zone (TDZ)
3312                 method.loadCompilerConstant(SCOPE);
3313                 method.loadUndefined(Type.OBJECT);
3314                 final int flags = getScopeCallSiteFlags(identSymbol) | (varNode.isBlockScoped() ? CALLSITE_DECLARE : 0);
3315                 assert isFastScope(identSymbol);
3316                 storeFastScopeVar(identSymbol, flags);
3317             }
3318             return false;
3319         }
3320 
3321         enterStatement(varNode);
3322         assert method != null;
3323 
3324         if (needsScope) {
3325             method.loadCompilerConstant(SCOPE);



3326             loadExpressionUnbounded(init);
3327             // block scoped variables need a DECLARE flag to signal end of temporal dead zone (TDZ)
3328             final int flags = getScopeCallSiteFlags(identSymbol) | (varNode.isBlockScoped() ? CALLSITE_DECLARE : 0);
3329             if (isFastScope(identSymbol)) {
3330                 storeFastScopeVar(identSymbol, flags);
3331             } else {
3332                 method.dynamicSet(identNode.getName(), flags, false);
3333             }
3334         } else {
3335             final Type identType = identNode.getType();
3336             if(identType == Type.UNDEFINED) {
3337                 // The initializer is either itself undefined (explicit assignment of undefined to undefined),
3338                 // or the left hand side is a dead variable.
3339                 assert init.getType() == Type.UNDEFINED || identNode.getSymbol().slotCount() == 0;
3340                 loadAndDiscard(init);
3341                 return false;
3342             }
3343             loadExpressionAsType(init, identType);
3344             storeIdentWithCatchConversion(identNode, identType);
3345         }


< prev index next >