--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/FunctionNode.java Wed Jul 05 20:49:25 2017 +0200
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/FunctionNode.java Mon Sep 14 16:13:10 2015 +0530
@@ -33,10 +33,8 @@
import static jdk.nashorn.internal.runtime.linker.NashornCallSiteDescriptor.CALLSITE_TRACE_VALUES;
import java.util.Collections;
-import java.util.EnumSet;
import java.util.Iterator;
import java.util.List;
-import jdk.nashorn.internal.AssertsEnabled;
import jdk.nashorn.internal.codegen.CompileUnit;
import jdk.nashorn.internal.codegen.Compiler;
import jdk.nashorn.internal.codegen.CompilerConstants;
@@ -74,40 +72,6 @@
SETTER
}
- /** Compilation states available */
- public enum CompilationState {
- /** compiler is ready */
- INITIALIZED,
- /** method has been parsed */
- PARSED,
- /** method has been parsed */
- PARSE_ERROR,
- /** constant folding pass */
- CONSTANT_FOLDED,
- /** method has been lowered */
- LOWERED,
- /** program points have been assigned to unique locations */
- PROGRAM_POINTS_ASSIGNED,
- /** any transformations of builtins have taken place, e.g. apply=>call */
- BUILTINS_TRANSFORMED,
- /** method has been split */
- SPLIT,
- /** method has had symbols assigned */
- SYMBOLS_ASSIGNED,
- /** computed scope depths for symbols */
- SCOPE_DEPTHS_COMPUTED,
- /** method has had types calculated*/
- OPTIMISTIC_TYPES_ASSIGNED,
- /** method has had types calculated */
- LOCAL_VARIABLE_TYPES_CALCULATED,
- /** compile units reused (optional) */
- COMPILE_UNITS_REUSED,
- /** method has been emitted to bytecode */
- BYTECODE_GENERATED,
- /** method has been installed */
- BYTECODE_INSTALLED
- }
-
/** Source of entity. */
private transient final Source source;
@@ -145,10 +109,6 @@
/** Method's namespace. */
private transient final Namespace namespace;
- /** Current compilation state */
- @Ignore
- private final EnumSet<CompilationState> compilationState;
-
/** Number of properties of "this" object assigned in this function */
@Ignore
private final int thisProperties;
@@ -306,7 +266,6 @@
* @param kind kind of function as in {@link FunctionNode.Kind}
* @param flags initial flags
* @param body body of the function
- * @param state The initial state from the parser. Must be one of {@link CompilationState#PARSED} and {@link CompilationState#PARSE_ERROR}
* @param endParserState The parser state at the end of the parsing.
*/
public FunctionNode(
@@ -323,7 +282,6 @@
final FunctionNode.Kind kind,
final int flags,
final Block body,
- final CompilationState state,
final Object endParserState) {
super(token, finish);
@@ -336,7 +294,6 @@
this.firstToken = firstToken;
this.lastToken = lastToken;
this.namespace = namespace;
- this.compilationState = EnumSet.of(CompilationState.INITIALIZED, state);
this.flags = flags;
this.compileUnit = null;
this.body = body;
@@ -353,7 +310,6 @@
final String name,
final Type returnType,
final CompileUnit compileUnit,
- final EnumSet<CompilationState> compilationState,
final Block body,
final List<IdentNode> parameters,
final int thisProperties,
@@ -368,7 +324,6 @@
this.returnType = returnType;
this.compileUnit = compileUnit;
this.lastToken = lastToken;
- this.compilationState = compilationState;
this.body = body;
this.parameters = parameters;
this.thisProperties = thisProperties;
@@ -468,7 +423,6 @@
name,
returnType,
compileUnit,
- compilationState,
body,
parameters,
thisProperties,
@@ -544,80 +498,6 @@
}
/**
- * Get the compilation state of this function
- * @return the compilation state
- */
- public EnumSet<CompilationState> getState() {
- return compilationState;
- }
-
- /**
- * Check whether this FunctionNode has reached a give CompilationState.
- *
- * @param state the state to check for
- * @return true of the node is in the given state
- */
- public boolean hasState(final EnumSet<CompilationState> state) {
- return !AssertsEnabled.assertsEnabled() || compilationState.containsAll(state);
- }
-
- /**
- * Add a state to the total CompilationState of this node, e.g. if
- * FunctionNode has been lowered, the compiler will add
- * {@code CompilationState#LOWERED} to the state vector
- *
- * @param lc lexical context
- * @param state {@link CompilationState} to add
- * @return function node or a new one if state was changed
- */
- public FunctionNode setState(final LexicalContext lc, final CompilationState state) {
- if (!AssertsEnabled.assertsEnabled() || this.compilationState.contains(state)) {
- return this;
- }
- final EnumSet<CompilationState> newState = EnumSet.copyOf(this.compilationState);
- newState.add(state);
- return setCompilationState(lc, newState);
- }
-
- /**
- * Copy a compilation state from an original function to this function. Used when creating synthetic
- * function nodes by the splitter.
- *
- * @param lc lexical context
- * @param original the original function node to copy compilation state from
- * @return function node or a new one if state was changed
- */
- public FunctionNode copyCompilationState(final LexicalContext lc, final FunctionNode original) {
- final EnumSet<CompilationState> origState = original.compilationState;
- if (!AssertsEnabled.assertsEnabled() || this.compilationState.containsAll(origState)) {
- return this;
- }
- final EnumSet<CompilationState> newState = EnumSet.copyOf(this.compilationState);
- newState.addAll(origState);
- return setCompilationState(lc, newState);
- }
-
- private FunctionNode setCompilationState(final LexicalContext lc, final EnumSet<CompilationState> compilationState) {
- return Node.replaceInLexicalContext(
- lc,
- this,
- new FunctionNode(
- this,
- lastToken,
- endParserState,
- flags,
- name,
- returnType,
- compileUnit,
- compilationState,
- body,
- parameters,
- thisProperties,
- rootClass, source, namespace));
- }
-
-
- /**
* Create a unique name in the namespace of this FunctionNode
* @param base prefix for name
* @return base if no collision exists, otherwise a name prefix with base
@@ -682,7 +562,6 @@
name,
returnType,
compileUnit,
- compilationState,
body,
parameters,
thisProperties,
@@ -823,7 +702,6 @@
name,
returnType,
compileUnit,
- compilationState,
body,
parameters,
thisProperties,
@@ -919,7 +797,6 @@
name,
returnType,
compileUnit,
- compilationState,
body,
parameters,
thisProperties,
@@ -996,7 +873,6 @@
name,
returnType,
compileUnit,
- compilationState,
body,
parameters,
thisProperties,
@@ -1070,7 +946,6 @@
name,
returnType,
compileUnit,
- compilationState,
body,
parameters,
thisProperties,
@@ -1158,7 +1033,6 @@
name,
type,
compileUnit,
- compilationState,
body,
parameters,
thisProperties,
@@ -1224,7 +1098,6 @@
name,
returnType,
compileUnit,
- compilationState,
body,
parameters,
thisProperties,
@@ -1280,7 +1153,6 @@
name,
returnType,
compileUnit,
- compilationState,
body,
parameters,
thisProperties,