Tue, 22 Jan 2013 14:36:28 +0100
8006677: Remove unused FunctionNode flags
Reviewed-by: hannesw, jlaskey
1.1 --- a/src/jdk/nashorn/internal/codegen/Lower.java Tue Jan 22 14:14:37 2013 +0100 1.2 +++ b/src/jdk/nashorn/internal/codegen/Lower.java Tue Jan 22 14:36:28 2013 +0100 1.3 @@ -1761,7 +1761,6 @@ 1.4 1.5 final CatchNode catchNode = new CatchNode(tryNodeSource, token, finish, new IdentNode(exception), null, catchBody); 1.6 catchNode.setIsSyntheticRethrow(); 1.7 - getCurrentFunctionNode().setHasThrows(true); 1.8 catchBlock.addStatement(catchNode); 1.9 1.10 // replace all catches of outer tryNode with the catch-all
2.1 --- a/src/jdk/nashorn/internal/ir/FunctionNode.java Tue Jan 22 14:14:37 2013 +0100 2.2 +++ b/src/jdk/nashorn/internal/ir/FunctionNode.java Tue Jan 22 14:36:28 2013 +0100 2.3 @@ -164,22 +164,16 @@ 2.4 private static final int IS_SPLIT = 0b0000_0000_0010_0000; 2.5 /** Is this function lazily compiled? */ 2.6 private static final int IS_LAZY = 0b0000_0000_0100_0000; 2.7 - /** Do we have throws ? */ 2.8 - private static final int HAS_THROWS = 0b0000_0000_1000_0000; 2.9 - /** Do we have calls ? */ 2.10 - private static final int HAS_CALLS = 0b0000_0001_0000_0000; 2.11 - /** Has yield flag */ 2.12 - private static final int HAS_YIELD = 0b0000_0010_0000_0000; 2.13 /** Does the function contain eval? */ 2.14 - private static final int HAS_EVAL = 0b0000_0100_0000_0000; 2.15 + private static final int HAS_EVAL = 0b0000_0000_1000_0000; 2.16 /** Does the function contain a with block ? */ 2.17 - private static final int HAS_WITH = 0b0000_1000_0000_0000; 2.18 + private static final int HAS_WITH = 0b0000_0001_0000_0000; 2.19 /** Does a child function contain a with or eval? */ 2.20 - private static final int HAS_CHILD_WITH_OR_EVAL = 0b0001_0000_0000_0000; 2.21 + private static final int HAS_CHILD_WITH_OR_EVAL = 0b0000_0010_0000_0000; 2.22 /** Hide arguments? */ 2.23 - private static final int HIDE_ARGS = 0b0010_0000_0000_0000; 2.24 + private static final int HIDE_ARGS = 0b0000_0100_0000_0000; 2.25 /** Does the function need a self symbol? */ 2.26 - private static final int NEEDS_SELF_SYMBOL = 0b0100_0000_0000_0000; 2.27 + private static final int NEEDS_SELF_SYMBOL = 0b0000_1000_0000_0000; 2.28 2.29 /** Does this function or any nested functions contain a with or an eval? */ 2.30 private static final int HAS_DEEP_WITH_OR_EVAL = HAS_EVAL | HAS_WITH | HAS_CHILD_WITH_OR_EVAL; 2.31 @@ -589,22 +583,6 @@ 2.32 } 2.33 2.34 /** 2.35 - * Check if this function has a {@code yield} usage 2.36 - * 2.37 - * @return true if function uses {@code yield} 2.38 - */ 2.39 - public boolean hasYield() { 2.40 - return (flags & HAS_YIELD) != 0; 2.41 - } 2.42 - 2.43 - /** 2.44 - * Flag this function as using the {@code yield} keyword 2.45 - */ 2.46 - public void setHasYield() { 2.47 - this.flags |= HAS_YIELD; 2.48 - } 2.49 - 2.50 - /** 2.51 * If this function needs to use var args, return the identifier to the node used 2.52 * for the var args structure 2.53 * 2.54 @@ -1049,42 +1027,6 @@ 2.55 } 2.56 2.57 /** 2.58 - * Set if function has calls 2.59 - * 2.60 - * @param hasCalls does the function have calls? 2.61 - */ 2.62 - public void setHasCalls(final boolean hasCalls) { 2.63 - flags = hasCalls ? flags | HAS_CALLS : flags & ~HAS_CALLS; 2.64 - } 2.65 - 2.66 - /** 2.67 - * Check if function has calls 2.68 - * 2.69 - * @return true if function has calls 2.70 - */ 2.71 - public boolean hasCalls() { 2.72 - return (flags & HAS_CALLS) != 0; 2.73 - } 2.74 - 2.75 - /** 2.76 - * Set if the function has throws 2.77 - * 2.78 - * @param hasThrows does the function have throw statements 2.79 - */ 2.80 - public void setHasThrows(final boolean hasThrows) { 2.81 - flags = hasThrows ? flags | HAS_THROWS : flags & ~HAS_THROWS; 2.82 - } 2.83 - 2.84 - /** 2.85 - * Can the function throw exceptioons 2.86 - * 2.87 - * @return true if function throws exceptions 2.88 - */ 2.89 - public boolean hasThrows() { 2.90 - return (flags & HAS_THROWS) != 0; 2.91 - } 2.92 - 2.93 - /** 2.94 * Add a new function to the function list. 2.95 * 2.96 * @param functionNode Function node to add.
3.1 --- a/src/jdk/nashorn/internal/parser/Parser.java Tue Jan 22 14:14:37 2013 +0100 3.2 +++ b/src/jdk/nashorn/internal/parser/Parser.java Tue Jan 22 14:36:28 2013 +0100 3.3 @@ -1447,9 +1447,6 @@ 3.4 // Construct and add YIELD node. 3.5 final ReturnNode yieldNode = new ReturnNode(source, yieldToken, finish, expression, findControl(TryNode.class)); 3.6 block.addStatement(yieldNode); 3.7 - 3.8 - // Note that this function contains a yield. 3.9 - function.setHasYield(); 3.10 } 3.11 3.12 /** 3.13 @@ -1671,7 +1668,6 @@ 3.14 3.15 // Construct and add THROW node. 3.16 final ThrowNode throwNode = new ThrowNode(source, throwToken, finish, expression, findControl(TryNode.class)); 3.17 - function.setHasThrows(true); 3.18 block.addStatement(throwNode); 3.19 } 3.20 3.21 @@ -2235,8 +2231,6 @@ 3.22 if (isInWithBlock()) { 3.23 ((CallNode)lhs).setInWithBlock(); 3.24 } 3.25 - 3.26 - function.setHasCalls(true); 3.27 } 3.28 3.29 loop: 3.30 @@ -2255,8 +2249,6 @@ 3.31 ((CallNode)lhs).setInWithBlock(); 3.32 } 3.33 3.34 - function.setHasCalls(true); 3.35 - 3.36 break; 3.37 3.38 case LBRACKET: 3.39 @@ -2333,7 +2325,6 @@ 3.40 arguments.add(objectLiteral()); 3.41 } 3.42 3.43 - function.setHasCalls(true); 3.44 final CallNode callNode = new CallNode(source, constructor.getToken(), finish, constructor, arguments); 3.45 if (isInWithBlock()) { 3.46 callNode.setInWithBlock();