8006677: Remove unused FunctionNode flags
authorattila
Tue, 22 Jan 2013 14:36:28 +0100
changeset 16187 32ebb6dca838
parent 16186 91bd9d2aa2f5
child 16188 d6390b0ea32a
8006677: Remove unused FunctionNode flags Reviewed-by: hannesw, jlaskey
nashorn/src/jdk/nashorn/internal/codegen/Lower.java
nashorn/src/jdk/nashorn/internal/ir/FunctionNode.java
nashorn/src/jdk/nashorn/internal/parser/Parser.java
--- a/nashorn/src/jdk/nashorn/internal/codegen/Lower.java	Tue Jan 22 14:14:37 2013 +0100
+++ b/nashorn/src/jdk/nashorn/internal/codegen/Lower.java	Tue Jan 22 14:36:28 2013 +0100
@@ -1761,7 +1761,6 @@
 
         final CatchNode catchNode = new CatchNode(tryNodeSource, token, finish, new IdentNode(exception), null, catchBody);
         catchNode.setIsSyntheticRethrow();
-        getCurrentFunctionNode().setHasThrows(true);
         catchBlock.addStatement(catchNode);
 
         // replace all catches of outer tryNode with the catch-all
--- a/nashorn/src/jdk/nashorn/internal/ir/FunctionNode.java	Tue Jan 22 14:14:37 2013 +0100
+++ b/nashorn/src/jdk/nashorn/internal/ir/FunctionNode.java	Tue Jan 22 14:36:28 2013 +0100
@@ -164,22 +164,16 @@
     private static final int IS_SPLIT                = 0b0000_0000_0010_0000;
     /** Is this function lazily compiled? */
     private static final int IS_LAZY                 = 0b0000_0000_0100_0000;
-    /** Do we have throws ? */
-    private static final int HAS_THROWS              = 0b0000_0000_1000_0000;
-    /** Do we have calls ? */
-    private static final int HAS_CALLS               = 0b0000_0001_0000_0000;
-    /** Has yield flag */
-    private static final int HAS_YIELD               = 0b0000_0010_0000_0000;
     /** Does the function contain eval? */
-    private static final int HAS_EVAL                = 0b0000_0100_0000_0000;
+    private static final int HAS_EVAL                = 0b0000_0000_1000_0000;
     /** Does the function contain a with block ? */
-    private static final int HAS_WITH                = 0b0000_1000_0000_0000;
+    private static final int HAS_WITH                = 0b0000_0001_0000_0000;
     /** Does a child function contain a with or eval? */
-    private static final int HAS_CHILD_WITH_OR_EVAL  = 0b0001_0000_0000_0000;
+    private static final int HAS_CHILD_WITH_OR_EVAL  = 0b0000_0010_0000_0000;
     /** Hide arguments? */
-    private static final int HIDE_ARGS               = 0b0010_0000_0000_0000;
+    private static final int HIDE_ARGS               = 0b0000_0100_0000_0000;
     /** Does the function need a self symbol? */
-    private static final int NEEDS_SELF_SYMBOL       = 0b0100_0000_0000_0000;
+    private static final int NEEDS_SELF_SYMBOL       = 0b0000_1000_0000_0000;
 
     /** Does this function or any nested functions contain a with or an eval? */
     private static final int HAS_DEEP_WITH_OR_EVAL = HAS_EVAL | HAS_WITH | HAS_CHILD_WITH_OR_EVAL;
@@ -589,22 +583,6 @@
     }
 
     /**
-     * Check if this function has a {@code yield} usage
-     *
-     * @return true if function uses {@code yield}
-     */
-    public boolean hasYield() {
-        return (flags & HAS_YIELD) != 0;
-    }
-
-    /**
-     * Flag this function as using the {@code yield} keyword
-     */
-    public void setHasYield() {
-        this.flags |= HAS_YIELD;
-    }
-
-    /**
      * If this function needs to use var args, return the identifier to the node used
      * for the var args structure
      *
@@ -1049,42 +1027,6 @@
     }
 
     /**
-     * Set if function has calls
-     *
-     * @param hasCalls does the function have calls?
-     */
-    public void setHasCalls(final boolean hasCalls) {
-        flags = hasCalls ? flags | HAS_CALLS : flags & ~HAS_CALLS;
-    }
-
-    /**
-     * Check if function has calls
-     *
-     * @return true if function has calls
-     */
-    public boolean hasCalls() {
-        return (flags & HAS_CALLS) != 0;
-    }
-
-    /**
-     * Set if the function has throws
-     *
-     * @param hasThrows does the function have throw statements
-     */
-    public void setHasThrows(final boolean hasThrows) {
-        flags = hasThrows ? flags | HAS_THROWS : flags & ~HAS_THROWS;
-    }
-
-    /**
-     * Can the function throw exceptioons
-     *
-     * @return true if function throws exceptions
-     */
-    public boolean hasThrows() {
-        return (flags & HAS_THROWS) != 0;
-    }
-
-    /**
      * Add a new function to the function list.
      *
      * @param functionNode Function node to add.
--- a/nashorn/src/jdk/nashorn/internal/parser/Parser.java	Tue Jan 22 14:14:37 2013 +0100
+++ b/nashorn/src/jdk/nashorn/internal/parser/Parser.java	Tue Jan 22 14:36:28 2013 +0100
@@ -1447,9 +1447,6 @@
         // Construct and add YIELD node.
         final ReturnNode yieldNode = new ReturnNode(source, yieldToken, finish, expression, findControl(TryNode.class));
         block.addStatement(yieldNode);
-
-        // Note that this function contains a yield.
-        function.setHasYield();
     }
 
     /**
@@ -1671,7 +1668,6 @@
 
         // Construct and add THROW node.
         final ThrowNode throwNode = new ThrowNode(source, throwToken, finish, expression, findControl(TryNode.class));
-        function.setHasThrows(true);
         block.addStatement(throwNode);
     }
 
@@ -2235,8 +2231,6 @@
             if (isInWithBlock()) {
                 ((CallNode)lhs).setInWithBlock();
             }
-
-            function.setHasCalls(true);
         }
 
 loop:
@@ -2255,8 +2249,6 @@
                     ((CallNode)lhs).setInWithBlock();
                 }
 
-                function.setHasCalls(true);
-
                 break;
 
             case LBRACKET:
@@ -2333,7 +2325,6 @@
             arguments.add(objectLiteral());
         }
 
-        function.setHasCalls(true);
         final CallNode callNode = new CallNode(source, constructor.getToken(), finish, constructor, arguments);
         if (isInWithBlock()) {
             callNode.setInWithBlock();