src/jdk/nashorn/internal/codegen/CodeGenerator.java

Print this page




2006         }
2007 
2008         if (!switchNode.isTerminal()) {
2009             method.label(breakLabel);
2010         }
2011 
2012         return false;
2013     }
2014 
2015     @Override
2016     public boolean enterThrowNode(final ThrowNode throwNode) {
2017         lineNumber(throwNode);
2018 
2019         if (throwNode.isSyntheticRethrow()) {
2020             //do not wrap whatever this is in an ecma exception, just rethrow it
2021             load(throwNode.getExpression());
2022             method.athrow();
2023             return false;
2024         }
2025 
2026         method._new(ECMAException.class).dup();
2027 
2028         final Source source     = lc.getCurrentFunction().getSource();
2029 
2030         final Expression expression = throwNode.getExpression();
2031         final int        position   = throwNode.position();
2032         final int        line       = throwNode.getLineNumber();
2033         final int        column     = source.getColumn(position);
2034 
2035         load(expression, Type.OBJECT);
2036 
2037         method.load(source.getName());
2038         method.load(line);
2039         method.load(column);
2040         method.invoke(ECMAException.THROW_INIT);
2041 
2042         method.athrow();
2043 
2044         return false;
2045     }
2046 
2047     @Override
2048     public boolean enterTryNode(final TryNode tryNode) {
2049         lineNumber(tryNode);
2050 
2051         final Block       body        = tryNode.getBody();
2052         final List<Block> catchBlocks = tryNode.getCatchBlocks();
2053         final Symbol      symbol      = tryNode.getException();
2054         final Label       entry       = new Label("try");
2055         final Label       recovery    = new Label("catch");
2056         final Label       exit        = tryNode.getExit();
2057         final Label       skip        = new Label("skip");
2058 
2059         method.label(entry);
2060 




2006         }
2007 
2008         if (!switchNode.isTerminal()) {
2009             method.label(breakLabel);
2010         }
2011 
2012         return false;
2013     }
2014 
2015     @Override
2016     public boolean enterThrowNode(final ThrowNode throwNode) {
2017         lineNumber(throwNode);
2018 
2019         if (throwNode.isSyntheticRethrow()) {
2020             //do not wrap whatever this is in an ecma exception, just rethrow it
2021             load(throwNode.getExpression());
2022             method.athrow();
2023             return false;
2024         }
2025 


2026         final Source source     = lc.getCurrentFunction().getSource();
2027 
2028         final Expression expression = throwNode.getExpression();
2029         final int        position   = throwNode.position();
2030         final int        line       = throwNode.getLineNumber();
2031         final int        column     = source.getColumn(position);
2032 
2033         load(expression, Type.OBJECT);
2034 
2035         method.load(source.getName());
2036         method.load(line);
2037         method.load(column);
2038         method.invoke(ECMAException.CREATE);
2039 
2040         method.athrow();
2041 
2042         return false;
2043     }
2044 
2045     @Override
2046     public boolean enterTryNode(final TryNode tryNode) {
2047         lineNumber(tryNode);
2048 
2049         final Block       body        = tryNode.getBody();
2050         final List<Block> catchBlocks = tryNode.getCatchBlocks();
2051         final Symbol      symbol      = tryNode.getException();
2052         final Label       entry       = new Label("try");
2053         final Label       recovery    = new Label("catch");
2054         final Label       exit        = tryNode.getExit();
2055         final Label       skip        = new Label("skip");
2056 
2057         method.label(entry);
2058