3247 loadAndDiscard(test); 3248 if(testHasLiveConversion) { 3249 method.beforeJoinPoint(test); 3250 } 3251 } 3252 } else if (test != null) { 3253 if (testHasLiveConversion) { 3254 emitBranch(test.getExpression(), body.getEntryLabel(), true); 3255 method.beforeJoinPoint(test); 3256 method._goto(breakLabel); 3257 } else { 3258 emitBranch(test.getExpression(), breakLabel, false); 3259 } 3260 } 3261 3262 body.accept(this); 3263 if(repeatLabel != continueLabel) { 3264 emitContinueLabel(continueLabel, liveLocalsOnContinue); 3265 } 3266 3267 if(method.isReachable()) { 3268 if(modify != null) { 3269 lineNumber(loopNode); 3270 loadAndDiscard(modify); 3271 method.beforeJoinPoint(modify); 3272 } 3273 method._goto(repeatLabel); 3274 } 3275 3276 method.breakLabel(breakLabel, liveLocalsOnBreak); 3277 } 3278 3279 private void emitContinueLabel(final Label continueLabel, final int liveLocals) { 3280 final boolean reachable = method.isReachable(); 3281 method.breakLabel(continueLabel, liveLocals); 3282 // If we reach here only through a continue statement (e.g. body does not exit normally) then the 3283 // continueLabel can have extra non-temp symbols (e.g. exception from a try/catch contained in the body). We 3284 // must make sure those are thrown away. 3285 if(!reachable) { 3286 method.undefineLocalVariables(lc.getUsedSlotCount(), false); | 3247 loadAndDiscard(test); 3248 if(testHasLiveConversion) { 3249 method.beforeJoinPoint(test); 3250 } 3251 } 3252 } else if (test != null) { 3253 if (testHasLiveConversion) { 3254 emitBranch(test.getExpression(), body.getEntryLabel(), true); 3255 method.beforeJoinPoint(test); 3256 method._goto(breakLabel); 3257 } else { 3258 emitBranch(test.getExpression(), breakLabel, false); 3259 } 3260 } 3261 3262 body.accept(this); 3263 if(repeatLabel != continueLabel) { 3264 emitContinueLabel(continueLabel, liveLocalsOnContinue); 3265 } 3266 3267 if (loopNode.hasPerIterationScope() && lc.getParentBlock().needsScope()) { 3268 // ES6 for loops with LET init need a new scope for each iteration. We just create a shallow copy here. 3269 method.loadCompilerConstant(SCOPE); 3270 method.invoke(virtualCallNoLookup(ScriptObject.class, "copy", ScriptObject.class)); 3271 method.storeCompilerConstant(SCOPE); 3272 } 3273 3274 if(method.isReachable()) { 3275 if(modify != null) { 3276 lineNumber(loopNode); 3277 loadAndDiscard(modify); 3278 method.beforeJoinPoint(modify); 3279 } 3280 method._goto(repeatLabel); 3281 } 3282 3283 method.breakLabel(breakLabel, liveLocalsOnBreak); 3284 } 3285 3286 private void emitContinueLabel(final Label continueLabel, final int liveLocals) { 3287 final boolean reachable = method.isReachable(); 3288 method.breakLabel(continueLabel, liveLocals); 3289 // If we reach here only through a continue statement (e.g. body does not exit normally) then the 3290 // continueLabel can have extra non-temp symbols (e.g. exception from a try/catch contained in the body). We 3291 // must make sure those are thrown away. 3292 if(!reachable) { 3293 method.undefineLocalVariables(lc.getUsedSlotCount(), false); |