Ignore:
Timestamp:
Aug 5, 2010, 3:22:49 PM (15 years ago)
Author:
[email protected]
Message:

2010-08-05 Nathan Lawrence <[email protected]>

Reviewed by Darin Adler.

https://bugs.webkit.org/show_bug.cgi?id=43464

Currently, the global object is being embedded in the JavaScriptCore
bytecode, however since the global object is the same for all opcodes
in a code block, we can have the global object just be a member of the
associated code block.

Additionally, I added an assert inside of emitOpcode that verifies
that the last generated opcode was of the correct length.

  • bytecode/CodeBlock.cpp: (JSC::CodeBlock::CodeBlock): (JSC::CodeBlock::derefStructures): (JSC::CodeBlock::markAggregate):
  • bytecode/CodeBlock.h: (JSC::CodeBlock::globalObject): (JSC::GlobalCodeBlock::GlobalCodeBlock): (JSC::ProgramCodeBlock::ProgramCodeBlock): (JSC::EvalCodeBlock::EvalCodeBlock): (JSC::FunctionCodeBlock::FunctionCodeBlock):
  • bytecode/Opcode.h: (JSC::opcodeLength):
  • bytecompiler/BytecodeGenerator.cpp: (JSC::BytecodeGenerator::BytecodeGenerator): (JSC::BytecodeGenerator::emitOpcode):

Added an assert to check that the last generated opcode is the
correct length.

(JSC::BytecodeGenerator::rewindBinaryOp):

Changed the last opcode to op_end since the length will no longer
be correct.

(JSC::BytecodeGenerator::rewindUnaryOp):

Changed the last opcode to op_end since the length will no longer
be correct.

(JSC::BytecodeGenerator::emitResolve):
(JSC::BytecodeGenerator::emitGetScopedVar):
(JSC::BytecodeGenerator::emitPutScopedVar):
(JSC::BytecodeGenerator::emitResolveWithBase):

  • bytecompiler/BytecodeGenerator.h:
  • interpreter/Interpreter.cpp: (JSC::Interpreter::resolveGlobal): (JSC::Interpreter::resolveGlobalDynamic): (JSC::Interpreter::privateExecute):
  • jit/JITOpcodes.cpp: (JSC::JIT::emit_op_get_global_var): (JSC::JIT::emit_op_put_global_var): (JSC::JIT::emit_op_resolve_global): (JSC::JIT::emitSlow_op_resolve_global): (JSC::JIT::emit_op_resolve_global_dynamic): (JSC::JIT::emitSlow_op_resolve_global_dynamic):
  • jit/JITOpcodes32_64.cpp: (JSC::JIT::emit_op_get_global_var): (JSC::JIT::emit_op_put_global_var): (JSC::JIT::emit_op_resolve_global): (JSC::JIT::emitSlow_op_resolve_global):
  • jit/JITStubs.cpp: (JSC::cti_op_resolve_global):
  • runtime/Executable.cpp: (JSC::FunctionExecutable::compileForCallInternal): (JSC::FunctionExecutable::compileForConstructInternal): (JSC::FunctionExecutable::reparseExceptionInfo):
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp

    r63515 r64790  
    217217    , m_globalData(&scopeChain.globalObject()->globalExec()->globalData())
    218218    , m_lastOpcodeID(op_end)
     219#ifndef NDEBUG
     220    , m_lastOpcodePosition(0)
     221#endif
    219222    , m_emitNodeDepth(0)
    220223    , m_usesExceptions(false)
     
    589592void BytecodeGenerator::emitOpcode(OpcodeID opcodeID)
    590593{
     594#ifndef NDEBUG
     595    size_t opcodePosition = instructions().size();
     596    ASSERT(opcodePosition - m_lastOpcodePosition == opcodeLength(m_lastOpcodeID) || m_lastOpcodeID == op_end);
     597    m_lastOpcodePosition = opcodePosition;
     598#endif
    591599    instructions().append(globalData()->interpreter->getOpcode(opcodeID));
    592600    m_lastOpcodeID = opcodeID;
     
    614622    ASSERT(instructions().size() >= 4);
    615623    instructions().shrink(instructions().size() - 4);
     624    m_lastOpcodeID = op_end;
    616625}
    617626
     
    620629    ASSERT(instructions().size() >= 3);
    621630    instructions().shrink(instructions().size() - 3);
     631    m_lastOpcodeID = op_end;
    622632}
    623633
     
    11071117        emitOpcode(requiresDynamicChecks ? op_resolve_global_dynamic : op_resolve_global);
    11081118        instructions().append(dst->index());
    1109         instructions().append(globalObject);
    11101119        instructions().append(addConstant(property));
    11111120        instructions().append(0);
     
    11431152        emitOpcode(op_get_global_var);
    11441153        instructions().append(dst->index());
    1145         instructions().append(asCell(globalObject));
    11461154        instructions().append(index);
    11471155        return dst;
     
    11591167    if (globalObject) {
    11601168        emitOpcode(op_put_global_var);
    1161         instructions().append(asCell(globalObject));
    11621169        instructions().append(index);
    11631170        instructions().append(value->index());
     
    12301237    emitOpcode(requiresDynamicChecks ? op_resolve_global_dynamic : op_resolve_global);
    12311238    instructions().append(propDst->index());
    1232     instructions().append(globalObject);
    12331239    instructions().append(addConstant(property));
    12341240    instructions().append(0);
Note: See TracChangeset for help on using the changeset viewer.