< prev index next >

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

Print this page




3238             // All inlined finallies end with a jump or a return
3239             assert !method.isReachable();
3240         }
3241 
3242 
3243         method._catch(recovery);
3244         method.store(vmException, EXCEPTION_TYPE);
3245 
3246         final int catchBlockCount = catchBlocks.size();
3247         final Label afterCatch = new Label("after_catch");
3248         for (int i = 0; i < catchBlockCount; i++) {
3249             assert method.isReachable();
3250             final Block catchBlock = catchBlocks.get(i);
3251 
3252             // Because of the peculiarities of the flow control, we need to use an explicit push/enterBlock/leaveBlock
3253             // here.
3254             lc.push(catchBlock);
3255             enterBlock(catchBlock);
3256 
3257             final CatchNode  catchNode          = (CatchNode)catchBlocks.get(i).getStatements().get(0);
3258             final IdentNode  exception          = catchNode.getException();
3259             final Expression exceptionCondition = catchNode.getExceptionCondition();
3260             final Block      catchBody          = catchNode.getBody();
3261 
3262             new Store<IdentNode>(exception) {
3263                 @Override
3264                 protected void storeNonDiscard() {
3265                     // This expression is neither part of a discard, nor needs to be left on the stack after it was
3266                     // stored, so we override storeNonDiscard to be a no-op.
3267                 }
3268 
3269                 @Override
3270                 protected void evaluate() {
3271                     if (catchNode.isSyntheticRethrow()) {
3272                         method.load(vmException, EXCEPTION_TYPE);
3273                         return;
3274                     }
3275                     /*
3276                      * If caught object is an instance of ECMAException, then
3277                      * bind obj.thrown to the script catch var. Or else bind the
3278                      * caught object itself to the script catch var.




3238             // All inlined finallies end with a jump or a return
3239             assert !method.isReachable();
3240         }
3241 
3242 
3243         method._catch(recovery);
3244         method.store(vmException, EXCEPTION_TYPE);
3245 
3246         final int catchBlockCount = catchBlocks.size();
3247         final Label afterCatch = new Label("after_catch");
3248         for (int i = 0; i < catchBlockCount; i++) {
3249             assert method.isReachable();
3250             final Block catchBlock = catchBlocks.get(i);
3251 
3252             // Because of the peculiarities of the flow control, we need to use an explicit push/enterBlock/leaveBlock
3253             // here.
3254             lc.push(catchBlock);
3255             enterBlock(catchBlock);
3256 
3257             final CatchNode  catchNode          = (CatchNode)catchBlocks.get(i).getStatements().get(0);
3258             final IdentNode exception = catchNode.getExceptionIdentifier();
3259             final Expression exceptionCondition = catchNode.getExceptionCondition();
3260             final Block      catchBody          = catchNode.getBody();
3261 
3262             new Store<IdentNode>(exception) {
3263                 @Override
3264                 protected void storeNonDiscard() {
3265                     // This expression is neither part of a discard, nor needs to be left on the stack after it was
3266                     // stored, so we override storeNonDiscard to be a no-op.
3267                 }
3268 
3269                 @Override
3270                 protected void evaluate() {
3271                     if (catchNode.isSyntheticRethrow()) {
3272                         method.load(vmException, EXCEPTION_TYPE);
3273                         return;
3274                     }
3275                     /*
3276                      * If caught object is an instance of ECMAException, then
3277                      * bind obj.thrown to the script catch var. Or else bind the
3278                      * caught object itself to the script catch var.


< prev index next >