Ignore:
Timestamp:
Nov 4, 2009, 6:22:08 PM (16 years ago)
Author:
[email protected]
Message:

Fix dumping of constants in bytecode so that they aren't printed as large positive register numbers.

Reviewed by Sam Weinig.

We do this by having the registerName function return information about the constant if the register
number corresponds to a constant. This requires that registerName, and several functions that call it,
be converted to member functions of CodeBlock so that the constant value can be retrieved. The
ExecState also needs to be threaded down through these functions so that it can be passed on to
constantName when needed.

  • bytecode/CodeBlock.cpp:

(JSC::constantName):
(JSC::CodeBlock::registerName):
(JSC::CodeBlock::printUnaryOp):
(JSC::CodeBlock::printBinaryOp):
(JSC::CodeBlock::printConditionalJump):
(JSC::CodeBlock::printGetByIdOp):
(JSC::CodeBlock::printPutByIdOp):
(JSC::CodeBlock::dump):

  • bytecode/CodeBlock.h:

(JSC::CodeBlock::isConstantRegisterIndex):

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/bytecode/CodeBlock.h

    r48836 r50537  
    439439        void addConstantRegister(const Register& r) { return m_constantRegisters.append(r); }
    440440        Register& constantRegister(int index) { return m_constantRegisters[index - FirstConstantRegisterIndex]; }
    441         ALWAYS_INLINE bool isConstantRegisterIndex(int index) { return index >= FirstConstantRegisterIndex; }
     441        ALWAYS_INLINE bool isConstantRegisterIndex(int index) const { return index >= FirstConstantRegisterIndex; }
    442442        ALWAYS_INLINE JSValue getConstant(int index) const { return m_constantRegisters[index - FirstConstantRegisterIndex].jsValue(); }
    443443
     
    483483#if !defined(NDEBUG) || ENABLE(OPCODE_SAMPLING)
    484484        void dump(ExecState*, const Vector<Instruction>::const_iterator& begin, Vector<Instruction>::const_iterator&) const;
     485
     486        CString registerName(ExecState*, int r) const;
     487        void printUnaryOp(ExecState*, int location, Vector<Instruction>::const_iterator&, const char* op) const;
     488        void printBinaryOp(ExecState*, int location, Vector<Instruction>::const_iterator&, const char* op) const;
     489        void printConditionalJump(ExecState*, const Vector<Instruction>::const_iterator&, Vector<Instruction>::const_iterator&, int location, const char* op) const;
     490        void printGetByIdOp(ExecState*, int location, Vector<Instruction>::const_iterator&, const char* op) const;
     491        void printPutByIdOp(ExecState*, int location, Vector<Instruction>::const_iterator&, const char* op) const;
    485492#endif
    486493
Note: See TracChangeset for help on using the changeset viewer.