Changeset 64790 in webkit


Ignore:
Timestamp:
Aug 5, 2010 3:22:49 PM (14 years ago)
Author:
commit-queue@webkit.org
Message:

2010-08-05 Nathan Lawrence <nlawrence@apple.com>

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):
Location:
trunk/JavaScriptCore
Files:
11 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/ChangeLog

    r64782 r64790  
     12010-08-05  Nathan Lawrence  <nlawrence@apple.com>
     2
     3        Reviewed by Darin Adler.
     4
     5        https://bugs.webkit.org/show_bug.cgi?id=43464
     6
     7        Currently, the global object is being embedded in the JavaScriptCore
     8        bytecode, however since the global object is the same for all opcodes
     9        in a code block, we can have the global object just be a member of the
     10        associated code block.
     11
     12        Additionally, I added an assert inside of emitOpcode that verifies
     13        that the last generated opcode was of the correct length.
     14
     15        * bytecode/CodeBlock.cpp:
     16        (JSC::CodeBlock::CodeBlock):
     17        (JSC::CodeBlock::derefStructures):
     18        (JSC::CodeBlock::markAggregate):
     19        * bytecode/CodeBlock.h:
     20        (JSC::CodeBlock::globalObject):
     21        (JSC::GlobalCodeBlock::GlobalCodeBlock):
     22        (JSC::ProgramCodeBlock::ProgramCodeBlock):
     23        (JSC::EvalCodeBlock::EvalCodeBlock):
     24        (JSC::FunctionCodeBlock::FunctionCodeBlock):
     25        * bytecode/Opcode.h:
     26        (JSC::opcodeLength):
     27        * bytecompiler/BytecodeGenerator.cpp:
     28        (JSC::BytecodeGenerator::BytecodeGenerator):
     29        (JSC::BytecodeGenerator::emitOpcode):
     30            Added an assert to check that the last generated opcode is the
     31            correct length.
     32        (JSC::BytecodeGenerator::rewindBinaryOp):
     33            Changed the last opcode to op_end since the length will no longer
     34            be correct.
     35        (JSC::BytecodeGenerator::rewindUnaryOp):
     36            Changed the last opcode to op_end since the length will no longer
     37            be correct.
     38        (JSC::BytecodeGenerator::emitResolve):
     39        (JSC::BytecodeGenerator::emitGetScopedVar):
     40        (JSC::BytecodeGenerator::emitPutScopedVar):
     41        (JSC::BytecodeGenerator::emitResolveWithBase):
     42        * bytecompiler/BytecodeGenerator.h:
     43        * interpreter/Interpreter.cpp:
     44        (JSC::Interpreter::resolveGlobal):
     45        (JSC::Interpreter::resolveGlobalDynamic):
     46        (JSC::Interpreter::privateExecute):
     47        * jit/JITOpcodes.cpp:
     48        (JSC::JIT::emit_op_get_global_var):
     49        (JSC::JIT::emit_op_put_global_var):
     50        (JSC::JIT::emit_op_resolve_global):
     51        (JSC::JIT::emitSlow_op_resolve_global):
     52        (JSC::JIT::emit_op_resolve_global_dynamic):
     53        (JSC::JIT::emitSlow_op_resolve_global_dynamic):
     54        * jit/JITOpcodes32_64.cpp:
     55        (JSC::JIT::emit_op_get_global_var):
     56        (JSC::JIT::emit_op_put_global_var):
     57        (JSC::JIT::emit_op_resolve_global):
     58        (JSC::JIT::emitSlow_op_resolve_global):
     59        * jit/JITStubs.cpp:
     60        (JSC::cti_op_resolve_global):
     61        * runtime/Executable.cpp:
     62        (JSC::FunctionExecutable::compileForCallInternal):
     63        (JSC::FunctionExecutable::compileForConstructInternal):
     64        (JSC::FunctionExecutable::reparseExceptionInfo):
     65
    1662010-08-05  Gavin Barraclough  <barraclough@apple.com>
    267
  • trunk/JavaScriptCore/bytecode/CodeBlock.cpp

    r64684 r64790  
    13451345}
    13461346
    1347 CodeBlock::CodeBlock(ScriptExecutable* ownerExecutable, CodeType codeType, PassRefPtr<SourceProvider> sourceProvider, unsigned sourceOffset, SymbolTable* symTab, bool isConstructor)
    1348     : m_numCalleeRegisters(0)
     1347CodeBlock::CodeBlock(ScriptExecutable* ownerExecutable, CodeType codeType, JSGlobalObject *globalObject, PassRefPtr<SourceProvider> sourceProvider, unsigned sourceOffset, SymbolTable* symTab, bool isConstructor)
     1348    : m_globalObject(globalObject)
     1349    , m_numCalleeRegisters(0)
    13491350    , m_numVars(0)
    13501351    , m_numParameters(0)
     
    14581459    }
    14591460    if (vPC[0].u.opcode == interpreter->getOpcode(op_resolve_global) || vPC[0].u.opcode == interpreter->getOpcode(op_resolve_global_dynamic)) {
    1460         if(vPC[4].u.structure)
    1461             vPC[4].u.structure->deref();
     1461        if (vPC[3].u.structure)
     1462            vPC[3].u.structure->deref();
    14621463        return;
    14631464    }
     
    15191520    for (size_t i = 0; i < m_functionDecls.size(); ++i)
    15201521        m_functionDecls[i]->markAggregate(markStack);
     1522    markStack.append(m_globalObject);
    15211523}
    15221524
  • trunk/JavaScriptCore/bytecode/CodeBlock.h

    r62677 r64790  
    276276        friend class JIT;
    277277    protected:
    278         CodeBlock(ScriptExecutable* ownerExecutable, CodeType, PassRefPtr<SourceProvider>, unsigned sourceOffset, SymbolTable* symbolTable, bool isConstructor);
     278        CodeBlock(ScriptExecutable* ownerExecutable, CodeType, JSGlobalObject*, PassRefPtr<SourceProvider>, unsigned sourceOffset, SymbolTable* symbolTable, bool isConstructor);
     279
     280        JSGlobalObject* m_globalObject;
     281
    279282    public:
    280283        virtual ~CodeBlock();
     
    484487        RegExp* regexp(int index) const { ASSERT(m_rareData); return m_rareData->m_regexps[index].get(); }
    485488
     489        JSGlobalObject* globalObject() { return m_globalObject; }
    486490
    487491        // Jump Tables
     
    603607    class GlobalCodeBlock : public CodeBlock {
    604608    public:
    605         GlobalCodeBlock(ScriptExecutable* ownerExecutable, CodeType codeType, PassRefPtr<SourceProvider> sourceProvider, unsigned sourceOffset, JSGlobalObject* globalObject)
    606             : CodeBlock(ownerExecutable, codeType, sourceProvider, sourceOffset, &m_unsharedSymbolTable, false)
    607             , m_globalObject(globalObject)
     609        GlobalCodeBlock(ScriptExecutable* ownerExecutable, CodeType codeType, JSGlobalObject* globalObject, PassRefPtr<SourceProvider> sourceProvider, unsigned sourceOffset)
     610            : CodeBlock(ownerExecutable, codeType, globalObject, sourceProvider, sourceOffset, &m_unsharedSymbolTable, false)
    608611        {
    609612            m_globalObject->codeBlocks().add(this);
     
    619622
    620623    private:
    621         JSGlobalObject* m_globalObject; // For program and eval nodes, the global object that marks the constant pool.
    622624        SymbolTable m_unsharedSymbolTable;
    623625    };
     
    626628    public:
    627629        ProgramCodeBlock(ProgramExecutable* ownerExecutable, CodeType codeType, JSGlobalObject* globalObject, PassRefPtr<SourceProvider> sourceProvider)
    628             : GlobalCodeBlock(ownerExecutable, codeType, sourceProvider, 0, globalObject)
     630            : GlobalCodeBlock(ownerExecutable, codeType, globalObject, sourceProvider, 0)
    629631        {
    630632        }
     
    634636    public:
    635637        EvalCodeBlock(EvalExecutable* ownerExecutable, JSGlobalObject* globalObject, PassRefPtr<SourceProvider> sourceProvider, int baseScopeDepth)
    636             : GlobalCodeBlock(ownerExecutable, EvalCode, sourceProvider, 0, globalObject)
     638            : GlobalCodeBlock(ownerExecutable, EvalCode, globalObject, sourceProvider, 0)
    637639            , m_baseScopeDepth(baseScopeDepth)
    638640        {
     
    660662        // symbol table, so we just pass as a raw pointer with a ref count of 1.  We then manually deref
    661663        // in the destructor.
    662         FunctionCodeBlock(FunctionExecutable* ownerExecutable, CodeType codeType, PassRefPtr<SourceProvider> sourceProvider, unsigned sourceOffset, bool isConstructor)
    663             : CodeBlock(ownerExecutable, codeType, sourceProvider, sourceOffset, SharedSymbolTable::create().releaseRef(), isConstructor)
     664        FunctionCodeBlock(FunctionExecutable* ownerExecutable, CodeType codeType, JSGlobalObject* globalObject, PassRefPtr<SourceProvider> sourceProvider, unsigned sourceOffset, bool isConstructor)
     665            : CodeBlock(ownerExecutable, codeType, globalObject, sourceProvider, sourceOffset, SharedSymbolTable::create().releaseRef(), isConstructor)
    664666        {
    665667        }
  • trunk/JavaScriptCore/bytecode/Opcode.h

    r63056 r64790  
    9494        macro(op_resolve, 3) \
    9595        macro(op_resolve_skip, 4) \
    96         macro(op_resolve_global, 6) \
    97         macro(op_resolve_global_dynamic, 7) \
     96        macro(op_resolve_global, 5) \
     97        macro(op_resolve_global_dynamic, 6) \
    9898        macro(op_get_scoped_var, 4) \
    9999        macro(op_put_scoped_var, 4) \
    100         macro(op_get_global_var, 4) \
    101         macro(op_put_global_var, 4) \
     100        macro(op_get_global_var, 3) \
     101        macro(op_put_global_var, 3) \
    102102        macro(op_resolve_base, 3) \
    103103        macro(op_resolve_with_base, 4) \
     
    255255#endif
    256256
     257    inline size_t opcodeLength(OpcodeID opcode)
     258    {
     259        switch (opcode) {
     260#define OPCODE_ID_LENGTHS(id, length) case id: return OPCODE_LENGTH(id);
     261             FOR_EACH_OPCODE_ID(OPCODE_ID_LENGTHS)
     262#undef OPCODE_ID_LENGTHS
     263        }
     264        ASSERT_NOT_REACHED();
     265        return 0;
     266    }
     267
    257268} // namespace JSC
    258269
  • 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);
  • trunk/JavaScriptCore/bytecompiler/BytecodeGenerator.h

    r63244 r64790  
    561561
    562562        OpcodeID m_lastOpcodeID;
     563#ifndef NDEBUG
     564        size_t m_lastOpcodePosition;
     565#endif
    563566
    564567        unsigned m_emitNodeDepth;
  • trunk/JavaScriptCore/interpreter/Interpreter.cpp

    r63267 r64790  
    145145{
    146146    int dst = vPC[1].u.operand;
    147     JSGlobalObject* globalObject = static_cast<JSGlobalObject*>(vPC[2].u.jsCell);
     147    CodeBlock* codeBlock = callFrame->codeBlock();
     148    JSGlobalObject* globalObject = codeBlock->globalObject();
    148149    ASSERT(globalObject->isGlobalObject());
    149     int property = vPC[3].u.operand;
    150     Structure* structure = vPC[4].u.structure;
    151     int offset = vPC[5].u.operand;
     150    int property = vPC[2].u.operand;
     151    Structure* structure = vPC[3].u.structure;
     152    int offset = vPC[4].u.operand;
    152153
    153154    if (structure == globalObject->structure()) {
     
    156157    }
    157158
    158     CodeBlock* codeBlock = callFrame->codeBlock();
    159159    Identifier& ident = codeBlock->identifier(property);
    160160    PropertySlot slot(globalObject);
     
    162162        JSValue result = slot.getValue(callFrame, ident);
    163163        if (slot.isCacheableValue() && !globalObject->structure()->isUncacheableDictionary() && slot.slotBase() == globalObject) {
    164             if (vPC[4].u.structure)
    165                 vPC[4].u.structure->deref();
     164            if (vPC[3].u.structure)
     165                vPC[3].u.structure->deref();
    166166            globalObject->structure()->ref();
    167             vPC[4] = globalObject->structure();
    168             vPC[5] = slot.cachedOffset();
     167            vPC[3] = globalObject->structure();
     168            vPC[4] = slot.cachedOffset();
    169169            callFrame->r(dst) = JSValue(result);
    170170            return true;
     
    185185{
    186186    int dst = vPC[1].u.operand;
    187     JSGlobalObject* globalObject = static_cast<JSGlobalObject*>(vPC[2].u.jsCell);
     187    CodeBlock* codeBlock = callFrame->codeBlock();
     188    JSGlobalObject* globalObject = codeBlock->globalObject();
    188189    ASSERT(globalObject->isGlobalObject());
    189     int property = vPC[3].u.operand;
    190     Structure* structure = vPC[4].u.structure;
    191     int offset = vPC[5].u.operand;
    192     CodeBlock* codeBlock = callFrame->codeBlock();
    193     int skip = vPC[6].u.operand;
     190    int property = vPC[2].u.operand;
     191    Structure* structure = vPC[3].u.structure;
     192    int offset = vPC[4].u.operand;
     193    int skip = vPC[5].u.operand;
    194194   
    195195    ScopeChainNode* scopeChain = callFrame->scopeChain();
     
    232232        JSValue result = slot.getValue(callFrame, ident);
    233233        if (slot.isCacheableValue() && !globalObject->structure()->isUncacheableDictionary() && slot.slotBase() == globalObject) {
    234             if (vPC[4].u.structure)
    235                 vPC[4].u.structure->deref();
     234            if (vPC[3].u.structure)
     235                vPC[3].u.structure->deref();
    236236            globalObject->structure()->ref();
    237             vPC[4] = globalObject->structure();
    238             vPC[5] = slot.cachedOffset();
     237            vPC[3] = globalObject->structure();
     238            vPC[4] = slot.cachedOffset();
    239239            callFrame->r(dst) = JSValue(result);
    240240            return true;
     
    22852285         */
    22862286        int dst = vPC[1].u.operand;
    2287         JSGlobalObject* scope = static_cast<JSGlobalObject*>(vPC[2].u.jsCell);
     2287        JSGlobalObject* scope = codeBlock->globalObject();
    22882288        ASSERT(scope->isGlobalObject());
    2289         int index = vPC[3].u.operand;
     2289        int index = vPC[2].u.operand;
    22902290
    22912291        callFrame->r(dst) = scope->registerAt(index);
     
    22982298           Puts value into global slot index.
    22992299         */
    2300         JSGlobalObject* scope = static_cast<JSGlobalObject*>(vPC[1].u.jsCell);
     2300        JSGlobalObject* scope = codeBlock->globalObject();
    23012301        ASSERT(scope->isGlobalObject());
    2302         int index = vPC[2].u.operand;
    2303         int value = vPC[3].u.operand;
     2302        int index = vPC[1].u.operand;
     2303        int value = vPC[2].u.operand;
    23042304       
    23052305        scope->registerAt(index) = JSValue(callFrame->r(value).jsValue());
  • trunk/JavaScriptCore/jit/JITOpcodes.cpp

    r64608 r64790  
    469469void JIT::emit_op_get_global_var(Instruction* currentInstruction)
    470470{
    471     JSVariableObject* globalObject = static_cast<JSVariableObject*>(currentInstruction[2].u.jsCell);
     471    JSVariableObject* globalObject = m_codeBlock->globalObject();
    472472    move(ImmPtr(globalObject), regT0);
    473     emitGetVariableObjectRegister(regT0, currentInstruction[3].u.operand, regT0);
     473    emitGetVariableObjectRegister(regT0, currentInstruction[2].u.operand, regT0);
    474474    emitPutVirtualRegister(currentInstruction[1].u.operand);
    475475}
     
    477477void JIT::emit_op_put_global_var(Instruction* currentInstruction)
    478478{
    479     emitGetVirtualRegister(currentInstruction[3].u.operand, regT1);
    480     JSVariableObject* globalObject = static_cast<JSVariableObject*>(currentInstruction[1].u.jsCell);
     479    emitGetVirtualRegister(currentInstruction[2].u.operand, regT1);
     480    JSVariableObject* globalObject = m_codeBlock->globalObject();
    481481    move(ImmPtr(globalObject), regT0);
    482     emitPutVariableObjectRegister(regT1, regT0, currentInstruction[2].u.operand);
     482    emitPutVariableObjectRegister(regT1, regT0, currentInstruction[1].u.operand);
    483483}
    484484
     
    651651{
    652652    // Fast case
    653     void* globalObject = currentInstruction[2].u.jsCell;
     653    void* globalObject = m_codeBlock->globalObject();
    654654    unsigned currentIndex = m_globalResolveInfoIndex++;
    655655    void* structureAddress = &(m_codeBlock->globalResolveInfo(currentIndex).structure);
     
    672672{
    673673    unsigned dst = currentInstruction[1].u.operand;
    674     void* globalObject = currentInstruction[2].u.jsCell;
    675     Identifier* ident = &m_codeBlock->identifier(currentInstruction[3].u.operand);
     674    Identifier* ident = &m_codeBlock->identifier(currentInstruction[2].u.operand);
    676675   
    677676    unsigned currentIndex = m_globalResolveInfoIndex++;
     
    679678    linkSlowCase(iter);
    680679    JITStubCall stubCall(this, cti_op_resolve_global);
    681     stubCall.addArgument(ImmPtr(globalObject));
    682680    stubCall.addArgument(ImmPtr(ident));
    683681    stubCall.addArgument(Imm32(currentIndex));
     682    stubCall.addArgument(regT0);
    684683    stubCall.call(dst);
    685684}
     
    14961495void JIT::emit_op_resolve_global_dynamic(Instruction* currentInstruction)
    14971496{
    1498     int skip = currentInstruction[6].u.operand;
     1497    int skip = currentInstruction[5].u.operand;
    14991498   
    15001499    emitGetFromCallFrameHeaderPtr(RegisterFile::ScopeChain, regT0);
     
    15101509{
    15111510    unsigned dst = currentInstruction[1].u.operand;
    1512     void* globalObject = currentInstruction[2].u.jsCell;
    1513     Identifier* ident = &m_codeBlock->identifier(currentInstruction[3].u.operand);
    1514     int skip = currentInstruction[6].u.operand;
     1511    Identifier* ident = &m_codeBlock->identifier(currentInstruction[2].u.operand);
     1512    int skip = currentInstruction[5].u.operand;
    15151513    while (skip--)
    15161514        linkSlowCase(iter);
     
    15241522    linkSlowCase(iter); // We managed to skip all the nodes in the scope chain, but the cache missed.
    15251523    JITStubCall stubCall(this, cti_op_resolve_global);
    1526     stubCall.addArgument(ImmPtr(globalObject));
    15271524    stubCall.addArgument(ImmPtr(ident));
    15281525    stubCall.addArgument(Imm32(currentIndex));
     1526    stubCall.addArgument(regT0);
    15291527    stubCall.call(dst);
    15301528}
  • trunk/JavaScriptCore/jit/JITOpcodes32_64.cpp

    r64608 r64790  
    526526{
    527527    int dst = currentInstruction[1].u.operand;
    528     JSGlobalObject* globalObject = static_cast<JSGlobalObject*>(currentInstruction[2].u.jsCell);
     528    JSGlobalObject* globalObject = m_codeBlock->globalObject();
    529529    ASSERT(globalObject->isGlobalObject());
    530     int index = currentInstruction[3].u.operand;
     530    int index = currentInstruction[2].u.operand;
    531531
    532532    loadPtr(&globalObject->d()->registers, regT2);
     
    539539void JIT::emit_op_put_global_var(Instruction* currentInstruction)
    540540{
    541     JSGlobalObject* globalObject = static_cast<JSGlobalObject*>(currentInstruction[1].u.jsCell);
     541    JSGlobalObject* globalObject = m_codeBlock->globalObject();
    542542    ASSERT(globalObject->isGlobalObject());
    543     int index = currentInstruction[2].u.operand;
    544     int value = currentInstruction[3].u.operand;
     543    int index = currentInstruction[1].u.operand;
     544    int value = currentInstruction[2].u.operand;
    545545
    546546    emitLoad(value, regT1, regT0);
     
    679679
    680680    unsigned dst = currentInstruction[1].u.operand;
    681     void* globalObject = currentInstruction[2].u.jsCell;
     681    void* globalObject = m_codeBlock->globalObject();
    682682
    683683    unsigned currentIndex = m_globalResolveInfoIndex++;
     
    702702{
    703703    unsigned dst = currentInstruction[1].u.operand;
    704     void* globalObject = currentInstruction[2].u.jsCell;
    705     Identifier* ident = &m_codeBlock->identifier(currentInstruction[3].u.operand);
     704    Identifier* ident = &m_codeBlock->identifier(currentInstruction[2].u.operand);
    706705
    707706    unsigned currentIndex = m_globalResolveInfoIndex++;
     
    709708    linkSlowCase(iter);
    710709    JITStubCall stubCall(this, cti_op_resolve_global);
    711     stubCall.addArgument(ImmPtr(globalObject));
    712710    stubCall.addArgument(ImmPtr(ident));
    713711    stubCall.addArgument(Imm32(currentIndex));
  • trunk/JavaScriptCore/jit/JITStubs.cpp

    r64618 r64790  
    26312631
    26322632    CallFrame* callFrame = stackFrame.callFrame;
    2633     JSGlobalObject* globalObject = stackFrame.args[0].globalObject();
    2634     Identifier& ident = stackFrame.args[1].identifier();
    2635     unsigned globalResolveInfoIndex = stackFrame.args[2].int32();
     2633    CodeBlock* codeBlock = callFrame->codeBlock();
     2634    JSGlobalObject* globalObject = codeBlock->globalObject();
     2635    Identifier& ident = stackFrame.args[0].identifier();
     2636    unsigned globalResolveInfoIndex = stackFrame.args[1].int32();
    26362637    ASSERT(globalObject->isGlobalObject());
    26372638
     
    26402641        JSValue result = slot.getValue(callFrame, ident);
    26412642        if (slot.isCacheableValue() && !globalObject->structure()->isUncacheableDictionary() && slot.slotBase() == globalObject) {
    2642             GlobalResolveInfo& globalResolveInfo = callFrame->codeBlock()->globalResolveInfo(globalResolveInfoIndex);
     2643            GlobalResolveInfo& globalResolveInfo = codeBlock->globalResolveInfo(globalResolveInfoIndex);
    26432644            if (globalResolveInfo.structure)
    26442645                globalResolveInfo.structure->deref();
     
    26532654    }
    26542655
    2655     unsigned vPCIndex = callFrame->codeBlock()->bytecodeOffset(callFrame, STUB_RETURN_ADDRESS);
    2656     stackFrame.globalData->exception = createUndefinedVariableError(callFrame, ident, vPCIndex, callFrame->codeBlock());
     2656    unsigned vPCIndex = codeBlock->bytecodeOffset(callFrame, STUB_RETURN_ADDRESS);
     2657    stackFrame.globalData->exception = createUndefinedVariableError(callFrame, ident, vPCIndex, codeBlock);
    26572658    VM_THROW_EXCEPTION();
    26582659}
  • trunk/JavaScriptCore/runtime/Executable.cpp

    r64608 r64790  
    201201
    202202    ASSERT(!m_codeBlockForCall);
    203     m_codeBlockForCall = adoptPtr(new FunctionCodeBlock(this, FunctionCode, source().provider(), source().startOffset(), false));
     203    m_codeBlockForCall = adoptPtr(new FunctionCodeBlock(this, FunctionCode, globalObject, source().provider(), source().startOffset(), false));
    204204    OwnPtr<BytecodeGenerator> generator(adoptPtr(new BytecodeGenerator(body.get(), globalObject->debugger(), scopeChain, m_codeBlockForCall->symbolTable(), m_codeBlockForCall.get())));
    205205    generator->generate();
     
    246246
    247247    ASSERT(!m_codeBlockForConstruct);
    248     m_codeBlockForConstruct = adoptPtr(new FunctionCodeBlock(this, FunctionCode, source().provider(), source().startOffset(), true));
     248    m_codeBlockForConstruct = adoptPtr(new FunctionCodeBlock(this, FunctionCode, globalObject, source().provider(), source().startOffset(), true));
    249249    OwnPtr<BytecodeGenerator> generator(adoptPtr(new BytecodeGenerator(body.get(), globalObject->debugger(), scopeChain, m_codeBlockForConstruct->symbolTable(), m_codeBlockForConstruct.get())));
    250250    generator->generate();
     
    294294    JSGlobalObject* globalObject = scopeChain.globalObject();
    295295
    296     OwnPtr<CodeBlock> newCodeBlock(adoptPtr(new FunctionCodeBlock(this, FunctionCode, source().provider(), source().startOffset(), codeBlock->m_isConstructor)));
     296    OwnPtr<CodeBlock> newCodeBlock(adoptPtr(new FunctionCodeBlock(this, FunctionCode, globalObject, source().provider(), source().startOffset(), codeBlock->m_isConstructor)));
    297297    globalData->functionCodeBlockBeingReparsed = newCodeBlock.get();
    298298
Note: See TracChangeset for help on using the changeset viewer.