src/jdk/nashorn/internal/ir/FunctionNode.java

changeset 769
5a1ae83c295f
parent 761
37bf1b9838b5
child 952
6d5471a497fb
child 962
ac62e33a99b0
equal deleted inserted replaced
768:27d6e99ae970 769:5a1ae83c295f
162 /** Does the function call eval? If it does, then all variables in this function might be get/set by it and it can 162 /** Does the function call eval? If it does, then all variables in this function might be get/set by it and it can
163 * introduce new variables into this function's scope too.*/ 163 * introduce new variables into this function's scope too.*/
164 public static final int HAS_EVAL = 1 << 5; 164 public static final int HAS_EVAL = 1 << 5;
165 165
166 /** Does a nested function contain eval? If it does, then all variables in this function might be get/set by it. */ 166 /** Does a nested function contain eval? If it does, then all variables in this function might be get/set by it. */
167 public static final int HAS_NESTED_EVAL = 1 << 6; 167 public static final int HAS_NESTED_EVAL = 1 << 6;
168 168
169 /** Does this function have any blocks that create a scope? This is used to determine if the function needs to 169 /** Does this function have any blocks that create a scope? This is used to determine if the function needs to
170 * have a local variable slot for the scope symbol. */ 170 * have a local variable slot for the scope symbol. */
171 public static final int HAS_SCOPE_BLOCK = 1 << 7; 171 public static final int HAS_SCOPE_BLOCK = 1 << 7;
172 172
173 /** 173 /**
174 * Flag this function as one that defines the identifier "arguments" as a function parameter or nested function 174 * Flag this function as one that defines the identifier "arguments" as a function parameter or nested function
175 * name. This precludes it from needing to have an Arguments object defined as "arguments" local variable. Note that 175 * name. This precludes it from needing to have an Arguments object defined as "arguments" local variable. Note that
176 * defining a local variable named "arguments" still requires construction of the Arguments object (see 176 * defining a local variable named "arguments" still requires construction of the Arguments object (see
194 /** Does this function have nested declarations? */ 194 /** Does this function have nested declarations? */
195 public static final int HAS_FUNCTION_DECLARATIONS = 1 << 13; 195 public static final int HAS_FUNCTION_DECLARATIONS = 1 << 13;
196 196
197 /** Can this function be specialized? */ 197 /** Can this function be specialized? */
198 public static final int CAN_SPECIALIZE = 1 << 14; 198 public static final int CAN_SPECIALIZE = 1 << 14;
199
200 /** Does this function use the "this" keyword? */
201 public static final int USES_THIS = 1 << 15;
199 202
200 /** Does this function or any nested functions contain an eval? */ 203 /** Does this function or any nested functions contain an eval? */
201 private static final int HAS_DEEP_EVAL = HAS_EVAL | HAS_NESTED_EVAL; 204 private static final int HAS_DEEP_EVAL = HAS_EVAL | HAS_NESTED_EVAL;
202 205
203 /** Does this function need to store all its variables in scope? */ 206 /** Does this function need to store all its variables in scope? */
589 public boolean needsCallee() { 592 public boolean needsCallee() {
590 return needsParentScope() || needsSelfSymbol() || isSplit() || (needsArguments() && !isStrict()); 593 return needsParentScope() || needsSelfSymbol() || isSplit() || (needsArguments() && !isStrict());
591 } 594 }
592 595
593 /** 596 /**
597 * Return {@code true} if this function makes use of the {@code this} object.
598 *
599 * @return true if function uses {@code this} object
600 */
601 public boolean usesThis() {
602 return getFlag(USES_THIS);
603 }
604
605 /**
594 * Get the identifier for this function, this is its symbol. 606 * Get the identifier for this function, this is its symbol.
595 * @return the identifier as an IdentityNode 607 * @return the identifier as an IdentityNode
596 */ 608 */
597 public IdentNode getIdent() { 609 public IdentNode getIdent() {
598 return ident; 610 return ident;

mercurial