Changeset 36997 in webkit for trunk/JavaScriptCore/VM/Machine.cpp


Ignore:
Timestamp:
Sep 27, 2008, 10:19:39 AM (17 years ago)
Author:
[email protected]
Message:

2008-09-27 Geoffrey Garen <[email protected]>

Reviewed by Cameron Zwarich.


Store the callee CodeBlock, not the caller CodeBlock, in the call frame
header. Nix the "codeBlock" local variable, and access the callee
CodeBlock through the call frame header instead.


Profit: call + return are simpler, because they don't have to update the
"codeBlock" local variable.


Because CTI keeps "r" in a register, reading the callee CodeBlock relative
to "r" can be very fast, in any cases we care to optimize. Presently,
no such cases seem important.


Also, stop writing "dst" to the call frame header. CTI doesn't use it.


21.6% speedup on empty function call benchmark.
3.8% speedup on SunSpider --v8.
2.1% speedup on v8 benchmark.
0.7% speedup on SunSpider (6% speedup on controlflow-recursive).


Small regression in bytecode, because currently every op_ret reads the
callee CodeBlock to check needsFullScopeChain, and bytecode does not
keep "r" in a register. On-balance, this is probably OK, since CTI is
our high-performance execution model. Also, this should go away once
we make needsFullScopeChain statically determinable at parse time.

  • VM/CTI.cpp: (JSC::CTI::compileOpCall): The speedup! (JSC::CTI::privateCompileSlowCases): ditto
  • VM/CTI.h: (JSC::): Fixed up magic trampoline constants to account for the nixed "codeBlock" argument. (JSC::CTI::execute): Changed trampoline function not to take a "codeBlock" argument, since codeBlock is now stored in the call frame header.


  • VM/Machine.cpp: Read the callee CodeBlock from the register file. Use a NULL CallerRegisters in the call frame header to signal a built-in caller, since CodeBlock is now never NULL.
  • VM/Machine.h: Made some stand-alone functions Machine member functions so they could call the private codeBlock() accessor in the Register class, of which Machine is a friend. Renamed "CallerCodeBlock" to "CodeBlock", since it's no longer the caller's CodeBlock.
  • VM/RegisterFile.h: Marked some methods const to accommodate a const RegisterFile* being passed around in Machine.cpp.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/VM/Machine.cpp

    r36976 r36997  
    305305}
    306306
    307 static bool NEVER_INLINE resolve(ExecState* exec, Instruction* vPC, Register* r, ScopeChainNode* scopeChain, CodeBlock* codeBlock, JSValue*& exceptionValue)
     307NEVER_INLINE bool Machine::resolve(ExecState* exec, Instruction* vPC, Register* r, ScopeChainNode* scopeChain, JSValue*& exceptionValue)
    308308{
    309309    int dst = (vPC + 1)->u.operand;
     
    314314    ASSERT(iter != end);
    315315
     316    CodeBlock* codeBlock = r[RegisterFile::CodeBlock].codeBlock();
    316317    Identifier& ident = codeBlock->identifiers[property];
    317318    do {
     
    331332}
    332333
    333 static bool NEVER_INLINE resolveSkip(ExecState* exec, Instruction* vPC, Register* r, ScopeChainNode* scopeChain, CodeBlock* codeBlock, JSValue*& exceptionValue)
    334 {
     334NEVER_INLINE bool Machine::resolveSkip(ExecState* exec, Instruction* vPC, Register* r, ScopeChainNode* scopeChain, JSValue*& exceptionValue)
     335{
     336    CodeBlock* codeBlock = r[RegisterFile::CodeBlock].codeBlock();
     337
    335338    int dst = (vPC + 1)->u.operand;
    336339    int property = (vPC + 2)->u.operand;
     
    361364}
    362365
    363 static bool NEVER_INLINE resolveGlobal(ExecState* exec, Instruction* vPC, Register* r, CodeBlock* codeBlock, JSValue*& exceptionValue)
     366NEVER_INLINE bool Machine::resolveGlobal(ExecState* exec, Instruction* vPC, Register* r, JSValue*& exceptionValue)
    364367{
    365368    int dst = (vPC + 1)->u.operand;
     
    375378    }
    376379
     380    CodeBlock* codeBlock = r[RegisterFile::CodeBlock].codeBlock();
    377381    Identifier& ident = codeBlock->identifiers[property];
    378382    PropertySlot slot(globalObject);
     
    423427}
    424428
    425 NEVER_INLINE static void resolveBase(ExecState* exec, Instruction* vPC, Register* r, ScopeChainNode* scopeChain, CodeBlock* codeBlock)
     429NEVER_INLINE void Machine::resolveBase(ExecState* exec, Instruction* vPC, Register* r, ScopeChainNode* scopeChain)
    426430{
    427431    int dst = (vPC + 1)->u.operand;
    428432    int property = (vPC + 2)->u.operand;
     433    CodeBlock* codeBlock = r[RegisterFile::CodeBlock].codeBlock();
    429434    r[dst] = inlineResolveBase(exec, codeBlock->identifiers[property], scopeChain);
    430435}
    431436
    432 static bool NEVER_INLINE resolveBaseAndProperty(ExecState* exec, Instruction* vPC, Register* r, ScopeChainNode* scopeChain, CodeBlock* codeBlock, JSValue*& exceptionValue)
     437NEVER_INLINE bool Machine::resolveBaseAndProperty(ExecState* exec, Instruction* vPC, Register* r, ScopeChainNode* scopeChain, JSValue*& exceptionValue)
    433438{
    434439    int baseDst = (vPC + 1)->u.operand;
     
    443448    ASSERT(iter != end);
    444449
     450    CodeBlock* codeBlock = r[RegisterFile::CodeBlock].codeBlock();
    445451    Identifier& ident = codeBlock->identifiers[property];
    446452    JSObject* base;
     
    464470}
    465471
    466 static bool NEVER_INLINE resolveBaseAndFunc(ExecState* exec, Instruction* vPC, Register* r, ScopeChainNode* scopeChain, CodeBlock* codeBlock, JSValue*& exceptionValue)
     472NEVER_INLINE bool Machine::resolveBaseAndFunc(ExecState* exec, Instruction* vPC, Register* r, ScopeChainNode* scopeChain, JSValue*& exceptionValue)
    467473{
    468474    int baseDst = (vPC + 1)->u.operand;
     
    477483    ASSERT(iter != end);
    478484
     485    CodeBlock* codeBlock = r[RegisterFile::CodeBlock].codeBlock();
    479486    Identifier& ident = codeBlock->identifiers[property];
    480487    JSObject* base;
     
    509516ALWAYS_INLINE void Machine::initializeCallFrame(Register* callFrame, CodeBlock* codeBlock, Instruction* vPC, ScopeChainNode* scopeChain, Register* r, int returnValueRegister, int argc, JSValue* function)
    510517{
    511     callFrame[RegisterFile::CallerCodeBlock] = codeBlock;
     518    callFrame[RegisterFile::CodeBlock] = codeBlock;
    512519    callFrame[RegisterFile::CallerScopeChain] = scopeChain;
    513520    callFrame[RegisterFile::CallerRegisters] = r;
     
    581588}
    582589
    583 NEVER_INLINE JSValue* Machine::callEval(ExecState* exec, CodeBlock* callingCodeBlock, JSObject* thisObj, ScopeChainNode* scopeChain, RegisterFile* registerFile, Register* r, int argv, int argc, JSValue*& exceptionValue)
     590NEVER_INLINE JSValue* Machine::callEval(ExecState* exec, JSObject* thisObj, ScopeChainNode* scopeChain, RegisterFile* registerFile, Register* r, int argv, int argc, JSValue*& exceptionValue)
    584591{
    585592    if (argc < 2)
     
    597604    UString programSource = static_cast<JSString*>(program)->value();
    598605
    599     RefPtr<EvalNode> evalNode = callingCodeBlock->evalCodeCache.get(exec, programSource, scopeChain, exceptionValue);
     606    CodeBlock* codeBlock = r[RegisterFile::CodeBlock].codeBlock();
     607    RefPtr<EvalNode> evalNode = codeBlock->evalCodeCache.get(exec, programSource, scopeChain, exceptionValue);
    600608
    601609    JSValue* result = 0;
     
    656664#ifndef NDEBUG
    657665
    658 void Machine::dumpCallFrame(const CodeBlock* codeBlock, ScopeChainNode* scopeChain, RegisterFile* registerFile, const Register* r)
     666void Machine::dumpCallFrame(ScopeChainNode* scopeChain, const RegisterFile* registerFile, const Register* r)
    659667{
    660668    ScopeChain sc(scopeChain);
    661669    JSGlobalObject* globalObject = sc.globalObject();
     670
     671    CodeBlock* codeBlock = r[RegisterFile::CodeBlock].codeBlock();
    662672    codeBlock->dump(globalObject->globalExec());
    663     dumpRegisters(codeBlock, registerFile, r);
    664 }
    665 
    666 void Machine::dumpRegisters(const CodeBlock* codeBlock, RegisterFile* registerFile, const Register* r)
     673
     674    dumpRegisters(registerFile, r);
     675}
     676
     677void Machine::dumpRegisters(const RegisterFile* registerFile, const Register* r)
    667678{
    668679    printf("Register frame: \n\n");
     
    671682    printf("----------------------------------------------------\n");
    672683
     684    CodeBlock* codeBlock = r[RegisterFile::CodeBlock].codeBlock();
    673685    const Register* it;
    674686    const Register* end;
     
    695707    printf("----------------------------------------------------\n");
    696708
    697     printf("[CallerCodeBlock]          | %10p | %10p \n", it, (*it).v()); ++it;
     709    printf("[CodeBlock]                | %10p | %10p \n", it, (*it).v()); ++it;
    698710    printf("[CallerScopeChain]         | %10p | %10p \n", it, (*it).v()); ++it;
    699711    printf("[CallerRegisters]          | %10p | %10p \n", it, (*it).v()); ++it;
     
    783795    }
    784796   
    785     codeBlock = r[RegisterFile::CallerCodeBlock].codeBlock();
    786     if (!codeBlock)
     797    void* returnPC = r[RegisterFile::ReturnPC].v();
     798    scopeChain = r[RegisterFile::CallerScopeChain].scopeChain();
     799    r = r[RegisterFile::CallerRegisters].r();
     800    if (!r)
    787801        return false;
    788802
    789     scopeChain = r[RegisterFile::CallerScopeChain].scopeChain();
    790     vPC = vPCForPC(codeBlock, r[RegisterFile::ReturnPC].v());
    791     r = r[RegisterFile::CallerRegisters].r();
    792803    exec->m_callFrame = r;
    793 
     804    codeBlock = r[RegisterFile::CodeBlock].codeBlock();
     805    vPC = vPCForPC(codeBlock, returnPC);
    794806    return true;
    795807}
    796808
    797 NEVER_INLINE Instruction* Machine::throwException(ExecState* exec, JSValue*& exceptionValue, const Instruction* vPC, CodeBlock*& codeBlock, ScopeChainNode*& scopeChain, Register*& r, bool explicitThrow)
     809NEVER_INLINE Instruction* Machine::throwException(ExecState* exec, JSValue*& exceptionValue, const Instruction* vPC, ScopeChainNode*& scopeChain, Register*& r, bool explicitThrow)
    798810{
    799811    // Set up the exception object
    800812   
     813    CodeBlock* codeBlock = r[RegisterFile::CodeBlock].codeBlock();
    801814    if (exceptionValue->isObject()) {
    802815        JSObject* exception = static_cast<JSObject*>(exceptionValue);
     
    888901    Register* r = m_registerFile.base() + oldSize + codeBlock->numParameters + RegisterFile::CallFrameHeaderSize;
    889902    r[codeBlock->thisRegister] = thisObj;
    890     initializeCallFrame(r, 0, 0, 0, 0, 0, 0, 0);
     903    initializeCallFrame(r, codeBlock, 0, 0, 0, 0, 0, 0);
    891904
    892905    if (codeBlock->needsFullScopeChain)
     
    903916    if (!codeBlock->ctiCode)
    904917        CTI::compile(this, exec, codeBlock);
    905     JSValue* result = CTI::execute(codeBlock->ctiCode, &newExec, &m_registerFile, r, scopeChain, codeBlock, exception);
     918    JSValue* result = CTI::execute(codeBlock->ctiCode, &newExec, &m_registerFile, r, scopeChain, exception);
    906919#else
    907     JSValue* result = privateExecute(Normal, &newExec, &m_registerFile, r, scopeChain, codeBlock, exception);
     920    JSValue* result = privateExecute(Normal, &newExec, &m_registerFile, r, scopeChain, exception);
    908921#endif
    909922    m_reentryDepth--;
     
    946959        argv[++dst] = *it;
    947960
    948     CodeBlock* newCodeBlock = &functionBodyNode->byteCode(scopeChain);
    949     Register* r = slideRegisterWindowForCall(exec, newCodeBlock, &m_registerFile, m_registerFile.base(), argv, argc + RegisterFile::CallFrameHeaderSize, argc, *exception);
     961    CodeBlock* codeBlock = &functionBodyNode->byteCode(scopeChain);
     962    Register* r = slideRegisterWindowForCall(exec, codeBlock, &m_registerFile, m_registerFile.base(), argv, argc + RegisterFile::CallFrameHeaderSize, argc, *exception);
    950963    if (UNLIKELY(*exception != 0)) {
    951964        m_registerFile.shrink(oldSize);
     
    953966    }
    954967    // a 0 codeBlock indicates a built-in caller
    955     initializeCallFrame(r, 0, 0, 0, argv, 0, argc, function);
     968    initializeCallFrame(r, codeBlock, 0, 0, 0, 0, argc, function);
    956969
    957970    ExecState newExec(exec, &m_registerFile, scopeChain, r);
     
    963976    m_reentryDepth++;
    964977#if ENABLE(CTI)
    965     if (!newCodeBlock->ctiCode)
    966         CTI::compile(this, exec, newCodeBlock);
    967     JSValue* result = CTI::execute(newCodeBlock->ctiCode, &newExec, &m_registerFile, r, scopeChain, newCodeBlock, exception);
     978    if (!codeBlock->ctiCode)
     979        CTI::compile(this, exec, codeBlock);
     980    JSValue* result = CTI::execute(codeBlock->ctiCode, &newExec, &m_registerFile, r, scopeChain, exception);
    968981#else
    969982    setScopeChain(&newExec, scopeChain, scopeChain);
    970     JSValue* result = privateExecute(Normal, &newExec, &m_registerFile, r, scopeChain, newCodeBlock, exception);
     983    JSValue* result = privateExecute(Normal, &newExec, &m_registerFile, r, scopeChain, exception);
    971984#endif
    972985    m_reentryDepth--;
     
    10371050    // a 0 codeBlock indicates a built-in caller
    10381051    r[codeBlock->thisRegister] = thisObj;
    1039     initializeCallFrame(r, 0, 0, 0, 0, 0, 0, 0);
     1052    initializeCallFrame(r, codeBlock, 0, 0, 0, 0, 0, 0);
    10401053
    10411054    if (codeBlock->needsFullScopeChain)
     
    10521065    if (!codeBlock->ctiCode)
    10531066        CTI::compile(this, exec, codeBlock);
    1054     JSValue* result = CTI::execute(codeBlock->ctiCode, &newExec, &m_registerFile, r, scopeChain, codeBlock, exception);
     1067    JSValue* result = CTI::execute(codeBlock->ctiCode, &newExec, &m_registerFile, r, scopeChain, exception);
    10551068#else
    1056     JSValue* result = privateExecute(Normal, &newExec, &m_registerFile, r, scopeChain, codeBlock, exception);
     1069    JSValue* result = privateExecute(Normal, &newExec, &m_registerFile, r, scopeChain, exception);
    10571070#endif
    10581071    m_reentryDepth--;
     
    10731086}
    10741087
    1075 NEVER_INLINE void Machine::debug(ExecState* exec, const CodeBlock* codeBlock, ScopeChainNode* scopeChain, Register* r, DebugHookID debugHookID, int firstLine, int lastLine)
     1088NEVER_INLINE void Machine::debug(ExecState* exec, ScopeChainNode* scopeChain, Register* r, DebugHookID debugHookID, int firstLine, int lastLine)
    10761089{
    10771090    Debugger* debugger = exec->dynamicGlobalObject()->debugger();
     
    10791092        return;
    10801093
     1094    CodeBlock* codeBlock = r[RegisterFile::CodeBlock].codeBlock();
    10811095    DebuggerCallFrame debuggerCallFrame(exec, exec->dynamicGlobalObject(), codeBlock, scopeChain, r, 0);
    10821096
     
    11881202}
    11891203
    1190 static NEVER_INLINE ScopeChainNode* createExceptionScope(ExecState* exec, CodeBlock* codeBlock, const Instruction* vPC, Register* r, ScopeChainNode* scopeChain)
     1204NEVER_INLINE ScopeChainNode* Machine::createExceptionScope(ExecState* exec, const Instruction* vPC, Register* r, ScopeChainNode* scopeChain)
    11911205{
    11921206    int dst = (++vPC)->u.operand;
     1207    CodeBlock* codeBlock = r[RegisterFile::CodeBlock].codeBlock();
    11931208    Identifier& property = codeBlock->identifiers[(++vPC)->u.operand];
    11941209    JSValue* value = r[(++vPC)->u.operand].jsValue(exec);
     
    14101425}
    14111426
    1412 JSValue* Machine::privateExecute(ExecutionFlag flag, ExecState* exec, RegisterFile* registerFile, Register* r, ScopeChainNode* scopeChain, CodeBlock* codeBlock, JSValue** exception)
     1427JSValue* Machine::privateExecute(ExecutionFlag flag, ExecState* exec, RegisterFile* registerFile, Register* r, ScopeChainNode* scopeChain, JSValue** exception)
    14131428{
    14141429    // One-time initialization of our address tables. We have to put this code
     
    14391454
    14401455    Register* registerBase = registerFile->base();
    1441     Instruction* vPC = codeBlock->instructions.begin();
     1456    Instruction* vPC = r[RegisterFile::CodeBlock].codeBlock()->instructions.begin();
    14421457    Profiler** enabledProfilerReference = Profiler::enabledProfilerReference();
    14431458    unsigned tickCount = m_ticksUntilNextTimeoutCheck + 1;
     
    14631478
    14641479#if HAVE(COMPUTED_GOTO)
    1465     #define NEXT_OPCODE MACHINE_SAMPLING_sample(codeBlock, vPC); goto *vPC->u.opcode
     1480    #define NEXT_OPCODE MACHINE_SAMPLING_sample(r[RegisterFile::CodeBlock].codeBlock(), vPC); goto *vPC->u.opcode
    14661481#if DUMP_OPCODE_STATS
    14671482    #define BEGIN_OPCODE(opcode) opcode: OpcodeStats::recordInstruction(opcode);
     
    14711486    NEXT_OPCODE;
    14721487#else
    1473     #define NEXT_OPCODE MACHINE_SAMPLING_sample(codeBlock, vPC); continue
     1488    #define NEXT_OPCODE MACHINE_SAMPLING_sample(r[RegisterFile::CodeBlock].codeBlock(), vPC); continue
    14741489#if DUMP_OPCODE_STATS
    14751490    #define BEGIN_OPCODE(opcode) case opcode: OpcodeStats::recordInstruction(opcode);
     
    15191534        int dst = (++vPC)->u.operand;
    15201535        int regExp = (++vPC)->u.operand;
    1521         r[dst] = new (exec) RegExpObject(scopeChain->globalObject()->regExpStructure(), codeBlock->regexps[regExp]);
     1536        r[dst] = new (exec) RegExpObject(scopeChain->globalObject()->regExpStructure(), r[RegisterFile::CodeBlock].codeBlock()->regexps[regExp]);
    15221537
    15231538        ++vPC;
     
    21262141        JSValue* baseVal = r[base].jsValue(exec);
    21272142
    2128         if (isNotObject(exec, true, codeBlock, vPC, baseVal, exceptionValue))
     2143        if (isNotObject(exec, true, r[RegisterFile::CodeBlock].codeBlock(), vPC, baseVal, exceptionValue))
    21292144            goto vm_throw;
    21302145
     
    22472262
    22482263        JSValue* baseVal = r[base].jsValue(exec);
    2249         if (isNotObject(exec, false, codeBlock, vPC, baseVal, exceptionValue))
     2264        if (isNotObject(exec, false, r[RegisterFile::CodeBlock].codeBlock(), vPC, baseVal, exceptionValue))
    22502265            goto vm_throw;
    22512266
     
    22732288           dst. If the property is not found, raises an exception.
    22742289        */
    2275         if (UNLIKELY(!resolve(exec, vPC, r, scopeChain, codeBlock, exceptionValue)))
     2290        if (UNLIKELY(!resolve(exec, vPC, r, scopeChain, exceptionValue)))
    22762291            goto vm_throw;
    22772292
     
    22862301         value to register dst. If the property is not found, raises an exception.
    22872302         */
    2288         if (UNLIKELY(!resolveSkip(exec, vPC, r, scopeChain, codeBlock, exceptionValue)))
     2303        if (UNLIKELY(!resolveSkip(exec, vPC, r, scopeChain, exceptionValue)))
    22892304            goto vm_throw;
    22902305
     
    23012316           cache the new structureID and offset
    23022317         */
    2303         if (UNLIKELY(!resolveGlobal(exec, vPC, r,  codeBlock, exceptionValue)))
     2318        if (UNLIKELY(!resolveGlobal(exec, vPC, r,  exceptionValue)))
    23042319            goto vm_throw;
    23052320       
     
    23442359        int dst = (++vPC)->u.operand;
    23452360        int index = (++vPC)->u.operand;
    2346         int skip = (++vPC)->u.operand + codeBlock->needsFullScopeChain;
     2361        int skip = (++vPC)->u.operand + r[RegisterFile::CodeBlock].codeBlock()->needsFullScopeChain;
    23472362
    23482363        ScopeChainIterator iter = scopeChain->begin();
     
    23652380         */
    23662381        int index = (++vPC)->u.operand;
    2367         int skip = (++vPC)->u.operand + codeBlock->needsFullScopeChain;
     2382        int skip = (++vPC)->u.operand + r[RegisterFile::CodeBlock].codeBlock()->needsFullScopeChain;
    23682383        int value = (++vPC)->u.operand;
    23692384
     
    23902405           will be the global object) is stored in register dst.
    23912406        */
    2392         resolveBase(exec, vPC, r, scopeChain, codeBlock);
     2407        resolveBase(exec, vPC, r, scopeChain);
    23932408
    23942409        vPC += 3;
     
    24072422           avoids duplicate hash lookups.
    24082423        */
    2409         if (UNLIKELY(!resolveBaseAndProperty(exec, vPC, r, scopeChain, codeBlock, exceptionValue)))
     2424        if (UNLIKELY(!resolveBaseAndProperty(exec, vPC, r, scopeChain, exceptionValue)))
    24102425            goto vm_throw;
    24112426
     
    24282443           calls but not for other property lookup.
    24292444        */
    2430         if (UNLIKELY(!resolveBaseAndFunc(exec, vPC, r, scopeChain, codeBlock, exceptionValue)))
     2445        if (UNLIKELY(!resolveBaseAndFunc(exec, vPC, r, scopeChain, exceptionValue)))
    24312446            goto vm_throw;
    24322447
     
    24442459        int property = vPC[3].u.operand;
    24452460
    2446         Identifier& ident = codeBlock->identifiers[property];
     2461        Identifier& ident = r[RegisterFile::CodeBlock].codeBlock()->identifiers[property];
    24472462        JSValue* baseValue = r[base].jsValue(exec);
    24482463        PropertySlot slot(baseValue);
     
    24502465        VM_CHECK_EXCEPTION();
    24512466
    2452         tryCacheGetByID(exec, codeBlock, vPC, baseValue, ident, slot);
     2467        tryCacheGetByID(exec, r[RegisterFile::CodeBlock].codeBlock(), vPC, baseValue, ident, slot);
    24532468
    24542469        r[dst] = result;
     
    24762491                int offset = vPC[5].u.operand;
    24772492
    2478                 ASSERT(baseObject->get(exec, codeBlock->identifiers[vPC[3].u.operand]) == baseObject->getDirectOffset(offset));
     2493                ASSERT(baseObject->get(exec, r[RegisterFile::CodeBlock].codeBlock()->identifiers[vPC[3].u.operand]) == baseObject->getDirectOffset(offset));
    24792494                r[dst] = baseObject->getDirectOffset(offset);
    24802495
     
    24842499        }
    24852500
    2486         uncacheGetByID(codeBlock, vPC);
     2501        uncacheGetByID(r[RegisterFile::CodeBlock].codeBlock(), vPC);
    24872502        NEXT_OPCODE;
    24882503    }
     
    25102525                    int offset = vPC[6].u.operand;
    25112526
    2512                     ASSERT(protoObject->get(exec, codeBlock->identifiers[vPC[3].u.operand]) == protoObject->getDirectOffset(offset));
     2527                    ASSERT(protoObject->get(exec, r[RegisterFile::CodeBlock].codeBlock()->identifiers[vPC[3].u.operand]) == protoObject->getDirectOffset(offset));
    25132528                    r[dst] = protoObject->getDirectOffset(offset);
    25142529
     
    25192534        }
    25202535
    2521         uncacheGetByID(codeBlock, vPC);
     2536        uncacheGetByID(r[RegisterFile::CodeBlock].codeBlock(), vPC);
    25222537        NEXT_OPCODE;
    25232538    }
     
    25512566                        int offset = vPC[7].u.operand;
    25522567
    2553                         ASSERT(baseObject->get(exec, codeBlock->identifiers[vPC[3].u.operand]) == baseObject->getDirectOffset(offset));
     2568                        ASSERT(baseObject->get(exec, r[RegisterFile::CodeBlock].codeBlock()->identifiers[vPC[3].u.operand]) == baseObject->getDirectOffset(offset));
    25542569                        r[dst] = baseObject->getDirectOffset(offset);
    25552570
     
    25612576        }
    25622577
    2563         uncacheGetByID(codeBlock, vPC);
     2578        uncacheGetByID(r[RegisterFile::CodeBlock].codeBlock(), vPC);
    25642579        NEXT_OPCODE;
    25652580    }
     
    25742589        int property = vPC[3].u.operand;
    25752590
    2576         Identifier& ident = codeBlock->identifiers[property];
     2591        Identifier& ident = r[RegisterFile::CodeBlock].codeBlock()->identifiers[property];
    25772592
    25782593        JSValue* baseValue = r[base].jsValue(exec);
     
    26022617        }
    26032618
    2604         uncacheGetByID(codeBlock, vPC);
     2619        uncacheGetByID(r[RegisterFile::CodeBlock].codeBlock(), vPC);
    26052620        NEXT_OPCODE;
    26062621    }
     
    26222637        }
    26232638
    2624         uncacheGetByID(codeBlock, vPC);
     2639        uncacheGetByID(r[RegisterFile::CodeBlock].codeBlock(), vPC);
    26252640        NEXT_OPCODE;
    26262641    }
     
    26422657
    26432658        PutPropertySlot slot;
    2644         Identifier& ident = codeBlock->identifiers[property];
     2659        Identifier& ident = r[RegisterFile::CodeBlock].codeBlock()->identifiers[property];
    26452660        baseValue->put(exec, ident, r[value].jsValue(exec), slot);
    26462661        VM_CHECK_EXCEPTION();
    26472662
    2648         tryCachePutByID(exec, codeBlock, vPC, baseValue, slot);
     2663        tryCachePutByID(exec, r[RegisterFile::CodeBlock].codeBlock(), vPC, baseValue, slot);
    26492664
    26502665        vPC += 8;
     
    26792694                while (!proto->isNull()) {
    26802695                    if (UNLIKELY(proto->structureID() != (*it).get())) {
    2681                         uncachePutByID(codeBlock, vPC);
     2696                        uncachePutByID(r[RegisterFile::CodeBlock].codeBlock(), vPC);
    26822697                        NEXT_OPCODE;
    26832698                    }
     
    26922707                int value = vPC[3].u.operand;
    26932708                unsigned offset = vPC[7].u.operand;
    2694                 ASSERT(baseObject->offsetForLocation(baseObject->getDirectLocation(codeBlock->identifiers[vPC[2].u.operand])) == offset);
     2709                ASSERT(baseObject->offsetForLocation(baseObject->getDirectLocation(r[RegisterFile::CodeBlock].codeBlock()->identifiers[vPC[2].u.operand])) == offset);
    26952710                baseObject->putDirectOffset(offset, r[value].jsValue(exec));
    26962711
     
    27002715        }
    27012716       
    2702         uncachePutByID(codeBlock, vPC);
     2717        uncachePutByID(r[RegisterFile::CodeBlock].codeBlock(), vPC);
    27032718        NEXT_OPCODE;
    27042719    }
     
    27272742                unsigned offset = vPC[5].u.operand;
    27282743               
    2729                 ASSERT(baseObject->offsetForLocation(baseObject->getDirectLocation(codeBlock->identifiers[vPC[2].u.operand])) == offset);
     2744                ASSERT(baseObject->offsetForLocation(baseObject->getDirectLocation(r[RegisterFile::CodeBlock].codeBlock()->identifiers[vPC[2].u.operand])) == offset);
    27302745                baseObject->putDirectOffset(offset, r[value].jsValue(exec));
    27312746
     
    27352750        }
    27362751
    2737         uncachePutByID(codeBlock, vPC);
     2752        uncachePutByID(r[RegisterFile::CodeBlock].codeBlock(), vPC);
    27382753        NEXT_OPCODE;
    27392754    }
     
    27542769
    27552770        PutPropertySlot slot;
    2756         Identifier& ident = codeBlock->identifiers[property];
     2771        Identifier& ident = r[RegisterFile::CodeBlock].codeBlock()->identifiers[property];
    27572772        baseValue->put(exec, ident, r[value].jsValue(exec), slot);
    27582773        VM_CHECK_EXCEPTION();
     
    27752790        JSObject* baseObj = r[base].jsValue(exec)->toObject(exec);
    27762791
    2777         Identifier& ident = codeBlock->identifiers[property];
     2792        Identifier& ident = r[RegisterFile::CodeBlock].codeBlock()->identifiers[property];
    27782793        JSValue* result = jsBoolean(baseObj->deleteProperty(exec, ident));
    27792794        VM_CHECK_EXCEPTION();
     
    30923107        else {
    30933108            int32_t value = JSImmediate::getTruncatedInt32(scrutinee);
    3094             vPC += codeBlock->immediateSwitchJumpTables[tableIndex].offsetForValue(value, defaultOffset);
     3109            vPC += r[RegisterFile::CodeBlock].codeBlock()->immediateSwitchJumpTables[tableIndex].offsetForValue(value, defaultOffset);
    30953110        }
    30963111        NEXT_OPCODE;
     
    31153130                vPC += defaultOffset;
    31163131            else
    3117                 vPC += codeBlock->characterSwitchJumpTables[tableIndex].offsetForValue(value->data()[0], defaultOffset);
     3132                vPC += r[RegisterFile::CodeBlock].codeBlock()->characterSwitchJumpTables[tableIndex].offsetForValue(value->data()[0], defaultOffset);
    31183133        }
    31193134        NEXT_OPCODE;
     
    31343149            vPC += defaultOffset;
    31353150        else
    3136             vPC += codeBlock->stringSwitchJumpTables[tableIndex].offsetForValue(static_cast<JSString*>(scrutinee)->value().rep(), defaultOffset);
     3151            vPC += r[RegisterFile::CodeBlock].codeBlock()->stringSwitchJumpTables[tableIndex].offsetForValue(static_cast<JSString*>(scrutinee)->value().rep(), defaultOffset);
    31373152        NEXT_OPCODE;
    31383153    }
     
    31483163        int func = (++vPC)->u.operand;
    31493164
    3150         r[dst] = codeBlock->functions[func]->makeFunction(exec, scopeChain);
     3165        r[dst] = r[RegisterFile::CodeBlock].codeBlock()->functions[func]->makeFunction(exec, scopeChain);
    31513166
    31523167        ++vPC;
     
    31643179        int func = (++vPC)->u.operand;
    31653180
    3166         r[dst] = codeBlock->functionExpressions[func]->makeFunction(exec, scopeChain);
     3181        r[dst] = r[RegisterFile::CodeBlock].codeBlock()->functionExpressions[func]->makeFunction(exec, scopeChain);
    31673182
    31683183        ++vPC;
     
    31923207
    31933208        if (baseVal == scopeChain->globalObject() && funcVal == scopeChain->globalObject()->evalFunction()) {
    3194             JSObject* thisObject = static_cast<JSObject*>(r[codeBlock->thisRegister].jsValue(exec));
    3195             JSValue* result = callEval(exec, codeBlock, thisObject, scopeChain, registerFile, r, firstArg, argCount, exceptionValue);
     3209            JSObject* thisObject = static_cast<JSObject*>(r[r[RegisterFile::CodeBlock].codeBlock()->thisRegister].jsValue(exec));
     3210            JSValue* result = callEval(exec, thisObject, scopeChain, registerFile, r, firstArg, argCount, exceptionValue);
    31963211            if (exceptionValue)
    31973212                goto vm_throw;
     
    32793294                goto vm_throw;
    32803295
    3281             initializeCallFrame(r, codeBlock, vPC, scopeChain, savedR, dst, argCount, v);
     3296            initializeCallFrame(r, newCodeBlock, vPC, scopeChain, savedR, dst, argCount, v);
    32823297            exec->m_callFrame = r;
    32833298   
     
    32853300                (*enabledProfilerReference)->willExecute(exec, static_cast<JSObject*>(v));
    32863301
    3287             codeBlock = newCodeBlock;
    32883302            setScopeChain(exec, scopeChain, callDataScopeChain);
    3289             vPC = codeBlock->instructions.begin();
     3303            vPC = newCodeBlock->instructions.begin();
    32903304
    32913305#if DUMP_OPCODE_STATS
     
    33003314            ArgList args(r + firstArg + 1, argCount - 1);
    33013315
    3302             initializeCallFrame(r + registerOffset, codeBlock, vPC, scopeChain, r, dst, argCount, v);
     3316            initializeCallFrame(r + registerOffset, 0, vPC, scopeChain, r, dst, argCount, v);
    33033317            exec->m_callFrame = r + registerOffset;
    33043318
     
    33233337        ASSERT(callType == CallTypeNone);
    33243338
    3325         exceptionValue = createNotAFunctionError(exec, v, vPC, codeBlock);
     3339        exceptionValue = createNotAFunctionError(exec, v, vPC, r[RegisterFile::CodeBlock].codeBlock());
    33263340        goto vm_throw;
    33273341    }
     
    33393353
    33403354        if (JSActivation* activation = static_cast<JSActivation*>(r[RegisterFile::OptionalCalleeActivation].jsValue(exec))) {
    3341             ASSERT(!codeBlock->needsFullScopeChain || scopeChain->object == activation);
     3355            ASSERT(!r[RegisterFile::CodeBlock].codeBlock()->needsFullScopeChain || scopeChain->object == activation);
    33423356            ASSERT(activation->isActivationObject());
    33433357            activation->copyRegisters();
     
    33473361            (*enabledProfilerReference)->didExecute(exec, static_cast<JSObject*>(r[RegisterFile::Callee].jsValue(exec)));
    33483362
    3349         if (codeBlock->needsFullScopeChain)
     3363        if (r[RegisterFile::CodeBlock].codeBlock()->needsFullScopeChain)
    33503364            scopeChain->deref();
    33513365
    33523366        JSValue* returnValue = r[result].jsValue(exec);
    3353 
    3354         codeBlock = r[RegisterFile::CallerCodeBlock].codeBlock();
    3355         if (!codeBlock)
    3356             return returnValue;
    33573367
    33583368        vPC = r[RegisterFile::ReturnPC].vPC();
     
    33613371        r = r[RegisterFile::CallerRegisters].r();
    33623372        exec->m_callFrame = r;
     3373       
     3374        if (!r)
     3375            return returnValue;
     3376
    33633377        r[dst] = returnValue;
    33643378
     
    33673381    BEGIN_OPCODE(op_init) {
    33683382        size_t i = 0;
    3369 
     3383        CodeBlock* codeBlock = r[RegisterFile::CodeBlock].codeBlock();
     3384       
    33703385        for (size_t count = codeBlock->numVars; i < count; ++i)
    33713386            r[i] = jsUndefined();
     
    33793394    BEGIN_OPCODE(op_init_activation) {
    33803395        size_t i = 0;
     3396        CodeBlock* codeBlock = r[RegisterFile::CodeBlock].codeBlock();
    33813397
    33823398        for (size_t count = codeBlock->numVars; i < count; ++i)
     
    34443460                goto vm_throw;
    34453461
    3446             initializeCallFrame(r, codeBlock, vPC, scopeChain, savedR, dst, argCount, v);
     3462            initializeCallFrame(r, newCodeBlock, vPC, scopeChain, savedR, dst, argCount, v);
    34473463            exec->m_callFrame = r;
    34483464   
     
    34503466                (*enabledProfilerReference)->didExecute(exec, static_cast<JSObject*>(v));
    34513467
    3452             codeBlock = newCodeBlock;
    34533468            setScopeChain(exec, scopeChain, callDataScopeChain);
    3454             vPC = codeBlock->instructions.begin();
     3469            vPC = newCodeBlock->instructions.begin();
    34553470
    34563471#if DUMP_OPCODE_STATS
     
    34643479            ArgList args(r + firstArg + 1, argCount - 1);
    34653480
    3466             initializeCallFrame(r + registerOffset, codeBlock, vPC, scopeChain, r, dst, argCount, v);
     3481            initializeCallFrame(r + registerOffset, 0, vPC, scopeChain, r, dst, argCount, v);
    34673482            exec->m_callFrame = r + registerOffset;
    34683483
     
    34873502        ASSERT(constructType == ConstructTypeNone);
    34883503
    3489         exceptionValue = createNotAConstructorError(exec, v, vPC, codeBlock);
     3504        exceptionValue = createNotAConstructorError(exec, v, vPC, r[RegisterFile::CodeBlock].codeBlock());
    34903505        goto vm_throw;
    34913506    }
     
    36043619           in dst for GC.
    36053620         */
    3606         setScopeChain(exec, scopeChain, createExceptionScope(exec, codeBlock, vPC, r, scopeChain));
     3621        setScopeChain(exec, scopeChain, createExceptionScope(exec, vPC, r, scopeChain));
    36073622        vPC += 4;
    36083623        NEXT_OPCODE;
     
    36413656        exceptionValue = r[ex].jsValue(exec);
    36423657
    3643         handlerVPC = throwException(exec, exceptionValue, vPC, codeBlock, scopeChain, r, true);
     3658        handlerVPC = throwException(exec, exceptionValue, vPC, scopeChain, r, true);
    36443659        if (!handlerVPC) {
    36453660            *exception = exceptionValue;
     
    36663681        int dst = (++vPC)->u.operand;
    36673682        int src = (++vPC)->u.operand;
    3668         r[dst] = codeBlock->unexpectedConstants[src];
     3683        r[dst] = r[RegisterFile::CodeBlock].codeBlock()->unexpectedConstants[src];
    36693684
    36703685        ++vPC;
     
    36833698        int message = (++vPC)->u.operand;
    36843699
     3700        CodeBlock* codeBlock = r[RegisterFile::CodeBlock].codeBlock();
    36853701        r[dst] = Error::create(exec, (ErrorType)type, codeBlock->unexpectedConstants[message]->toString(exec), codeBlock->lineNumberForVPC(vPC), codeBlock->ownerNode->sourceId(), codeBlock->ownerNode->sourceURL());
    36863702
     
    36953711        */
    36963712
    3697         if (codeBlock->needsFullScopeChain) {
     3713        if (r[RegisterFile::CodeBlock].codeBlock()->needsFullScopeChain) {
    36983714            ASSERT(scopeChain->refCount > 1);
    36993715            scopeChain->deref();
     
    37193735        ASSERT(r[base].jsValue(exec)->isObject());
    37203736        JSObject* baseObj = static_cast<JSObject*>(r[base].jsValue(exec));
    3721         Identifier& ident = codeBlock->identifiers[property];
     3737        Identifier& ident = r[RegisterFile::CodeBlock].codeBlock()->identifiers[property];
    37223738        ASSERT(r[function].jsValue(exec)->isObject());
    37233739        baseObj->defineGetter(exec, ident, static_cast<JSObject*>(r[function].jsValue(exec)));
     
    37433759        ASSERT(r[base].jsValue(exec)->isObject());
    37443760        JSObject* baseObj = static_cast<JSObject*>(r[base].jsValue(exec));
    3745         Identifier& ident = codeBlock->identifiers[property];
     3761        Identifier& ident = r[RegisterFile::CodeBlock].codeBlock()->identifiers[property];
    37463762        ASSERT(r[function].jsValue(exec)->isObject());
    37473763        baseObj->defineSetter(exec, ident, static_cast<JSObject*>(r[function].jsValue(exec)));
     
    37843800        int lastLine = (++vPC)->u.operand;
    37853801
    3786         debug(exec, codeBlock, scopeChain, r, static_cast<DebugHookID>(debugHookID), firstLine, lastLine);
     3802        debug(exec, scopeChain, r, static_cast<DebugHookID>(debugHookID), firstLine, lastLine);
    37873803
    37883804        ++vPC;
     
    37963812            exceptionValue = createInterruptedExecutionException(exec);
    37973813        }
    3798         handlerVPC = throwException(exec, exceptionValue, vPC, codeBlock, scopeChain, r, false);
     3814        handlerVPC = throwException(exec, exceptionValue, vPC, scopeChain, r, false);
    37993815        if (!handlerVPC) {
    38003816            *exception = exceptionValue;
     
    38283844JSValue* Machine::retrieveCaller(ExecState* exec, InternalFunction* function) const
    38293845{
    3830     Register* callFrame = this->callFrame(exec, function);
    3831     if (!callFrame)
     3846    Register* r = this->callFrame(exec, function);
     3847    if (!r)
    38323848        return jsNull();
    38333849
    3834     CodeBlock* callerCodeBlock = callFrame[RegisterFile::CallerCodeBlock].codeBlock();
    3835     if (!callerCodeBlock)
     3850    Register* callerR = r[RegisterFile::CallerRegisters].r();
     3851    if (!callerR)
    38363852        return jsNull();
    38373853
    3838     Register* callerCallFrame = callFrame[RegisterFile::CallerRegisters].r();
    3839     if (JSValue* caller = callerCallFrame[RegisterFile::Callee].jsValue(exec))
    3840         return caller;
    3841 
    3842     return jsNull();
     3854    JSValue* caller = callerR[RegisterFile::Callee].jsValue(exec);
     3855    if (!caller)
     3856        return jsNull();
     3857
     3858    return caller;
    38433859}
    38443860
     
    38493865    sourceURL = UString();
    38503866
    3851     Register* callFrame = exec->m_callFrame;
    3852     if (!callFrame)
     3867    Register* r = exec->m_callFrame;
     3868    if (!r)
    38533869        return;
    38543870
    3855     CodeBlock* callerCodeBlock = callFrame[RegisterFile::CallerCodeBlock].codeBlock();
    3856     if (!callerCodeBlock)
     3871    Register* callerR = r[RegisterFile::CallerRegisters].r();
     3872    if (!callerR)
    38573873        return;
    38583874
    3859     Instruction* vPC = vPCForPC(callerCodeBlock, callFrame[RegisterFile::ReturnPC].v());
     3875    CodeBlock* callerCodeBlock = callerR[RegisterFile::CodeBlock].codeBlock();
     3876    Instruction* vPC = vPCForPC(callerCodeBlock, r[RegisterFile::ReturnPC].v());
    38603877    lineNumber = callerCodeBlock->lineNumberForVPC(vPC - 1);
    38613878    sourceId = callerCodeBlock->ownerNode->sourceId();
    38623879    sourceURL = callerCodeBlock->ownerNode->sourceURL();
    38633880
    3864     JSValue* callee = callFrame[RegisterFile::Callee].getJSValue();
    3865     if (callee->toThisObject(exec)->inherits(&InternalFunction::info))
    3866         function = retrieveCaller(exec, static_cast<InternalFunction*>(callee));
     3881    JSValue* caller = callerR[RegisterFile::Callee].getJSValue();
     3882    if (!caller)
     3883        return;
     3884
     3885    function = caller;
    38673886}
    38683887
     
    38823901            return callFrame;
    38833902
    3884         CodeBlock* callerCodeBlock = callFrame[RegisterFile::CallerCodeBlock].codeBlock();
    3885         if (!callerCodeBlock) {
    3886             callFrame = 0;
    3887             continue;
    3888         }
    3889        
    38903903        callFrame = callFrame[RegisterFile::CallerRegisters].r();
    38913904    }
     
    42514264    baseValue->put(exec, ident, ARG_src3, slot);
    42524265
    4253     exec->machine()->tryCTICachePutByID(exec, ARG_codeBlock, CTI_RETURN_ADDRESS, baseValue, slot);
     4266    exec->machine()->tryCTICachePutByID(exec, ARG_r[RegisterFile::CodeBlock].codeBlock(), CTI_RETURN_ADDRESS, baseValue, slot);
    42544267
    42554268    VM_CHECK_EXCEPTION_AT_END();
     
    43054318    JSValue* result = baseValue->get(exec, ident, slot);
    43064319
    4307     exec->machine()->tryCTICacheGetByID(exec, ARG_codeBlock, CTI_RETURN_ADDRESS, baseValue, ident, slot);
     4320    exec->machine()->tryCTICacheGetByID(exec, ARG_r[RegisterFile::CodeBlock].codeBlock(), CTI_RETURN_ADDRESS, baseValue, ident, slot);
    43084321
    43094322    VM_CHECK_EXCEPTION_AT_END();
     
    43564369
    43574370    if (!baseVal->isObject()) {
    4358         CodeBlock* codeBlock = ARG_codeBlock;
     4371        CodeBlock* codeBlock = ARG_r[RegisterFile::CodeBlock].codeBlock();
    43594372        ASSERT(codeBlock->ctiReturnAddressVPCMap.contains(CTI_RETURN_ADDRESS));
    43604373        unsigned vPCIndex = codeBlock->ctiReturnAddressVPCMap.get(CTI_RETURN_ADDRESS);
     
    44454458    JSVALUE_VM_CHECK_EXCEPTION_ARG(exceptionValue);
    44464459
    4447     // RegisterFile::CallerCodeBlock is set by caller
     4460    r[RegisterFile::CodeBlock] = newCodeBlock;
    44484461    r[RegisterFile::CallerScopeChain] = ARG_scopeChain;
    44494462    r[RegisterFile::CallerRegisters] = savedR;
     
    44584471
    44594472    ARG_setScopeChain(callDataScopeChain);
    4460     ARG_setCodeBlock(newCodeBlock);
    44614473    ARG_setR(r);
    44624474    return newCodeBlock->ctiCode;
     
    44664478{
    44674479    ExecState* exec = ARG_exec;
    4468     CodeBlock* codeBlock = ARG_codeBlock;
     4480    CodeBlock* codeBlock = ARG_r[RegisterFile::CodeBlock].codeBlock();
    44694481
    44704482    if (!codeBlock->ctiCode)
     
    44774489{
    44784490    ExecState* exec = ARG_exec;
    4479     CodeBlock* codeBlock = ARG_codeBlock;
     4491    CodeBlock* codeBlock = ARG_r[RegisterFile::CodeBlock].codeBlock();
    44804492    ScopeChainNode* scopeChain = ARG_scopeChain;
    44814493    Register* r = ARG_r;
     
    45044516        Register* r = ARG_r + registerOffset;
    45054517       
    4506         initializeCallFrame(r, ARG_codeBlock, ARG_instr4, ARG_scopeChain, ARG_r, 0, argCount, funcVal);
     4518        initializeCallFrame(r, 0, ARG_instr4, ARG_scopeChain, ARG_r, 0, argCount, funcVal);
    45074519        exec->m_callFrame = r;
    45084520
     
    45274539    ASSERT(callType == CallTypeNone);
    45284540
    4529     exec->setException(createNotAFunctionError(exec, funcVal, ARG_instr4, ARG_codeBlock));
     4541    exec->setException(createNotAFunctionError(exec, funcVal, ARG_instr4, ARG_r[RegisterFile::CodeBlock].codeBlock()));
    45304542    VM_CHECK_EXCEPTION_AT_END();
    45314543    return 0;
     
    45404552    ASSERT(activation);
    45414553
    4542     ASSERT(!ARG_codeBlock->needsFullScopeChain || ARG_scopeChain->object == activation);
     4554    ASSERT(!ARG_r[RegisterFile::CodeBlock].codeBlock()->needsFullScopeChain || ARG_scopeChain->object == activation);
    45434555    ASSERT(activation->isActivationObject());
    45444556    activation->copyRegisters();
     
    45564568void Machine::cti_op_ret_scopeChain(CTI_ARGS)
    45574569{
    4558     ASSERT(ARG_codeBlock->needsFullScopeChain);
     4570    ASSERT(ARG_r[RegisterFile::CodeBlock].codeBlock()->needsFullScopeChain);
    45594571    ARG_scopeChain->deref();
    45604572}
     
    45864598    } while (++iter != end);
    45874599
    4588     CodeBlock* codeBlock = ARG_codeBlock;
     4600    CodeBlock* codeBlock = ARG_r[RegisterFile::CodeBlock].codeBlock();
    45894601    ASSERT(codeBlock->ctiReturnAddressVPCMap.contains(CTI_RETURN_ADDRESS));
    45904602    unsigned vPCIndex = codeBlock->ctiReturnAddressVPCMap.get(CTI_RETURN_ADDRESS);
     
    46384650    JSVALUE_VM_CHECK_EXCEPTION_ARG(exceptionValue);
    46394651
    4640     // RegisterFile::CallerCodeBlock is set by caller
     4652    r[RegisterFile::CodeBlock] = newCodeBlock;
    46414653    r[RegisterFile::CallerScopeChain] = ARG_scopeChain;
    46424654    r[RegisterFile::CallerRegisters] = savedR;
     
    46514663
    46524664    ARG_setScopeChain(callDataScopeChain);
    4653     ARG_setCodeBlock(newCodeBlock);
    46544665    ARG_setR(r);
    46554666    return newCodeBlock->ctiCode;
     
    46894700    ASSERT(constructType == ConstructTypeNone);
    46904701
    4691     exec->setException(createNotAConstructorError(exec, constrVal, ARG_instr6, ARG_codeBlock));
     4702    exec->setException(createNotAConstructorError(exec, constrVal, ARG_instr6, r[RegisterFile::CodeBlock].codeBlock()));
    46924703    VM_CHECK_EXCEPTION_AT_END();
    46934704    return 0;
     
    47614772    } while (iter != end);
    47624773
    4763     CodeBlock* codeBlock = ARG_codeBlock;
     4774    CodeBlock* codeBlock = ARG_r[RegisterFile::CodeBlock].codeBlock();
    47644775    ASSERT(codeBlock->ctiReturnAddressVPCMap.contains(CTI_RETURN_ADDRESS));
    47654776    unsigned vPCIndex = codeBlock->ctiReturnAddressVPCMap.get(CTI_RETURN_ADDRESS);
     
    49084919    } while (++iter != end);
    49094920
    4910     CodeBlock* codeBlock = ARG_codeBlock;
     4921    CodeBlock* codeBlock = ARG_r[RegisterFile::CodeBlock].codeBlock();
    49114922    ASSERT(codeBlock->ctiReturnAddressVPCMap.contains(CTI_RETURN_ADDRESS));
    49124923    unsigned vPCIndex = codeBlock->ctiReturnAddressVPCMap.get(CTI_RETURN_ADDRESS);
     
    49414952    }
    49424953   
    4943     exec->setException(createUndefinedVariableError(exec, ident, vPC, ARG_codeBlock));
     4954    exec->setException(createUndefinedVariableError(exec, ident, vPC, ARG_r[RegisterFile::CodeBlock].codeBlock()));
    49444955   
    49454956    VM_CHECK_EXCEPTION_AT_END();
     
    51315142    } while (iter != end);
    51325143
    5133     CodeBlock* codeBlock = ARG_codeBlock;
     5144    CodeBlock* codeBlock = ARG_r[RegisterFile::CodeBlock].codeBlock();
    51345145    ASSERT(codeBlock->ctiReturnAddressVPCMap.contains(CTI_RETURN_ADDRESS));
    51355146    unsigned vPCIndex = codeBlock->ctiReturnAddressVPCMap.get(CTI_RETURN_ADDRESS);
     
    52415252    RegisterFile* registerFile = ARG_registerFile;
    52425253    Register* r = ARG_r;
    5243     CodeBlock* codeBlock = ARG_codeBlock;
     5254    CodeBlock* codeBlock = r[RegisterFile::CodeBlock].codeBlock();
    52445255    ScopeChainNode* scopeChain = ARG_scopeChain;
    52455256
     
    52545265        JSObject* thisObject = static_cast<JSObject*>(r[codeBlock->thisRegister].jsValue(exec));
    52555266        JSValue* exceptionValue = 0;
    5256         JSValue* result = machine->callEval(exec, codeBlock, thisObject, scopeChain, registerFile,  r, registerOffset - RegisterFile::CallFrameHeaderSize - argCount, argCount, exceptionValue);
     5267        JSValue* result = machine->callEval(exec, thisObject, scopeChain, registerFile,  r, registerOffset - RegisterFile::CallFrameHeaderSize - argCount, argCount, exceptionValue);
    52575268        JSVALUE_VM_CHECK_EXCEPTION_ARG(exceptionValue);
    52585269        return result;
     
    52655276{
    52665277    ExecState* exec = ARG_exec;
    5267     CodeBlock* codeBlock = ARG_codeBlock;
    52685278    ScopeChainNode* scopeChain = ARG_scopeChain;
    52695279    Register* r = ARG_r;
     5280    CodeBlock* codeBlock = r[RegisterFile::CodeBlock].codeBlock();
    52705281
    52715282    ASSERT(codeBlock->ctiReturnAddressVPCMap.contains(CTI_RETURN_ADDRESS));
     
    52735284
    52745285    JSValue* exceptionValue = ARG_src1;
    5275     Instruction* handlerVPC = ARG_exec->machine()->throwException(exec, exceptionValue, codeBlock->instructions.begin() + vPCIndex, codeBlock, scopeChain, r, true);
     5286    Instruction* handlerVPC = ARG_exec->machine()->throwException(exec, exceptionValue, codeBlock->instructions.begin() + vPCIndex, scopeChain, r, true);
    52765287
    52775288    if (handlerVPC) {
    52785289        exec->setException(exceptionValue);
    52795290        ARG_setScopeChain(scopeChain);
    5280         ARG_setCodeBlock(codeBlock);
    52815291        ARG_setR(r);
    52825292
    5283         void* catchRoutine = codeBlock->nativeExceptionCodeForHandlerVPC(handlerVPC);
     5293        void* catchRoutine = r[RegisterFile::CodeBlock].codeBlock()->nativeExceptionCodeForHandlerVPC(handlerVPC);
    52845294        ASSERT(catchRoutine);
    52855295        ctiSetReturnAddress(&CTI_RETURN_ADDRESS, catchRoutine);
     
    54045414
    54055415    if (!baseVal->isObject()) {
    5406         CodeBlock* codeBlock = ARG_codeBlock;
     5416        CodeBlock* codeBlock = ARG_r[RegisterFile::CodeBlock].codeBlock();
    54075417        ASSERT(codeBlock->ctiReturnAddressVPCMap.contains(CTI_RETURN_ADDRESS));
    54085418        unsigned vPCIndex = codeBlock->ctiReturnAddressVPCMap.get(CTI_RETURN_ADDRESS);
     
    54615471    unsigned tableIndex = ARG_int2;
    54625472
    5463     CodeBlock* codeBlock = ARG_codeBlock;
     5473    CodeBlock* codeBlock = ARG_r[RegisterFile::CodeBlock].codeBlock();
    54645474
    54655475    if (JSImmediate::isNumber(scrutinee)) {
     
    54765486    unsigned tableIndex = ARG_int2;
    54775487
    5478     CodeBlock* codeBlock = ARG_codeBlock;
     5488    CodeBlock* codeBlock = ARG_r[RegisterFile::CodeBlock].codeBlock();
    54795489
    54805490    void* result = codeBlock->characterSwitchJumpTables[tableIndex].ctiDefault;
     
    54945504    unsigned tableIndex = ARG_int2;
    54955505
    5496     CodeBlock* codeBlock = ARG_codeBlock;
     5506    CodeBlock* codeBlock = ARG_r[RegisterFile::CodeBlock].codeBlock();
    54975507
    54985508    void* result = codeBlock->stringSwitchJumpTables[tableIndex].ctiDefault;
     
    55545564{
    55555565    ExecState* exec = ARG_exec;
    5556     CodeBlock* codeBlock = ARG_codeBlock;
     5566    CodeBlock* codeBlock = ARG_r[RegisterFile::CodeBlock].codeBlock();
    55575567    unsigned type = ARG_int1;
    55585568    JSValue* message = ARG_src2;
     
    55655575{
    55665576    ExecState* exec = ARG_exec;
    5567     CodeBlock* codeBlock = ARG_codeBlock;
    55685577    ScopeChainNode* scopeChain = ARG_scopeChain;
    55695578    Register* r = ARG_r;
     
    55735582    int lastLine = ARG_int3;
    55745583
    5575     exec->machine()->debug(exec, codeBlock, scopeChain, r, static_cast<DebugHookID>(debugHookID), firstLine, lastLine);
     5584    exec->machine()->debug(exec, scopeChain, r, static_cast<DebugHookID>(debugHookID), firstLine, lastLine);
    55765585}
    55775586
     
    55795588{
    55805589    ExecState* exec = ARG_exec;
    5581     CodeBlock* codeBlock = ARG_codeBlock;
    55825590    ScopeChainNode* scopeChain = ARG_scopeChain;
    55835591    Register* r = ARG_r;
     5592    CodeBlock* codeBlock = r[RegisterFile::CodeBlock].codeBlock();
    55845593
    55855594    ASSERT(codeBlock->ctiReturnAddressVPCMap.contains(exec->ctiReturnAddress()));
     
    55905599    JSValue* exceptionValue = exec->exception();
    55915600
    5592     Instruction* handlerVPC = ARG_exec->machine()->throwException(exec, exceptionValue, codeBlock->instructions.begin() + vPCIndex, codeBlock, scopeChain, r, false);
     5601    Instruction* handlerVPC = ARG_exec->machine()->throwException(exec, exceptionValue, codeBlock->instructions.begin() + vPCIndex, scopeChain, r, false);
    55935602
    55945603    if (handlerVPC) {
    55955604        exec->setException(exceptionValue);
    55965605        ARG_setScopeChain(scopeChain);
    5597         ARG_setCodeBlock(codeBlock);
    55985606        ARG_setR(r);
    55995607
    5600         void* catchRoutine = codeBlock->nativeExceptionCodeForHandlerVPC(handlerVPC);
     5608        void* catchRoutine = r[RegisterFile::CodeBlock].codeBlock()->nativeExceptionCodeForHandlerVPC(handlerVPC);
    56015609        ASSERT(catchRoutine);
    56025610        ctiSetReturnAddress(&CTI_RETURN_ADDRESS, catchRoutine);
Note: See TracChangeset for help on using the changeset viewer.