Changeset 36997 in webkit for trunk/JavaScriptCore
- Timestamp:
- Sep 27, 2008, 10:19:39 AM (17 years ago)
- Location:
- trunk/JavaScriptCore
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/ChangeLog
r36989 r36997 1 2008-09-27 Geoffrey Garen <[email protected]> 2 3 Reviewed by Cameron Zwarich. 4 5 Store the callee CodeBlock, not the caller CodeBlock, in the call frame 6 header. Nix the "codeBlock" local variable, and access the callee 7 CodeBlock through the call frame header instead. 8 9 Profit: call + return are simpler, because they don't have to update the 10 "codeBlock" local variable. 11 12 Because CTI keeps "r" in a register, reading the callee CodeBlock relative 13 to "r" can be very fast, in any cases we care to optimize. Presently, 14 no such cases seem important. 15 16 Also, stop writing "dst" to the call frame header. CTI doesn't use it. 17 18 21.6% speedup on empty function call benchmark. 19 3.8% speedup on SunSpider --v8. 20 2.1% speedup on v8 benchmark. 21 0.7% speedup on SunSpider (6% speedup on controlflow-recursive). 22 23 Small regression in bytecode, because currently every op_ret reads the 24 callee CodeBlock to check needsFullScopeChain, and bytecode does not 25 keep "r" in a register. On-balance, this is probably OK, since CTI is 26 our high-performance execution model. Also, this should go away once 27 we make needsFullScopeChain statically determinable at parse time. 28 29 * VM/CTI.cpp: 30 (JSC::CTI::compileOpCall): The speedup! 31 (JSC::CTI::privateCompileSlowCases): ditto 32 33 * VM/CTI.h: 34 (JSC::): Fixed up magic trampoline constants to account for the nixed 35 "codeBlock" argument. 36 (JSC::CTI::execute): Changed trampoline function not to take a "codeBlock" 37 argument, since codeBlock is now stored in the call frame header. 38 39 * VM/Machine.cpp: Read the callee CodeBlock from the register file. Use 40 a NULL CallerRegisters in the call frame header to signal a built-in 41 caller, since CodeBlock is now never NULL. 42 43 * VM/Machine.h: Made some stand-alone functions Machine member functions 44 so they could call the private codeBlock() accessor in the Register 45 class, of which Machine is a friend. Renamed "CallerCodeBlock" to 46 "CodeBlock", since it's no longer the caller's CodeBlock. 47 48 * VM/RegisterFile.h: Marked some methods const to accommodate a 49 const RegisterFile* being passed around in Machine.cpp. 50 1 51 2008-09-26 Jan Michael Alonzo <[email protected]> 2 52 -
trunk/JavaScriptCore/VM/CTI.cpp
r36976 r36997 538 538 emitCall(i, ((type == OpConstruct) ? Machine::cti_op_construct_JSConstruct : Machine::cti_op_call_JSFunction)); 539 539 540 // Initialize the parts of the call frame that have not already been initialized.541 emitGetCTIParam(CTI_ARGS_r, X86::edi);542 m_jit.movl_i32m(reinterpret_cast<unsigned>(m_codeBlock), RegisterFile::CallerCodeBlock * static_cast<int>(sizeof(Register)), X86::edi);543 m_jit.movl_i32m(dst, RegisterFile::ReturnValueRegister * static_cast<int>(sizeof(Register)), X86::edi);544 545 540 // Check the ctiCode has been generated - if not, this is handled in a slow case. 546 541 m_jit.testl_rr(X86::eax, X86::eax); … … 548 543 emitCall(i, X86::eax); 549 544 550 // Restore CTI_ARGS_codeBlock. In the interpreter, op_ret does this.551 emitPutCTIParam(m_codeBlock, CTI_ARGS_codeBlock);552 553 545 X86Assembler::JmpDst end = m_jit.label(); 554 546 m_jit.link(wasNotJSFunction, end); … … 2489 2481 // Instead of checking for 0 we could initialize the CodeBlock::ctiCode to point to a trampoline that would trigger the translation. 2490 2482 2491 // Restore CTI_ARGS_codeBlock. In the interpreter, op_ret does this.2492 emitPutCTIParam(m_codeBlock, CTI_ARGS_codeBlock);2493 2494 2483 // Put the return value in dst. In the interpreter, op_ret does this. 2495 2484 emitPutResult(instruction[i + 1].u.operand); -
trunk/JavaScriptCore/VM/CTI.h
r36976 r36997 57 57 #define CTI_ARGS_r 0x0F 58 58 #define CTI_ARGS_scopeChain 0x10 59 #define CTI_ARGS_codeBlock 0x11 60 #define CTI_ARGS_exception 0x12 61 #define CTI_ARGS_profilerReference 0x13 59 #define CTI_ARGS_exception 0x11 60 #define CTI_ARGS_profilerReference 0x12 62 61 #define ARG_exec ((ExecState*)(ARGS)[CTI_ARGS_exec]) 63 62 #define ARG_registerFile ((RegisterFile*)(ARGS)[CTI_ARGS_registerFile]) 64 63 #define ARG_r ((Register*)(ARGS)[CTI_ARGS_r]) 65 64 #define ARG_scopeChain ((ScopeChainNode*)(ARGS)[CTI_ARGS_scopeChain]) 66 #define ARG_codeBlock ((CodeBlock*)(ARGS)[CTI_ARGS_codeBlock])67 65 #define ARG_exception ((JSValue**)(ARGS)[CTI_ARGS_exception]) 68 66 #define ARG_profilerReference ((Profiler**)(ARGS)[CTI_ARGS_profilerReference]) 69 67 70 68 #define ARG_setScopeChain(newScopeChain) (*(volatile ScopeChainNode**)&(ARGS)[CTI_ARGS_scopeChain] = newScopeChain) 71 #define ARG_setCodeBlock(newCodeBlock) (*(volatile CodeBlock**)&(ARGS)[CTI_ARGS_codeBlock] = newCodeBlock)72 69 #define ARG_setR(newR) (*(volatile Register**)&(ARGS)[CTI_ARGS_r] = newR) 73 70 #define ARG_set2ndResult(new2ndResult) (*(volatile JSValue**)&(ARGS)[CTI_ARGS_2ndResult] = new2ndResult) … … 239 236 240 237 extern "C" { 241 JSValue* ctiTrampoline(void* code, ExecState* exec, RegisterFile* registerFile, Register* r, ScopeChainNode* scopeChain, CodeBlock* codeBlock,JSValue** exception, Profiler**);238 JSValue* ctiTrampoline(void* code, ExecState* exec, RegisterFile* registerFile, Register* r, ScopeChainNode* scopeChain, JSValue** exception, Profiler**); 242 239 void ctiVMThrowTrampoline(); 243 240 }; … … 323 320 } 324 321 325 inline static JSValue* execute(void* code, ExecState* exec, RegisterFile* registerFile, Register* r, ScopeChainNode* scopeChain, CodeBlock* codeBlock,JSValue** exception)326 { 327 JSValue* value = ctiTrampoline(code, exec, registerFile, r, scopeChain, codeBlock,exception, Profiler::enabledProfilerReference());322 inline static JSValue* execute(void* code, ExecState* exec, RegisterFile* registerFile, Register* r, ScopeChainNode* scopeChain, JSValue** exception) 323 { 324 JSValue* value = ctiTrampoline(code, exec, registerFile, r, scopeChain, exception, Profiler::enabledProfilerReference()); 328 325 #if ENABLE(SAMPLING_TOOL) 329 326 currentOpcodeID = static_cast<OpcodeID>(-1); -
trunk/JavaScriptCore/VM/Machine.cpp
r36976 r36997 305 305 } 306 306 307 static bool NEVER_INLINE resolve(ExecState* exec, Instruction* vPC, Register* r, ScopeChainNode* scopeChain, CodeBlock* codeBlock, JSValue*& exceptionValue)307 NEVER_INLINE bool Machine::resolve(ExecState* exec, Instruction* vPC, Register* r, ScopeChainNode* scopeChain, JSValue*& exceptionValue) 308 308 { 309 309 int dst = (vPC + 1)->u.operand; … … 314 314 ASSERT(iter != end); 315 315 316 CodeBlock* codeBlock = r[RegisterFile::CodeBlock].codeBlock(); 316 317 Identifier& ident = codeBlock->identifiers[property]; 317 318 do { … … 331 332 } 332 333 333 static bool NEVER_INLINE resolveSkip(ExecState* exec, Instruction* vPC, Register* r, ScopeChainNode* scopeChain, CodeBlock* codeBlock, JSValue*& exceptionValue) 334 { 334 NEVER_INLINE bool Machine::resolveSkip(ExecState* exec, Instruction* vPC, Register* r, ScopeChainNode* scopeChain, JSValue*& exceptionValue) 335 { 336 CodeBlock* codeBlock = r[RegisterFile::CodeBlock].codeBlock(); 337 335 338 int dst = (vPC + 1)->u.operand; 336 339 int property = (vPC + 2)->u.operand; … … 361 364 } 362 365 363 static bool NEVER_INLINE resolveGlobal(ExecState* exec, Instruction* vPC, Register* r, CodeBlock* codeBlock, JSValue*& exceptionValue)366 NEVER_INLINE bool Machine::resolveGlobal(ExecState* exec, Instruction* vPC, Register* r, JSValue*& exceptionValue) 364 367 { 365 368 int dst = (vPC + 1)->u.operand; … … 375 378 } 376 379 380 CodeBlock* codeBlock = r[RegisterFile::CodeBlock].codeBlock(); 377 381 Identifier& ident = codeBlock->identifiers[property]; 378 382 PropertySlot slot(globalObject); … … 423 427 } 424 428 425 NEVER_INLINE static void resolveBase(ExecState* exec, Instruction* vPC, Register* r, ScopeChainNode* scopeChain, CodeBlock* codeBlock)429 NEVER_INLINE void Machine::resolveBase(ExecState* exec, Instruction* vPC, Register* r, ScopeChainNode* scopeChain) 426 430 { 427 431 int dst = (vPC + 1)->u.operand; 428 432 int property = (vPC + 2)->u.operand; 433 CodeBlock* codeBlock = r[RegisterFile::CodeBlock].codeBlock(); 429 434 r[dst] = inlineResolveBase(exec, codeBlock->identifiers[property], scopeChain); 430 435 } 431 436 432 static bool NEVER_INLINE resolveBaseAndProperty(ExecState* exec, Instruction* vPC, Register* r, ScopeChainNode* scopeChain, CodeBlock* codeBlock, JSValue*& exceptionValue)437 NEVER_INLINE bool Machine::resolveBaseAndProperty(ExecState* exec, Instruction* vPC, Register* r, ScopeChainNode* scopeChain, JSValue*& exceptionValue) 433 438 { 434 439 int baseDst = (vPC + 1)->u.operand; … … 443 448 ASSERT(iter != end); 444 449 450 CodeBlock* codeBlock = r[RegisterFile::CodeBlock].codeBlock(); 445 451 Identifier& ident = codeBlock->identifiers[property]; 446 452 JSObject* base; … … 464 470 } 465 471 466 static bool NEVER_INLINE resolveBaseAndFunc(ExecState* exec, Instruction* vPC, Register* r, ScopeChainNode* scopeChain, CodeBlock* codeBlock, JSValue*& exceptionValue)472 NEVER_INLINE bool Machine::resolveBaseAndFunc(ExecState* exec, Instruction* vPC, Register* r, ScopeChainNode* scopeChain, JSValue*& exceptionValue) 467 473 { 468 474 int baseDst = (vPC + 1)->u.operand; … … 477 483 ASSERT(iter != end); 478 484 485 CodeBlock* codeBlock = r[RegisterFile::CodeBlock].codeBlock(); 479 486 Identifier& ident = codeBlock->identifiers[property]; 480 487 JSObject* base; … … 509 516 ALWAYS_INLINE void Machine::initializeCallFrame(Register* callFrame, CodeBlock* codeBlock, Instruction* vPC, ScopeChainNode* scopeChain, Register* r, int returnValueRegister, int argc, JSValue* function) 510 517 { 511 callFrame[RegisterFile::C allerCodeBlock] = codeBlock;518 callFrame[RegisterFile::CodeBlock] = codeBlock; 512 519 callFrame[RegisterFile::CallerScopeChain] = scopeChain; 513 520 callFrame[RegisterFile::CallerRegisters] = r; … … 581 588 } 582 589 583 NEVER_INLINE JSValue* Machine::callEval(ExecState* exec, CodeBlock* callingCodeBlock,JSObject* thisObj, ScopeChainNode* scopeChain, RegisterFile* registerFile, Register* r, int argv, int argc, JSValue*& exceptionValue)590 NEVER_INLINE JSValue* Machine::callEval(ExecState* exec, JSObject* thisObj, ScopeChainNode* scopeChain, RegisterFile* registerFile, Register* r, int argv, int argc, JSValue*& exceptionValue) 584 591 { 585 592 if (argc < 2) … … 597 604 UString programSource = static_cast<JSString*>(program)->value(); 598 605 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); 600 608 601 609 JSValue* result = 0; … … 656 664 #ifndef NDEBUG 657 665 658 void Machine::dumpCallFrame( const CodeBlock* codeBlock, ScopeChainNode* scopeChain,RegisterFile* registerFile, const Register* r)666 void Machine::dumpCallFrame(ScopeChainNode* scopeChain, const RegisterFile* registerFile, const Register* r) 659 667 { 660 668 ScopeChain sc(scopeChain); 661 669 JSGlobalObject* globalObject = sc.globalObject(); 670 671 CodeBlock* codeBlock = r[RegisterFile::CodeBlock].codeBlock(); 662 672 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 677 void Machine::dumpRegisters(const RegisterFile* registerFile, const Register* r) 667 678 { 668 679 printf("Register frame: \n\n"); … … 671 682 printf("----------------------------------------------------\n"); 672 683 684 CodeBlock* codeBlock = r[RegisterFile::CodeBlock].codeBlock(); 673 685 const Register* it; 674 686 const Register* end; … … 695 707 printf("----------------------------------------------------\n"); 696 708 697 printf("[C allerCodeBlock]| %10p | %10p \n", it, (*it).v()); ++it;709 printf("[CodeBlock] | %10p | %10p \n", it, (*it).v()); ++it; 698 710 printf("[CallerScopeChain] | %10p | %10p \n", it, (*it).v()); ++it; 699 711 printf("[CallerRegisters] | %10p | %10p \n", it, (*it).v()); ++it; … … 783 795 } 784 796 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) 787 801 return false; 788 802 789 scopeChain = r[RegisterFile::CallerScopeChain].scopeChain();790 vPC = vPCForPC(codeBlock, r[RegisterFile::ReturnPC].v());791 r = r[RegisterFile::CallerRegisters].r();792 803 exec->m_callFrame = r; 793 804 codeBlock = r[RegisterFile::CodeBlock].codeBlock(); 805 vPC = vPCForPC(codeBlock, returnPC); 794 806 return true; 795 807 } 796 808 797 NEVER_INLINE Instruction* Machine::throwException(ExecState* exec, JSValue*& exceptionValue, const Instruction* vPC, CodeBlock*& codeBlock,ScopeChainNode*& scopeChain, Register*& r, bool explicitThrow)809 NEVER_INLINE Instruction* Machine::throwException(ExecState* exec, JSValue*& exceptionValue, const Instruction* vPC, ScopeChainNode*& scopeChain, Register*& r, bool explicitThrow) 798 810 { 799 811 // Set up the exception object 800 812 813 CodeBlock* codeBlock = r[RegisterFile::CodeBlock].codeBlock(); 801 814 if (exceptionValue->isObject()) { 802 815 JSObject* exception = static_cast<JSObject*>(exceptionValue); … … 888 901 Register* r = m_registerFile.base() + oldSize + codeBlock->numParameters + RegisterFile::CallFrameHeaderSize; 889 902 r[codeBlock->thisRegister] = thisObj; 890 initializeCallFrame(r, 0, 0, 0, 0, 0, 0, 0);903 initializeCallFrame(r, codeBlock, 0, 0, 0, 0, 0, 0); 891 904 892 905 if (codeBlock->needsFullScopeChain) … … 903 916 if (!codeBlock->ctiCode) 904 917 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); 906 919 #else 907 JSValue* result = privateExecute(Normal, &newExec, &m_registerFile, r, scopeChain, codeBlock,exception);920 JSValue* result = privateExecute(Normal, &newExec, &m_registerFile, r, scopeChain, exception); 908 921 #endif 909 922 m_reentryDepth--; … … 946 959 argv[++dst] = *it; 947 960 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); 950 963 if (UNLIKELY(*exception != 0)) { 951 964 m_registerFile.shrink(oldSize); … … 953 966 } 954 967 // 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); 956 969 957 970 ExecState newExec(exec, &m_registerFile, scopeChain, r); … … 963 976 m_reentryDepth++; 964 977 #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); 968 981 #else 969 982 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); 971 984 #endif 972 985 m_reentryDepth--; … … 1037 1050 // a 0 codeBlock indicates a built-in caller 1038 1051 r[codeBlock->thisRegister] = thisObj; 1039 initializeCallFrame(r, 0, 0, 0, 0, 0, 0, 0);1052 initializeCallFrame(r, codeBlock, 0, 0, 0, 0, 0, 0); 1040 1053 1041 1054 if (codeBlock->needsFullScopeChain) … … 1052 1065 if (!codeBlock->ctiCode) 1053 1066 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); 1055 1068 #else 1056 JSValue* result = privateExecute(Normal, &newExec, &m_registerFile, r, scopeChain, codeBlock,exception);1069 JSValue* result = privateExecute(Normal, &newExec, &m_registerFile, r, scopeChain, exception); 1057 1070 #endif 1058 1071 m_reentryDepth--; … … 1073 1086 } 1074 1087 1075 NEVER_INLINE void Machine::debug(ExecState* exec, const CodeBlock* codeBlock,ScopeChainNode* scopeChain, Register* r, DebugHookID debugHookID, int firstLine, int lastLine)1088 NEVER_INLINE void Machine::debug(ExecState* exec, ScopeChainNode* scopeChain, Register* r, DebugHookID debugHookID, int firstLine, int lastLine) 1076 1089 { 1077 1090 Debugger* debugger = exec->dynamicGlobalObject()->debugger(); … … 1079 1092 return; 1080 1093 1094 CodeBlock* codeBlock = r[RegisterFile::CodeBlock].codeBlock(); 1081 1095 DebuggerCallFrame debuggerCallFrame(exec, exec->dynamicGlobalObject(), codeBlock, scopeChain, r, 0); 1082 1096 … … 1188 1202 } 1189 1203 1190 static NEVER_INLINE ScopeChainNode* createExceptionScope(ExecState* exec, CodeBlock* codeBlock, const Instruction* vPC, Register* r, ScopeChainNode* scopeChain)1204 NEVER_INLINE ScopeChainNode* Machine::createExceptionScope(ExecState* exec, const Instruction* vPC, Register* r, ScopeChainNode* scopeChain) 1191 1205 { 1192 1206 int dst = (++vPC)->u.operand; 1207 CodeBlock* codeBlock = r[RegisterFile::CodeBlock].codeBlock(); 1193 1208 Identifier& property = codeBlock->identifiers[(++vPC)->u.operand]; 1194 1209 JSValue* value = r[(++vPC)->u.operand].jsValue(exec); … … 1410 1425 } 1411 1426 1412 JSValue* Machine::privateExecute(ExecutionFlag flag, ExecState* exec, RegisterFile* registerFile, Register* r, ScopeChainNode* scopeChain, CodeBlock* codeBlock,JSValue** exception)1427 JSValue* Machine::privateExecute(ExecutionFlag flag, ExecState* exec, RegisterFile* registerFile, Register* r, ScopeChainNode* scopeChain, JSValue** exception) 1413 1428 { 1414 1429 // One-time initialization of our address tables. We have to put this code … … 1439 1454 1440 1455 Register* registerBase = registerFile->base(); 1441 Instruction* vPC = codeBlock->instructions.begin();1456 Instruction* vPC = r[RegisterFile::CodeBlock].codeBlock()->instructions.begin(); 1442 1457 Profiler** enabledProfilerReference = Profiler::enabledProfilerReference(); 1443 1458 unsigned tickCount = m_ticksUntilNextTimeoutCheck + 1; … … 1463 1478 1464 1479 #if HAVE(COMPUTED_GOTO) 1465 #define NEXT_OPCODE MACHINE_SAMPLING_sample( codeBlock, vPC); goto *vPC->u.opcode1480 #define NEXT_OPCODE MACHINE_SAMPLING_sample(r[RegisterFile::CodeBlock].codeBlock(), vPC); goto *vPC->u.opcode 1466 1481 #if DUMP_OPCODE_STATS 1467 1482 #define BEGIN_OPCODE(opcode) opcode: OpcodeStats::recordInstruction(opcode); … … 1471 1486 NEXT_OPCODE; 1472 1487 #else 1473 #define NEXT_OPCODE MACHINE_SAMPLING_sample( codeBlock, vPC); continue1488 #define NEXT_OPCODE MACHINE_SAMPLING_sample(r[RegisterFile::CodeBlock].codeBlock(), vPC); continue 1474 1489 #if DUMP_OPCODE_STATS 1475 1490 #define BEGIN_OPCODE(opcode) case opcode: OpcodeStats::recordInstruction(opcode); … … 1519 1534 int dst = (++vPC)->u.operand; 1520 1535 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]); 1522 1537 1523 1538 ++vPC; … … 2126 2141 JSValue* baseVal = r[base].jsValue(exec); 2127 2142 2128 if (isNotObject(exec, true, codeBlock, vPC, baseVal, exceptionValue))2143 if (isNotObject(exec, true, r[RegisterFile::CodeBlock].codeBlock(), vPC, baseVal, exceptionValue)) 2129 2144 goto vm_throw; 2130 2145 … … 2247 2262 2248 2263 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)) 2250 2265 goto vm_throw; 2251 2266 … … 2273 2288 dst. If the property is not found, raises an exception. 2274 2289 */ 2275 if (UNLIKELY(!resolve(exec, vPC, r, scopeChain, codeBlock,exceptionValue)))2290 if (UNLIKELY(!resolve(exec, vPC, r, scopeChain, exceptionValue))) 2276 2291 goto vm_throw; 2277 2292 … … 2286 2301 value to register dst. If the property is not found, raises an exception. 2287 2302 */ 2288 if (UNLIKELY(!resolveSkip(exec, vPC, r, scopeChain, codeBlock,exceptionValue)))2303 if (UNLIKELY(!resolveSkip(exec, vPC, r, scopeChain, exceptionValue))) 2289 2304 goto vm_throw; 2290 2305 … … 2301 2316 cache the new structureID and offset 2302 2317 */ 2303 if (UNLIKELY(!resolveGlobal(exec, vPC, r, codeBlock,exceptionValue)))2318 if (UNLIKELY(!resolveGlobal(exec, vPC, r, exceptionValue))) 2304 2319 goto vm_throw; 2305 2320 … … 2344 2359 int dst = (++vPC)->u.operand; 2345 2360 int index = (++vPC)->u.operand; 2346 int skip = (++vPC)->u.operand + codeBlock->needsFullScopeChain;2361 int skip = (++vPC)->u.operand + r[RegisterFile::CodeBlock].codeBlock()->needsFullScopeChain; 2347 2362 2348 2363 ScopeChainIterator iter = scopeChain->begin(); … … 2365 2380 */ 2366 2381 int index = (++vPC)->u.operand; 2367 int skip = (++vPC)->u.operand + codeBlock->needsFullScopeChain;2382 int skip = (++vPC)->u.operand + r[RegisterFile::CodeBlock].codeBlock()->needsFullScopeChain; 2368 2383 int value = (++vPC)->u.operand; 2369 2384 … … 2390 2405 will be the global object) is stored in register dst. 2391 2406 */ 2392 resolveBase(exec, vPC, r, scopeChain , codeBlock);2407 resolveBase(exec, vPC, r, scopeChain); 2393 2408 2394 2409 vPC += 3; … … 2407 2422 avoids duplicate hash lookups. 2408 2423 */ 2409 if (UNLIKELY(!resolveBaseAndProperty(exec, vPC, r, scopeChain, codeBlock,exceptionValue)))2424 if (UNLIKELY(!resolveBaseAndProperty(exec, vPC, r, scopeChain, exceptionValue))) 2410 2425 goto vm_throw; 2411 2426 … … 2428 2443 calls but not for other property lookup. 2429 2444 */ 2430 if (UNLIKELY(!resolveBaseAndFunc(exec, vPC, r, scopeChain, codeBlock,exceptionValue)))2445 if (UNLIKELY(!resolveBaseAndFunc(exec, vPC, r, scopeChain, exceptionValue))) 2431 2446 goto vm_throw; 2432 2447 … … 2444 2459 int property = vPC[3].u.operand; 2445 2460 2446 Identifier& ident = codeBlock->identifiers[property];2461 Identifier& ident = r[RegisterFile::CodeBlock].codeBlock()->identifiers[property]; 2447 2462 JSValue* baseValue = r[base].jsValue(exec); 2448 2463 PropertySlot slot(baseValue); … … 2450 2465 VM_CHECK_EXCEPTION(); 2451 2466 2452 tryCacheGetByID(exec, codeBlock, vPC, baseValue, ident, slot);2467 tryCacheGetByID(exec, r[RegisterFile::CodeBlock].codeBlock(), vPC, baseValue, ident, slot); 2453 2468 2454 2469 r[dst] = result; … … 2476 2491 int offset = vPC[5].u.operand; 2477 2492 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)); 2479 2494 r[dst] = baseObject->getDirectOffset(offset); 2480 2495 … … 2484 2499 } 2485 2500 2486 uncacheGetByID( codeBlock, vPC);2501 uncacheGetByID(r[RegisterFile::CodeBlock].codeBlock(), vPC); 2487 2502 NEXT_OPCODE; 2488 2503 } … … 2510 2525 int offset = vPC[6].u.operand; 2511 2526 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)); 2513 2528 r[dst] = protoObject->getDirectOffset(offset); 2514 2529 … … 2519 2534 } 2520 2535 2521 uncacheGetByID( codeBlock, vPC);2536 uncacheGetByID(r[RegisterFile::CodeBlock].codeBlock(), vPC); 2522 2537 NEXT_OPCODE; 2523 2538 } … … 2551 2566 int offset = vPC[7].u.operand; 2552 2567 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)); 2554 2569 r[dst] = baseObject->getDirectOffset(offset); 2555 2570 … … 2561 2576 } 2562 2577 2563 uncacheGetByID( codeBlock, vPC);2578 uncacheGetByID(r[RegisterFile::CodeBlock].codeBlock(), vPC); 2564 2579 NEXT_OPCODE; 2565 2580 } … … 2574 2589 int property = vPC[3].u.operand; 2575 2590 2576 Identifier& ident = codeBlock->identifiers[property];2591 Identifier& ident = r[RegisterFile::CodeBlock].codeBlock()->identifiers[property]; 2577 2592 2578 2593 JSValue* baseValue = r[base].jsValue(exec); … … 2602 2617 } 2603 2618 2604 uncacheGetByID( codeBlock, vPC);2619 uncacheGetByID(r[RegisterFile::CodeBlock].codeBlock(), vPC); 2605 2620 NEXT_OPCODE; 2606 2621 } … … 2622 2637 } 2623 2638 2624 uncacheGetByID( codeBlock, vPC);2639 uncacheGetByID(r[RegisterFile::CodeBlock].codeBlock(), vPC); 2625 2640 NEXT_OPCODE; 2626 2641 } … … 2642 2657 2643 2658 PutPropertySlot slot; 2644 Identifier& ident = codeBlock->identifiers[property];2659 Identifier& ident = r[RegisterFile::CodeBlock].codeBlock()->identifiers[property]; 2645 2660 baseValue->put(exec, ident, r[value].jsValue(exec), slot); 2646 2661 VM_CHECK_EXCEPTION(); 2647 2662 2648 tryCachePutByID(exec, codeBlock, vPC, baseValue, slot);2663 tryCachePutByID(exec, r[RegisterFile::CodeBlock].codeBlock(), vPC, baseValue, slot); 2649 2664 2650 2665 vPC += 8; … … 2679 2694 while (!proto->isNull()) { 2680 2695 if (UNLIKELY(proto->structureID() != (*it).get())) { 2681 uncachePutByID( codeBlock, vPC);2696 uncachePutByID(r[RegisterFile::CodeBlock].codeBlock(), vPC); 2682 2697 NEXT_OPCODE; 2683 2698 } … … 2692 2707 int value = vPC[3].u.operand; 2693 2708 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); 2695 2710 baseObject->putDirectOffset(offset, r[value].jsValue(exec)); 2696 2711 … … 2700 2715 } 2701 2716 2702 uncachePutByID( codeBlock, vPC);2717 uncachePutByID(r[RegisterFile::CodeBlock].codeBlock(), vPC); 2703 2718 NEXT_OPCODE; 2704 2719 } … … 2727 2742 unsigned offset = vPC[5].u.operand; 2728 2743 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); 2730 2745 baseObject->putDirectOffset(offset, r[value].jsValue(exec)); 2731 2746 … … 2735 2750 } 2736 2751 2737 uncachePutByID( codeBlock, vPC);2752 uncachePutByID(r[RegisterFile::CodeBlock].codeBlock(), vPC); 2738 2753 NEXT_OPCODE; 2739 2754 } … … 2754 2769 2755 2770 PutPropertySlot slot; 2756 Identifier& ident = codeBlock->identifiers[property];2771 Identifier& ident = r[RegisterFile::CodeBlock].codeBlock()->identifiers[property]; 2757 2772 baseValue->put(exec, ident, r[value].jsValue(exec), slot); 2758 2773 VM_CHECK_EXCEPTION(); … … 2775 2790 JSObject* baseObj = r[base].jsValue(exec)->toObject(exec); 2776 2791 2777 Identifier& ident = codeBlock->identifiers[property];2792 Identifier& ident = r[RegisterFile::CodeBlock].codeBlock()->identifiers[property]; 2778 2793 JSValue* result = jsBoolean(baseObj->deleteProperty(exec, ident)); 2779 2794 VM_CHECK_EXCEPTION(); … … 3092 3107 else { 3093 3108 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); 3095 3110 } 3096 3111 NEXT_OPCODE; … … 3115 3130 vPC += defaultOffset; 3116 3131 else 3117 vPC += codeBlock->characterSwitchJumpTables[tableIndex].offsetForValue(value->data()[0], defaultOffset);3132 vPC += r[RegisterFile::CodeBlock].codeBlock()->characterSwitchJumpTables[tableIndex].offsetForValue(value->data()[0], defaultOffset); 3118 3133 } 3119 3134 NEXT_OPCODE; … … 3134 3149 vPC += defaultOffset; 3135 3150 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); 3137 3152 NEXT_OPCODE; 3138 3153 } … … 3148 3163 int func = (++vPC)->u.operand; 3149 3164 3150 r[dst] = codeBlock->functions[func]->makeFunction(exec, scopeChain);3165 r[dst] = r[RegisterFile::CodeBlock].codeBlock()->functions[func]->makeFunction(exec, scopeChain); 3151 3166 3152 3167 ++vPC; … … 3164 3179 int func = (++vPC)->u.operand; 3165 3180 3166 r[dst] = codeBlock->functionExpressions[func]->makeFunction(exec, scopeChain);3181 r[dst] = r[RegisterFile::CodeBlock].codeBlock()->functionExpressions[func]->makeFunction(exec, scopeChain); 3167 3182 3168 3183 ++vPC; … … 3192 3207 3193 3208 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); 3196 3211 if (exceptionValue) 3197 3212 goto vm_throw; … … 3279 3294 goto vm_throw; 3280 3295 3281 initializeCallFrame(r, codeBlock, vPC, scopeChain, savedR, dst, argCount, v);3296 initializeCallFrame(r, newCodeBlock, vPC, scopeChain, savedR, dst, argCount, v); 3282 3297 exec->m_callFrame = r; 3283 3298 … … 3285 3300 (*enabledProfilerReference)->willExecute(exec, static_cast<JSObject*>(v)); 3286 3301 3287 codeBlock = newCodeBlock;3288 3302 setScopeChain(exec, scopeChain, callDataScopeChain); 3289 vPC = codeBlock->instructions.begin();3303 vPC = newCodeBlock->instructions.begin(); 3290 3304 3291 3305 #if DUMP_OPCODE_STATS … … 3300 3314 ArgList args(r + firstArg + 1, argCount - 1); 3301 3315 3302 initializeCallFrame(r + registerOffset, codeBlock, vPC, scopeChain, r, dst, argCount, v);3316 initializeCallFrame(r + registerOffset, 0, vPC, scopeChain, r, dst, argCount, v); 3303 3317 exec->m_callFrame = r + registerOffset; 3304 3318 … … 3323 3337 ASSERT(callType == CallTypeNone); 3324 3338 3325 exceptionValue = createNotAFunctionError(exec, v, vPC, codeBlock);3339 exceptionValue = createNotAFunctionError(exec, v, vPC, r[RegisterFile::CodeBlock].codeBlock()); 3326 3340 goto vm_throw; 3327 3341 } … … 3339 3353 3340 3354 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); 3342 3356 ASSERT(activation->isActivationObject()); 3343 3357 activation->copyRegisters(); … … 3347 3361 (*enabledProfilerReference)->didExecute(exec, static_cast<JSObject*>(r[RegisterFile::Callee].jsValue(exec))); 3348 3362 3349 if ( codeBlock->needsFullScopeChain)3363 if (r[RegisterFile::CodeBlock].codeBlock()->needsFullScopeChain) 3350 3364 scopeChain->deref(); 3351 3365 3352 3366 JSValue* returnValue = r[result].jsValue(exec); 3353 3354 codeBlock = r[RegisterFile::CallerCodeBlock].codeBlock();3355 if (!codeBlock)3356 return returnValue;3357 3367 3358 3368 vPC = r[RegisterFile::ReturnPC].vPC(); … … 3361 3371 r = r[RegisterFile::CallerRegisters].r(); 3362 3372 exec->m_callFrame = r; 3373 3374 if (!r) 3375 return returnValue; 3376 3363 3377 r[dst] = returnValue; 3364 3378 … … 3367 3381 BEGIN_OPCODE(op_init) { 3368 3382 size_t i = 0; 3369 3383 CodeBlock* codeBlock = r[RegisterFile::CodeBlock].codeBlock(); 3384 3370 3385 for (size_t count = codeBlock->numVars; i < count; ++i) 3371 3386 r[i] = jsUndefined(); … … 3379 3394 BEGIN_OPCODE(op_init_activation) { 3380 3395 size_t i = 0; 3396 CodeBlock* codeBlock = r[RegisterFile::CodeBlock].codeBlock(); 3381 3397 3382 3398 for (size_t count = codeBlock->numVars; i < count; ++i) … … 3444 3460 goto vm_throw; 3445 3461 3446 initializeCallFrame(r, codeBlock, vPC, scopeChain, savedR, dst, argCount, v);3462 initializeCallFrame(r, newCodeBlock, vPC, scopeChain, savedR, dst, argCount, v); 3447 3463 exec->m_callFrame = r; 3448 3464 … … 3450 3466 (*enabledProfilerReference)->didExecute(exec, static_cast<JSObject*>(v)); 3451 3467 3452 codeBlock = newCodeBlock;3453 3468 setScopeChain(exec, scopeChain, callDataScopeChain); 3454 vPC = codeBlock->instructions.begin();3469 vPC = newCodeBlock->instructions.begin(); 3455 3470 3456 3471 #if DUMP_OPCODE_STATS … … 3464 3479 ArgList args(r + firstArg + 1, argCount - 1); 3465 3480 3466 initializeCallFrame(r + registerOffset, codeBlock, vPC, scopeChain, r, dst, argCount, v);3481 initializeCallFrame(r + registerOffset, 0, vPC, scopeChain, r, dst, argCount, v); 3467 3482 exec->m_callFrame = r + registerOffset; 3468 3483 … … 3487 3502 ASSERT(constructType == ConstructTypeNone); 3488 3503 3489 exceptionValue = createNotAConstructorError(exec, v, vPC, codeBlock);3504 exceptionValue = createNotAConstructorError(exec, v, vPC, r[RegisterFile::CodeBlock].codeBlock()); 3490 3505 goto vm_throw; 3491 3506 } … … 3604 3619 in dst for GC. 3605 3620 */ 3606 setScopeChain(exec, scopeChain, createExceptionScope(exec, codeBlock,vPC, r, scopeChain));3621 setScopeChain(exec, scopeChain, createExceptionScope(exec, vPC, r, scopeChain)); 3607 3622 vPC += 4; 3608 3623 NEXT_OPCODE; … … 3641 3656 exceptionValue = r[ex].jsValue(exec); 3642 3657 3643 handlerVPC = throwException(exec, exceptionValue, vPC, codeBlock,scopeChain, r, true);3658 handlerVPC = throwException(exec, exceptionValue, vPC, scopeChain, r, true); 3644 3659 if (!handlerVPC) { 3645 3660 *exception = exceptionValue; … … 3666 3681 int dst = (++vPC)->u.operand; 3667 3682 int src = (++vPC)->u.operand; 3668 r[dst] = codeBlock->unexpectedConstants[src];3683 r[dst] = r[RegisterFile::CodeBlock].codeBlock()->unexpectedConstants[src]; 3669 3684 3670 3685 ++vPC; … … 3683 3698 int message = (++vPC)->u.operand; 3684 3699 3700 CodeBlock* codeBlock = r[RegisterFile::CodeBlock].codeBlock(); 3685 3701 r[dst] = Error::create(exec, (ErrorType)type, codeBlock->unexpectedConstants[message]->toString(exec), codeBlock->lineNumberForVPC(vPC), codeBlock->ownerNode->sourceId(), codeBlock->ownerNode->sourceURL()); 3686 3702 … … 3695 3711 */ 3696 3712 3697 if ( codeBlock->needsFullScopeChain) {3713 if (r[RegisterFile::CodeBlock].codeBlock()->needsFullScopeChain) { 3698 3714 ASSERT(scopeChain->refCount > 1); 3699 3715 scopeChain->deref(); … … 3719 3735 ASSERT(r[base].jsValue(exec)->isObject()); 3720 3736 JSObject* baseObj = static_cast<JSObject*>(r[base].jsValue(exec)); 3721 Identifier& ident = codeBlock->identifiers[property];3737 Identifier& ident = r[RegisterFile::CodeBlock].codeBlock()->identifiers[property]; 3722 3738 ASSERT(r[function].jsValue(exec)->isObject()); 3723 3739 baseObj->defineGetter(exec, ident, static_cast<JSObject*>(r[function].jsValue(exec))); … … 3743 3759 ASSERT(r[base].jsValue(exec)->isObject()); 3744 3760 JSObject* baseObj = static_cast<JSObject*>(r[base].jsValue(exec)); 3745 Identifier& ident = codeBlock->identifiers[property];3761 Identifier& ident = r[RegisterFile::CodeBlock].codeBlock()->identifiers[property]; 3746 3762 ASSERT(r[function].jsValue(exec)->isObject()); 3747 3763 baseObj->defineSetter(exec, ident, static_cast<JSObject*>(r[function].jsValue(exec))); … … 3784 3800 int lastLine = (++vPC)->u.operand; 3785 3801 3786 debug(exec, codeBlock,scopeChain, r, static_cast<DebugHookID>(debugHookID), firstLine, lastLine);3802 debug(exec, scopeChain, r, static_cast<DebugHookID>(debugHookID), firstLine, lastLine); 3787 3803 3788 3804 ++vPC; … … 3796 3812 exceptionValue = createInterruptedExecutionException(exec); 3797 3813 } 3798 handlerVPC = throwException(exec, exceptionValue, vPC, codeBlock,scopeChain, r, false);3814 handlerVPC = throwException(exec, exceptionValue, vPC, scopeChain, r, false); 3799 3815 if (!handlerVPC) { 3800 3816 *exception = exceptionValue; … … 3828 3844 JSValue* Machine::retrieveCaller(ExecState* exec, InternalFunction* function) const 3829 3845 { 3830 Register* callFrame= this->callFrame(exec, function);3831 if (! callFrame)3846 Register* r = this->callFrame(exec, function); 3847 if (!r) 3832 3848 return jsNull(); 3833 3849 3834 CodeBlock* callerCodeBlock = callFrame[RegisterFile::CallerCodeBlock].codeBlock();3835 if (!caller CodeBlock)3850 Register* callerR = r[RegisterFile::CallerRegisters].r(); 3851 if (!callerR) 3836 3852 return jsNull(); 3837 3853 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; 3843 3859 } 3844 3860 … … 3849 3865 sourceURL = UString(); 3850 3866 3851 Register* callFrame= exec->m_callFrame;3852 if (! callFrame)3867 Register* r = exec->m_callFrame; 3868 if (!r) 3853 3869 return; 3854 3870 3855 CodeBlock* callerCodeBlock = callFrame[RegisterFile::CallerCodeBlock].codeBlock();3856 if (!caller CodeBlock)3871 Register* callerR = r[RegisterFile::CallerRegisters].r(); 3872 if (!callerR) 3857 3873 return; 3858 3874 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()); 3860 3877 lineNumber = callerCodeBlock->lineNumberForVPC(vPC - 1); 3861 3878 sourceId = callerCodeBlock->ownerNode->sourceId(); 3862 3879 sourceURL = callerCodeBlock->ownerNode->sourceURL(); 3863 3880 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; 3867 3886 } 3868 3887 … … 3882 3901 return callFrame; 3883 3902 3884 CodeBlock* callerCodeBlock = callFrame[RegisterFile::CallerCodeBlock].codeBlock();3885 if (!callerCodeBlock) {3886 callFrame = 0;3887 continue;3888 }3889 3890 3903 callFrame = callFrame[RegisterFile::CallerRegisters].r(); 3891 3904 } … … 4251 4264 baseValue->put(exec, ident, ARG_src3, slot); 4252 4265 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); 4254 4267 4255 4268 VM_CHECK_EXCEPTION_AT_END(); … … 4305 4318 JSValue* result = baseValue->get(exec, ident, slot); 4306 4319 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); 4308 4321 4309 4322 VM_CHECK_EXCEPTION_AT_END(); … … 4356 4369 4357 4370 if (!baseVal->isObject()) { 4358 CodeBlock* codeBlock = ARG_ codeBlock;4371 CodeBlock* codeBlock = ARG_r[RegisterFile::CodeBlock].codeBlock(); 4359 4372 ASSERT(codeBlock->ctiReturnAddressVPCMap.contains(CTI_RETURN_ADDRESS)); 4360 4373 unsigned vPCIndex = codeBlock->ctiReturnAddressVPCMap.get(CTI_RETURN_ADDRESS); … … 4445 4458 JSVALUE_VM_CHECK_EXCEPTION_ARG(exceptionValue); 4446 4459 4447 // RegisterFile::CallerCodeBlock is set by caller4460 r[RegisterFile::CodeBlock] = newCodeBlock; 4448 4461 r[RegisterFile::CallerScopeChain] = ARG_scopeChain; 4449 4462 r[RegisterFile::CallerRegisters] = savedR; … … 4458 4471 4459 4472 ARG_setScopeChain(callDataScopeChain); 4460 ARG_setCodeBlock(newCodeBlock);4461 4473 ARG_setR(r); 4462 4474 return newCodeBlock->ctiCode; … … 4466 4478 { 4467 4479 ExecState* exec = ARG_exec; 4468 CodeBlock* codeBlock = ARG_ codeBlock;4480 CodeBlock* codeBlock = ARG_r[RegisterFile::CodeBlock].codeBlock(); 4469 4481 4470 4482 if (!codeBlock->ctiCode) … … 4477 4489 { 4478 4490 ExecState* exec = ARG_exec; 4479 CodeBlock* codeBlock = ARG_ codeBlock;4491 CodeBlock* codeBlock = ARG_r[RegisterFile::CodeBlock].codeBlock(); 4480 4492 ScopeChainNode* scopeChain = ARG_scopeChain; 4481 4493 Register* r = ARG_r; … … 4504 4516 Register* r = ARG_r + registerOffset; 4505 4517 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); 4507 4519 exec->m_callFrame = r; 4508 4520 … … 4527 4539 ASSERT(callType == CallTypeNone); 4528 4540 4529 exec->setException(createNotAFunctionError(exec, funcVal, ARG_instr4, ARG_ codeBlock));4541 exec->setException(createNotAFunctionError(exec, funcVal, ARG_instr4, ARG_r[RegisterFile::CodeBlock].codeBlock())); 4530 4542 VM_CHECK_EXCEPTION_AT_END(); 4531 4543 return 0; … … 4540 4552 ASSERT(activation); 4541 4553 4542 ASSERT(!ARG_ codeBlock->needsFullScopeChain || ARG_scopeChain->object == activation);4554 ASSERT(!ARG_r[RegisterFile::CodeBlock].codeBlock()->needsFullScopeChain || ARG_scopeChain->object == activation); 4543 4555 ASSERT(activation->isActivationObject()); 4544 4556 activation->copyRegisters(); … … 4556 4568 void Machine::cti_op_ret_scopeChain(CTI_ARGS) 4557 4569 { 4558 ASSERT(ARG_ codeBlock->needsFullScopeChain);4570 ASSERT(ARG_r[RegisterFile::CodeBlock].codeBlock()->needsFullScopeChain); 4559 4571 ARG_scopeChain->deref(); 4560 4572 } … … 4586 4598 } while (++iter != end); 4587 4599 4588 CodeBlock* codeBlock = ARG_ codeBlock;4600 CodeBlock* codeBlock = ARG_r[RegisterFile::CodeBlock].codeBlock(); 4589 4601 ASSERT(codeBlock->ctiReturnAddressVPCMap.contains(CTI_RETURN_ADDRESS)); 4590 4602 unsigned vPCIndex = codeBlock->ctiReturnAddressVPCMap.get(CTI_RETURN_ADDRESS); … … 4638 4650 JSVALUE_VM_CHECK_EXCEPTION_ARG(exceptionValue); 4639 4651 4640 // RegisterFile::CallerCodeBlock is set by caller4652 r[RegisterFile::CodeBlock] = newCodeBlock; 4641 4653 r[RegisterFile::CallerScopeChain] = ARG_scopeChain; 4642 4654 r[RegisterFile::CallerRegisters] = savedR; … … 4651 4663 4652 4664 ARG_setScopeChain(callDataScopeChain); 4653 ARG_setCodeBlock(newCodeBlock);4654 4665 ARG_setR(r); 4655 4666 return newCodeBlock->ctiCode; … … 4689 4700 ASSERT(constructType == ConstructTypeNone); 4690 4701 4691 exec->setException(createNotAConstructorError(exec, constrVal, ARG_instr6, ARG_codeBlock));4702 exec->setException(createNotAConstructorError(exec, constrVal, ARG_instr6, r[RegisterFile::CodeBlock].codeBlock())); 4692 4703 VM_CHECK_EXCEPTION_AT_END(); 4693 4704 return 0; … … 4761 4772 } while (iter != end); 4762 4773 4763 CodeBlock* codeBlock = ARG_ codeBlock;4774 CodeBlock* codeBlock = ARG_r[RegisterFile::CodeBlock].codeBlock(); 4764 4775 ASSERT(codeBlock->ctiReturnAddressVPCMap.contains(CTI_RETURN_ADDRESS)); 4765 4776 unsigned vPCIndex = codeBlock->ctiReturnAddressVPCMap.get(CTI_RETURN_ADDRESS); … … 4908 4919 } while (++iter != end); 4909 4920 4910 CodeBlock* codeBlock = ARG_ codeBlock;4921 CodeBlock* codeBlock = ARG_r[RegisterFile::CodeBlock].codeBlock(); 4911 4922 ASSERT(codeBlock->ctiReturnAddressVPCMap.contains(CTI_RETURN_ADDRESS)); 4912 4923 unsigned vPCIndex = codeBlock->ctiReturnAddressVPCMap.get(CTI_RETURN_ADDRESS); … … 4941 4952 } 4942 4953 4943 exec->setException(createUndefinedVariableError(exec, ident, vPC, ARG_ codeBlock));4954 exec->setException(createUndefinedVariableError(exec, ident, vPC, ARG_r[RegisterFile::CodeBlock].codeBlock())); 4944 4955 4945 4956 VM_CHECK_EXCEPTION_AT_END(); … … 5131 5142 } while (iter != end); 5132 5143 5133 CodeBlock* codeBlock = ARG_ codeBlock;5144 CodeBlock* codeBlock = ARG_r[RegisterFile::CodeBlock].codeBlock(); 5134 5145 ASSERT(codeBlock->ctiReturnAddressVPCMap.contains(CTI_RETURN_ADDRESS)); 5135 5146 unsigned vPCIndex = codeBlock->ctiReturnAddressVPCMap.get(CTI_RETURN_ADDRESS); … … 5241 5252 RegisterFile* registerFile = ARG_registerFile; 5242 5253 Register* r = ARG_r; 5243 CodeBlock* codeBlock = ARG_codeBlock;5254 CodeBlock* codeBlock = r[RegisterFile::CodeBlock].codeBlock(); 5244 5255 ScopeChainNode* scopeChain = ARG_scopeChain; 5245 5256 … … 5254 5265 JSObject* thisObject = static_cast<JSObject*>(r[codeBlock->thisRegister].jsValue(exec)); 5255 5266 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); 5257 5268 JSVALUE_VM_CHECK_EXCEPTION_ARG(exceptionValue); 5258 5269 return result; … … 5265 5276 { 5266 5277 ExecState* exec = ARG_exec; 5267 CodeBlock* codeBlock = ARG_codeBlock;5268 5278 ScopeChainNode* scopeChain = ARG_scopeChain; 5269 5279 Register* r = ARG_r; 5280 CodeBlock* codeBlock = r[RegisterFile::CodeBlock].codeBlock(); 5270 5281 5271 5282 ASSERT(codeBlock->ctiReturnAddressVPCMap.contains(CTI_RETURN_ADDRESS)); … … 5273 5284 5274 5285 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); 5276 5287 5277 5288 if (handlerVPC) { 5278 5289 exec->setException(exceptionValue); 5279 5290 ARG_setScopeChain(scopeChain); 5280 ARG_setCodeBlock(codeBlock);5281 5291 ARG_setR(r); 5282 5292 5283 void* catchRoutine = codeBlock->nativeExceptionCodeForHandlerVPC(handlerVPC);5293 void* catchRoutine = r[RegisterFile::CodeBlock].codeBlock()->nativeExceptionCodeForHandlerVPC(handlerVPC); 5284 5294 ASSERT(catchRoutine); 5285 5295 ctiSetReturnAddress(&CTI_RETURN_ADDRESS, catchRoutine); … … 5404 5414 5405 5415 if (!baseVal->isObject()) { 5406 CodeBlock* codeBlock = ARG_ codeBlock;5416 CodeBlock* codeBlock = ARG_r[RegisterFile::CodeBlock].codeBlock(); 5407 5417 ASSERT(codeBlock->ctiReturnAddressVPCMap.contains(CTI_RETURN_ADDRESS)); 5408 5418 unsigned vPCIndex = codeBlock->ctiReturnAddressVPCMap.get(CTI_RETURN_ADDRESS); … … 5461 5471 unsigned tableIndex = ARG_int2; 5462 5472 5463 CodeBlock* codeBlock = ARG_ codeBlock;5473 CodeBlock* codeBlock = ARG_r[RegisterFile::CodeBlock].codeBlock(); 5464 5474 5465 5475 if (JSImmediate::isNumber(scrutinee)) { … … 5476 5486 unsigned tableIndex = ARG_int2; 5477 5487 5478 CodeBlock* codeBlock = ARG_ codeBlock;5488 CodeBlock* codeBlock = ARG_r[RegisterFile::CodeBlock].codeBlock(); 5479 5489 5480 5490 void* result = codeBlock->characterSwitchJumpTables[tableIndex].ctiDefault; … … 5494 5504 unsigned tableIndex = ARG_int2; 5495 5505 5496 CodeBlock* codeBlock = ARG_ codeBlock;5506 CodeBlock* codeBlock = ARG_r[RegisterFile::CodeBlock].codeBlock(); 5497 5507 5498 5508 void* result = codeBlock->stringSwitchJumpTables[tableIndex].ctiDefault; … … 5554 5564 { 5555 5565 ExecState* exec = ARG_exec; 5556 CodeBlock* codeBlock = ARG_ codeBlock;5566 CodeBlock* codeBlock = ARG_r[RegisterFile::CodeBlock].codeBlock(); 5557 5567 unsigned type = ARG_int1; 5558 5568 JSValue* message = ARG_src2; … … 5565 5575 { 5566 5576 ExecState* exec = ARG_exec; 5567 CodeBlock* codeBlock = ARG_codeBlock;5568 5577 ScopeChainNode* scopeChain = ARG_scopeChain; 5569 5578 Register* r = ARG_r; … … 5573 5582 int lastLine = ARG_int3; 5574 5583 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); 5576 5585 } 5577 5586 … … 5579 5588 { 5580 5589 ExecState* exec = ARG_exec; 5581 CodeBlock* codeBlock = ARG_codeBlock;5582 5590 ScopeChainNode* scopeChain = ARG_scopeChain; 5583 5591 Register* r = ARG_r; 5592 CodeBlock* codeBlock = r[RegisterFile::CodeBlock].codeBlock(); 5584 5593 5585 5594 ASSERT(codeBlock->ctiReturnAddressVPCMap.contains(exec->ctiReturnAddress())); … … 5590 5599 JSValue* exceptionValue = exec->exception(); 5591 5600 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); 5593 5602 5594 5603 if (handlerVPC) { 5595 5604 exec->setException(exceptionValue); 5596 5605 ARG_setScopeChain(scopeChain); 5597 ARG_setCodeBlock(codeBlock);5598 5606 ARG_setR(r); 5599 5607 5600 void* catchRoutine = codeBlock->nativeExceptionCodeForHandlerVPC(handlerVPC);5608 void* catchRoutine = r[RegisterFile::CodeBlock].codeBlock()->nativeExceptionCodeForHandlerVPC(handlerVPC); 5601 5609 ASSERT(catchRoutine); 5602 5610 ctiSetReturnAddress(&CTI_RETURN_ADDRESS, catchRoutine); -
trunk/JavaScriptCore/VM/Machine.h
r36973 r36997 243 243 enum ExecutionFlag { Normal, InitializeAndReturn }; 244 244 245 NEVER_INLINE JSValue* callEval(ExecState* exec, CodeBlock* callingCodeBlock,JSObject* thisObj, ScopeChainNode* scopeChain, RegisterFile*, Register* r, int argv, int argc, JSValue*& exceptionValue);245 NEVER_INLINE JSValue* callEval(ExecState* exec, JSObject* thisObj, ScopeChainNode* scopeChain, RegisterFile*, Register* r, int argv, int argc, JSValue*& exceptionValue); 246 246 JSValue* execute(EvalNode*, ExecState*, JSObject* thisObj, int registerOffset, ScopeChainNode*, JSValue** exception); 247 247 … … 249 249 250 250 ALWAYS_INLINE static void setScopeChain(ExecState* exec, ScopeChainNode*&, ScopeChainNode*); 251 NEVER_INLINE void debug(ExecState*, const CodeBlock*, ScopeChainNode*, Register*, DebugHookID, int firstLine, int lastLine); 251 NEVER_INLINE void debug(ExecState*, ScopeChainNode*, Register*, DebugHookID, int firstLine, int lastLine); 252 253 NEVER_INLINE bool resolve(ExecState* exec, Instruction* vPC, Register* r, ScopeChainNode* scopeChain, JSValue*& exceptionValue); 254 NEVER_INLINE bool resolveSkip(ExecState* exec, Instruction* vPC, Register* r, ScopeChainNode* scopeChain, JSValue*& exceptionValue); 255 NEVER_INLINE bool resolveGlobal(ExecState* exec, Instruction* vPC, Register* r, JSValue*& exceptionValue); 256 NEVER_INLINE void resolveBase(ExecState* exec, Instruction* vPC, Register* r, ScopeChainNode* scopeChain); 257 NEVER_INLINE bool resolveBaseAndProperty(ExecState* exec, Instruction* vPC, Register* r, ScopeChainNode* scopeChain, JSValue*& exceptionValue); 258 NEVER_INLINE ScopeChainNode* createExceptionScope(ExecState* exec, const Instruction* vPC, Register* r, ScopeChainNode* scopeChain); 252 259 253 260 NEVER_INLINE bool unwindCallFrame(ExecState*, JSValue*, const Instruction*&, CodeBlock*&, ScopeChainNode*&, Register*&); 254 NEVER_INLINE Instruction* throwException(ExecState*, JSValue*&, const Instruction*, CodeBlock*&, ScopeChainNode*&, Register*&, bool); 261 NEVER_INLINE Instruction* throwException(ExecState*, JSValue*&, const Instruction*, ScopeChainNode*&, Register*&, bool); 262 NEVER_INLINE bool resolveBaseAndFunc(ExecState* exec, Instruction* vPC, Register* r, ScopeChainNode* scopeChain, JSValue*& exceptionValue); 255 263 256 264 Register* callFrame(ExecState*, InternalFunction*) const; 257 265 258 JSValue* privateExecute(ExecutionFlag, ExecState* = 0, RegisterFile* = 0, Register* = 0, ScopeChainNode* = 0, CodeBlock* = 0,JSValue** exception = 0);259 260 void dumpCallFrame( const CodeBlock*, ScopeChainNode*,RegisterFile*, const Register*);261 void dumpRegisters(const CodeBlock*,RegisterFile*, const Register*);266 JSValue* privateExecute(ExecutionFlag, ExecState* = 0, RegisterFile* = 0, Register* = 0, ScopeChainNode* = 0, JSValue** exception = 0); 267 268 void dumpCallFrame(ScopeChainNode*, const RegisterFile*, const Register*); 269 void dumpRegisters(const RegisterFile*, const Register*); 262 270 263 271 JSValue* checkTimeout(JSGlobalObject*); -
trunk/JavaScriptCore/VM/RegisterFile.h
r36821 r36997 93 93 CallFrameHeaderSize = 8, 94 94 95 C allerCodeBlock = -8,95 CodeBlock = -8, 96 96 CallerScopeChain = -7, 97 97 CallerRegisters = -6, … … 156 156 } 157 157 158 size_t size() { return m_size; }158 size_t size() const { return m_size; } 159 159 160 160 void setNumGlobals(size_t numGlobals) { m_numGlobals = numGlobals; } 161 int numGlobals() { return m_numGlobals; }162 size_t maxGlobals() { return m_maxGlobals; }161 int numGlobals() const { return m_numGlobals; } 162 size_t maxGlobals() const { return m_maxGlobals; } 163 163 164 Register* lastGlobal() { return m_base - m_numGlobals; }164 Register* lastGlobal() const { return m_base - m_numGlobals; } 165 165 166 166 void markGlobals(Heap* heap) { heap->markConservatively(lastGlobal(), m_base); }
Note:
See TracChangeset
for help on using the changeset viewer.