Class CodeGenerator


  • class CodeGenerator
    extends Icode
    Generates bytecode for the Interpreter.
    • Field Detail

      • itsInFunctionFlag

        private boolean itsInFunctionFlag
      • itsInTryFlag

        private boolean itsInTryFlag
      • iCodeTop

        private int iCodeTop
      • stackDepth

        private int stackDepth
      • lineNumber

        private int lineNumber
      • doubleTableTop

        private int doubleTableTop
      • localTop

        private int localTop
      • labelTable

        private int[] labelTable
      • labelTableTop

        private int labelTableTop
      • fixupTable

        private long[] fixupTable
      • fixupTableTop

        private int fixupTableTop
      • literalIds

        private ObjArray literalIds
      • exceptionTableTop

        private int exceptionTableTop
    • Constructor Detail

      • CodeGenerator

        CodeGenerator()
    • Method Detail

      • generateFunctionICode

        private void generateFunctionICode()
      • generateICodeFromTree

        private void generateICodeFromTree​(Node tree)
      • generateNestedFunctions

        private void generateNestedFunctions()
      • generateRegExpLiterals

        private void generateRegExpLiterals()
      • generateTemplateLiterals

        private void generateTemplateLiterals()
      • updateLineNumber

        private void updateLineNumber​(Node node)
      • badTree

        private static java.lang.RuntimeException badTree​(Node node)
      • visitStatement

        private void visitStatement​(Node node,
                                    int initialStackDepth)
      • visitExpression

        private void visitExpression​(Node node,
                                     int contextFlags)
      • generateCallFunAndThis

        private void generateCallFunAndThis​(Node left)
      • visitIncDec

        private void visitIncDec​(Node node,
                                 Node child)
      • visitLiteral

        private void visitLiteral​(Node node,
                                  Node child)
      • visitTemplateLiteral

        private void visitTemplateLiteral​(Node node)
      • visitArrayComprehension

        private void visitArrayComprehension​(Node node,
                                             Node initStmt,
                                             Node expr)
      • getLocalBlockRef

        private static int getLocalBlockRef​(Node node)
      • getTargetLabel

        private int getTargetLabel​(Node target)
      • markTargetLabel

        private void markTargetLabel​(Node target)
      • addGoto

        private void addGoto​(Node target,
                             int gotoOp)
      • fixLabelGotos

        private void fixLabelGotos()
      • addBackwardGoto

        private void addBackwardGoto​(int gotoOp,
                                     int jumpPC)
      • resolveForwardGoto

        private void resolveForwardGoto​(int fromPC)
      • resolveGoto

        private void resolveGoto​(int fromPC,
                                 int jumpPC)
      • addToken

        private void addToken​(int token)
      • addIcode

        private void addIcode​(int icode)
      • addUint8

        private void addUint8​(int value)
      • addUint16

        private void addUint16​(int value)
      • addInt

        private void addInt​(int i)
      • getDoubleIndex

        private int getDoubleIndex​(double num)
      • addGotoOp

        private void addGotoOp​(int gotoOp)
      • addVarOp

        private void addVarOp​(int op,
                              int varIndex)
      • addStringOp

        private void addStringOp​(int op,
                                 java.lang.String str)
      • addIndexOp

        private void addIndexOp​(int op,
                                int index)
      • addStringPrefix

        private void addStringPrefix​(java.lang.String str)
      • addBigInt

        private void addBigInt​(java.math.BigInteger n)
      • addIndexPrefix

        private void addIndexPrefix​(int index)
      • addExceptionHandler

        private void addExceptionHandler​(int icodeStart,
                                         int icodeEnd,
                                         int handlerStart,
                                         boolean isFinally,
                                         int exceptionObjectLocal,
                                         int scopeLocal)
      • increaseICodeCapacity

        private byte[] increaseICodeCapacity​(int extraSize)
      • stackChange

        private void stackChange​(int change)
      • allocLocal

        private int allocLocal()
      • releaseLocal

        private void releaseLocal​(int localSlot)