Tue, 07 May 2013 14:36:57 +0200
8013913: Removed Source field from all nodes except FunctionNode in order to save footprint
Reviewed-by: jlaskey, attila
1.1 --- a/src/jdk/nashorn/api/scripting/NashornScriptEngine.java Fri May 03 22:50:51 2013 +0200 1.2 +++ b/src/jdk/nashorn/api/scripting/NashornScriptEngine.java Tue May 07 14:36:57 2013 +0200 1.3 @@ -78,7 +78,6 @@ 1.4 this(factory, DEFAULT_OPTIONS, appLoader); 1.5 } 1.6 1.7 - @SuppressWarnings("LeakingThisInConstructor") 1.8 NashornScriptEngine(final NashornScriptEngineFactory factory, final String[] args, final ClassLoader appLoader) { 1.9 this.factory = factory; 1.10 final Options options = new Options("nashorn"); 1.11 @@ -102,7 +101,7 @@ 1.12 }); 1.13 1.14 // create new global object 1.15 - this.global = createNashornGlobal(); 1.16 + this.global = createNashornGlobal(); 1.17 // set the default engine scope for the default context 1.18 context.setBindings(new ScriptObjectMirror(global, global), ScriptContext.ENGINE_SCOPE); 1.19
2.1 --- a/src/jdk/nashorn/internal/codegen/Attr.java Fri May 03 22:50:51 2013 +0200 2.2 +++ b/src/jdk/nashorn/internal/codegen/Attr.java Tue May 07 14:36:57 2013 +0200 2.3 @@ -435,7 +435,6 @@ 2.4 final IdentNode callee = compilerConstant(CALLEE); 2.5 VarNode selfInit = 2.6 new VarNode( 2.7 - newFunctionNode.getSource(), 2.8 newFunctionNode.getToken(), 2.9 newFunctionNode.getFinish(), 2.10 newFunctionNode.getIdent(), 2.11 @@ -531,6 +530,7 @@ 2.12 setBlockScope(name, symbol); 2.13 2.14 if (symbol != null && !identNode.isInitializedHere()) { 2.15 + 2.16 symbol.increaseUseCount(); 2.17 } 2.18 addLocalUse(identNode.getName()); 2.19 @@ -914,7 +914,6 @@ 2.20 final FunctionNode functionNode = getLexicalContext().getCurrentFunction(); 2.21 return (IdentNode) 2.22 new IdentNode( 2.23 - functionNode.getSource(), 2.24 functionNode.getToken(), 2.25 functionNode.getFinish(), 2.26 cc.symbolName()).
3.1 --- a/src/jdk/nashorn/internal/codegen/CodeGenerator.java Fri May 03 22:50:51 2013 +0200 3.2 +++ b/src/jdk/nashorn/internal/codegen/CodeGenerator.java Tue May 07 14:36:57 2013 +0200 3.3 @@ -261,14 +261,15 @@ 3.4 return method.load(symbol); 3.5 } 3.6 3.7 - final String name = symbol.getName(); 3.8 + final String name = symbol.getName(); 3.9 + final Source source = getLexicalContext().getCurrentFunction().getSource(); 3.10 3.11 if (CompilerConstants.__FILE__.name().equals(name)) { 3.12 - return method.load(identNode.getSource().getName()); 3.13 + return method.load(source.getName()); 3.14 } else if (CompilerConstants.__DIR__.name().equals(name)) { 3.15 - return method.load(identNode.getSource().getBase()); 3.16 + return method.load(source.getBase()); 3.17 } else if (CompilerConstants.__LINE__.name().equals(name)) { 3.18 - return method.load(identNode.getSource().getLine(identNode.position())).convert(Type.OBJECT); 3.19 + return method.load(source.getLine(identNode.position())).convert(Type.OBJECT); 3.20 } else { 3.21 assert identNode.getSymbol().isScope() : identNode + " is not in scope!"; 3.22 3.23 @@ -2005,8 +2006,9 @@ 3.24 public boolean enterThrowNode(final ThrowNode throwNode) { 3.25 method._new(ECMAException.class).dup(); 3.26 3.27 + final Source source = getLexicalContext().getCurrentFunction().getSource(); 3.28 + 3.29 final Node expression = throwNode.getExpression(); 3.30 - final Source source = throwNode.getSource(); 3.31 final int position = throwNode.position(); 3.32 final int line = source.getLine(position); 3.33 final int column = source.getColumn(position); 3.34 @@ -3013,7 +3015,6 @@ 3.35 return; 3.36 } 3.37 3.38 - @SuppressWarnings("resource") 3.39 final PrintWriter out = compiler.getEnv().getErr(); 3.40 out.println("[BLOCK in '" + ident + "']"); 3.41 if (!block.printSymbols(out)) {
4.1 --- a/src/jdk/nashorn/internal/codegen/FinalizeTypes.java Fri May 03 22:50:51 2013 +0200 4.2 +++ b/src/jdk/nashorn/internal/codegen/FinalizeTypes.java Tue May 07 14:36:57 2013 +0200 4.3 @@ -773,7 +773,7 @@ 4.4 private Node convert(final Node node, final Type to) { 4.5 assert !to.isUnknown() : "unknown type for " + node + " class=" + node.getClass(); 4.6 assert node != null : "node is null"; 4.7 - assert node.getSymbol() != null : "node " + node + " " + node.getClass() + " has no symbol! " + getLexicalContext().getCurrentFunction() + " " + node.getSource(); 4.8 + assert node.getSymbol() != null : "node " + node + " " + node.getClass() + " has no symbol! " + getLexicalContext().getCurrentFunction(); 4.9 assert node.tokenType() != TokenType.CONVERT : "assert convert in convert " + node + " in " + getLexicalContext().getCurrentFunction(); 4.10 4.11 final Type from = node.getType(); 4.12 @@ -798,7 +798,7 @@ 4.13 assert node instanceof TypeOverride; 4.14 return setTypeOverride(node, to); 4.15 } 4.16 - resultNode = new UnaryNode(node.getSource(), Token.recast(node.getToken(), TokenType.CONVERT), node); 4.17 + resultNode = new UnaryNode(Token.recast(node.getToken(), TokenType.CONVERT), node); 4.18 } 4.19 4.20 LOG.info("CONVERT('", node, "', ", to, ") => '", resultNode, "'"); 4.21 @@ -813,7 +813,7 @@ 4.22 4.23 private static Node discard(final Node node) { 4.24 if (node.getSymbol() != null) { 4.25 - final Node discard = new UnaryNode(node.getSource(), Token.recast(node.getToken(), TokenType.DISCARD), node); 4.26 + final Node discard = new UnaryNode(Token.recast(node.getToken(), TokenType.DISCARD), node); 4.27 //discard never has a symbol in the discard node - then it would be a nop 4.28 assert !node.isTerminal(); 4.29 return discard; 4.30 @@ -881,15 +881,15 @@ 4.31 LiteralNode<?> literalNode = null; 4.32 4.33 if (type.isString()) { 4.34 - literalNode = LiteralNode.newInstance(source, token, finish, JSType.toString(value)); 4.35 + literalNode = LiteralNode.newInstance(token, finish, JSType.toString(value)); 4.36 } else if (type.isBoolean()) { 4.37 - literalNode = LiteralNode.newInstance(source, token, finish, JSType.toBoolean(value)); 4.38 + literalNode = LiteralNode.newInstance(token, finish, JSType.toBoolean(value)); 4.39 } else if (type.isInteger()) { 4.40 - literalNode = LiteralNode.newInstance(source, token, finish, JSType.toInt32(value)); 4.41 + literalNode = LiteralNode.newInstance(token, finish, JSType.toInt32(value)); 4.42 } else if (type.isLong()) { 4.43 - literalNode = LiteralNode.newInstance(source, token, finish, JSType.toLong(value)); 4.44 + literalNode = LiteralNode.newInstance(token, finish, JSType.toLong(value)); 4.45 } else if (type.isNumber() || parent.getType().isNumeric() && !parent.getType().isNumber()) { 4.46 - literalNode = LiteralNode.newInstance(source, token, finish, JSType.toNumber(value)); 4.47 + literalNode = LiteralNode.newInstance(token, finish, JSType.toNumber(value)); 4.48 } 4.49 4.50 if (literalNode != null) {
5.1 --- a/src/jdk/nashorn/internal/codegen/FoldConstants.java Fri May 03 22:50:51 2013 +0200 5.2 +++ b/src/jdk/nashorn/internal/codegen/FoldConstants.java Tue May 07 14:36:57 2013 +0200 5.3 @@ -41,7 +41,6 @@ 5.4 import jdk.nashorn.internal.runtime.DebugLogger; 5.5 import jdk.nashorn.internal.runtime.JSType; 5.6 import jdk.nashorn.internal.runtime.ScriptRuntime; 5.7 -import jdk.nashorn.internal.runtime.Source; 5.8 5.9 /** 5.10 * Simple constant folding pass, executed before IR is starting to be lowered. 5.11 @@ -112,13 +111,11 @@ 5.12 */ 5.13 abstract static class ConstantEvaluator<T extends Node> { 5.14 protected T parent; 5.15 - protected final Source source; 5.16 protected final long token; 5.17 protected final int finish; 5.18 5.19 protected ConstantEvaluator(final T parent) { 5.20 this.parent = parent; 5.21 - this.source = parent.getSource(); 5.22 this.token = parent.getToken(); 5.23 this.finish = parent.getFinish(); 5.24 } 5.25 @@ -152,23 +149,23 @@ 5.26 switch (parent.tokenType()) { 5.27 case ADD: 5.28 if (rhsInteger) { 5.29 - literalNode = LiteralNode.newInstance(source, token, finish, rhs.getInt32()); 5.30 + literalNode = LiteralNode.newInstance(token, finish, rhs.getInt32()); 5.31 } else { 5.32 - literalNode = LiteralNode.newInstance(source, token, finish, rhs.getNumber()); 5.33 + literalNode = LiteralNode.newInstance(token, finish, rhs.getNumber()); 5.34 } 5.35 break; 5.36 case SUB: 5.37 if (rhsInteger && rhs.getInt32() != 0) { // @see test/script/basic/minuszero.js 5.38 - literalNode = LiteralNode.newInstance(source, token, finish, -rhs.getInt32()); 5.39 + literalNode = LiteralNode.newInstance(token, finish, -rhs.getInt32()); 5.40 } else { 5.41 - literalNode = LiteralNode.newInstance(source, token, finish, -rhs.getNumber()); 5.42 + literalNode = LiteralNode.newInstance(token, finish, -rhs.getNumber()); 5.43 } 5.44 break; 5.45 case NOT: 5.46 - literalNode = LiteralNode.newInstance(source, token, finish, !rhs.getBoolean()); 5.47 + literalNode = LiteralNode.newInstance(token, finish, !rhs.getBoolean()); 5.48 break; 5.49 case BIT_NOT: 5.50 - literalNode = LiteralNode.newInstance(source, token, finish, ~rhs.getInt32()); 5.51 + literalNode = LiteralNode.newInstance(token, finish, ~rhs.getInt32()); 5.52 break; 5.53 default: 5.54 return null; 5.55 @@ -234,7 +231,7 @@ 5.56 break; 5.57 } 5.58 assert res instanceof CharSequence : res + " was not a CharSequence, it was a " + res.getClass(); 5.59 - return LiteralNode.newInstance(source, token, finish, res.toString()); 5.60 + return LiteralNode.newInstance(token, finish, res.toString()); 5.61 } 5.62 return null; 5.63 case MUL: 5.64 @@ -247,33 +244,33 @@ 5.65 value = lhs.getNumber() - rhs.getNumber(); 5.66 break; 5.67 case SHR: 5.68 - return LiteralNode.newInstance(source, token, finish, (lhs.getInt32() >>> rhs.getInt32()) & JSType.MAX_UINT); 5.69 + return LiteralNode.newInstance(token, finish, (lhs.getInt32() >>> rhs.getInt32()) & JSType.MAX_UINT); 5.70 case SAR: 5.71 - return LiteralNode.newInstance(source, token, finish, lhs.getInt32() >> rhs.getInt32()); 5.72 + return LiteralNode.newInstance(token, finish, lhs.getInt32() >> rhs.getInt32()); 5.73 case SHL: 5.74 - return LiteralNode.newInstance(source, token, finish, lhs.getInt32() << rhs.getInt32()); 5.75 + return LiteralNode.newInstance(token, finish, lhs.getInt32() << rhs.getInt32()); 5.76 case BIT_XOR: 5.77 - return LiteralNode.newInstance(source, token, finish, lhs.getInt32() ^ rhs.getInt32()); 5.78 + return LiteralNode.newInstance(token, finish, lhs.getInt32() ^ rhs.getInt32()); 5.79 case BIT_AND: 5.80 - return LiteralNode.newInstance(source, token, finish, lhs.getInt32() & rhs.getInt32()); 5.81 + return LiteralNode.newInstance(token, finish, lhs.getInt32() & rhs.getInt32()); 5.82 case BIT_OR: 5.83 - return LiteralNode.newInstance(source, token, finish, lhs.getInt32() | rhs.getInt32()); 5.84 + return LiteralNode.newInstance(token, finish, lhs.getInt32() | rhs.getInt32()); 5.85 case GE: 5.86 - return LiteralNode.newInstance(source, token, finish, ScriptRuntime.GE(lhs.getObject(), rhs.getObject())); 5.87 + return LiteralNode.newInstance(token, finish, ScriptRuntime.GE(lhs.getObject(), rhs.getObject())); 5.88 case LE: 5.89 - return LiteralNode.newInstance(source, token, finish, ScriptRuntime.LE(lhs.getObject(), rhs.getObject())); 5.90 + return LiteralNode.newInstance(token, finish, ScriptRuntime.LE(lhs.getObject(), rhs.getObject())); 5.91 case GT: 5.92 - return LiteralNode.newInstance(source, token, finish, ScriptRuntime.GT(lhs.getObject(), rhs.getObject())); 5.93 + return LiteralNode.newInstance(token, finish, ScriptRuntime.GT(lhs.getObject(), rhs.getObject())); 5.94 case LT: 5.95 - return LiteralNode.newInstance(source, token, finish, ScriptRuntime.LT(lhs.getObject(), rhs.getObject())); 5.96 + return LiteralNode.newInstance(token, finish, ScriptRuntime.LT(lhs.getObject(), rhs.getObject())); 5.97 case NE: 5.98 - return LiteralNode.newInstance(source, token, finish, ScriptRuntime.NE(lhs.getObject(), rhs.getObject())); 5.99 + return LiteralNode.newInstance(token, finish, ScriptRuntime.NE(lhs.getObject(), rhs.getObject())); 5.100 case NE_STRICT: 5.101 - return LiteralNode.newInstance(source, token, finish, ScriptRuntime.NE_STRICT(lhs.getObject(), rhs.getObject())); 5.102 + return LiteralNode.newInstance(token, finish, ScriptRuntime.NE_STRICT(lhs.getObject(), rhs.getObject())); 5.103 case EQ: 5.104 - return LiteralNode.newInstance(source, token, finish, ScriptRuntime.EQ(lhs.getObject(), rhs.getObject())); 5.105 + return LiteralNode.newInstance(token, finish, ScriptRuntime.EQ(lhs.getObject(), rhs.getObject())); 5.106 case EQ_STRICT: 5.107 - return LiteralNode.newInstance(source, token, finish, ScriptRuntime.EQ_STRICT(lhs.getObject(), rhs.getObject())); 5.108 + return LiteralNode.newInstance(token, finish, ScriptRuntime.EQ_STRICT(lhs.getObject(), rhs.getObject())); 5.109 default: 5.110 return null; 5.111 } 5.112 @@ -282,12 +279,12 @@ 5.113 isLong &= value != 0.0 && JSType.isRepresentableAsLong(value); 5.114 5.115 if (isInteger) { 5.116 - return LiteralNode.newInstance(source, token, finish, JSType.toInt32(value)); 5.117 + return LiteralNode.newInstance(token, finish, JSType.toInt32(value)); 5.118 } else if (isLong) { 5.119 - return LiteralNode.newInstance(source, token, finish, JSType.toLong(value)); 5.120 + return LiteralNode.newInstance(token, finish, JSType.toLong(value)); 5.121 } 5.122 5.123 - return LiteralNode.newInstance(source, token, finish, value); 5.124 + return LiteralNode.newInstance(token, finish, value); 5.125 } 5.126 } 5.127 }
6.1 --- a/src/jdk/nashorn/internal/codegen/Lower.java Fri May 03 22:50:51 2013 +0200 6.2 +++ b/src/jdk/nashorn/internal/codegen/Lower.java Tue May 07 14:36:57 2013 +0200 6.3 @@ -118,8 +118,9 @@ 6.4 @Override 6.5 public boolean enterBlock(final Block block) { 6.6 final LexicalContext lc = getLexicalContext(); 6.7 - if (lc.isFunctionBody() && lc.getCurrentFunction().isProgram() && !lc.getCurrentFunction().hasDeclaredFunctions()) { 6.8 - new ExecuteNode(block.getSource(), block.getToken(), block.getFinish(), LiteralNode.newInstance(block, ScriptRuntime.UNDEFINED)).accept(this); 6.9 + final FunctionNode function = lc.getCurrentFunction(); 6.10 + if (lc.isFunctionBody() && function.isProgram() && !function.hasDeclaredFunctions()) { 6.11 + new ExecuteNode(block.getToken(), block.getFinish(), LiteralNode.newInstance(block, ScriptRuntime.UNDEFINED)).accept(this); 6.12 } 6.13 return true; 6.14 } 6.15 @@ -137,7 +138,6 @@ 6.16 final FunctionNode currentFunction = getLexicalContext().getCurrentFunction(); 6.17 final boolean isProgram = currentFunction.isProgram(); 6.18 final ReturnNode returnNode = new ReturnNode( 6.19 - currentFunction.getSource(), 6.20 currentFunction.getToken(), 6.21 currentFunction.getFinish(), 6.22 isProgram ? 6.23 @@ -193,7 +193,6 @@ 6.24 if (!isInternalExpression(expr) && !isEvalResultAssignment(expr)) { 6.25 node = executeNode.setExpression( 6.26 new BinaryNode( 6.27 - executeNode.getSource(), 6.28 Token.recast( 6.29 executeNode.getToken(), 6.30 TokenType.ASSIGN), 6.31 @@ -284,17 +283,16 @@ 6.32 } 6.33 6.34 private Block catchAllBlock(final TryNode tryNode) { 6.35 - final Source source = tryNode.getSource(); 6.36 final long token = tryNode.getToken(); 6.37 final int finish = tryNode.getFinish(); 6.38 6.39 - final IdentNode exception = new IdentNode(source, token, finish, getLexicalContext().getCurrentFunction().uniqueName("catch_all")); 6.40 + final IdentNode exception = new IdentNode(token, finish, getLexicalContext().getCurrentFunction().uniqueName("catch_all")); 6.41 6.42 - final Block catchBody = new Block(source, token, finish, new ThrowNode(source, token, finish, new IdentNode(exception))). 6.43 + final Block catchBody = new Block(token, finish, new ThrowNode(token, finish, new IdentNode(exception))). 6.44 setIsTerminal(getLexicalContext(), true); //ends with throw, so terminal 6.45 6.46 - final CatchNode catchAllNode = new CatchNode(source, token, finish, new IdentNode(exception), null, catchBody); 6.47 - final Block catchAllBlock = new Block(source, token, finish, catchAllNode); 6.48 + final CatchNode catchAllNode = new CatchNode(token, finish, new IdentNode(exception), null, catchBody); 6.49 + final Block catchAllBlock = new Block(token, finish, catchAllNode); 6.50 6.51 //catchallblock -> catchallnode (catchnode) -> exception -> throw 6.52 6.53 @@ -303,7 +301,7 @@ 6.54 6.55 private IdentNode compilerConstant(final CompilerConstants cc) { 6.56 final FunctionNode functionNode = getLexicalContext().getCurrentFunction(); 6.57 - return new IdentNode(functionNode.getSource(), functionNode.getToken(), functionNode.getFinish(), cc.symbolName()); 6.58 + return new IdentNode(functionNode.getToken(), functionNode.getFinish(), cc.symbolName()); 6.59 } 6.60 6.61 private static boolean isTerminal(final List<Node> statements) { 6.62 @@ -318,7 +316,6 @@ 6.63 * @return new try node after splicing finally code (same if nop) 6.64 */ 6.65 private Node spliceFinally(final TryNode tryNode, final List<ThrowNode> rethrows, final Block finallyBody) { 6.66 - final Source source = tryNode.getSource(); 6.67 final int finish = tryNode.getFinish(); 6.68 6.69 assert tryNode.getFinallyBody() == null; 6.70 @@ -345,7 +342,7 @@ 6.71 if (!isTerminal(newStatements)) { 6.72 newStatements.add(throwNode); 6.73 } 6.74 - return new Block(source, throwNode.getToken(), throwNode.getFinish(), newStatements); 6.75 + return new Block(throwNode.getToken(), throwNode.getFinish(), newStatements); 6.76 } 6.77 return throwNode; 6.78 } 6.79 @@ -370,7 +367,7 @@ 6.80 //we need to evaluate the result of the return in case it is complex while 6.81 //still in the try block, store it in a result value and return it afterwards 6.82 resultNode = new IdentNode(Lower.this.compilerConstant(RETURN)); 6.83 - newStatements.add(new ExecuteNode(new BinaryNode(source, Token.recast(returnNode.getToken(), TokenType.ASSIGN), resultNode, expr))); 6.84 + newStatements.add(new ExecuteNode(new BinaryNode(Token.recast(returnNode.getToken(), TokenType.ASSIGN), resultNode, expr))); 6.85 } else { 6.86 resultNode = null; 6.87 } 6.88 @@ -380,7 +377,7 @@ 6.89 newStatements.add(expr == null ? returnNode : returnNode.setExpression(resultNode)); 6.90 } 6.91 6.92 - return new ExecuteNode(new Block(source, returnNode.getToken(), getLexicalContext().getCurrentBlock().getFinish(), newStatements)); 6.93 + return new ExecuteNode(new Block(returnNode.getToken(), getLexicalContext().getCurrentBlock().getFinish(), newStatements)); 6.94 } 6.95 6.96 private Node copy(final Node endpoint, final Node targetNode) { 6.97 @@ -389,7 +386,7 @@ 6.98 if (!isTerminal(newStatements)) { 6.99 newStatements.add(endpoint); 6.100 } 6.101 - return new ExecuteNode(new Block(source, endpoint.getToken(), finish, newStatements)); 6.102 + return new ExecuteNode(new Block(endpoint.getToken(), finish, newStatements)); 6.103 } 6.104 return endpoint; 6.105 } 6.106 @@ -451,7 +448,7 @@ 6.107 if (tryNode.getCatchBlocks().isEmpty()) { 6.108 newTryNode = tryNode.setFinallyBody(null); 6.109 } else { 6.110 - Block outerBody = new Block(tryNode.getSource(), tryNode.getToken(), tryNode.getFinish(), new ArrayList<Node>(Arrays.asList(tryNode.setFinallyBody(null)))); 6.111 + Block outerBody = new Block(tryNode.getToken(), tryNode.getFinish(), new ArrayList<Node>(Arrays.asList(tryNode.setFinallyBody(null)))); 6.112 newTryNode = tryNode.setBody(outerBody).setCatchBlocks(null); 6.113 } 6.114 6.115 @@ -468,19 +465,19 @@ 6.116 public Node leaveVarNode(final VarNode varNode) { 6.117 addStatement(varNode); 6.118 if (varNode.getFlag(VarNode.IS_LAST_FUNCTION_DECLARATION) && getLexicalContext().getCurrentFunction().isProgram()) { 6.119 - new ExecuteNode(varNode.getSource(), varNode.getToken(), varNode.getFinish(), new IdentNode(varNode.getName())).accept(this); 6.120 + new ExecuteNode(varNode.getToken(), varNode.getFinish(), new IdentNode(varNode.getName())).accept(this); 6.121 } 6.122 return varNode; 6.123 } 6.124 6.125 @Override 6.126 public Node leaveWhileNode(final WhileNode whileNode) { 6.127 - final Node test = whileNode.getTest(); 6.128 + final Node test = whileNode.getTest(); 6.129 final Block body = whileNode.getBody(); 6.130 6.131 if (conservativeAlwaysTrue(test)) { 6.132 //turn it into a for node without a test. 6.133 - final ForNode forNode = (ForNode)new ForNode(whileNode.getSource(), whileNode.getToken(), whileNode.getFinish(), null, null, body, null, ForNode.IS_FOR).accept(this); 6.134 + final ForNode forNode = (ForNode)new ForNode(whileNode.getToken(), whileNode.getFinish(), null, null, body, null, ForNode.IS_FOR).accept(this); 6.135 getLexicalContext().replace(whileNode, forNode); 6.136 return forNode; 6.137 } 6.138 @@ -525,11 +522,12 @@ 6.139 * @param node a node 6.140 * @return eval location 6.141 */ 6.142 - private static String evalLocation(final IdentNode node) { 6.143 + private String evalLocation(final IdentNode node) { 6.144 + final Source source = getLexicalContext().getCurrentFunction().getSource(); 6.145 return new StringBuilder(). 6.146 - append(node.getSource().getName()). 6.147 + append(source.getName()). 6.148 append('#'). 6.149 - append(node.getSource().getLine(node.position())). 6.150 + append(source.getLine(node.position())). 6.151 append("<eval>"). 6.152 toString(); 6.153 }
7.1 --- a/src/jdk/nashorn/internal/codegen/Splitter.java Fri May 03 22:50:51 2013 +0200 7.2 +++ b/src/jdk/nashorn/internal/codegen/Splitter.java Tue May 07 14:36:57 2013 +0200 7.3 @@ -42,7 +42,6 @@ 7.4 import jdk.nashorn.internal.ir.SplitNode; 7.5 import jdk.nashorn.internal.ir.visitor.NodeVisitor; 7.6 import jdk.nashorn.internal.runtime.DebugLogger; 7.7 -import jdk.nashorn.internal.runtime.Source; 7.8 import jdk.nashorn.internal.runtime.options.Options; 7.9 7.10 /** 7.11 @@ -221,12 +220,11 @@ 7.12 * @return New split node. 7.13 */ 7.14 private SplitNode createBlockSplitNode(final Block parent, final FunctionNode function, final List<Node> statements, final long weight) { 7.15 - final Source source = parent.getSource(); 7.16 final long token = parent.getToken(); 7.17 final int finish = parent.getFinish(); 7.18 final String name = function.uniqueName(SPLIT_PREFIX.symbolName()); 7.19 7.20 - final Block newBlock = new Block(source, token, finish, statements); 7.21 + final Block newBlock = new Block(token, finish, statements); 7.22 7.23 return new SplitNode(name, newBlock, compiler.findUnit(weight + WeighNodes.FUNCTION_WEIGHT)); 7.24 }
8.1 --- a/src/jdk/nashorn/internal/ir/AccessNode.java Fri May 03 22:50:51 2013 +0200 8.2 +++ b/src/jdk/nashorn/internal/ir/AccessNode.java Tue May 07 14:36:57 2013 +0200 8.3 @@ -28,7 +28,6 @@ 8.4 import jdk.nashorn.internal.codegen.types.Type; 8.5 import jdk.nashorn.internal.ir.annotations.Immutable; 8.6 import jdk.nashorn.internal.ir.visitor.NodeVisitor; 8.7 -import jdk.nashorn.internal.runtime.Source; 8.8 8.9 /** 8.10 * IR representation of a property access (period operator.) 8.11 @@ -41,14 +40,13 @@ 8.12 /** 8.13 * Constructor 8.14 * 8.15 - * @param source source code 8.16 * @param token token 8.17 * @param finish finish 8.18 * @param base base node 8.19 * @param property property 8.20 */ 8.21 - public AccessNode(final Source source, final long token, final int finish, final Node base, final IdentNode property) { 8.22 - super(source, token, finish, base, false, false); 8.23 + public AccessNode(final long token, final int finish, final Node base, final IdentNode property) { 8.24 + super(token, finish, base, false, false); 8.25 this.property = property.setIsPropertyName(); 8.26 } 8.27
9.1 --- a/src/jdk/nashorn/internal/ir/BaseNode.java Fri May 03 22:50:51 2013 +0200 9.2 +++ b/src/jdk/nashorn/internal/ir/BaseNode.java Tue May 07 14:36:57 2013 +0200 9.3 @@ -29,7 +29,6 @@ 9.4 import jdk.nashorn.internal.codegen.ObjectClassGenerator; 9.5 import jdk.nashorn.internal.codegen.types.Type; 9.6 import jdk.nashorn.internal.ir.annotations.Immutable; 9.7 -import jdk.nashorn.internal.runtime.Source; 9.8 9.9 /** 9.10 * IR base for accessing/indexing nodes. 9.11 @@ -50,15 +49,14 @@ 9.12 /** 9.13 * Constructor 9.14 * 9.15 - * @param source source code 9.16 * @param token token 9.17 * @param finish finish 9.18 * @param base base node 9.19 * @param isFunction is this a function 9.20 * @param hasCallSiteType does this access have a callsite type 9.21 */ 9.22 - public BaseNode(final Source source, final long token, final int finish, final Node base, final boolean isFunction, final boolean hasCallSiteType) { 9.23 - super(source, token, base.getStart(), finish); 9.24 + public BaseNode(final long token, final int finish, final Node base, final boolean isFunction, final boolean hasCallSiteType) { 9.25 + super(token, base.getStart(), finish); 9.26 this.base = base; 9.27 this.isFunction = isFunction; 9.28 this.hasCallSiteType = hasCallSiteType;
10.1 --- a/src/jdk/nashorn/internal/ir/BinaryNode.java Fri May 03 22:50:51 2013 +0200 10.2 +++ b/src/jdk/nashorn/internal/ir/BinaryNode.java Tue May 07 14:36:57 2013 +0200 10.3 @@ -29,7 +29,6 @@ 10.4 import jdk.nashorn.internal.ir.annotations.Immutable; 10.5 import jdk.nashorn.internal.ir.visitor.NodeVisitor; 10.6 import jdk.nashorn.internal.parser.TokenType; 10.7 -import jdk.nashorn.internal.runtime.Source; 10.8 10.9 /** 10.10 * BinaryNode nodes represent two operand operations. 10.11 @@ -44,13 +43,12 @@ 10.12 /** 10.13 * Constructor 10.14 * 10.15 - * @param source source code 10.16 * @param token token 10.17 * @param lhs left hand side 10.18 * @param rhs right hand side 10.19 */ 10.20 - public BinaryNode(final Source source, final long token, final Node lhs, final Node rhs) { 10.21 - super(source, token, lhs.getStart(), rhs.getFinish()); 10.22 + public BinaryNode(final long token, final Node lhs, final Node rhs) { 10.23 + super(token, lhs.getStart(), rhs.getFinish()); 10.24 this.lhs = lhs; 10.25 this.rhs = rhs; 10.26 }
11.1 --- a/src/jdk/nashorn/internal/ir/Block.java Fri May 03 22:50:51 2013 +0200 11.2 +++ b/src/jdk/nashorn/internal/ir/Block.java Tue May 07 14:36:57 2013 +0200 11.3 @@ -36,7 +36,6 @@ 11.4 import jdk.nashorn.internal.codegen.Label; 11.5 import jdk.nashorn.internal.ir.annotations.Immutable; 11.6 import jdk.nashorn.internal.ir.visitor.NodeVisitor; 11.7 -import jdk.nashorn.internal.runtime.Source; 11.8 11.9 /** 11.10 * IR representation for a list of statements and functions. All provides the 11.11 @@ -77,13 +76,12 @@ 11.12 /** 11.13 * Constructor 11.14 * 11.15 - * @param source source code 11.16 * @param token token 11.17 * @param finish finish 11.18 * @param statements statements 11.19 */ 11.20 - public Block(final Source source, final long token, final int finish, final Node... statements) { 11.21 - super(source, token, finish, new Label("block_break")); 11.22 + public Block(final long token, final int finish, final Node... statements) { 11.23 + super(token, finish, new Label("block_break")); 11.24 11.25 this.statements = Arrays.asList(statements); 11.26 this.symbols = new LinkedHashMap<>(); 11.27 @@ -94,13 +92,12 @@ 11.28 /** 11.29 * Constructor 11.30 * 11.31 - * @param source source code 11.32 * @param token token 11.33 * @param finish finish 11.34 * @param statements statements 11.35 */ 11.36 - public Block(final Source source, final long token, final int finish, final List<Node> statements) { 11.37 - this(source, token, finish, statements.toArray(new Node[statements.size()])); 11.38 + public Block(final long token, final int finish, final List<Node> statements) { 11.39 + this(token, finish, statements.toArray(new Node[statements.size()])); 11.40 } 11.41 11.42 private Block(final Block block, final int finish, final List<Node> statements, final int flags, final Map<String, Symbol> symbols) {
12.1 --- a/src/jdk/nashorn/internal/ir/BreakNode.java Fri May 03 22:50:51 2013 +0200 12.2 +++ b/src/jdk/nashorn/internal/ir/BreakNode.java Tue May 07 14:36:57 2013 +0200 12.3 @@ -27,7 +27,6 @@ 12.4 12.5 import jdk.nashorn.internal.ir.annotations.Immutable; 12.6 import jdk.nashorn.internal.ir.visitor.NodeVisitor; 12.7 -import jdk.nashorn.internal.runtime.Source; 12.8 12.9 /** 12.10 * IR representation for {@code break} statements. 12.11 @@ -40,13 +39,12 @@ 12.12 /** 12.13 * Constructor 12.14 * 12.15 - * @param source source code 12.16 * @param token token 12.17 * @param finish finish 12.18 * @param label label for break or null if none 12.19 */ 12.20 - public BreakNode(final Source source, final long token, final int finish, final IdentNode label) { 12.21 - super(source, token, finish); 12.22 + public BreakNode(final long token, final int finish, final IdentNode label) { 12.23 + super(token, finish); 12.24 this.label = label; 12.25 } 12.26
13.1 --- a/src/jdk/nashorn/internal/ir/BreakableNode.java Fri May 03 22:50:51 2013 +0200 13.2 +++ b/src/jdk/nashorn/internal/ir/BreakableNode.java Tue May 07 14:36:57 2013 +0200 13.3 @@ -30,7 +30,6 @@ 13.4 13.5 import jdk.nashorn.internal.codegen.Label; 13.6 import jdk.nashorn.internal.ir.annotations.Immutable; 13.7 -import jdk.nashorn.internal.runtime.Source; 13.8 13.9 /** 13.10 * This class represents a node from which control flow can execute 13.11 @@ -45,13 +44,12 @@ 13.12 /** 13.13 * Constructor 13.14 * 13.15 - * @param source source code 13.16 * @param token token 13.17 * @param finish finish 13.18 * @param breakLabel break label 13.19 */ 13.20 - protected BreakableNode(final Source source, final long token, final int finish, final Label breakLabel) { 13.21 - super(source, token, finish); 13.22 + protected BreakableNode(final long token, final int finish, final Label breakLabel) { 13.23 + super(token, finish); 13.24 this.breakLabel = breakLabel; 13.25 } 13.26
14.1 --- a/src/jdk/nashorn/internal/ir/CallNode.java Fri May 03 22:50:51 2013 +0200 14.2 +++ b/src/jdk/nashorn/internal/ir/CallNode.java Tue May 07 14:36:57 2013 +0200 14.3 @@ -31,7 +31,6 @@ 14.4 import jdk.nashorn.internal.ir.annotations.Ignore; 14.5 import jdk.nashorn.internal.ir.annotations.Immutable; 14.6 import jdk.nashorn.internal.ir.visitor.NodeVisitor; 14.7 -import jdk.nashorn.internal.runtime.Source; 14.8 14.9 /** 14.10 * IR representation for a function call. 14.11 @@ -137,14 +136,13 @@ 14.12 /** 14.13 * Constructors 14.14 * 14.15 - * @param source the source 14.16 * @param token token 14.17 * @param finish finish 14.18 * @param function the function to call 14.19 * @param args args to the call 14.20 */ 14.21 - public CallNode(final Source source, final long token, final int finish, final Node function, final List<Node> args) { 14.22 - super(source, token, finish); 14.23 + public CallNode(final long token, final int finish, final Node function, final List<Node> args) { 14.24 + super(token, finish); 14.25 14.26 this.function = function; 14.27 this.args = args;
15.1 --- a/src/jdk/nashorn/internal/ir/CaseNode.java Fri May 03 22:50:51 2013 +0200 15.2 +++ b/src/jdk/nashorn/internal/ir/CaseNode.java Tue May 07 14:36:57 2013 +0200 15.3 @@ -28,7 +28,6 @@ 15.4 import jdk.nashorn.internal.codegen.Label; 15.5 import jdk.nashorn.internal.ir.annotations.Immutable; 15.6 import jdk.nashorn.internal.ir.visitor.NodeVisitor; 15.7 -import jdk.nashorn.internal.runtime.Source; 15.8 15.9 /** 15.10 * IR representation of CASE clause. 15.11 @@ -48,14 +47,13 @@ 15.12 /** 15.13 * Constructors 15.14 * 15.15 - * @param source the source 15.16 * @param token token 15.17 * @param finish finish 15.18 * @param test case test node, can be any node in JavaScript 15.19 * @param body case body 15.20 */ 15.21 - public CaseNode(final Source source, final long token, final int finish, final Node test, final Block body) { 15.22 - super(source, token, finish); 15.23 + public CaseNode(final long token, final int finish, final Node test, final Block body) { 15.24 + super(token, finish); 15.25 15.26 this.test = test; 15.27 this.body = body;
16.1 --- a/src/jdk/nashorn/internal/ir/CatchNode.java Fri May 03 22:50:51 2013 +0200 16.2 +++ b/src/jdk/nashorn/internal/ir/CatchNode.java Tue May 07 14:36:57 2013 +0200 16.3 @@ -27,7 +27,6 @@ 16.4 16.5 import jdk.nashorn.internal.ir.annotations.Immutable; 16.6 import jdk.nashorn.internal.ir.visitor.NodeVisitor; 16.7 -import jdk.nashorn.internal.runtime.Source; 16.8 16.9 /** 16.10 * IR representation of a catch clause. 16.11 @@ -46,16 +45,14 @@ 16.12 /** 16.13 * Constructors 16.14 * 16.15 - * @param source the source 16.16 * @param token token 16.17 * @param finish finish 16.18 * @param exception variable name of exception 16.19 * @param exceptionCondition exception condition 16.20 * @param body catch body 16.21 */ 16.22 - public CatchNode(final Source source, final long token, final int finish, final IdentNode exception, final Node exceptionCondition, final Block body) { 16.23 - super(source, token, finish); 16.24 - 16.25 + public CatchNode(final long token, final int finish, final IdentNode exception, final Node exceptionCondition, final Block body) { 16.26 + super(token, finish); 16.27 this.exception = exception; 16.28 this.exceptionCondition = exceptionCondition; 16.29 this.body = body; 16.30 @@ -63,7 +60,6 @@ 16.31 16.32 private CatchNode(final CatchNode catchNode, final IdentNode exception, final Node exceptionCondition, final Block body) { 16.33 super(catchNode); 16.34 - 16.35 this.exception = exception; 16.36 this.exceptionCondition = exceptionCondition; 16.37 this.body = body;
17.1 --- a/src/jdk/nashorn/internal/ir/ContinueNode.java Fri May 03 22:50:51 2013 +0200 17.2 +++ b/src/jdk/nashorn/internal/ir/ContinueNode.java Tue May 07 14:36:57 2013 +0200 17.3 @@ -27,7 +27,6 @@ 17.4 17.5 import jdk.nashorn.internal.ir.annotations.Immutable; 17.6 import jdk.nashorn.internal.ir.visitor.NodeVisitor; 17.7 -import jdk.nashorn.internal.runtime.Source; 17.8 17.9 /** 17.10 * IR representation for CONTINUE statements. 17.11 @@ -40,13 +39,12 @@ 17.12 /** 17.13 * Constructor 17.14 * 17.15 - * @param source source code 17.16 * @param token token 17.17 * @param finish finish 17.18 * @param label label for break or null if none 17.19 */ 17.20 - public ContinueNode(final Source source, final long token, final int finish, final IdentNode label) { 17.21 - super(source, token, finish); 17.22 + public ContinueNode(final long token, final int finish, final IdentNode label) { 17.23 + super(token, finish); 17.24 this.label = label; 17.25 } 17.26
18.1 --- a/src/jdk/nashorn/internal/ir/EmptyNode.java Fri May 03 22:50:51 2013 +0200 18.2 +++ b/src/jdk/nashorn/internal/ir/EmptyNode.java Tue May 07 14:36:57 2013 +0200 18.3 @@ -27,7 +27,6 @@ 18.4 18.5 import jdk.nashorn.internal.ir.annotations.Immutable; 18.6 import jdk.nashorn.internal.ir.visitor.NodeVisitor; 18.7 -import jdk.nashorn.internal.runtime.Source; 18.8 18.9 /** 18.10 * IR representation for an empty statement. 18.11 @@ -47,12 +46,11 @@ 18.12 /** 18.13 * Constructor 18.14 * 18.15 - * @param source the source 18.16 * @param token token 18.17 * @param finish finish 18.18 */ 18.19 - public EmptyNode(final Source source, final long token, final int finish) { 18.20 - super(source, token, finish); 18.21 + public EmptyNode(final long token, final int finish) { 18.22 + super(token, finish); 18.23 } 18.24 18.25
19.1 --- a/src/jdk/nashorn/internal/ir/ExecuteNode.java Fri May 03 22:50:51 2013 +0200 19.2 +++ b/src/jdk/nashorn/internal/ir/ExecuteNode.java Tue May 07 14:36:57 2013 +0200 19.3 @@ -27,7 +27,6 @@ 19.4 19.5 import jdk.nashorn.internal.ir.annotations.Immutable; 19.6 import jdk.nashorn.internal.ir.visitor.NodeVisitor; 19.7 -import jdk.nashorn.internal.runtime.Source; 19.8 19.9 /** 19.10 * IR representation for executing bare expressions. Basically, an expression 19.11 @@ -42,13 +41,12 @@ 19.12 /** 19.13 * Constructor 19.14 * 19.15 - * @param source the source 19.16 * @param token token 19.17 * @param finish finish 19.18 * @param expression the expression to execute 19.19 */ 19.20 - public ExecuteNode(final Source source, final long token, final int finish, final Node expression) { 19.21 - super(source, token, finish); 19.22 + public ExecuteNode(final long token, final int finish, final Node expression) { 19.23 + super(token, finish); 19.24 this.expression = expression; 19.25 } 19.26 19.27 @@ -63,7 +61,7 @@ 19.28 * @param expression an expression to wrap, from which source, tokens and finish are also inherited 19.29 */ 19.30 public ExecuteNode(final Node expression) { 19.31 - super(expression.getSource(), expression.getToken(), expression.getFinish()); 19.32 + super(expression.getToken(), expression.getFinish()); 19.33 this.expression = expression; 19.34 } 19.35
20.1 --- a/src/jdk/nashorn/internal/ir/ForNode.java Fri May 03 22:50:51 2013 +0200 20.2 +++ b/src/jdk/nashorn/internal/ir/ForNode.java Tue May 07 14:36:57 2013 +0200 20.3 @@ -27,7 +27,6 @@ 20.4 20.5 import jdk.nashorn.internal.ir.annotations.Immutable; 20.6 import jdk.nashorn.internal.ir.visitor.NodeVisitor; 20.7 -import jdk.nashorn.internal.runtime.Source; 20.8 20.9 /** 20.10 * IR representing a FOR statement. 20.11 @@ -57,7 +56,6 @@ 20.12 /** 20.13 * Constructor 20.14 * 20.15 - * @param source the source 20.16 * @param token token 20.17 * @param finish finish 20.18 * @param init init 20.19 @@ -66,8 +64,8 @@ 20.20 * @param modify modify 20.21 * @param flags flags 20.22 */ 20.23 - public ForNode(final Source source, final long token, final int finish, final Node init, final Node test, final Block body, final Node modify, final int flags) { 20.24 - super(source, token, finish, test, body, false); 20.25 + public ForNode(final long token, final int finish, final Node init, final Node test, final Block body, final Node modify, final int flags) { 20.26 + super(token, finish, test, body, false); 20.27 this.init = init; 20.28 this.modify = modify; 20.29 this.flags = flags;
21.1 --- a/src/jdk/nashorn/internal/ir/FunctionNode.java Fri May 03 22:50:51 2013 +0200 21.2 +++ b/src/jdk/nashorn/internal/ir/FunctionNode.java Tue May 07 14:36:57 2013 +0200 21.3 @@ -86,6 +86,8 @@ 21.4 /** method has been emitted to bytecode */ 21.5 EMITTED 21.6 } 21.7 + /** Source of entity. */ 21.8 + private final Source source; 21.9 21.10 /** External function identifier. */ 21.11 @Ignore 21.12 @@ -223,8 +225,9 @@ 21.13 final List<IdentNode> parameters, 21.14 final FunctionNode.Kind kind, 21.15 final int flags) { 21.16 - super(source, token, finish); 21.17 + super(token, finish); 21.18 21.19 + this.source = source; 21.20 this.ident = ident; 21.21 this.name = name; 21.22 this.kind = kind; 21.23 @@ -265,6 +268,7 @@ 21.24 this.hints = hints; 21.25 21.26 // the fields below never change - they are final and assigned in constructor 21.27 + this.source = functionNode.source; 21.28 this.name = functionNode.name; 21.29 this.ident = functionNode.ident; 21.30 this.namespace = functionNode.namespace; 21.31 @@ -282,6 +286,14 @@ 21.32 } 21.33 21.34 /** 21.35 + * Get the source for this function 21.36 + * @return the source 21.37 + */ 21.38 + public Source getSource() { 21.39 + return source; 21.40 + } 21.41 + 21.42 + /** 21.43 * Get the version of this function node's code as it looked upon construction 21.44 * i.e typically parsed and nothing else 21.45 * @return initial version of function node 21.46 @@ -300,6 +312,9 @@ 21.47 if (this.snapshot == this) { 21.48 return this; 21.49 } 21.50 + if (isProgram() || parameters.isEmpty()) { 21.51 + return this; //never specialize anything that won't be recompiled 21.52 + } 21.53 return Node.replaceInLexicalContext(lc, this, new FunctionNode(this, lastToken, flags, returnType, compileUnit, compilationState, body, parameters, this, hints)); 21.54 } 21.55
22.1 --- a/src/jdk/nashorn/internal/ir/IdentNode.java Fri May 03 22:50:51 2013 +0200 22.2 +++ b/src/jdk/nashorn/internal/ir/IdentNode.java Tue May 07 14:36:57 2013 +0200 22.3 @@ -34,7 +34,6 @@ 22.4 import jdk.nashorn.internal.codegen.types.Type; 22.5 import jdk.nashorn.internal.ir.annotations.Immutable; 22.6 import jdk.nashorn.internal.ir.visitor.NodeVisitor; 22.7 -import jdk.nashorn.internal.runtime.Source; 22.8 22.9 /** 22.10 * IR representation for an identifier. 22.11 @@ -56,13 +55,12 @@ 22.12 /** 22.13 * Constructor 22.14 * 22.15 - * @param source the source 22.16 * @param token token 22.17 * @param finish finish position 22.18 * @param name name of identifier 22.19 */ 22.20 - public IdentNode(final Source source, final long token, final int finish, final String name) { 22.21 - super(source, token, finish); 22.22 + public IdentNode(final long token, final int finish, final String name) { 22.23 + super(token, finish); 22.24 this.name = name; 22.25 this.callSiteType = null; 22.26 this.flags = 0;
23.1 --- a/src/jdk/nashorn/internal/ir/IfNode.java Fri May 03 22:50:51 2013 +0200 23.2 +++ b/src/jdk/nashorn/internal/ir/IfNode.java Tue May 07 14:36:57 2013 +0200 23.3 @@ -27,7 +27,6 @@ 23.4 23.5 import jdk.nashorn.internal.ir.annotations.Immutable; 23.6 import jdk.nashorn.internal.ir.visitor.NodeVisitor; 23.7 -import jdk.nashorn.internal.runtime.Source; 23.8 23.9 /** 23.10 * IR representation for an IF statement. 23.11 @@ -46,15 +45,14 @@ 23.12 /** 23.13 * Constructor 23.14 * 23.15 - * @param source the source 23.16 * @param token token 23.17 * @param finish finish 23.18 * @param test test 23.19 * @param pass block to execute when test passes 23.20 * @param fail block to execute when test fails or null 23.21 */ 23.22 - public IfNode(final Source source, final long token, final int finish, final Node test, final Block pass, final Block fail) { 23.23 - super(source, token, finish); 23.24 + public IfNode(final long token, final int finish, final Node test, final Block pass, final Block fail) { 23.25 + super(token, finish); 23.26 this.test = test; 23.27 this.pass = pass; 23.28 this.fail = fail;
24.1 --- a/src/jdk/nashorn/internal/ir/IndexNode.java Fri May 03 22:50:51 2013 +0200 24.2 +++ b/src/jdk/nashorn/internal/ir/IndexNode.java Tue May 07 14:36:57 2013 +0200 24.3 @@ -28,7 +28,6 @@ 24.4 import jdk.nashorn.internal.codegen.types.Type; 24.5 import jdk.nashorn.internal.ir.annotations.Immutable; 24.6 import jdk.nashorn.internal.ir.visitor.NodeVisitor; 24.7 -import jdk.nashorn.internal.runtime.Source; 24.8 24.9 /** 24.10 * IR representation of an indexed access (brackets operator.) 24.11 @@ -41,14 +40,13 @@ 24.12 /** 24.13 * Constructors 24.14 * 24.15 - * @param source the source 24.16 * @param token token 24.17 * @param finish finish 24.18 * @param base base node for access 24.19 * @param index index for access 24.20 */ 24.21 - public IndexNode(final Source source, final long token, final int finish, final Node base, final Node index) { 24.22 - super(source, token, finish, base, false, false); 24.23 + public IndexNode(final long token, final int finish, final Node base, final Node index) { 24.24 + super(token, finish, base, false, false); 24.25 this.index = index; 24.26 } 24.27
25.1 --- a/src/jdk/nashorn/internal/ir/LabelNode.java Fri May 03 22:50:51 2013 +0200 25.2 +++ b/src/jdk/nashorn/internal/ir/LabelNode.java Tue May 07 14:36:57 2013 +0200 25.3 @@ -27,7 +27,6 @@ 25.4 25.5 import jdk.nashorn.internal.ir.annotations.Immutable; 25.6 import jdk.nashorn.internal.ir.visitor.NodeVisitor; 25.7 -import jdk.nashorn.internal.runtime.Source; 25.8 25.9 /** 25.10 * IR representation for a labeled statement. 25.11 @@ -43,14 +42,13 @@ 25.12 /** 25.13 * Constructor 25.14 * 25.15 - * @param source the source 25.16 * @param token token 25.17 * @param finish finish 25.18 * @param label label identifier 25.19 * @param body body of label node 25.20 */ 25.21 - public LabelNode(final Source source, final long token, final int finish, final IdentNode label, final Block body) { 25.22 - super(source, token, finish); 25.23 + public LabelNode(final long token, final int finish, final IdentNode label, final Block body) { 25.24 + super(token, finish); 25.25 25.26 this.label = label; 25.27 this.body = body;
26.1 --- a/src/jdk/nashorn/internal/ir/LexicalContext.java Fri May 03 22:50:51 2013 +0200 26.2 +++ b/src/jdk/nashorn/internal/ir/LexicalContext.java Tue May 07 14:36:57 2013 +0200 26.3 @@ -392,8 +392,7 @@ 26.4 */ 26.5 public boolean isFunctionDefinedInCurrentCall(FunctionNode functionNode) { 26.6 final LexicalContextNode parent = stack[sp - 2]; 26.7 - if(parent instanceof CallNode && ((CallNode)parent).getFunction() == functionNode) { 26.8 - assert functionNode.getSource() == peek().getSource(); 26.9 + if (parent instanceof CallNode && ((CallNode)parent).getFunction() == functionNode) { 26.10 return true; 26.11 } 26.12 return false; 26.13 @@ -540,13 +539,16 @@ 26.14 sb.append('@'); 26.15 sb.append(Debug.id(node)); 26.16 sb.append(':'); 26.17 - final Source source = node.getSource(); 26.18 - String src = source.toString(); 26.19 - if (src.indexOf(File.pathSeparator) != -1) { 26.20 - src = src.substring(src.lastIndexOf(File.pathSeparator)); 26.21 + if (node instanceof FunctionNode) { 26.22 + final Source source = ((FunctionNode)node).getSource(); 26.23 + String src = source.toString(); 26.24 + if (src.indexOf(File.pathSeparator) != -1) { 26.25 + src = src.substring(src.lastIndexOf(File.pathSeparator)); 26.26 + } 26.27 + src += ' '; 26.28 + src += source.getLine(node.getStart()); 26.29 + sb.append(src); 26.30 } 26.31 - src += ' '; 26.32 - src += source.getLine(node.getStart()); 26.33 sb.append(' '); 26.34 } 26.35 sb.append(" ==> ]");
27.1 --- a/src/jdk/nashorn/internal/ir/LexicalContextNode.java Fri May 03 22:50:51 2013 +0200 27.2 +++ b/src/jdk/nashorn/internal/ir/LexicalContextNode.java Tue May 07 14:36:57 2013 +0200 27.3 @@ -25,7 +25,6 @@ 27.4 package jdk.nashorn.internal.ir; 27.5 27.6 import jdk.nashorn.internal.ir.visitor.NodeVisitor; 27.7 -import jdk.nashorn.internal.runtime.Source; 27.8 27.9 /** 27.10 * Superclass for nodes that can be part of the lexical context 27.11 @@ -35,12 +34,11 @@ 27.12 /** 27.13 * Constructor 27.14 * 27.15 - * @param source source 27.16 * @param token token 27.17 * @param finish finish 27.18 */ 27.19 - protected LexicalContextNode(final Source source, final long token, final int finish) { 27.20 - super(source, token, finish); 27.21 + protected LexicalContextNode(final long token, final int finish) { 27.22 + super(token, finish); 27.23 } 27.24 27.25 /**
28.1 --- a/src/jdk/nashorn/internal/ir/LineNumberNode.java Fri May 03 22:50:51 2013 +0200 28.2 +++ b/src/jdk/nashorn/internal/ir/LineNumberNode.java Tue May 07 14:36:57 2013 +0200 28.3 @@ -28,7 +28,6 @@ 28.4 import jdk.nashorn.internal.ir.annotations.Immutable; 28.5 import jdk.nashorn.internal.ir.visitor.NodeVisitor; 28.6 import jdk.nashorn.internal.parser.Token; 28.7 -import jdk.nashorn.internal.runtime.Source; 28.8 28.9 /** 28.10 * IR Node representing a line number 28.11 @@ -41,12 +40,11 @@ 28.12 /** 28.13 * Constructor 28.14 * 28.15 - * @param source the source 28.16 * @param token token 28.17 * @param lineNumber the line number 28.18 */ 28.19 - public LineNumberNode(final Source source, final long token, final int lineNumber) { 28.20 - super(source, token, Token.descPosition(token)); 28.21 + public LineNumberNode(final long token, final int lineNumber) { 28.22 + super(token, Token.descPosition(token)); 28.23 this.lineNumber = lineNumber; 28.24 } 28.25
29.1 --- a/src/jdk/nashorn/internal/ir/LiteralNode.java Fri May 03 22:50:51 2013 +0200 29.2 +++ b/src/jdk/nashorn/internal/ir/LiteralNode.java Tue May 07 14:36:57 2013 +0200 29.3 @@ -37,7 +37,6 @@ 29.4 import jdk.nashorn.internal.parser.TokenType; 29.5 import jdk.nashorn.internal.runtime.JSType; 29.6 import jdk.nashorn.internal.runtime.ScriptRuntime; 29.7 -import jdk.nashorn.internal.runtime.Source; 29.8 import jdk.nashorn.internal.runtime.Undefined; 29.9 29.10 /** 29.11 @@ -50,16 +49,15 @@ 29.12 /** Literal value */ 29.13 protected final T value; 29.14 29.15 - /** 29.16 + /** 29.17 * Constructor 29.18 * 29.19 - * @param source the source 29.20 * @param token token 29.21 * @param finish finish 29.22 * @param value the value of the literal 29.23 */ 29.24 - protected LiteralNode(final Source source, final long token, final int finish, final T value) { 29.25 - super(source, token, finish); 29.26 + protected LiteralNode(final long token, final int finish, final T value) { 29.27 + super(token, finish); 29.28 this.value = value; 29.29 } 29.30 29.31 @@ -238,14 +236,13 @@ 29.32 /** 29.33 * Create a new null literal 29.34 * 29.35 - * @param source the source 29.36 * @param token token 29.37 * @param finish finish 29.38 * 29.39 * @return the new literal node 29.40 */ 29.41 - public static LiteralNode<Node> newInstance(final Source source, final long token, final int finish) { 29.42 - return new NodeLiteralNode(source, token, finish); 29.43 + public static LiteralNode<Node> newInstance(final long token, final int finish) { 29.44 + return new NodeLiteralNode(token, finish); 29.45 } 29.46 29.47 /** 29.48 @@ -256,14 +253,14 @@ 29.49 * @return the new literal node 29.50 */ 29.51 public static LiteralNode<?> newInstance(final Node parent) { 29.52 - return new NodeLiteralNode(parent.getSource(), parent.getToken(), parent.getFinish()); 29.53 + return new NodeLiteralNode(parent.getToken(), parent.getFinish()); 29.54 } 29.55 29.56 @Immutable 29.57 private static final class BooleanLiteralNode extends LiteralNode<Boolean> { 29.58 29.59 - private BooleanLiteralNode(final Source source, final long token, final int finish, final boolean value) { 29.60 - super(source, Token.recast(token, value ? TokenType.TRUE : TokenType.FALSE), finish, value); 29.61 + private BooleanLiteralNode(final long token, final int finish, final boolean value) { 29.62 + super(Token.recast(token, value ? TokenType.TRUE : TokenType.FALSE), finish, value); 29.63 } 29.64 29.65 private BooleanLiteralNode(final BooleanLiteralNode literalNode) { 29.66 @@ -289,15 +286,14 @@ 29.67 /** 29.68 * Create a new boolean literal 29.69 * 29.70 - * @param source the source 29.71 * @param token token 29.72 * @param finish finish 29.73 * @param value true or false 29.74 * 29.75 * @return the new literal node 29.76 */ 29.77 - public static LiteralNode<Boolean> newInstance(final Source source, final long token, final int finish, final boolean value) { 29.78 - return new BooleanLiteralNode(source, token, finish, value); 29.79 + public static LiteralNode<Boolean> newInstance(final long token, final int finish, final boolean value) { 29.80 + return new BooleanLiteralNode(token, finish, value); 29.81 } 29.82 29.83 /** 29.84 @@ -309,7 +305,7 @@ 29.85 * @return the new literal node 29.86 */ 29.87 public static LiteralNode<?> newInstance(final Node parent, final boolean value) { 29.88 - return new BooleanLiteralNode(parent.getSource(), parent.getToken(), parent.getFinish(), value); 29.89 + return new BooleanLiteralNode(parent.getToken(), parent.getFinish(), value); 29.90 } 29.91 29.92 @Immutable 29.93 @@ -317,8 +313,8 @@ 29.94 29.95 private final Type type = numberGetType(value); 29.96 29.97 - private NumberLiteralNode(final Source source, final long token, final int finish, final Number value) { 29.98 - super(source, Token.recast(token, TokenType.DECIMAL), finish, value); 29.99 + private NumberLiteralNode(final long token, final int finish, final Number value) { 29.100 + super(Token.recast(token, TokenType.DECIMAL), finish, value); 29.101 } 29.102 29.103 private NumberLiteralNode(final NumberLiteralNode literalNode) { 29.104 @@ -353,15 +349,14 @@ 29.105 /** 29.106 * Create a new number literal 29.107 * 29.108 - * @param source the source 29.109 * @param token token 29.110 * @param finish finish 29.111 * @param value literal value 29.112 * 29.113 * @return the new literal node 29.114 */ 29.115 - public static LiteralNode<Number> newInstance(final Source source, final long token, final int finish, final Number value) { 29.116 - return new NumberLiteralNode(source, token, finish, value); 29.117 + public static LiteralNode<Number> newInstance(final long token, final int finish, final Number value) { 29.118 + return new NumberLiteralNode(token, finish, value); 29.119 } 29.120 29.121 /** 29.122 @@ -373,12 +368,12 @@ 29.123 * @return the new literal node 29.124 */ 29.125 public static LiteralNode<?> newInstance(final Node parent, final Number value) { 29.126 - return new NumberLiteralNode(parent.getSource(), parent.getToken(), parent.getFinish(), value); 29.127 + return new NumberLiteralNode(parent.getToken(), parent.getFinish(), value); 29.128 } 29.129 29.130 private static class UndefinedLiteralNode extends LiteralNode<Undefined> { 29.131 - private UndefinedLiteralNode(final Source source, final long token, final int finish) { 29.132 - super(source, Token.recast(token, TokenType.OBJECT), finish, ScriptRuntime.UNDEFINED); 29.133 + private UndefinedLiteralNode(final long token, final int finish) { 29.134 + super(Token.recast(token, TokenType.OBJECT), finish, ScriptRuntime.UNDEFINED); 29.135 } 29.136 29.137 private UndefinedLiteralNode(final UndefinedLiteralNode literalNode) { 29.138 @@ -389,15 +384,14 @@ 29.139 /** 29.140 * Create a new undefined literal 29.141 * 29.142 - * @param source the source 29.143 * @param token token 29.144 * @param finish finish 29.145 * @param value undefined value, passed only for polymorphisism discrimination 29.146 * 29.147 * @return the new literal node 29.148 */ 29.149 - public static LiteralNode<Undefined> newInstance(final Source source, final long token, final int finish, final Undefined value) { 29.150 - return new UndefinedLiteralNode(source, token, finish); 29.151 + public static LiteralNode<Undefined> newInstance(final long token, final int finish, final Undefined value) { 29.152 + return new UndefinedLiteralNode(token, finish); 29.153 } 29.154 29.155 /** 29.156 @@ -409,13 +403,13 @@ 29.157 * @return the new literal node 29.158 */ 29.159 public static LiteralNode<?> newInstance(final Node parent, final Undefined value) { 29.160 - return new UndefinedLiteralNode(parent.getSource(), parent.getToken(), parent.getFinish()); 29.161 + return new UndefinedLiteralNode(parent.getToken(), parent.getFinish()); 29.162 } 29.163 29.164 @Immutable 29.165 private static class StringLiteralNode extends LiteralNode<String> { 29.166 - private StringLiteralNode(final Source source, final long token, final int finish, final String value) { 29.167 - super(source, Token.recast(token, TokenType.STRING), finish, value); 29.168 + private StringLiteralNode(final long token, final int finish, final String value) { 29.169 + super(Token.recast(token, TokenType.STRING), finish, value); 29.170 } 29.171 29.172 private StringLiteralNode(final StringLiteralNode literalNode) { 29.173 @@ -433,15 +427,14 @@ 29.174 /** 29.175 * Create a new string literal 29.176 * 29.177 - * @param source the source 29.178 * @param token token 29.179 * @param finish finish 29.180 * @param value string value 29.181 * 29.182 * @return the new literal node 29.183 */ 29.184 - public static LiteralNode<String> newInstance(final Source source, final long token, final int finish, final String value) { 29.185 - return new StringLiteralNode(source, token, finish, value); 29.186 + public static LiteralNode<String> newInstance(final long token, final int finish, final String value) { 29.187 + return new StringLiteralNode(token, finish, value); 29.188 } 29.189 29.190 /** 29.191 @@ -453,13 +446,13 @@ 29.192 * @return the new literal node 29.193 */ 29.194 public static LiteralNode<?> newInstance(final Node parent, final String value) { 29.195 - return new StringLiteralNode(parent.getSource(), parent.getToken(), parent.getFinish(), value); 29.196 + return new StringLiteralNode(parent.getToken(), parent.getFinish(), value); 29.197 } 29.198 29.199 @Immutable 29.200 private static class LexerTokenLiteralNode extends LiteralNode<LexerToken> { 29.201 - private LexerTokenLiteralNode(final Source source, final long token, final int finish, final LexerToken value) { 29.202 - super(source, Token.recast(token, TokenType.STRING), finish, value); //TODO is string the correct token type here? 29.203 + private LexerTokenLiteralNode(final long token, final int finish, final LexerToken value) { 29.204 + super(Token.recast(token, TokenType.STRING), finish, value); //TODO is string the correct token type here? 29.205 } 29.206 29.207 private LexerTokenLiteralNode(final LexerTokenLiteralNode literalNode) { 29.208 @@ -480,15 +473,14 @@ 29.209 /** 29.210 * Create a new literal node for a lexer token 29.211 * 29.212 - * @param source the source 29.213 * @param token token 29.214 * @param finish finish 29.215 * @param value lexer token value 29.216 * 29.217 * @return the new literal node 29.218 */ 29.219 - public static LiteralNode<LexerToken> newInstance(final Source source, final long token, final int finish, final LexerToken value) { 29.220 - return new LexerTokenLiteralNode(source, token, finish, value); 29.221 + public static LiteralNode<LexerToken> newInstance(final long token, final int finish, final LexerToken value) { 29.222 + return new LexerTokenLiteralNode(token, finish, value); 29.223 } 29.224 29.225 /** 29.226 @@ -500,17 +492,17 @@ 29.227 * @return the new literal node 29.228 */ 29.229 public static LiteralNode<?> newInstance(final Node parent, final LexerToken value) { 29.230 - return new LexerTokenLiteralNode(parent.getSource(), parent.getToken(), parent.getFinish(), value); 29.231 + return new LexerTokenLiteralNode(parent.getToken(), parent.getFinish(), value); 29.232 } 29.233 29.234 private static final class NodeLiteralNode extends LiteralNode<Node> { 29.235 29.236 - private NodeLiteralNode(final Source source, final long token, final int finish) { 29.237 - this(source, token, finish, null); 29.238 + private NodeLiteralNode(final long token, final int finish) { 29.239 + this(token, finish, null); 29.240 } 29.241 29.242 - private NodeLiteralNode(final Source source, final long token, final int finish, final Node value) { 29.243 - super(source, Token.recast(token, TokenType.OBJECT), finish, value); 29.244 + private NodeLiteralNode(final long token, final int finish, final Node value) { 29.245 + super(Token.recast(token, TokenType.OBJECT), finish, value); 29.246 } 29.247 29.248 private NodeLiteralNode(final LiteralNode<Node> literalNode) { 29.249 @@ -550,15 +542,14 @@ 29.250 /** 29.251 * Create a new node literal for an arbitrary node 29.252 * 29.253 - * @param source the source 29.254 * @param token token 29.255 * @param finish finish 29.256 * @param value the literal value node 29.257 * 29.258 * @return the new literal node 29.259 */ 29.260 - public static LiteralNode<Node> newInstance(final Source source, final long token, final int finish, final Node value) { 29.261 - return new NodeLiteralNode(source, token, finish, value); 29.262 + public static LiteralNode<Node> newInstance(final long token, final int finish, final Node value) { 29.263 + return new NodeLiteralNode(token, finish, value); 29.264 } 29.265 29.266 /** 29.267 @@ -570,7 +561,7 @@ 29.268 * @return the new literal node 29.269 */ 29.270 public static LiteralNode<?> newInstance(final Node parent, final Node value) { 29.271 - return new NodeLiteralNode(parent.getSource(), parent.getToken(), parent.getFinish(), value); 29.272 + return new NodeLiteralNode(parent.getToken(), parent.getFinish(), value); 29.273 } 29.274 29.275 /** 29.276 @@ -645,13 +636,12 @@ 29.277 /** 29.278 * Constructor 29.279 * 29.280 - * @param source the source 29.281 * @param token token 29.282 * @param finish finish 29.283 * @param value array literal value, a Node array 29.284 */ 29.285 - protected ArrayLiteralNode(final Source source, final long token, final int finish, final Node[] value) { 29.286 - super(source, Token.recast(token, TokenType.ARRAY), finish, value); 29.287 + protected ArrayLiteralNode(final long token, final int finish, final Node[] value) { 29.288 + super(Token.recast(token, TokenType.ARRAY), finish, value); 29.289 this.elementType = Type.UNKNOWN; 29.290 } 29.291 29.292 @@ -886,15 +876,14 @@ 29.293 /** 29.294 * Create a new array literal of Nodes from a list of Node values 29.295 * 29.296 - * @param source the source 29.297 * @param token token 29.298 * @param finish finish 29.299 * @param value literal value list 29.300 * 29.301 * @return the new literal node 29.302 */ 29.303 - public static LiteralNode<Node[]> newInstance(final Source source, final long token, final int finish, final List<Node> value) { 29.304 - return new ArrayLiteralNode(source, token, finish, value.toArray(new Node[value.size()])); 29.305 + public static LiteralNode<Node[]> newInstance(final long token, final int finish, final List<Node> value) { 29.306 + return new ArrayLiteralNode(token, finish, value.toArray(new Node[value.size()])); 29.307 } 29.308 29.309 29.310 @@ -907,20 +896,19 @@ 29.311 * @return the new literal node 29.312 */ 29.313 public static LiteralNode<?> newInstance(final Node parent, final List<Node> value) { 29.314 - return new ArrayLiteralNode(parent.getSource(), parent.getToken(), parent.getFinish(), value.toArray(new Node[value.size()])); 29.315 + return new ArrayLiteralNode(parent.getToken(), parent.getFinish(), value.toArray(new Node[value.size()])); 29.316 } 29.317 29.318 /** 29.319 * Create a new array literal of Nodes 29.320 * 29.321 - * @param source the source 29.322 * @param token token 29.323 * @param finish finish 29.324 * @param value literal value array 29.325 * 29.326 * @return the new literal node 29.327 */ 29.328 - public static LiteralNode<Node[]> newInstance(final Source source, final long token, final int finish, final Node[] value) { 29.329 - return new ArrayLiteralNode(source, token, finish, value); 29.330 + public static LiteralNode<Node[]> newInstance(final long token, final int finish, final Node[] value) { 29.331 + return new ArrayLiteralNode(token, finish, value); 29.332 } 29.333 }
30.1 --- a/src/jdk/nashorn/internal/ir/Location.java Fri May 03 22:50:51 2013 +0200 30.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 30.3 @@ -1,134 +0,0 @@ 30.4 -/* 30.5 - * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved. 30.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 30.7 - * 30.8 - * This code is free software; you can redistribute it and/or modify it 30.9 - * under the terms of the GNU General Public License version 2 only, as 30.10 - * published by the Free Software Foundation. Oracle designates this 30.11 - * particular file as subject to the "Classpath" exception as provided 30.12 - * by Oracle in the LICENSE file that accompanied this code. 30.13 - * 30.14 - * This code is distributed in the hope that it will be useful, but WITHOUT 30.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 30.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 30.17 - * version 2 for more details (a copy is included in the LICENSE file that 30.18 - * accompanied this code). 30.19 - * 30.20 - * You should have received a copy of the GNU General Public License version 30.21 - * 2 along with this work; if not, write to the Free Software Foundation, 30.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 30.23 - * 30.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 30.25 - * or visit www.oracle.com if you need additional information or have any 30.26 - * questions. 30.27 - */ 30.28 - 30.29 -package jdk.nashorn.internal.ir; 30.30 - 30.31 -import jdk.nashorn.internal.parser.Token; 30.32 -import jdk.nashorn.internal.parser.TokenType; 30.33 -import jdk.nashorn.internal.runtime.Source; 30.34 - 30.35 -/** 30.36 - * Used to locate an entity back to it's source file. 30.37 - */ 30.38 -public class Location implements Cloneable { 30.39 - /** Source of entity. */ 30.40 - private final Source source; 30.41 - 30.42 - /** Token descriptor. */ 30.43 - private final long token; 30.44 - 30.45 - /** 30.46 - * Constructor 30.47 - * 30.48 - * @param source the source 30.49 - * @param token token 30.50 - */ 30.51 - public Location(final Source source, final long token) { 30.52 - this.source = source; 30.53 - this.token = token; 30.54 - } 30.55 - 30.56 - /** 30.57 - * Copy constructor 30.58 - * 30.59 - * @param location source node 30.60 - */ 30.61 - protected Location(final Location location) { 30.62 - this.source = location.source; 30.63 - this.token = location.token; 30.64 - } 30.65 - 30.66 - @Override 30.67 - protected Object clone() { 30.68 - try { 30.69 - return super.clone(); 30.70 - } catch(CloneNotSupportedException e) { 30.71 - throw new AssertionError(e); 30.72 - } 30.73 - } 30.74 - 30.75 - @Override 30.76 - public final boolean equals(final Object other) { 30.77 - return super.equals(other); 30.78 - } 30.79 - 30.80 - @Override 30.81 - public final int hashCode() { 30.82 - return super.hashCode(); 30.83 - } 30.84 - 30.85 - /** 30.86 - * Return token position from a token descriptor. 30.87 - * 30.88 - * @return Start position of the token in the source. 30.89 - */ 30.90 - public int position() { 30.91 - return Token.descPosition(token); 30.92 - } 30.93 - 30.94 - /** 30.95 - * Return token length from a token descriptor. 30.96 - * 30.97 - * @return Length of the token. 30.98 - */ 30.99 - public int length() { 30.100 - return Token.descLength(token); 30.101 - } 30.102 - 30.103 - /** 30.104 - * Return token tokenType from a token descriptor. 30.105 - * 30.106 - * @return Type of token. 30.107 - */ 30.108 - public TokenType tokenType() { 30.109 - return Token.descType(token); 30.110 - } 30.111 - 30.112 - /** 30.113 - * Test token tokenType. 30.114 - * 30.115 - * @param type a type to check this token against 30.116 - * @return true if token types match. 30.117 - */ 30.118 - public boolean isTokenType(final TokenType type) { 30.119 - return Token.descType(token) == type; 30.120 - } 30.121 - 30.122 - /** 30.123 - * Get the source for this location 30.124 - * @return the source 30.125 - */ 30.126 - public Source getSource() { 30.127 - return source; 30.128 - } 30.129 - 30.130 - /** 30.131 - * Get the token for this location 30.132 - * @return the token 30.133 - */ 30.134 - public long getToken() { 30.135 - return token; 30.136 - } 30.137 -}
31.1 --- a/src/jdk/nashorn/internal/ir/LoopNode.java Fri May 03 22:50:51 2013 +0200 31.2 +++ b/src/jdk/nashorn/internal/ir/LoopNode.java Tue May 07 14:36:57 2013 +0200 31.3 @@ -29,7 +29,6 @@ 31.4 import java.util.List; 31.5 31.6 import jdk.nashorn.internal.codegen.Label; 31.7 -import jdk.nashorn.internal.runtime.Source; 31.8 31.9 /** 31.10 * A loop node, for example a while node, do while node or for node 31.11 @@ -50,15 +49,14 @@ 31.12 /** 31.13 * Constructor 31.14 * 31.15 - * @param source source 31.16 * @param token token 31.17 * @param finish finish 31.18 * @param test test, or null if infinite loop 31.19 * @param body loop body 31.20 * @param controlFlowEscapes controlFlowEscapes 31.21 */ 31.22 - protected LoopNode(final Source source, final long token, final int finish, final Node test, final Block body, final boolean controlFlowEscapes) { 31.23 - super(source, token, finish, new Label("while_break")); 31.24 + protected LoopNode(final long token, final int finish, final Node test, final Block body, final boolean controlFlowEscapes) { 31.25 + super(token, finish, new Label("while_break")); 31.26 this.continueLabel = new Label("while_continue"); 31.27 this.test = test; 31.28 this.body = body;
32.1 --- a/src/jdk/nashorn/internal/ir/Node.java Fri May 03 22:50:51 2013 +0200 32.2 +++ b/src/jdk/nashorn/internal/ir/Node.java Tue May 07 14:36:57 2013 +0200 32.3 @@ -31,12 +31,12 @@ 32.4 import jdk.nashorn.internal.codegen.types.Type; 32.5 import jdk.nashorn.internal.ir.visitor.NodeVisitor; 32.6 import jdk.nashorn.internal.parser.Token; 32.7 -import jdk.nashorn.internal.runtime.Source; 32.8 +import jdk.nashorn.internal.parser.TokenType; 32.9 32.10 /** 32.11 * Nodes are used to compose Abstract Syntax Trees. 32.12 */ 32.13 -public abstract class Node extends Location { 32.14 +public abstract class Node implements Cloneable { 32.15 /** Node symbol. */ 32.16 private Symbol symbol; 32.17 32.18 @@ -46,16 +46,17 @@ 32.19 /** End of source range. */ 32.20 protected int finish; 32.21 32.22 + /** Token descriptor. */ 32.23 + private final long token; 32.24 + 32.25 /** 32.26 * Constructor 32.27 * 32.28 - * @param source the source 32.29 * @param token token 32.30 * @param finish finish 32.31 */ 32.32 - public Node(final Source source, final long token, final int finish) { 32.33 - super(source, token); 32.34 - 32.35 + public Node(final long token, final int finish) { 32.36 + this.token = token; 32.37 this.start = Token.descPosition(token); 32.38 this.finish = finish; 32.39 } 32.40 @@ -63,16 +64,14 @@ 32.41 /** 32.42 * Constructor 32.43 * 32.44 - * @param source source 32.45 * @param token token 32.46 * @param start start 32.47 * @param finish finish 32.48 */ 32.49 - protected Node(final Source source, final long token, final int start, final int finish) { 32.50 - super(source, token); 32.51 - 32.52 + protected Node(final long token, final int start, final int finish) { 32.53 this.start = start; 32.54 this.finish = finish; 32.55 + this.token = token; 32.56 } 32.57 32.58 /** 32.59 @@ -81,8 +80,7 @@ 32.60 * @param node source node 32.61 */ 32.62 protected Node(final Node node) { 32.63 - super(node); 32.64 - 32.65 + this.token = node.token; 32.66 this.symbol = node.symbol; 32.67 this.start = node.start; 32.68 this.finish = node.finish; 32.69 @@ -248,6 +246,15 @@ 32.70 return symbol; 32.71 } 32.72 32.73 + @Override 32.74 + protected Object clone() { 32.75 + try { 32.76 + return super.clone(); 32.77 + } catch (final CloneNotSupportedException e) { 32.78 + throw new AssertionError(e); 32.79 + } 32.80 + } 32.81 + 32.82 /** 32.83 * Assign a symbol to this node. See {@link Node#getSymbol()} for explanation 32.84 * of what a symbol is 32.85 @@ -265,6 +272,62 @@ 32.86 return newNode; 32.87 } 32.88 32.89 + 32.90 + @Override 32.91 + public final boolean equals(final Object other) { 32.92 + return super.equals(other); 32.93 + } 32.94 + 32.95 + @Override 32.96 + public final int hashCode() { 32.97 + return super.hashCode(); 32.98 + } 32.99 + 32.100 + /** 32.101 + * Return token position from a token descriptor. 32.102 + * 32.103 + * @return Start position of the token in the source. 32.104 + */ 32.105 + public int position() { 32.106 + return Token.descPosition(token); 32.107 + } 32.108 + 32.109 + /** 32.110 + * Return token length from a token descriptor. 32.111 + * 32.112 + * @return Length of the token. 32.113 + */ 32.114 + public int length() { 32.115 + return Token.descLength(token); 32.116 + } 32.117 + 32.118 + /** 32.119 + * Return token tokenType from a token descriptor. 32.120 + * 32.121 + * @return Type of token. 32.122 + */ 32.123 + public TokenType tokenType() { 32.124 + return Token.descType(token); 32.125 + } 32.126 + 32.127 + /** 32.128 + * Test token tokenType. 32.129 + * 32.130 + * @param type a type to check this token against 32.131 + * @return true if token types match. 32.132 + */ 32.133 + public boolean isTokenType(final TokenType type) { 32.134 + return Token.descType(token) == type; 32.135 + } 32.136 + 32.137 + /** 32.138 + * Get the token for this location 32.139 + * @return the token 32.140 + */ 32.141 + public long getToken() { 32.142 + return token; 32.143 + } 32.144 + 32.145 /** 32.146 * Is this a terminal Node, i.e. does it end control flow like a throw or return 32.147 * expression does?
33.1 --- a/src/jdk/nashorn/internal/ir/ObjectNode.java Fri May 03 22:50:51 2013 +0200 33.2 +++ b/src/jdk/nashorn/internal/ir/ObjectNode.java Tue May 07 14:36:57 2013 +0200 33.3 @@ -30,7 +30,6 @@ 33.4 33.5 import jdk.nashorn.internal.ir.annotations.Immutable; 33.6 import jdk.nashorn.internal.ir.visitor.NodeVisitor; 33.7 -import jdk.nashorn.internal.runtime.Source; 33.8 33.9 /** 33.10 * IR representation of an object literal. 33.11 @@ -44,13 +43,12 @@ 33.12 /** 33.13 * Constructor 33.14 * 33.15 - * @param source the source 33.16 * @param token token 33.17 * @param finish finish 33.18 * @param elements the elements used to initialize this ObjectNode 33.19 */ 33.20 - public ObjectNode(final Source source, final long token, final int finish, final List<Node> elements) { 33.21 - super(source, token, finish); 33.22 + public ObjectNode(final long token, final int finish, final List<Node> elements) { 33.23 + super(token, finish); 33.24 this.elements = elements; 33.25 } 33.26
34.1 --- a/src/jdk/nashorn/internal/ir/PropertyNode.java Fri May 03 22:50:51 2013 +0200 34.2 +++ b/src/jdk/nashorn/internal/ir/PropertyNode.java Tue May 07 14:36:57 2013 +0200 34.3 @@ -27,7 +27,6 @@ 34.4 34.5 import jdk.nashorn.internal.ir.annotations.Immutable; 34.6 import jdk.nashorn.internal.ir.visitor.NodeVisitor; 34.7 -import jdk.nashorn.internal.runtime.Source; 34.8 34.9 /** 34.10 * IR representation of an object literal property. 34.11 @@ -50,7 +49,6 @@ 34.12 /** 34.13 * Constructor 34.14 * 34.15 - * @param source the source 34.16 * @param token token 34.17 * @param finish finish 34.18 * @param key the key of this property 34.19 @@ -58,8 +56,8 @@ 34.20 * @param getter getter function body 34.21 * @param setter setter function body 34.22 */ 34.23 - public PropertyNode(final Source source, final long token, final int finish, final PropertyKey key, final Node value, final FunctionNode getter, final FunctionNode setter) { 34.24 - super(source, token, finish); 34.25 + public PropertyNode(final long token, final int finish, final PropertyKey key, final Node value, final FunctionNode getter, final FunctionNode setter) { 34.26 + super(token, finish); 34.27 this.key = key; 34.28 this.value = value; 34.29 this.getter = getter;
35.1 --- a/src/jdk/nashorn/internal/ir/ReturnNode.java Fri May 03 22:50:51 2013 +0200 35.2 +++ b/src/jdk/nashorn/internal/ir/ReturnNode.java Tue May 07 14:36:57 2013 +0200 35.3 @@ -29,7 +29,6 @@ 35.4 import static jdk.nashorn.internal.parser.TokenType.YIELD; 35.5 import jdk.nashorn.internal.ir.annotations.Immutable; 35.6 import jdk.nashorn.internal.ir.visitor.NodeVisitor; 35.7 -import jdk.nashorn.internal.runtime.Source; 35.8 35.9 /** 35.10 * IR representation for RETURN or YIELD statements. 35.11 @@ -42,13 +41,12 @@ 35.12 /** 35.13 * Constructor 35.14 * 35.15 - * @param source the source 35.16 * @param token token 35.17 * @param finish finish 35.18 * @param expression expression to return 35.19 */ 35.20 - public ReturnNode(final Source source, final long token, final int finish, final Node expression) { 35.21 - super(source, token, finish); 35.22 + public ReturnNode(final long token, final int finish, final Node expression) { 35.23 + super(token, finish); 35.24 this.expression = expression; 35.25 } 35.26
36.1 --- a/src/jdk/nashorn/internal/ir/RuntimeNode.java Fri May 03 22:50:51 2013 +0200 36.2 +++ b/src/jdk/nashorn/internal/ir/RuntimeNode.java Tue May 07 14:36:57 2013 +0200 36.3 @@ -33,7 +33,6 @@ 36.4 import jdk.nashorn.internal.ir.annotations.Immutable; 36.5 import jdk.nashorn.internal.ir.visitor.NodeVisitor; 36.6 import jdk.nashorn.internal.parser.TokenType; 36.7 -import jdk.nashorn.internal.runtime.Source; 36.8 36.9 /** 36.10 * IR representation for a runtime call. 36.11 @@ -280,14 +279,13 @@ 36.12 /** 36.13 * Constructor 36.14 * 36.15 - * @param source the source 36.16 * @param token token 36.17 * @param finish finish 36.18 * @param request the request 36.19 * @param args arguments to request 36.20 */ 36.21 - public RuntimeNode(final Source source, final long token, final int finish, final Request request, final List<Node> args) { 36.22 - super(source, token, finish); 36.23 + public RuntimeNode(final long token, final int finish, final Request request, final List<Node> args) { 36.24 + super(token, finish); 36.25 36.26 this.request = request; 36.27 this.args = args; 36.28 @@ -307,14 +305,13 @@ 36.29 /** 36.30 * Constructor 36.31 * 36.32 - * @param source the source 36.33 * @param token token 36.34 * @param finish finish 36.35 * @param request the request 36.36 * @param args arguments to request 36.37 */ 36.38 - public RuntimeNode(final Source source, final long token, final int finish, final Request request, final Node... args) { 36.39 - this(source, token, finish, request, Arrays.asList(args)); 36.40 + public RuntimeNode(final long token, final int finish, final Request request, final Node... args) { 36.41 + this(token, finish, request, Arrays.asList(args)); 36.42 } 36.43 36.44 /**
37.1 --- a/src/jdk/nashorn/internal/ir/SplitNode.java Fri May 03 22:50:51 2013 +0200 37.2 +++ b/src/jdk/nashorn/internal/ir/SplitNode.java Tue May 07 14:36:57 2013 +0200 37.3 @@ -51,7 +51,7 @@ 37.4 * @param compileUnit compile unit to use for the body 37.5 */ 37.6 public SplitNode(final String name, final Node body, final CompileUnit compileUnit) { 37.7 - super(body.getSource(), body.getToken(), body.getFinish()); 37.8 + super(body.getToken(), body.getFinish()); 37.9 this.name = name; 37.10 this.body = body; 37.11 this.compileUnit = compileUnit;
38.1 --- a/src/jdk/nashorn/internal/ir/SwitchNode.java Fri May 03 22:50:51 2013 +0200 38.2 +++ b/src/jdk/nashorn/internal/ir/SwitchNode.java Tue May 07 14:36:57 2013 +0200 38.3 @@ -32,7 +32,6 @@ 38.4 import jdk.nashorn.internal.codegen.Label; 38.5 import jdk.nashorn.internal.ir.annotations.Immutable; 38.6 import jdk.nashorn.internal.ir.visitor.NodeVisitor; 38.7 -import jdk.nashorn.internal.runtime.Source; 38.8 38.9 /** 38.10 * IR representation of a SWITCH statement. 38.11 @@ -54,15 +53,14 @@ 38.12 /** 38.13 * Constructor 38.14 * 38.15 - * @param source the source 38.16 * @param token token 38.17 * @param finish finish 38.18 * @param expression switch expression 38.19 * @param cases cases 38.20 * @param defaultCase the default case node - null if none, otherwise has to be present in cases list 38.21 */ 38.22 - public SwitchNode(final Source source, final long token, final int finish, final Node expression, final List<CaseNode> cases, final CaseNode defaultCase) { 38.23 - super(source, token, finish, new Label("switch_break")); 38.24 + public SwitchNode(final long token, final int finish, final Node expression, final List<CaseNode> cases, final CaseNode defaultCase) { 38.25 + super(token, finish, new Label("switch_break")); 38.26 this.expression = expression; 38.27 this.cases = cases; 38.28 this.defaultCaseIndex = defaultCase == null ? -1 : cases.indexOf(defaultCase);
39.1 --- a/src/jdk/nashorn/internal/ir/TernaryNode.java Fri May 03 22:50:51 2013 +0200 39.2 +++ b/src/jdk/nashorn/internal/ir/TernaryNode.java Tue May 07 14:36:57 2013 +0200 39.3 @@ -27,7 +27,6 @@ 39.4 39.5 import jdk.nashorn.internal.ir.annotations.Immutable; 39.6 import jdk.nashorn.internal.ir.visitor.NodeVisitor; 39.7 -import jdk.nashorn.internal.runtime.Source; 39.8 39.9 /** 39.10 * TernaryNode nodes represent three operand operations (?:). 39.11 @@ -44,14 +43,13 @@ 39.12 /** 39.13 * Constructor 39.14 * 39.15 - * @param source the source 39.16 * @param token token 39.17 * @param lhs left hand side node 39.18 * @param rhs right hand side node 39.19 * @param third third node 39.20 */ 39.21 - public TernaryNode(final Source source, final long token, final Node lhs, final Node rhs, final Node third) { 39.22 - super(source, token, third.getFinish()); 39.23 + public TernaryNode(final long token, final Node lhs, final Node rhs, final Node third) { 39.24 + super(token, third.getFinish()); 39.25 this.lhs = lhs; 39.26 this.rhs = rhs; 39.27 this.third = third;
40.1 --- a/src/jdk/nashorn/internal/ir/ThrowNode.java Fri May 03 22:50:51 2013 +0200 40.2 +++ b/src/jdk/nashorn/internal/ir/ThrowNode.java Tue May 07 14:36:57 2013 +0200 40.3 @@ -27,7 +27,6 @@ 40.4 40.5 import jdk.nashorn.internal.ir.annotations.Immutable; 40.6 import jdk.nashorn.internal.ir.visitor.NodeVisitor; 40.7 -import jdk.nashorn.internal.runtime.Source; 40.8 40.9 /** 40.10 * IR representation for THROW statements. 40.11 @@ -40,14 +39,12 @@ 40.12 /** 40.13 * Constructor 40.14 * 40.15 - * @param source the source 40.16 * @param token token 40.17 * @param finish finish 40.18 * @param expression expression to throw 40.19 */ 40.20 - public ThrowNode(final Source source, final long token, final int finish, final Node expression) { 40.21 - super(source, token, finish); 40.22 - 40.23 + public ThrowNode(final long token, final int finish, final Node expression) { 40.24 + super(token, finish); 40.25 this.expression = expression; 40.26 } 40.27
41.1 --- a/src/jdk/nashorn/internal/ir/TryNode.java Fri May 03 22:50:51 2013 +0200 41.2 +++ b/src/jdk/nashorn/internal/ir/TryNode.java Tue May 07 14:36:57 2013 +0200 41.3 @@ -32,7 +32,6 @@ 41.4 import jdk.nashorn.internal.codegen.Label; 41.5 import jdk.nashorn.internal.ir.annotations.Immutable; 41.6 import jdk.nashorn.internal.ir.visitor.NodeVisitor; 41.7 -import jdk.nashorn.internal.runtime.Source; 41.8 41.9 /** 41.10 * IR representation of a TRY statement. 41.11 @@ -60,15 +59,14 @@ 41.12 /** 41.13 * Constructor 41.14 * 41.15 - * @param source the source 41.16 * @param token token 41.17 * @param finish finish 41.18 * @param body try node body 41.19 * @param catchBlocks list of catch blocks in order 41.20 * @param finallyBody body of finally block or null if none 41.21 */ 41.22 - public TryNode(final Source source, final long token, final int finish, final Block body, final List<Block> catchBlocks, final Block finallyBody) { 41.23 - super(source, token, finish); 41.24 + public TryNode(final long token, final int finish, final Block body, final List<Block> catchBlocks, final Block finallyBody) { 41.25 + super(token, finish); 41.26 this.body = body; 41.27 this.catchBlocks = catchBlocks; 41.28 this.finallyBody = finallyBody;
42.1 --- a/src/jdk/nashorn/internal/ir/UnaryNode.java Fri May 03 22:50:51 2013 +0200 42.2 +++ b/src/jdk/nashorn/internal/ir/UnaryNode.java Tue May 07 14:36:57 2013 +0200 42.3 @@ -35,7 +35,6 @@ 42.4 import jdk.nashorn.internal.ir.visitor.NodeVisitor; 42.5 import jdk.nashorn.internal.parser.Token; 42.6 import jdk.nashorn.internal.parser.TokenType; 42.7 -import jdk.nashorn.internal.runtime.Source; 42.8 42.9 /** 42.10 * UnaryNode nodes represent single operand operations. 42.11 @@ -48,24 +47,23 @@ 42.12 /** 42.13 * Constructor 42.14 * 42.15 - * @param source the source 42.16 * @param token token 42.17 * @param rhs expression 42.18 */ 42.19 - public UnaryNode(final Source source, final long token, final Node rhs) { 42.20 - this(source, token, Math.min(rhs.getStart(), Token.descPosition(token)), Math.max(Token.descPosition(token) + Token.descLength(token), rhs.getFinish()), rhs); 42.21 + public UnaryNode(final long token, final Node rhs) { 42.22 + this(token, Math.min(rhs.getStart(), Token.descPosition(token)), Math.max(Token.descPosition(token) + Token.descLength(token), rhs.getFinish()), rhs); 42.23 } 42.24 42.25 /** 42.26 * Constructor 42.27 - * @param source the source 42.28 + * 42.29 * @param token token 42.30 * @param start start 42.31 * @param finish finish 42.32 * @param rhs expression 42.33 */ 42.34 - public UnaryNode(final Source source, final long token, final int start, final int finish, final Node rhs) { 42.35 - super(source, token, start, finish); 42.36 + public UnaryNode(final long token, final int start, final int finish, final Node rhs) { 42.37 + super(token, start, finish); 42.38 this.rhs = rhs; 42.39 } 42.40
43.1 --- a/src/jdk/nashorn/internal/ir/VarNode.java Fri May 03 22:50:51 2013 +0200 43.2 +++ b/src/jdk/nashorn/internal/ir/VarNode.java Tue May 07 14:36:57 2013 +0200 43.3 @@ -27,7 +27,6 @@ 43.4 43.5 import jdk.nashorn.internal.ir.annotations.Immutable; 43.6 import jdk.nashorn.internal.ir.visitor.NodeVisitor; 43.7 -import jdk.nashorn.internal.runtime.Source; 43.8 43.9 /** 43.10 * Node represents a var/let declaration. 43.11 @@ -54,14 +53,13 @@ 43.12 /** 43.13 * Constructor 43.14 * 43.15 - * @param source the source 43.16 * @param token token 43.17 * @param finish finish 43.18 * @param name name of variable 43.19 * @param init init node or null if just a declaration 43.20 */ 43.21 - public VarNode(final Source source, final long token, final int finish, final IdentNode name, final Node init) { 43.22 - this(source, token, finish, name, init, IS_STATEMENT); 43.23 + public VarNode(final long token, final int finish, final IdentNode name, final Node init) { 43.24 + this(token, finish, name, init, IS_STATEMENT); 43.25 } 43.26 43.27 private VarNode(final VarNode varNode, final IdentNode name, final Node init, final int flags) { 43.28 @@ -74,15 +72,14 @@ 43.29 /** 43.30 * Constructor 43.31 * 43.32 - * @param source the source 43.33 * @param token token 43.34 * @param finish finish 43.35 * @param name name of variable 43.36 * @param init init node or null if just a declaration 43.37 * @param flags flags 43.38 */ 43.39 - public VarNode(final Source source, final long token, final int finish, final IdentNode name, final Node init, final int flags) { 43.40 - super(source, token, finish); 43.41 + public VarNode(final long token, final int finish, final IdentNode name, final Node init, final int flags) { 43.42 + super(token, finish); 43.43 43.44 this.name = init == null ? name : name.setIsInitializedHere(); 43.45 this.init = init;
44.1 --- a/src/jdk/nashorn/internal/ir/WhileNode.java Fri May 03 22:50:51 2013 +0200 44.2 +++ b/src/jdk/nashorn/internal/ir/WhileNode.java Tue May 07 14:36:57 2013 +0200 44.3 @@ -27,7 +27,6 @@ 44.4 44.5 import jdk.nashorn.internal.ir.annotations.Immutable; 44.6 import jdk.nashorn.internal.ir.visitor.NodeVisitor; 44.7 -import jdk.nashorn.internal.runtime.Source; 44.8 44.9 /** 44.10 * IR representation for a WHILE statement. This is the superclass of all 44.11 @@ -42,13 +41,12 @@ 44.12 /** 44.13 * Constructor 44.14 * 44.15 - * @param source the source 44.16 * @param token token 44.17 * @param finish finish 44.18 * @param isDoWhile is this a do while loop? 44.19 */ 44.20 - public WhileNode(final Source source, final long token, final int finish, final boolean isDoWhile) { 44.21 - super(source, token, finish, null, null, false); 44.22 + public WhileNode(final long token, final int finish, final boolean isDoWhile) { 44.23 + super(token, finish, null, null, false); 44.24 this.isDoWhile = isDoWhile; 44.25 } 44.26
45.1 --- a/src/jdk/nashorn/internal/ir/WithNode.java Fri May 03 22:50:51 2013 +0200 45.2 +++ b/src/jdk/nashorn/internal/ir/WithNode.java Tue May 07 14:36:57 2013 +0200 45.3 @@ -27,7 +27,6 @@ 45.4 45.5 import jdk.nashorn.internal.ir.annotations.Immutable; 45.6 import jdk.nashorn.internal.ir.visitor.NodeVisitor; 45.7 -import jdk.nashorn.internal.runtime.Source; 45.8 45.9 /** 45.10 * IR representation for {@code with} statements. 45.11 @@ -43,20 +42,17 @@ 45.12 /** 45.13 * Constructor 45.14 * 45.15 - * @param source the source 45.16 * @param token token 45.17 * @param finish finish 45.18 */ 45.19 - public WithNode(final Source source, final long token, final int finish) { 45.20 - super(source, token, finish); 45.21 - 45.22 + public WithNode(final long token, final int finish) { 45.23 + super(token, finish); 45.24 this.expression = null; 45.25 this.body = null; 45.26 } 45.27 45.28 private WithNode(final WithNode node, final Node expression, final Block body) { 45.29 super(node); 45.30 - 45.31 this.expression = expression; 45.32 this.body = body; 45.33 }
46.1 --- a/src/jdk/nashorn/internal/ir/debug/JSONWriter.java Fri May 03 22:50:51 2013 +0200 46.2 +++ b/src/jdk/nashorn/internal/ir/debug/JSONWriter.java Tue May 07 14:36:57 2013 +0200 46.3 @@ -971,7 +971,7 @@ 46.4 objectStart("loc"); 46.5 46.6 // source name 46.7 - final Source src = node.getSource(); 46.8 + final Source src = getLexicalContext().getCurrentFunction().getSource(); 46.9 property("source", src.getName()); 46.10 comma(); 46.11
47.1 --- a/src/jdk/nashorn/internal/objects/NativeDebug.java Fri May 03 22:50:51 2013 +0200 47.2 +++ b/src/jdk/nashorn/internal/objects/NativeDebug.java Tue May 07 14:36:57 2013 +0200 47.3 @@ -178,7 +178,6 @@ 47.4 * @param self self reference 47.5 * @return undefined 47.6 */ 47.7 - @SuppressWarnings("resource") 47.8 @Function(attributes = Attribute.NOT_ENUMERABLE, where = Where.CONSTRUCTOR) 47.9 public static Object dumpCounters(final Object self) { 47.10 final PrintWriter out = Context.getCurrentErr();
48.1 --- a/src/jdk/nashorn/internal/parser/AbstractParser.java Fri May 03 22:50:51 2013 +0200 48.2 +++ b/src/jdk/nashorn/internal/parser/AbstractParser.java Tue May 07 14:36:57 2013 +0200 48.3 @@ -364,7 +364,7 @@ 48.4 next(); 48.5 48.6 // Create IDENT node. 48.7 - return new IdentNode(source, identToken, finish, ident); 48.8 + return new IdentNode(identToken, finish, ident); 48.9 } 48.10 48.11 // Get IDENT. 48.12 @@ -373,7 +373,7 @@ 48.13 return null; 48.14 } 48.15 // Create IDENT node. 48.16 - return new IdentNode(source, identToken, finish, ident); 48.17 + return new IdentNode(identToken, finish, ident); 48.18 } 48.19 48.20 /** 48.21 @@ -408,7 +408,7 @@ 48.22 final String ident = (String)getValue(identToken); 48.23 next(); 48.24 // Create IDENT node. 48.25 - return new IdentNode(source, identToken, finish, ident); 48.26 + return new IdentNode(identToken, finish, ident); 48.27 } else { 48.28 expect(IDENT); 48.29 return null; 48.30 @@ -433,11 +433,11 @@ 48.31 LiteralNode<?> node = null; 48.32 48.33 if (value == null) { 48.34 - node = LiteralNode.newInstance(source, literalToken, finish); 48.35 + node = LiteralNode.newInstance(literalToken, finish); 48.36 } else if (value instanceof Number) { 48.37 - node = LiteralNode.newInstance(source, literalToken, finish, (Number)value); 48.38 + node = LiteralNode.newInstance(literalToken, finish, (Number)value); 48.39 } else if (value instanceof String) { 48.40 - node = LiteralNode.newInstance(source, literalToken, finish, (String)value); 48.41 + node = LiteralNode.newInstance(literalToken, finish, (String)value); 48.42 } else if (value instanceof LexerToken) { 48.43 if (value instanceof RegexToken) { 48.44 final RegexToken regex = (RegexToken)value; 48.45 @@ -447,7 +447,7 @@ 48.46 throw error(e.getMessage()); 48.47 } 48.48 } 48.49 - node = LiteralNode.newInstance(source, literalToken, finish, (LexerToken)value); 48.50 + node = LiteralNode.newInstance(literalToken, finish, (LexerToken)value); 48.51 } else { 48.52 assert false : "unknown type for LiteralNode: " + value.getClass(); 48.53 }
49.1 --- a/src/jdk/nashorn/internal/parser/JSONParser.java Fri May 03 22:50:51 2013 +0200 49.2 +++ b/src/jdk/nashorn/internal/parser/JSONParser.java Tue May 07 14:36:57 2013 +0200 49.3 @@ -193,13 +193,13 @@ 49.4 return getLiteral(); 49.5 case FALSE: 49.6 next(); 49.7 - return LiteralNode.newInstance(source, literalToken, finish, false); 49.8 + return LiteralNode.newInstance(literalToken, finish, false); 49.9 case TRUE: 49.10 next(); 49.11 - return LiteralNode.newInstance(source, literalToken, finish, true); 49.12 + return LiteralNode.newInstance(literalToken, finish, true); 49.13 case NULL: 49.14 next(); 49.15 - return LiteralNode.newInstance(source, literalToken, finish); 49.16 + return LiteralNode.newInstance(literalToken, finish); 49.17 case LBRACKET: 49.18 return arrayLiteral(); 49.19 case LBRACE: 49.20 @@ -218,7 +218,7 @@ 49.21 49.22 if (value instanceof Number) { 49.23 next(); 49.24 - return new UnaryNode(source, literalToken, LiteralNode.newInstance(source, realToken, finish, (Number)value)); 49.25 + return new UnaryNode(literalToken, LiteralNode.newInstance(realToken, finish, (Number)value)); 49.26 } 49.27 49.28 throw error(AbstractParser.message("expected", "number", type.getNameOrType())); 49.29 @@ -250,7 +250,7 @@ 49.30 switch (type) { 49.31 case RBRACKET: 49.32 next(); 49.33 - result = LiteralNode.newInstance(source, arrayToken, finish, elements); 49.34 + result = LiteralNode.newInstance(arrayToken, finish, elements); 49.35 break loop; 49.36 49.37 case COMMARIGHT: 49.38 @@ -310,7 +310,7 @@ 49.39 } 49.40 49.41 // Construct new object literal. 49.42 - return new ObjectNode(source, objectToken, finish, elements); 49.43 + return new ObjectNode(objectToken, finish, elements); 49.44 } 49.45 49.46 /** 49.47 @@ -331,7 +331,7 @@ 49.48 if (name != null) { 49.49 expect(COLON); 49.50 final Node value = jsonLiteral(); 49.51 - return new PropertyNode(source, propertyToken, value.getFinish(), name, value, null, null); 49.52 + return new PropertyNode(propertyToken, value.getFinish(), name, value, null, null); 49.53 } 49.54 49.55 // Raise an error.
50.1 --- a/src/jdk/nashorn/internal/parser/Parser.java Fri May 03 22:50:51 2013 +0200 50.2 +++ b/src/jdk/nashorn/internal/parser/Parser.java Tue May 07 14:36:57 2013 +0200 50.3 @@ -275,8 +275,7 @@ 50.4 * @return New block. 50.5 */ 50.6 private Block newBlock() { 50.7 - final Block block = new Block(source, token, Token.descPosition(token)); 50.8 - return lc.push(block); 50.9 + return lc.push(new Block(token, Token.descPosition(token))); 50.10 } 50.11 50.12 /** 50.13 @@ -479,7 +478,7 @@ 50.14 } 50.15 50.16 // Build up node. 50.17 - return new BinaryNode(source, op, lhs, rhs); 50.18 + return new BinaryNode(op, lhs, rhs); 50.19 } 50.20 50.21 /** 50.22 @@ -490,12 +489,12 @@ 50.23 * @param isPostfix Prefix or postfix. 50.24 * @return Reduced expression. 50.25 */ 50.26 - private Node incDecExpression(final long firstToken, final TokenType tokenType, final Node expression, final boolean isPostfix) { 50.27 + private static Node incDecExpression(final long firstToken, final TokenType tokenType, final Node expression, final boolean isPostfix) { 50.28 if (isPostfix) { 50.29 - return new UnaryNode(source, Token.recast(firstToken, tokenType == DECPREFIX ? DECPOSTFIX : INCPOSTFIX), expression.getStart(), Token.descPosition(firstToken) + Token.descLength(firstToken), expression); 50.30 + return new UnaryNode(Token.recast(firstToken, tokenType == DECPREFIX ? DECPOSTFIX : INCPOSTFIX), expression.getStart(), Token.descPosition(firstToken) + Token.descLength(firstToken), expression); 50.31 } 50.32 50.33 - return new UnaryNode(source, firstToken, expression); 50.34 + return new UnaryNode(firstToken, expression); 50.35 } 50.36 50.37 /** 50.38 @@ -524,7 +523,7 @@ 50.39 50.40 FunctionNode script = newFunctionNode( 50.41 functionToken, 50.42 - new IdentNode(source, functionToken, Token.descPosition(functionToken), scriptName), 50.43 + new IdentNode(functionToken, Token.descPosition(functionToken), scriptName), 50.44 new ArrayList<IdentNode>(), 50.45 FunctionNode.Kind.SCRIPT); 50.46 50.47 @@ -774,7 +773,7 @@ 50.48 private void block() { 50.49 final Block newBlock = getBlock(true); 50.50 // Force block execution. 50.51 - appendStatement(new ExecuteNode(source, newBlock.getToken(), finish, newBlock)); 50.52 + appendStatement(new ExecuteNode(newBlock.getToken(), finish, newBlock)); 50.53 } 50.54 50.55 /** 50.56 @@ -867,7 +866,7 @@ 50.57 } 50.58 50.59 // Allocate var node. 50.60 - final VarNode var = new VarNode(source, varToken, finish, name, init); 50.61 + final VarNode var = new VarNode(varToken, finish, name, init); 50.62 vars.add(var); 50.63 appendStatement(var); 50.64 50.65 @@ -899,7 +898,7 @@ 50.66 */ 50.67 private void emptyStatement() { 50.68 if (env._empty_statements) { 50.69 - appendStatement(new EmptyNode(source, token, Token.descPosition(token) + Token.descLength(token))); 50.70 + appendStatement(new EmptyNode(token, Token.descPosition(token) + Token.descLength(token))); 50.71 } 50.72 50.73 // SEMICOLON checked in caller. 50.74 @@ -923,7 +922,7 @@ 50.75 50.76 ExecuteNode executeNode = null; 50.77 if (expression != null) { 50.78 - executeNode = new ExecuteNode(source, expressionToken, finish, expression); 50.79 + executeNode = new ExecuteNode(expressionToken, finish, expression); 50.80 appendStatement(executeNode); 50.81 } else { 50.82 expect(null); 50.83 @@ -963,7 +962,7 @@ 50.84 fail = getStatement(); 50.85 } 50.86 50.87 - appendStatement(new IfNode(source, ifToken, fail != null ? fail.getFinish() : pass.getFinish(), test, pass, fail)); 50.88 + appendStatement(new IfNode(ifToken, fail != null ? fail.getFinish() : pass.getFinish(), test, pass, fail)); 50.89 } 50.90 50.91 /** 50.92 @@ -980,7 +979,7 @@ 50.93 */ 50.94 private void forStatement() { 50.95 // Create FOR node, capturing FOR token. 50.96 - ForNode forNode = new ForNode(source, token, Token.descPosition(token), null, null, null, null, ForNode.IS_FOR); 50.97 + ForNode forNode = new ForNode(token, Token.descPosition(token), null, null, null, null, ForNode.IS_FOR); 50.98 50.99 50.100 // Set up new block for scope of vars. Captures first token. 50.101 @@ -1084,7 +1083,7 @@ 50.102 outer = restoreBlock(outer); 50.103 } 50.104 50.105 - appendStatement(new ExecuteNode(source, outer.getToken(), outer.getFinish(), outer)); 50.106 + appendStatement(new ExecuteNode(outer.getToken(), outer.getFinish(), outer)); 50.107 } 50.108 50.109 /** 50.110 @@ -1120,7 +1119,7 @@ 50.111 next(); 50.112 50.113 // Construct WHILE node. 50.114 - WhileNode whileNode = new WhileNode(source, whileToken, Token.descPosition(whileToken), false); 50.115 + WhileNode whileNode = new WhileNode(whileToken, Token.descPosition(whileToken), false); 50.116 lc.push(whileNode); 50.117 50.118 try { 50.119 @@ -1150,7 +1149,7 @@ 50.120 // DO tested in the caller. 50.121 next(); 50.122 50.123 - WhileNode doWhileNode = new WhileNode(source, doToken, Token.descPosition(doToken), true); 50.124 + WhileNode doWhileNode = new WhileNode(doToken, Token.descPosition(doToken), true); 50.125 lc.push(doWhileNode); 50.126 50.127 try { 50.128 @@ -1216,7 +1215,7 @@ 50.129 endOfLine(); 50.130 50.131 // Construct and add CONTINUE node. 50.132 - appendStatement(new ContinueNode(source, continueToken, finish, label == null ? null : new IdentNode(label))); 50.133 + appendStatement(new ContinueNode(continueToken, finish, label == null ? null : new IdentNode(label))); 50.134 } 50.135 50.136 /** 50.137 @@ -1263,7 +1262,7 @@ 50.138 endOfLine(); 50.139 50.140 // Construct and add BREAK node. 50.141 - appendStatement(new BreakNode(source, breakToken, finish, label == null ? null : new IdentNode(label))); 50.142 + appendStatement(new BreakNode(breakToken, finish, label == null ? null : new IdentNode(label))); 50.143 } 50.144 50.145 /** 50.146 @@ -1302,7 +1301,7 @@ 50.147 endOfLine(); 50.148 50.149 // Construct and add RETURN node. 50.150 - appendStatement(new ReturnNode(source, returnToken, finish, expression)); 50.151 + appendStatement(new ReturnNode(returnToken, finish, expression)); 50.152 } 50.153 50.154 /** 50.155 @@ -1336,7 +1335,7 @@ 50.156 endOfLine(); 50.157 50.158 // Construct and add YIELD node. 50.159 - appendStatement(new ReturnNode(source, yieldToken, finish, expression)); 50.160 + appendStatement(new ReturnNode(yieldToken, finish, expression)); 50.161 } 50.162 50.163 /** 50.164 @@ -1359,7 +1358,7 @@ 50.165 } 50.166 50.167 // Get WITH expression. 50.168 - WithNode withNode = new WithNode(source, withToken, finish); 50.169 + WithNode withNode = new WithNode(withToken, finish); 50.170 50.171 try { 50.172 lc.push(withNode); 50.173 @@ -1402,7 +1401,7 @@ 50.174 next(); 50.175 50.176 // Create and add switch statement. 50.177 - SwitchNode switchNode = new SwitchNode(source, switchToken, Token.descPosition(switchToken), null, new ArrayList<CaseNode>(), null); 50.178 + SwitchNode switchNode = new SwitchNode(switchToken, Token.descPosition(switchToken), null, new ArrayList<CaseNode>(), null); 50.179 lc.push(switchNode); 50.180 50.181 try { 50.182 @@ -1444,7 +1443,7 @@ 50.183 50.184 // Get CASE body. 50.185 final Block statements = getBlock(false); 50.186 - final CaseNode caseNode = new CaseNode(source, caseToken, finish, caseExpression, statements); 50.187 + final CaseNode caseNode = new CaseNode(caseToken, finish, caseExpression, statements); 50.188 statements.setFinish(finish); 50.189 50.190 if (caseExpression == null) { 50.191 @@ -1484,7 +1483,7 @@ 50.192 throw error(AbstractParser.message("duplicate.label", ident.getName()), labelToken); 50.193 } 50.194 50.195 - LabelNode labelNode = new LabelNode(source, labelToken, finish, ident, null); 50.196 + LabelNode labelNode = new LabelNode(labelToken, finish, ident, null); 50.197 try { 50.198 lc.push(labelNode); 50.199 labelNode = labelNode.setBody(lc, getStatement()); 50.200 @@ -1530,7 +1529,7 @@ 50.201 50.202 endOfLine(); 50.203 50.204 - appendStatement(new ThrowNode(source, throwToken, finish, expression)); 50.205 + appendStatement(new ThrowNode(throwToken, finish, expression)); 50.206 } 50.207 50.208 /** 50.209 @@ -1588,7 +1587,7 @@ 50.210 try { 50.211 // Get CATCH body. 50.212 final Block catchBody = getBlock(true); 50.213 - final CatchNode catchNode = new CatchNode(source, catchToken, finish, exception, ifExpression, catchBody); 50.214 + final CatchNode catchNode = new CatchNode(catchToken, finish, exception, ifExpression, catchBody); 50.215 appendStatement(catchNode); 50.216 } finally { 50.217 catchBlock = restoreBlock(catchBlock); 50.218 @@ -1614,7 +1613,7 @@ 50.219 throw error(AbstractParser.message("missing.catch.or.finally"), tryToken); 50.220 } 50.221 50.222 - final TryNode tryNode = new TryNode(source, tryToken, Token.descPosition(tryToken), tryBody, catchBlocks, finallyStatements); 50.223 + final TryNode tryNode = new TryNode(tryToken, Token.descPosition(tryToken), tryBody, catchBlocks, finallyStatements); 50.224 // Add try. 50.225 assert lc.peek() == outer; 50.226 appendStatement(tryNode); 50.227 @@ -1626,7 +1625,7 @@ 50.228 outer = restoreBlock(outer); 50.229 } 50.230 50.231 - appendStatement(new ExecuteNode(source, outer.getToken(), outer.getFinish(), outer)); 50.232 + appendStatement(new ExecuteNode(outer.getToken(), outer.getFinish(), outer)); 50.233 } 50.234 50.235 /** 50.236 @@ -1643,7 +1642,7 @@ 50.237 // DEBUGGER tested in caller. 50.238 next(); 50.239 endOfLine(); 50.240 - appendStatement(new RuntimeNode(source, debuggerToken, finish, RuntimeNode.Request.DEBUGGER, new ArrayList<Node>())); 50.241 + appendStatement(new RuntimeNode(debuggerToken, finish, RuntimeNode.Request.DEBUGGER, new ArrayList<Node>())); 50.242 } 50.243 50.244 /** 50.245 @@ -1669,7 +1668,7 @@ 50.246 case THIS: 50.247 final String name = type.getName(); 50.248 next(); 50.249 - return new IdentNode(source, primaryToken, finish, name); 50.250 + return new IdentNode(primaryToken, finish, name); 50.251 case IDENT: 50.252 final IdentNode ident = getIdent(); 50.253 if (ident == null) { 50.254 @@ -1693,13 +1692,13 @@ 50.255 return execString(primaryToken); 50.256 case FALSE: 50.257 next(); 50.258 - return LiteralNode.newInstance(source, primaryToken, finish, false); 50.259 + return LiteralNode.newInstance(primaryToken, finish, false); 50.260 case TRUE: 50.261 next(); 50.262 - return LiteralNode.newInstance(source, primaryToken, finish, true); 50.263 + return LiteralNode.newInstance(primaryToken, finish, true); 50.264 case NULL: 50.265 next(); 50.266 - return LiteralNode.newInstance(source, primaryToken, finish); 50.267 + return LiteralNode.newInstance(primaryToken, finish); 50.268 case LBRACKET: 50.269 return arrayLiteral(); 50.270 case LBRACE: 50.271 @@ -1736,7 +1735,7 @@ 50.272 */ 50.273 Node execString(final long primaryToken) { 50.274 // Synthesize an ident to call $EXEC. 50.275 - final IdentNode execIdent = new IdentNode(source, primaryToken, finish, ScriptingFunctions.EXEC_NAME); 50.276 + final IdentNode execIdent = new IdentNode(primaryToken, finish, ScriptingFunctions.EXEC_NAME); 50.277 // Skip over EXECSTRING. 50.278 next(); 50.279 // Set up argument list for call. 50.280 @@ -1748,7 +1747,7 @@ 50.281 // Skip ending of edit string expression. 50.282 expect(RBRACE); 50.283 50.284 - return new CallNode(source, primaryToken, finish, execIdent, arguments); 50.285 + return new CallNode(primaryToken, finish, execIdent, arguments); 50.286 } 50.287 50.288 /** 50.289 @@ -1819,7 +1818,7 @@ 50.290 } 50.291 } 50.292 50.293 - return LiteralNode.newInstance(source, arrayToken, finish, elements); 50.294 + return LiteralNode.newInstance(arrayToken, finish, elements); 50.295 } 50.296 50.297 /** 50.298 @@ -1926,7 +1925,7 @@ 50.299 map.put(key, newProperty = newProperty.setValue(value)); 50.300 } else { 50.301 final long propertyToken = Token.recast(newProperty.getToken(), COMMARIGHT); 50.302 - map.put(key, newProperty = newProperty.setValue(new BinaryNode(source, propertyToken, prevValue, value))); 50.303 + map.put(key, newProperty = newProperty.setValue(new BinaryNode(propertyToken, prevValue, value))); 50.304 } 50.305 50.306 map.put(key, newProperty = newProperty.setGetter(null).setSetter(null)); 50.307 @@ -1943,7 +1942,7 @@ 50.308 } 50.309 } 50.310 50.311 - return new ObjectNode(source, objectToken, finish, new ArrayList<Node>(map.values())); 50.312 + return new ObjectNode(objectToken, finish, new ArrayList<Node>(map.values())); 50.313 } 50.314 50.315 /** 50.316 @@ -2013,16 +2012,16 @@ 50.317 case "get": 50.318 final PropertyKey getIdent = propertyName(); 50.319 final String getterName = getIdent.getPropertyName(); 50.320 - final IdentNode getNameNode = new IdentNode(source, ((Node)getIdent).getToken(), finish, "get " + getterName); 50.321 + final IdentNode getNameNode = new IdentNode(((Node)getIdent).getToken(), finish, "get " + getterName); 50.322 expect(LPAREN); 50.323 expect(RPAREN); 50.324 functionNode = functionBody(getSetToken, getNameNode, new ArrayList<IdentNode>(), FunctionNode.Kind.GETTER); 50.325 - return new PropertyNode(source, propertyToken, finish, getIdent, null, functionNode, null); 50.326 + return new PropertyNode(propertyToken, finish, getIdent, null, functionNode, null); 50.327 50.328 case "set": 50.329 final PropertyKey setIdent = propertyName(); 50.330 final String setterName = setIdent.getPropertyName(); 50.331 - final IdentNode setNameNode = new IdentNode(source, ((Node)setIdent).getToken(), finish, "set " + setterName); 50.332 + final IdentNode setNameNode = new IdentNode(((Node)setIdent).getToken(), finish, "set " + setterName); 50.333 expect(LPAREN); 50.334 final IdentNode argIdent = getIdent(); 50.335 verifyStrictIdent(argIdent, "setter argument"); 50.336 @@ -2030,21 +2029,21 @@ 50.337 List<IdentNode> parameters = new ArrayList<>(); 50.338 parameters.add(argIdent); 50.339 functionNode = functionBody(getSetToken, setNameNode, parameters, FunctionNode.Kind.SETTER); 50.340 - return new PropertyNode(source, propertyToken, finish, setIdent, null, null, functionNode); 50.341 + return new PropertyNode(propertyToken, finish, setIdent, null, null, functionNode); 50.342 50.343 default: 50.344 break; 50.345 } 50.346 } 50.347 50.348 - propertyName = new IdentNode(source, propertyToken, finish, ident); 50.349 + propertyName = new IdentNode(propertyToken, finish, ident); 50.350 } else { 50.351 propertyName = propertyName(); 50.352 } 50.353 50.354 expect(COLON); 50.355 50.356 - return new PropertyNode(source, propertyToken, finish, propertyName, assignmentExpression(false), null, null); 50.357 + return new PropertyNode(propertyToken, finish, propertyName, assignmentExpression(false), null, null); 50.358 } 50.359 50.360 /** 50.361 @@ -2076,7 +2075,7 @@ 50.362 detectSpecialFunction((IdentNode)lhs); 50.363 } 50.364 50.365 - lhs = new CallNode(source, callToken, finish, lhs, arguments); 50.366 + lhs = new CallNode(callToken, finish, lhs, arguments); 50.367 } 50.368 50.369 loop: 50.370 @@ -2090,7 +2089,7 @@ 50.371 final List<Node> arguments = argumentList(); 50.372 50.373 // Create call node. 50.374 - lhs = new CallNode(source, callToken, finish, lhs, arguments); 50.375 + lhs = new CallNode(callToken, finish, lhs, arguments); 50.376 50.377 break; 50.378 50.379 @@ -2103,7 +2102,7 @@ 50.380 expect(RBRACKET); 50.381 50.382 // Create indexing node. 50.383 - lhs = new IndexNode(source, callToken, finish, lhs, rhs); 50.384 + lhs = new IndexNode(callToken, finish, lhs, rhs); 50.385 50.386 break; 50.387 50.388 @@ -2113,7 +2112,7 @@ 50.389 final IdentNode property = getIdentifierName(); 50.390 50.391 // Create property access node. 50.392 - lhs = new AccessNode(source, callToken, finish, lhs, property); 50.393 + lhs = new AccessNode(callToken, finish, lhs, property); 50.394 50.395 break; 50.396 50.397 @@ -2169,9 +2168,9 @@ 50.398 arguments.add(objectLiteral()); 50.399 } 50.400 50.401 - final CallNode callNode = new CallNode(source, constructor.getToken(), finish, constructor, arguments); 50.402 - 50.403 - return new UnaryNode(source, newToken, callNode); 50.404 + final CallNode callNode = new CallNode(constructor.getToken(), finish, constructor, arguments); 50.405 + 50.406 + return new UnaryNode(newToken, callNode); 50.407 } 50.408 50.409 /** 50.410 @@ -2223,7 +2222,7 @@ 50.411 expect(RBRACKET); 50.412 50.413 // Create indexing node. 50.414 - lhs = new IndexNode(source, callToken, finish, lhs, index); 50.415 + lhs = new IndexNode(callToken, finish, lhs, index); 50.416 50.417 break; 50.418 50.419 @@ -2237,7 +2236,7 @@ 50.420 final IdentNode property = getIdentifierName(); 50.421 50.422 // Create property access node. 50.423 - lhs = new AccessNode(source, callToken, finish, lhs, property); 50.424 + lhs = new AccessNode(callToken, finish, lhs, property); 50.425 50.426 break; 50.427 50.428 @@ -2326,7 +2325,7 @@ 50.429 boolean isAnonymous = false; 50.430 if (name == null) { 50.431 final String tmpName = "_L" + source.getLine(Token.descPosition(token)); 50.432 - name = new IdentNode(source, functionToken, Token.descPosition(functionToken), tmpName); 50.433 + name = new IdentNode(functionToken, Token.descPosition(functionToken), tmpName); 50.434 isAnonymous = true; 50.435 } 50.436 50.437 @@ -2377,7 +2376,7 @@ 50.438 // rename in non-strict mode 50.439 parameterName = functionNode.uniqueName(parameterName); 50.440 final long parameterToken = parameter.getToken(); 50.441 - parameters.set(i, new IdentNode(source, parameterToken, Token.descPosition(parameterToken), functionNode.uniqueName(parameterName))); 50.442 + parameters.set(i, new IdentNode(parameterToken, Token.descPosition(parameterToken), functionNode.uniqueName(parameterName))); 50.443 } 50.444 50.445 parametersSet.add(parameterName); 50.446 @@ -2389,7 +2388,7 @@ 50.447 } 50.448 50.449 if (isStatement) { 50.450 - final VarNode varNode = new VarNode(source, functionToken, finish, name, functionNode, VarNode.IS_STATEMENT); 50.451 + final VarNode varNode = new VarNode(functionToken, finish, name, functionNode, VarNode.IS_STATEMENT); 50.452 if (topLevel) { 50.453 functionDeclarations.add(lineNumber); 50.454 functionDeclarations.add(varNode); 50.455 @@ -2469,7 +2468,7 @@ 50.456 assert lc.getCurrentBlock() == lc.getFunctionBody(functionNode); 50.457 // create a return statement - this creates code in itself and does not need to be 50.458 // wrapped into an ExecuteNode 50.459 - final ReturnNode returnNode = new ReturnNode(source, expr.getToken(), finish, expr); 50.460 + final ReturnNode returnNode = new ReturnNode(expr.getToken(), finish, expr); 50.461 appendStatement(returnNode); 50.462 lastToken = token; 50.463 functionNode.setFinish(Token.descPosition(token) + Token.descLength(token)); 50.464 @@ -2511,16 +2510,16 @@ 50.465 } 50.466 } 50.467 50.468 - private RuntimeNode referenceError(final Node lhs, final Node rhs) { 50.469 + private static RuntimeNode referenceError(final Node lhs, final Node rhs) { 50.470 final ArrayList<Node> args = new ArrayList<>(); 50.471 args.add(lhs); 50.472 if (rhs == null) { 50.473 - args.add(LiteralNode.newInstance(source, lhs.getToken(), lhs.getFinish())); 50.474 + args.add(LiteralNode.newInstance(lhs.getToken(), lhs.getFinish())); 50.475 } else { 50.476 args.add(rhs); 50.477 } 50.478 - args.add(LiteralNode.newInstance(source, lhs.getToken(), lhs.getFinish(), lhs.toString())); 50.479 - return new RuntimeNode(source, lhs.getToken(), lhs.getFinish(), RuntimeNode.Request.REFERENCE_ERROR, args); 50.480 + args.add(LiteralNode.newInstance(lhs.getToken(), lhs.getFinish(), lhs.toString())); 50.481 + return new RuntimeNode(lhs.getToken(), lhs.getFinish(), RuntimeNode.Request.REFERENCE_ERROR, args); 50.482 } 50.483 50.484 /* 50.485 @@ -2570,7 +2569,7 @@ 50.486 case NOT: 50.487 next(); 50.488 final Node expr = unaryExpression(); 50.489 - return new UnaryNode(source, unaryToken, expr); 50.490 + return new UnaryNode(unaryToken, expr); 50.491 50.492 case INCPREFIX: 50.493 case DECPREFIX: 50.494 @@ -2759,7 +2758,7 @@ 50.495 final Node third = expression(unaryExpression(), ASSIGN.getPrecedence(), noIn); 50.496 50.497 // Build up node. 50.498 - lhs = new TernaryNode(source, op, lhs, rhs, third); 50.499 + lhs = new TernaryNode(op, lhs, rhs, third); 50.500 } else { 50.501 // Skip operator. 50.502 next(); 50.503 @@ -2820,7 +2819,7 @@ 50.504 */ 50.505 private LineNumberNode lineNumber() { 50.506 if (env._debug_lines) { 50.507 - return new LineNumberNode(source, token, line); 50.508 + return new LineNumberNode(token, line); 50.509 } 50.510 return null; 50.511 }
51.1 --- a/src/jdk/nashorn/internal/runtime/RecompilableScriptFunctionData.java Fri May 03 22:50:51 2013 +0200 51.2 +++ b/src/jdk/nashorn/internal/runtime/RecompilableScriptFunctionData.java Tue May 07 14:36:57 2013 +0200 51.3 @@ -229,6 +229,10 @@ 51.4 } 51.5 51.6 final FunctionNode snapshot = functionNode.getSnapshot(); 51.7 + if (snapshot == null) { 51.8 + return mh; 51.9 + } 51.10 + 51.11 int i; 51.12 51.13 //classes known at runtime
52.1 --- a/src/jdk/nashorn/internal/runtime/ScriptObject.java Fri May 03 22:50:51 2013 +0200 52.2 +++ b/src/jdk/nashorn/internal/runtime/ScriptObject.java Tue May 07 14:36:57 2013 +0200 52.3 @@ -970,9 +970,7 @@ 52.4 * @param bindName null or name to bind to second argument (property not found method.) 52.5 * 52.6 * @return value of property as a MethodHandle or null. 52.7 - * 52.8 */ 52.9 - @SuppressWarnings("static-method") 52.10 protected MethodHandle getCallMethodHandle(final FindProperty find, final MethodType type, final String bindName) { 52.11 return getCallMethodHandle(getObjectValue(find), type, bindName); 52.12 }
53.1 --- a/src/jdk/nashorn/internal/runtime/arrays/ArrayLikeIterator.java Fri May 03 22:50:51 2013 +0200 53.2 +++ b/src/jdk/nashorn/internal/runtime/arrays/ArrayLikeIterator.java Tue May 07 14:36:57 2013 +0200 53.3 @@ -57,7 +57,6 @@ 53.4 * Is this a reverse order iteration? 53.5 * @return true if reverse 53.6 */ 53.7 - @SuppressWarnings("static-method") 53.8 public boolean isReverse() { 53.9 return false; 53.10 }
54.1 --- a/src/jdk/nashorn/internal/runtime/linker/LinkerCallSite.java Fri May 03 22:50:51 2013 +0200 54.2 +++ b/src/jdk/nashorn/internal/runtime/linker/LinkerCallSite.java Tue May 07 14:36:57 2013 +0200 54.3 @@ -275,7 +275,6 @@ 54.4 } 54.5 54.6 static class ProfileDumper implements Runnable { 54.7 - @SuppressWarnings("resource") 54.8 @Override 54.9 public void run() { 54.10 PrintWriter out = null; 54.11 @@ -447,7 +446,7 @@ 54.12 * 54.13 * @throws Throwable if invocation fails or throws exception/error 54.14 */ 54.15 - @SuppressWarnings({"unused", "resource"}) 54.16 + @SuppressWarnings("unused") 54.17 public Object traceObject(final MethodHandle mh, final Object... args) throws Throwable { 54.18 final PrintWriter out = Context.getCurrentErr(); 54.19 tracePrint(out, "ENTER ", args, null); 54.20 @@ -465,7 +464,7 @@ 54.21 * 54.22 * @throws Throwable if invocation fails or throws exception/error 54.23 */ 54.24 - @SuppressWarnings({"unused", "resource"}) 54.25 + @SuppressWarnings("unused") 54.26 public void traceVoid(final MethodHandle mh, final Object... args) throws Throwable { 54.27 final PrintWriter out = Context.getCurrentErr(); 54.28 tracePrint(out, "ENTER ", args, null);
55.1 --- a/src/jdk/nashorn/tools/Shell.java Fri May 03 22:50:51 2013 +0200 55.2 +++ b/src/jdk/nashorn/tools/Shell.java Tue May 07 14:36:57 2013 +0200 55.3 @@ -392,7 +392,6 @@ 55.4 * @param global global scope object to use 55.5 * @return return code 55.6 */ 55.7 - @SuppressWarnings("resource") 55.8 private static int readEvalPrint(final Context context, final ScriptObject global) { 55.9 final String prompt = bundle.getString("shell.prompt"); 55.10 final BufferedReader in = new BufferedReader(new InputStreamReader(System.in));