nashorn/src/jdk/nashorn/internal/ir/Block.java
changeset 24719 f726e9d67629
parent 19100 62d400be5b44
child 24725 7bb1f687a852
equal deleted inserted replaced
23083:8c74590d5df1 24719:f726e9d67629
    23  * questions.
    23  * questions.
    24  */
    24  */
    25 
    25 
    26 package jdk.nashorn.internal.ir;
    26 package jdk.nashorn.internal.ir;
    27 
    27 
       
    28 import static jdk.nashorn.internal.codegen.CompilerConstants.RETURN;
       
    29 
    28 import java.io.PrintWriter;
    30 import java.io.PrintWriter;
    29 import java.util.ArrayList;
    31 import java.util.ArrayList;
    30 import java.util.Arrays;
    32 import java.util.Arrays;
    31 import java.util.Collections;
    33 import java.util.Collections;
    32 import java.util.Comparator;
    34 import java.util.Comparator;
    33 import java.util.LinkedHashMap;
    35 import java.util.LinkedHashMap;
    34 import java.util.List;
    36 import java.util.List;
    35 import java.util.Map;
    37 import java.util.Map;
    36 
       
    37 import jdk.nashorn.internal.codegen.Label;
    38 import jdk.nashorn.internal.codegen.Label;
    38 import jdk.nashorn.internal.codegen.types.Type;
    39 import jdk.nashorn.internal.codegen.types.Type;
    39 import jdk.nashorn.internal.ir.annotations.Immutable;
    40 import jdk.nashorn.internal.ir.annotations.Immutable;
    40 import jdk.nashorn.internal.ir.visitor.NodeVisitor;
    41 import jdk.nashorn.internal.ir.visitor.NodeVisitor;
    41 
       
    42 import static jdk.nashorn.internal.codegen.CompilerConstants.RETURN;
       
    43 
    42 
    44 /**
    43 /**
    45  * IR representation for a list of statements.
    44  * IR representation for a list of statements.
    46  */
    45  */
    47 @Immutable
    46 @Immutable
    51 
    50 
    52     /** Symbol table - keys must be returned in the order they were put in. */
    51     /** Symbol table - keys must be returned in the order they were put in. */
    53     protected final Map<String, Symbol> symbols;
    52     protected final Map<String, Symbol> symbols;
    54 
    53 
    55     /** Entry label. */
    54     /** Entry label. */
    56     protected final Label entryLabel;
    55     private final Label entryLabel;
    57 
    56 
    58     /** Break label. */
    57     /** Break label. */
    59     private final Label breakLabel;
    58     private final Label breakLabel;
    60 
    59 
    61     /** Does the block/function need a new scope? */
    60     /** Does the block/function need a new scope? */
    63 
    62 
    64     /** Flag indicating that this block needs scope */
    63     /** Flag indicating that this block needs scope */
    65     public static final int NEEDS_SCOPE = 1 << 0;
    64     public static final int NEEDS_SCOPE = 1 << 0;
    66 
    65 
    67     /**
    66     /**
    68      * Flag indicating whether this block needs
    67      * Flag indicating whether this block uses the self symbol for the function. This is used only for blocks that are
    69      * self symbol assignment at the start. This is used only for
    68      * bodies of function nodes who refer to themselves by name. It causes Attr to insert a var [fn_name] = __callee__
    70      * blocks that are the bodies of function nodes who refer to themselves
       
    71      * by name. It causes codegen to insert a var [fn_name] = __callee__
       
    72      * at the start of the body
    69      * at the start of the body
    73      */
    70      */
    74     public static final int NEEDS_SELF_SYMBOL = 1 << 1;
    71     public static final int USES_SELF_SYMBOL = 1 << 1;
    75 
    72 
    76     /**
    73     /**
    77      * Is this block tagged as terminal based on its contents
    74      * Is this block tagged as terminal based on its contents
    78      * (usually the last statement)
    75      * (usually the last statement)
    79      */
    76      */