Changeset 37086 in webkit for trunk/JavaScriptCore/VM/Machine.cpp
- Timestamp:
- Sep 29, 2008, 5:46:25 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/VM/Machine.cpp
r37068 r37086 306 306 } 307 307 308 NEVER_INLINE bool Machine::resolve(ExecState* exec, Instruction* vPC, Register* r, ScopeChainNode* scopeChain,JSValue*& exceptionValue)308 NEVER_INLINE bool Machine::resolve(ExecState* exec, Instruction* vPC, Register* r, JSValue*& exceptionValue) 309 309 { 310 310 int dst = (vPC + 1)->u.operand; 311 311 int property = (vPC + 2)->u.operand; 312 312 313 ScopeChainNode* scopeChain = this->scopeChain(r); 313 314 ScopeChainIterator iter = scopeChain->begin(); 314 315 ScopeChainIterator end = scopeChain->end(); 315 316 ASSERT(iter != end); 316 317 317 CodeBlock* codeBlock = r[RegisterFile::CodeBlock].codeBlock();318 CodeBlock* codeBlock = this->codeBlock(r); 318 319 Identifier& ident = codeBlock->identifiers[property]; 319 320 do { … … 333 334 } 334 335 335 NEVER_INLINE bool Machine::resolveSkip(ExecState* exec, Instruction* vPC, Register* r, ScopeChainNode* scopeChain,JSValue*& exceptionValue)336 { 337 CodeBlock* codeBlock = r[RegisterFile::CodeBlock].codeBlock();336 NEVER_INLINE bool Machine::resolveSkip(ExecState* exec, Instruction* vPC, Register* r, JSValue*& exceptionValue) 337 { 338 CodeBlock* codeBlock = this->codeBlock(r); 338 339 339 340 int dst = (vPC + 1)->u.operand; … … 341 342 int skip = (vPC + 3)->u.operand + codeBlock->needsFullScopeChain; 342 343 344 ScopeChainNode* scopeChain = this->scopeChain(r); 343 345 ScopeChainIterator iter = scopeChain->begin(); 344 346 ScopeChainIterator end = scopeChain->end(); … … 379 381 } 380 382 381 CodeBlock* codeBlock = r[RegisterFile::CodeBlock].codeBlock();383 CodeBlock* codeBlock = this->codeBlock(r); 382 384 Identifier& ident = codeBlock->identifiers[property]; 383 385 PropertySlot slot(globalObject); … … 428 430 } 429 431 430 NEVER_INLINE void Machine::resolveBase(ExecState* exec, Instruction* vPC, Register* r , ScopeChainNode* scopeChain)432 NEVER_INLINE void Machine::resolveBase(ExecState* exec, Instruction* vPC, Register* r) 431 433 { 432 434 int dst = (vPC + 1)->u.operand; 433 435 int property = (vPC + 2)->u.operand; 434 CodeBlock* codeBlock = r[RegisterFile::CodeBlock].codeBlock(); 436 CodeBlock* codeBlock = this->codeBlock(r); 437 ScopeChainNode* scopeChain = this->scopeChain(r); 435 438 r[dst] = inlineResolveBase(exec, codeBlock->identifiers[property], scopeChain); 436 439 } 437 440 438 NEVER_INLINE bool Machine::resolveBaseAndProperty(ExecState* exec, Instruction* vPC, Register* r, ScopeChainNode* scopeChain,JSValue*& exceptionValue)441 NEVER_INLINE bool Machine::resolveBaseAndProperty(ExecState* exec, Instruction* vPC, Register* r, JSValue*& exceptionValue) 439 442 { 440 443 int baseDst = (vPC + 1)->u.operand; … … 442 445 int property = (vPC + 3)->u.operand; 443 446 447 ScopeChainNode* scopeChain = this->scopeChain(r); 444 448 ScopeChainIterator iter = scopeChain->begin(); 445 449 ScopeChainIterator end = scopeChain->end(); … … 449 453 ASSERT(iter != end); 450 454 451 CodeBlock* codeBlock = r[RegisterFile::CodeBlock].codeBlock();455 CodeBlock* codeBlock = this->codeBlock(r); 452 456 Identifier& ident = codeBlock->identifiers[property]; 453 457 JSObject* base; … … 471 475 } 472 476 473 NEVER_INLINE bool Machine::resolveBaseAndFunc(ExecState* exec, Instruction* vPC, Register* r, ScopeChainNode* scopeChain,JSValue*& exceptionValue)477 NEVER_INLINE bool Machine::resolveBaseAndFunc(ExecState* exec, Instruction* vPC, Register* r, JSValue*& exceptionValue) 474 478 { 475 479 int baseDst = (vPC + 1)->u.operand; … … 477 481 int property = (vPC + 3)->u.operand; 478 482 483 ScopeChainNode* scopeChain = this->scopeChain(r); 479 484 ScopeChainIterator iter = scopeChain->begin(); 480 485 ScopeChainIterator end = scopeChain->end(); … … 484 489 ASSERT(iter != end); 485 490 486 CodeBlock* codeBlock = r[RegisterFile::CodeBlock].codeBlock();491 CodeBlock* codeBlock = this->codeBlock(r); 487 492 Identifier& ident = codeBlock->identifiers[property]; 488 493 JSObject* base; … … 515 520 } 516 521 517 ALWAYS_INLINE void Machine::initializeCallFrame(Register* callFrame, CodeBlock* codeBlock, Instruction* vPC, ScopeChainNode* scopeChain, Register* r, int returnValueRegister, int argc, JSValue* function)518 {519 callFrame[RegisterFile::CodeBlock] = codeBlock;520 callFrame[RegisterFile::CallerScopeChain] = scopeChain;521 callFrame[RegisterFile::CallerRegisters] = r;522 callFrame[RegisterFile::ReturnPC] = vPC + 1;523 callFrame[RegisterFile::ReturnValueRegister] = returnValueRegister;524 callFrame[RegisterFile::ArgumentCount] = argc; // original argument count (for the sake of the "arguments" object)525 callFrame[RegisterFile::Callee] = function;526 callFrame[RegisterFile::OptionalCalleeActivation] = nullJSValue;527 callFrame[RegisterFile::OptionalCalleeArguments] = nullJSValue;528 }529 530 522 ALWAYS_INLINE Register* slideRegisterWindowForCall(ExecState* exec, CodeBlock* newCodeBlock, RegisterFile* registerFile, Register* registerBase, Register* r, size_t registerOffset, int argc, JSValue*& exceptionValue) 531 523 { … … 570 562 } 571 563 572 ALWAYS_INLINE ScopeChainNode* scopeChainForCall(ExecState* exec, FunctionBodyNode* functionBodyNode, CodeBlock* newCodeBlock, ScopeChainNode* callDataScopeChain, Register* r)573 {574 if (newCodeBlock->needsFullScopeChain) {575 JSActivation* activation = new (exec) JSActivation(exec, functionBodyNode, r);576 r[RegisterFile::OptionalCalleeActivation] = activation;577 578 return callDataScopeChain->copy()->push(activation);579 }580 581 return callDataScopeChain;582 }583 584 564 static NEVER_INLINE bool isNotObject(ExecState* exec, bool forInstanceOf, CodeBlock* codeBlock, const Instruction* vPC, JSValue* value, JSValue*& exceptionData) 585 565 { … … 606 586 UString programSource = static_cast<JSString*>(program)->value(); 607 587 608 CodeBlock* codeBlock = r[RegisterFile::CodeBlock].codeBlock();588 CodeBlock* codeBlock = this->codeBlock(r); 609 589 RefPtr<EvalNode> evalNode = codeBlock->evalCodeCache.get(exec, programSource, scopeChain, exceptionValue); 610 590 … … 666 646 #ifndef NDEBUG 667 647 668 void Machine::dumpCallFrame(ScopeChainNode* scopeChain, const RegisterFile* registerFile, const Register* r) 669 { 670 ScopeChain sc(scopeChain); 671 JSGlobalObject* globalObject = sc.globalObject(); 672 673 CodeBlock* codeBlock = r[RegisterFile::CodeBlock].codeBlock(); 648 void Machine::dumpCallFrame(const RegisterFile* registerFile, const Register* r) 649 { 650 JSGlobalObject* globalObject = scopeChain(r)->globalObject(); 651 652 CodeBlock* codeBlock = this->codeBlock(r); 674 653 codeBlock->dump(globalObject->globalExec()); 675 654 … … 684 663 printf("----------------------------------------------------\n"); 685 664 686 CodeBlock* codeBlock = r[RegisterFile::CodeBlock].codeBlock();665 CodeBlock* codeBlock = this->codeBlock(r); 687 666 const Register* it; 688 667 const Register* end; … … 710 689 711 690 printf("[CodeBlock] | %10p | %10p \n", it, (*it).v()); ++it; 712 printf("[ CallerScopeChain]| %10p | %10p \n", it, (*it).v()); ++it;691 printf("[ScopeChain] | %10p | %10p \n", it, (*it).v()); ++it; 713 692 printf("[CallerRegisters] | %10p | %10p \n", it, (*it).v()); ++it; 714 693 printf("[ReturnPC] | %10p | %10p \n", it, (*it).v()); ++it; … … 770 749 //#endif 771 750 772 NEVER_INLINE bool Machine::unwindCallFrame(ExecState* exec, JSValue* exceptionValue, const Instruction*& vPC, CodeBlock*& codeBlock, ScopeChainNode*& scopeChain,Register*& r)751 NEVER_INLINE bool Machine::unwindCallFrame(ExecState* exec, JSValue* exceptionValue, const Instruction*& vPC, CodeBlock*& codeBlock, Register*& r) 773 752 { 774 753 CodeBlock* oldCodeBlock = codeBlock; 754 ScopeChainNode* scopeChain = this->scopeChain(r); 775 755 776 756 if (Debugger* debugger = exec->dynamicGlobalObject()->debugger()) { … … 799 779 800 780 void* returnPC = r[RegisterFile::ReturnPC].v(); 801 scopeChain = r[RegisterFile::CallerScopeChain].scopeChain();802 781 r = r[RegisterFile::CallerRegisters].r(); 803 782 if (!r) … … 805 784 806 785 exec->m_callFrame = r; 807 codeBlock = r[RegisterFile::CodeBlock].codeBlock();786 codeBlock = this->codeBlock(r); 808 787 vPC = vPCForPC(codeBlock, returnPC); 809 788 return true; 810 789 } 811 790 812 NEVER_INLINE Instruction* Machine::throwException(ExecState* exec, JSValue*& exceptionValue, const Instruction* vPC, ScopeChainNode*& scopeChain,Register*& r, bool explicitThrow)791 NEVER_INLINE Instruction* Machine::throwException(ExecState* exec, JSValue*& exceptionValue, const Instruction* vPC, Register*& r, bool explicitThrow) 813 792 { 814 793 // Set up the exception object 815 794 816 CodeBlock* codeBlock = r[RegisterFile::CodeBlock].codeBlock();795 CodeBlock* codeBlock = this->codeBlock(r); 817 796 if (exceptionValue->isObject()) { 818 797 JSObject* exception = static_cast<JSObject*>(exceptionValue); … … 845 824 846 825 if (exception->isWatchdogException()) { 847 while (unwindCallFrame(exec, exceptionValue, vPC, codeBlock, scopeChain,r)) {826 while (unwindCallFrame(exec, exceptionValue, vPC, codeBlock, r)) { 848 827 // Don't need handler checks or anything, we just want to unroll all the JS callframes possible. 849 828 } … … 854 833 855 834 if (Debugger* debugger = exec->dynamicGlobalObject()->debugger()) { 835 ScopeChainNode* scopeChain = this->scopeChain(r); 856 836 DebuggerCallFrame debuggerCallFrame(exec, exec->dynamicGlobalObject(), codeBlock, scopeChain, r, exceptionValue); 857 837 debugger->exception(debuggerCallFrame, codeBlock->ownerNode->sourceId(), codeBlock->lineNumberForVPC(vPC)); … … 864 844 865 845 while (!codeBlock->getHandlerForVPC(vPC, handlerVPC, scopeDepth)) { 866 if (!unwindCallFrame(exec, exceptionValue, vPC, codeBlock, scopeChain,r))846 if (!unwindCallFrame(exec, exceptionValue, vPC, codeBlock, r)) 867 847 return 0; 868 848 } … … 870 850 // Now unwind the scope chain within the exception handler's call frame. 871 851 872 ScopeChain sc( scopeChain);852 ScopeChain sc(this->scopeChain(r)); 873 853 int scopeDelta = depth(codeBlock, sc) - scopeDepth; 874 854 ASSERT(scopeDelta >= 0); 875 855 while (scopeDelta--) 876 856 sc.pop(); 877 setScopeChain(exec, scopeChain, sc.node());857 r[RegisterFile::ScopeChain] = sc.node(); 878 858 879 859 return handlerVPC; … … 904 884 Register* r = m_registerFile.base() + oldSize + codeBlock->numParameters + RegisterFile::CallFrameHeaderSize; 905 885 r[codeBlock->thisRegister] = thisObj; 906 initializeCallFrame(r, codeBlock, 0, 0, 0, 0, 0, 0);886 initializeCallFrame(r, codeBlock, 0, scopeChain, 0, 0, 0, 0); 907 887 908 888 if (codeBlock->needsFullScopeChain) 909 889 scopeChain = scopeChain->copy(); 910 890 911 ExecState newExec(exec, &m_registerFile, scopeChain, 0);891 ExecState newExec(exec, &m_registerFile, r); 912 892 913 893 Profiler** profiler = Profiler::enabledProfilerReference(); … … 919 899 if (!codeBlock->ctiCode) 920 900 CTI::compile(this, exec, codeBlock); 921 JSValue* result = CTI::execute(codeBlock->ctiCode, &newExec, &m_registerFile, r, scopeChain,exception);901 JSValue* result = CTI::execute(codeBlock->ctiCode, &newExec, &m_registerFile, r, exception); 922 902 #else 923 JSValue* result = privateExecute(Normal, &newExec, &m_registerFile, r, scopeChain,exception);903 JSValue* result = privateExecute(Normal, &newExec, &m_registerFile, r, exception); 924 904 #endif 925 905 m_reentryDepth--; … … 969 949 } 970 950 // a 0 codeBlock indicates a built-in caller 971 initializeCallFrame(r, codeBlock, 0, 0, 0, 0, argc, function);972 973 ExecState newExec(exec, &m_registerFile, scopeChain,r);951 initializeCallFrame(r, codeBlock, 0, scopeChain, 0, 0, argc, function); 952 953 ExecState newExec(exec, &m_registerFile, r); 974 954 975 955 Profiler** profiler = Profiler::enabledProfilerReference(); … … 981 961 if (!codeBlock->ctiCode) 982 962 CTI::compile(this, exec, codeBlock); 983 JSValue* result = CTI::execute(codeBlock->ctiCode, &newExec, &m_registerFile, r, scopeChain,exception);963 JSValue* result = CTI::execute(codeBlock->ctiCode, &newExec, &m_registerFile, r, exception); 984 964 #else 985 setScopeChain(&newExec, scopeChain, scopeChain); 986 JSValue* result = privateExecute(Normal, &newExec, &m_registerFile, r, scopeChain, exception); 965 JSValue* result = privateExecute(Normal, &newExec, &m_registerFile, r, exception); 987 966 #endif 988 967 m_reentryDepth--; … … 1053 1032 // a 0 codeBlock indicates a built-in caller 1054 1033 r[codeBlock->thisRegister] = thisObj; 1055 initializeCallFrame(r, codeBlock, 0, 0, 0, 0, 0, 0);1034 initializeCallFrame(r, codeBlock, 0, scopeChain, 0, 0, 0, 0); 1056 1035 1057 1036 if (codeBlock->needsFullScopeChain) 1058 1037 scopeChain = scopeChain->copy(); 1059 1038 1060 ExecState newExec(exec, &m_registerFile, scopeChain, 0);1039 ExecState newExec(exec, &m_registerFile, r); 1061 1040 1062 1041 Profiler** profiler = Profiler::enabledProfilerReference(); … … 1068 1047 if (!codeBlock->ctiCode) 1069 1048 CTI::compile(this, exec, codeBlock); 1070 JSValue* result = CTI::execute(codeBlock->ctiCode, &newExec, &m_registerFile, r, scopeChain,exception);1049 JSValue* result = CTI::execute(codeBlock->ctiCode, &newExec, &m_registerFile, r, exception); 1071 1050 #else 1072 JSValue* result = privateExecute(Normal, &newExec, &m_registerFile, r, scopeChain,exception);1051 JSValue* result = privateExecute(Normal, &newExec, &m_registerFile, r, exception); 1073 1052 #endif 1074 1053 m_reentryDepth--; … … 1083 1062 } 1084 1063 1085 ALWAYS_INLINE void Machine::setScopeChain(ExecState* exec, ScopeChainNode*& scopeChain, ScopeChainNode* newScopeChain) 1086 { 1087 scopeChain = newScopeChain; 1088 exec->m_scopeChain = newScopeChain; 1089 } 1090 1091 NEVER_INLINE void Machine::debug(ExecState* exec, ScopeChainNode* scopeChain, Register* r, DebugHookID debugHookID, int firstLine, int lastLine) 1064 NEVER_INLINE void Machine::debug(ExecState* exec, Register* r, DebugHookID debugHookID, int firstLine, int lastLine) 1092 1065 { 1093 1066 Debugger* debugger = exec->dynamicGlobalObject()->debugger(); … … 1095 1068 return; 1096 1069 1097 CodeBlock* codeBlock = r[RegisterFile::CodeBlock].codeBlock(); 1070 CodeBlock* codeBlock = this->codeBlock(r); 1071 ScopeChainNode* scopeChain = this->scopeChain(r); 1098 1072 DebuggerCallFrame debuggerCallFrame(exec, exec->dynamicGlobalObject(), codeBlock, scopeChain, r, 0); 1099 1073 … … 1205 1179 } 1206 1180 1207 NEVER_INLINE ScopeChainNode* Machine::createExceptionScope(ExecState* exec, const Instruction* vPC, Register* r , ScopeChainNode* scopeChain)1181 NEVER_INLINE ScopeChainNode* Machine::createExceptionScope(ExecState* exec, const Instruction* vPC, Register* r) 1208 1182 { 1209 1183 int dst = (++vPC)->u.operand; 1210 CodeBlock* codeBlock = r[RegisterFile::CodeBlock].codeBlock();1184 CodeBlock* codeBlock = this->codeBlock(r); 1211 1185 Identifier& property = codeBlock->identifiers[(++vPC)->u.operand]; 1212 1186 JSValue* value = r[(++vPC)->u.operand].jsValue(exec); 1213 1187 JSObject* scope = new (exec) JSStaticScopeObject(exec, property, value, DontDelete); 1214 1188 r[dst] = scope; 1215 return scopeChain->push(scope); 1189 1190 return scopeChain(r)->push(scope); 1216 1191 } 1217 1192 … … 1428 1403 } 1429 1404 1430 JSValue* Machine::privateExecute(ExecutionFlag flag, ExecState* exec, RegisterFile* registerFile, Register* r, ScopeChainNode* scopeChain,JSValue** exception)1405 JSValue* Machine::privateExecute(ExecutionFlag flag, ExecState* exec, RegisterFile* registerFile, Register* r, JSValue** exception) 1431 1406 { 1432 1407 // One-time initialization of our address tables. We have to put this code … … 1457 1432 1458 1433 Register* registerBase = registerFile->base(); 1459 Instruction* vPC = r[RegisterFile::CodeBlock].codeBlock()->instructions.begin();1434 Instruction* vPC = this->codeBlock(r)->instructions.begin(); 1460 1435 Profiler** enabledProfilerReference = Profiler::enabledProfilerReference(); 1461 1436 unsigned tickCount = m_ticksUntilNextTimeoutCheck + 1; … … 1481 1456 1482 1457 #if HAVE(COMPUTED_GOTO) 1483 #define NEXT_OPCODE MACHINE_SAMPLING_sample( r[RegisterFile::CodeBlock].codeBlock(), vPC); goto *vPC->u.opcode1458 #define NEXT_OPCODE MACHINE_SAMPLING_sample(this->codeBlock(r), vPC); goto *vPC->u.opcode 1484 1459 #if DUMP_OPCODE_STATS 1485 1460 #define BEGIN_OPCODE(opcode) opcode: OpcodeStats::recordInstruction(opcode); … … 1489 1464 NEXT_OPCODE; 1490 1465 #else 1491 #define NEXT_OPCODE MACHINE_SAMPLING_sample( r[RegisterFile::CodeBlock].codeBlock(), vPC); continue1466 #define NEXT_OPCODE MACHINE_SAMPLING_sample(this->codeBlock(r), vPC); continue 1492 1467 #if DUMP_OPCODE_STATS 1493 1468 #define BEGIN_OPCODE(opcode) case opcode: OpcodeStats::recordInstruction(opcode); … … 1537 1512 int dst = (++vPC)->u.operand; 1538 1513 int regExp = (++vPC)->u.operand; 1539 r[dst] = new (exec) RegExpObject(scopeChain ->globalObject()->regExpStructure(), r[RegisterFile::CodeBlock].codeBlock()->regexps[regExp]);1514 r[dst] = new (exec) RegExpObject(scopeChain(r)->globalObject()->regExpStructure(), codeBlock(r)->regexps[regExp]); 1540 1515 1541 1516 ++vPC; … … 2144 2119 JSValue* baseVal = r[base].jsValue(exec); 2145 2120 2146 if (isNotObject(exec, true, r[RegisterFile::CodeBlock].codeBlock(), vPC, baseVal, exceptionValue))2121 if (isNotObject(exec, true, codeBlock(r), vPC, baseVal, exceptionValue)) 2147 2122 goto vm_throw; 2148 2123 … … 2265 2240 2266 2241 JSValue* baseVal = r[base].jsValue(exec); 2267 if (isNotObject(exec, false, r[RegisterFile::CodeBlock].codeBlock(), vPC, baseVal, exceptionValue))2242 if (isNotObject(exec, false, codeBlock(r), vPC, baseVal, exceptionValue)) 2268 2243 goto vm_throw; 2269 2244 … … 2291 2266 dst. If the property is not found, raises an exception. 2292 2267 */ 2293 if (UNLIKELY(!resolve(exec, vPC, r, scopeChain,exceptionValue)))2268 if (UNLIKELY(!resolve(exec, vPC, r, exceptionValue))) 2294 2269 goto vm_throw; 2295 2270 … … 2304 2279 value to register dst. If the property is not found, raises an exception. 2305 2280 */ 2306 if (UNLIKELY(!resolveSkip(exec, vPC, r, scopeChain,exceptionValue)))2281 if (UNLIKELY(!resolveSkip(exec, vPC, r, exceptionValue))) 2307 2282 goto vm_throw; 2308 2283 … … 2362 2337 int dst = (++vPC)->u.operand; 2363 2338 int index = (++vPC)->u.operand; 2364 int skip = (++vPC)->u.operand + r[RegisterFile::CodeBlock].codeBlock()->needsFullScopeChain; 2365 2339 int skip = (++vPC)->u.operand + codeBlock(r)->needsFullScopeChain; 2340 2341 ScopeChainNode* scopeChain = this->scopeChain(r); 2366 2342 ScopeChainIterator iter = scopeChain->begin(); 2367 2343 ScopeChainIterator end = scopeChain->end(); … … 2383 2359 */ 2384 2360 int index = (++vPC)->u.operand; 2385 int skip = (++vPC)->u.operand + r[RegisterFile::CodeBlock].codeBlock()->needsFullScopeChain;2361 int skip = (++vPC)->u.operand + codeBlock(r)->needsFullScopeChain; 2386 2362 int value = (++vPC)->u.operand; 2387 2363 2364 ScopeChainNode* scopeChain = this->scopeChain(r); 2388 2365 ScopeChainIterator iter = scopeChain->begin(); 2389 2366 ScopeChainIterator end = scopeChain->end(); … … 2408 2385 will be the global object) is stored in register dst. 2409 2386 */ 2410 resolveBase(exec, vPC, r , scopeChain);2387 resolveBase(exec, vPC, r); 2411 2388 2412 2389 vPC += 3; … … 2425 2402 avoids duplicate hash lookups. 2426 2403 */ 2427 if (UNLIKELY(!resolveBaseAndProperty(exec, vPC, r, scopeChain,exceptionValue)))2404 if (UNLIKELY(!resolveBaseAndProperty(exec, vPC, r, exceptionValue))) 2428 2405 goto vm_throw; 2429 2406 … … 2446 2423 calls but not for other property lookup. 2447 2424 */ 2448 if (UNLIKELY(!resolveBaseAndFunc(exec, vPC, r, scopeChain,exceptionValue)))2425 if (UNLIKELY(!resolveBaseAndFunc(exec, vPC, r, exceptionValue))) 2449 2426 goto vm_throw; 2450 2427 … … 2462 2439 int property = vPC[3].u.operand; 2463 2440 2464 Identifier& ident = r[RegisterFile::CodeBlock].codeBlock()->identifiers[property]; 2441 CodeBlock* codeBlock = this->codeBlock(r); 2442 Identifier& ident = codeBlock->identifiers[property]; 2465 2443 JSValue* baseValue = r[base].jsValue(exec); 2466 2444 PropertySlot slot(baseValue); … … 2468 2446 VM_CHECK_EXCEPTION(); 2469 2447 2470 tryCacheGetByID(exec, r[RegisterFile::CodeBlock].codeBlock(), vPC, baseValue, ident, slot);2448 tryCacheGetByID(exec, codeBlock, vPC, baseValue, ident, slot); 2471 2449 2472 2450 r[dst] = result; … … 2494 2472 int offset = vPC[5].u.operand; 2495 2473 2496 ASSERT(baseObject->get(exec, r[RegisterFile::CodeBlock].codeBlock()->identifiers[vPC[3].u.operand]) == baseObject->getDirectOffset(offset));2474 ASSERT(baseObject->get(exec, codeBlock(r)->identifiers[vPC[3].u.operand]) == baseObject->getDirectOffset(offset)); 2497 2475 r[dst] = baseObject->getDirectOffset(offset); 2498 2476 … … 2502 2480 } 2503 2481 2504 uncacheGetByID( r[RegisterFile::CodeBlock].codeBlock(), vPC);2482 uncacheGetByID(codeBlock(r), vPC); 2505 2483 NEXT_OPCODE; 2506 2484 } … … 2528 2506 int offset = vPC[6].u.operand; 2529 2507 2530 ASSERT(protoObject->get(exec, r[RegisterFile::CodeBlock].codeBlock()->identifiers[vPC[3].u.operand]) == protoObject->getDirectOffset(offset));2508 ASSERT(protoObject->get(exec, codeBlock(r)->identifiers[vPC[3].u.operand]) == protoObject->getDirectOffset(offset)); 2531 2509 r[dst] = protoObject->getDirectOffset(offset); 2532 2510 … … 2537 2515 } 2538 2516 2539 uncacheGetByID( r[RegisterFile::CodeBlock].codeBlock(), vPC);2517 uncacheGetByID(codeBlock(r), vPC); 2540 2518 NEXT_OPCODE; 2541 2519 } … … 2569 2547 int offset = vPC[7].u.operand; 2570 2548 2571 ASSERT(baseObject->get(exec, r[RegisterFile::CodeBlock].codeBlock()->identifiers[vPC[3].u.operand]) == baseObject->getDirectOffset(offset));2549 ASSERT(baseObject->get(exec, codeBlock(r)->identifiers[vPC[3].u.operand]) == baseObject->getDirectOffset(offset)); 2572 2550 r[dst] = baseObject->getDirectOffset(offset); 2573 2551 … … 2579 2557 } 2580 2558 2581 uncacheGetByID( r[RegisterFile::CodeBlock].codeBlock(), vPC);2559 uncacheGetByID(codeBlock(r), vPC); 2582 2560 NEXT_OPCODE; 2583 2561 } … … 2592 2570 int property = vPC[3].u.operand; 2593 2571 2594 Identifier& ident = r[RegisterFile::CodeBlock].codeBlock()->identifiers[property]; 2595 2572 Identifier& ident = codeBlock(r)->identifiers[property]; 2596 2573 JSValue* baseValue = r[base].jsValue(exec); 2597 2574 PropertySlot slot(baseValue); … … 2620 2597 } 2621 2598 2622 uncacheGetByID( r[RegisterFile::CodeBlock].codeBlock(), vPC);2599 uncacheGetByID(codeBlock(r), vPC); 2623 2600 NEXT_OPCODE; 2624 2601 } … … 2640 2617 } 2641 2618 2642 uncacheGetByID( r[RegisterFile::CodeBlock].codeBlock(), vPC);2619 uncacheGetByID(codeBlock(r), vPC); 2643 2620 NEXT_OPCODE; 2644 2621 } … … 2657 2634 int value = vPC[3].u.operand; 2658 2635 2636 CodeBlock* codeBlock = this->codeBlock(r); 2659 2637 JSValue* baseValue = r[base].jsValue(exec); 2660 2638 Identifier& ident = codeBlock->identifiers[property]; 2661 2639 PutPropertySlot slot; 2662 Identifier& ident = r[RegisterFile::CodeBlock].codeBlock()->identifiers[property];2663 2640 baseValue->put(exec, ident, r[value].jsValue(exec), slot); 2664 2641 VM_CHECK_EXCEPTION(); 2665 2642 2666 tryCachePutByID(exec, r[RegisterFile::CodeBlock].codeBlock(), vPC, baseValue, slot);2643 tryCachePutByID(exec, codeBlock, vPC, baseValue, slot); 2667 2644 2668 2645 vPC += 8; … … 2697 2674 while (!proto->isNull()) { 2698 2675 if (UNLIKELY(proto->structureID() != (*it).get())) { 2699 uncachePutByID( r[RegisterFile::CodeBlock].codeBlock(), vPC);2676 uncachePutByID(codeBlock(r), vPC); 2700 2677 NEXT_OPCODE; 2701 2678 } … … 2710 2687 int value = vPC[3].u.operand; 2711 2688 unsigned offset = vPC[7].u.operand; 2712 ASSERT(baseObject->offsetForLocation(baseObject->getDirectLocation( r[RegisterFile::CodeBlock].codeBlock()->identifiers[vPC[2].u.operand])) == offset);2689 ASSERT(baseObject->offsetForLocation(baseObject->getDirectLocation(codeBlock(r)->identifiers[vPC[2].u.operand])) == offset); 2713 2690 baseObject->putDirectOffset(offset, r[value].jsValue(exec)); 2714 2691 … … 2718 2695 } 2719 2696 2720 uncachePutByID( r[RegisterFile::CodeBlock].codeBlock(), vPC);2697 uncachePutByID(codeBlock(r), vPC); 2721 2698 NEXT_OPCODE; 2722 2699 } … … 2745 2722 unsigned offset = vPC[5].u.operand; 2746 2723 2747 ASSERT(baseObject->offsetForLocation(baseObject->getDirectLocation( r[RegisterFile::CodeBlock].codeBlock()->identifiers[vPC[2].u.operand])) == offset);2724 ASSERT(baseObject->offsetForLocation(baseObject->getDirectLocation(codeBlock(r)->identifiers[vPC[2].u.operand])) == offset); 2748 2725 baseObject->putDirectOffset(offset, r[value].jsValue(exec)); 2749 2726 … … 2753 2730 } 2754 2731 2755 uncachePutByID( r[RegisterFile::CodeBlock].codeBlock(), vPC);2732 uncachePutByID(codeBlock(r), vPC); 2756 2733 NEXT_OPCODE; 2757 2734 } … … 2770 2747 2771 2748 JSValue* baseValue = r[base].jsValue(exec); 2772 2749 Identifier& ident = codeBlock(r)->identifiers[property]; 2773 2750 PutPropertySlot slot; 2774 Identifier& ident = r[RegisterFile::CodeBlock].codeBlock()->identifiers[property];2775 2751 baseValue->put(exec, ident, r[value].jsValue(exec), slot); 2776 2752 VM_CHECK_EXCEPTION(); … … 2792 2768 2793 2769 JSObject* baseObj = r[base].jsValue(exec)->toObject(exec); 2794 2795 Identifier& ident = r[RegisterFile::CodeBlock].codeBlock()->identifiers[property]; 2770 Identifier& ident = codeBlock(r)->identifiers[property]; 2796 2771 JSValue* result = jsBoolean(baseObj->deleteProperty(exec, ident)); 2797 2772 VM_CHECK_EXCEPTION(); … … 3110 3085 else { 3111 3086 int32_t value = JSImmediate::getTruncatedInt32(scrutinee); 3112 vPC += r[RegisterFile::CodeBlock].codeBlock()->immediateSwitchJumpTables[tableIndex].offsetForValue(value, defaultOffset);3087 vPC += codeBlock(r)->immediateSwitchJumpTables[tableIndex].offsetForValue(value, defaultOffset); 3113 3088 } 3114 3089 NEXT_OPCODE; … … 3133 3108 vPC += defaultOffset; 3134 3109 else 3135 vPC += r[RegisterFile::CodeBlock].codeBlock()->characterSwitchJumpTables[tableIndex].offsetForValue(value->data()[0], defaultOffset);3110 vPC += codeBlock(r)->characterSwitchJumpTables[tableIndex].offsetForValue(value->data()[0], defaultOffset); 3136 3111 } 3137 3112 NEXT_OPCODE; … … 3152 3127 vPC += defaultOffset; 3153 3128 else 3154 vPC += r[RegisterFile::CodeBlock].codeBlock()->stringSwitchJumpTables[tableIndex].offsetForValue(static_cast<JSString*>(scrutinee)->value().rep(), defaultOffset);3129 vPC += codeBlock(r)->stringSwitchJumpTables[tableIndex].offsetForValue(static_cast<JSString*>(scrutinee)->value().rep(), defaultOffset); 3155 3130 NEXT_OPCODE; 3156 3131 } … … 3166 3141 int func = (++vPC)->u.operand; 3167 3142 3168 r[dst] = r[RegisterFile::CodeBlock].codeBlock()->functions[func]->makeFunction(exec, scopeChain);3143 r[dst] = codeBlock(r)->functions[func]->makeFunction(exec, scopeChain(r)); 3169 3144 3170 3145 ++vPC; … … 3182 3157 int func = (++vPC)->u.operand; 3183 3158 3184 r[dst] = r[RegisterFile::CodeBlock].codeBlock()->functionExpressions[func]->makeFunction(exec, scopeChain);3159 r[dst] = codeBlock(r)->functionExpressions[func]->makeFunction(exec, scopeChain(r)); 3185 3160 3186 3161 ++vPC; … … 3209 3184 JSValue* baseVal = r[thisVal].jsValue(exec); 3210 3185 3186 ScopeChainNode* scopeChain = this->scopeChain(r); 3211 3187 if (baseVal == scopeChain->globalObject() && funcVal == scopeChain->globalObject()->evalFunction()) { 3212 JSObject* thisObject = static_cast<JSObject*>(r[ r[RegisterFile::CodeBlock].codeBlock()->thisRegister].jsValue(exec));3188 JSObject* thisObject = static_cast<JSObject*>(r[codeBlock(r)->thisRegister].jsValue(exec)); 3213 3189 JSValue* result = callEval(exec, thisObject, scopeChain, registerFile, r, firstArg, argCount, exceptionValue); 3214 3190 if (exceptionValue) … … 3294 3270 3295 3271 r = slideRegisterWindowForCall(exec, newCodeBlock, registerFile, registerBase, r, registerOffset, argCount, exceptionValue); 3272 exec->m_callFrame = r; 3296 3273 if (UNLIKELY(exceptionValue != 0)) 3297 3274 goto vm_throw; 3298 3275 3299 initializeCallFrame(r, newCodeBlock, vPC, scopeChain, savedR, dst, argCount, v); 3300 exec->m_callFrame = r; 3276 initializeCallFrame(r, newCodeBlock, vPC + 1, callDataScopeChain, savedR, dst, argCount, v); 3301 3277 3302 3278 if (*enabledProfilerReference) 3303 3279 (*enabledProfilerReference)->willExecute(exec, static_cast<JSObject*>(v)); 3304 3280 3305 setScopeChain(exec, scopeChain, callDataScopeChain);3306 3281 vPC = newCodeBlock->instructions.begin(); 3307 3282 … … 3317 3292 ArgList args(r + firstArg + 1, argCount - 1); 3318 3293 3319 initializeCallFrame(r + registerOffset, 0, vPC, scopeChain, r, dst, argCount, v); 3294 ScopeChainNode* scopeChain = this->scopeChain(r); 3295 initializeCallFrame(r + registerOffset, 0, vPC + 1, scopeChain, r, dst, argCount, v); 3320 3296 exec->m_callFrame = r + registerOffset; 3321 3297 … … 3340 3316 ASSERT(callType == CallTypeNone); 3341 3317 3342 exceptionValue = createNotAFunctionError(exec, v, vPC, r[RegisterFile::CodeBlock].codeBlock());3318 exceptionValue = createNotAFunctionError(exec, v, vPC, codeBlock(r)); 3343 3319 goto vm_throw; 3344 3320 } … … 3356 3332 3357 3333 if (JSActivation* activation = static_cast<JSActivation*>(r[RegisterFile::OptionalCalleeActivation].jsValue(exec))) { 3358 ASSERT(! r[RegisterFile::CodeBlock].codeBlock()->needsFullScopeChain || scopeChain->object == activation);3334 ASSERT(!codeBlock(r)->needsFullScopeChain || scopeChain(r)->object == activation); 3359 3335 ASSERT(activation->isObject(&JSActivation::info)); 3360 3336 activation->copyRegisters(); … … 3364 3340 (*enabledProfilerReference)->didExecute(exec, static_cast<JSObject*>(r[RegisterFile::Callee].jsValue(exec))); 3365 3341 3366 if ( r[RegisterFile::CodeBlock].codeBlock()->needsFullScopeChain)3367 scopeChain ->deref();3342 if (codeBlock(r)->needsFullScopeChain) 3343 scopeChain(r)->deref(); 3368 3344 3369 3345 JSValue* returnValue = r[result].jsValue(exec); 3370 3346 3371 3347 vPC = r[RegisterFile::ReturnPC].vPC(); 3372 setScopeChain(exec, scopeChain, r[RegisterFile::CallerScopeChain].scopeChain());3373 3348 int dst = r[RegisterFile::ReturnValueRegister].i(); 3374 3349 r = r[RegisterFile::CallerRegisters].r(); … … 3384 3359 BEGIN_OPCODE(op_init) { 3385 3360 size_t i = 0; 3386 CodeBlock* codeBlock = r[RegisterFile::CodeBlock].codeBlock();3361 CodeBlock* codeBlock = this->codeBlock(r); 3387 3362 3388 3363 for (size_t count = codeBlock->numVars; i < count; ++i) … … 3397 3372 BEGIN_OPCODE(op_init_activation) { 3398 3373 size_t i = 0; 3399 CodeBlock* codeBlock = r[RegisterFile::CodeBlock].codeBlock();3374 CodeBlock* codeBlock = this->codeBlock(r); 3400 3375 3401 3376 for (size_t count = codeBlock->numVars; i < count; ++i) … … 3407 3382 JSActivation* activation = new (exec) JSActivation(exec, static_cast<FunctionBodyNode*>(codeBlock->ownerNode), r); 3408 3383 r[RegisterFile::OptionalCalleeActivation] = activation; 3409 setScopeChain(exec, scopeChain, scopeChain->copy()->push(activation));3384 r[RegisterFile::ScopeChain] = scopeChain(r)->copy()->push(activation); 3410 3385 3411 3386 ++vPC; … … 3449 3424 (*enabledProfilerReference)->willExecute(exec, static_cast<JSObject*>(v)); 3450 3425 3426 ScopeChainNode* callDataScopeChain = constructData.js.scopeChain; 3427 FunctionBodyNode* functionBodyNode = constructData.js.functionBody; 3428 CodeBlock* newCodeBlock = &functionBodyNode->byteCode(callDataScopeChain); 3429 3451 3430 StructureID* structure; 3452 3431 JSValue* prototype = r[constrProto].jsValue(exec); … … 3454 3433 structure = static_cast<JSObject*>(prototype)->inheritorID(); 3455 3434 else 3456 structure = scopeChain->globalObject()->emptyObjectStructure();3435 structure = callDataScopeChain->globalObject()->emptyObjectStructure(); 3457 3436 JSObject* newObject = new (exec) JSObject(structure); 3458 3437 3459 ScopeChainNode* callDataScopeChain = constructData.js.scopeChain;3460 FunctionBodyNode* functionBodyNode = constructData.js.functionBody;3461 CodeBlock* newCodeBlock = &functionBodyNode->byteCode(callDataScopeChain);3462 3463 3438 r[firstArg] = newObject; // "this" value 3464 3439 … … 3466 3441 3467 3442 r = slideRegisterWindowForCall(exec, newCodeBlock, registerFile, registerBase, r, registerOffset, argCount, exceptionValue); 3443 exec->m_callFrame = r; 3468 3444 if (UNLIKELY(exceptionValue != 0)) 3469 3445 goto vm_throw; 3470 3446 3471 initializeCallFrame(r, newCodeBlock, vPC, scopeChain, savedR, dst, argCount, v); 3472 exec->m_callFrame = r; 3447 initializeCallFrame(r, newCodeBlock, vPC + 1, callDataScopeChain, savedR, dst, argCount, v); 3473 3448 3474 3449 if (*enabledProfilerReference) 3475 3450 (*enabledProfilerReference)->didExecute(exec, static_cast<JSObject*>(v)); 3476 3451 3477 setScopeChain(exec, scopeChain, callDataScopeChain);3478 3452 vPC = newCodeBlock->instructions.begin(); 3479 3453 … … 3488 3462 ArgList args(r + firstArg + 1, argCount - 1); 3489 3463 3490 initializeCallFrame(r + registerOffset, 0, vPC, scopeChain, r, dst, argCount, v); 3464 ScopeChainNode* scopeChain = this->scopeChain(r); 3465 initializeCallFrame(r + registerOffset, 0, vPC + 1, scopeChain, r, dst, argCount, v); 3491 3466 exec->m_callFrame = r + registerOffset; 3492 3467 … … 3511 3486 ASSERT(constructType == ConstructTypeNone); 3512 3487 3513 exceptionValue = createNotAConstructorError(exec, v, vPC, r[RegisterFile::CodeBlock].codeBlock());3488 exceptionValue = createNotAConstructorError(exec, v, vPC, codeBlock(r)); 3514 3489 goto vm_throw; 3515 3490 } … … 3544 3519 VM_CHECK_EXCEPTION(); 3545 3520 3546 setScopeChain(exec, scopeChain, scopeChain->push(o));3521 r[RegisterFile::ScopeChain] = scopeChain(r)->push(o); 3547 3522 3548 3523 ++vPC; … … 3554 3529 Removes the top item from the current scope chain. 3555 3530 */ 3556 setScopeChain(exec, scopeChain, scopeChain->pop());3531 r[RegisterFile::ScopeChain] = scopeChain(r)->pop(); 3557 3532 3558 3533 ++vPC; … … 3609 3584 int target = (++vPC)->u.operand; 3610 3585 3611 ScopeChainNode* tmp = scopeChain ;3586 ScopeChainNode* tmp = scopeChain(r); 3612 3587 while (count--) 3613 3588 tmp = tmp->pop(); 3614 setScopeChain(exec, scopeChain, tmp);3589 r[RegisterFile::ScopeChain] = tmp; 3615 3590 3616 3591 vPC += target; … … 3628 3603 in dst for GC. 3629 3604 */ 3630 setScopeChain(exec, scopeChain, createExceptionScope(exec, vPC, r, scopeChain)); 3605 r[RegisterFile::ScopeChain] = createExceptionScope(exec, vPC, r); 3606 3631 3607 vPC += 4; 3632 3608 NEXT_OPCODE; … … 3665 3641 exceptionValue = r[ex].jsValue(exec); 3666 3642 3667 handlerVPC = throwException(exec, exceptionValue, vPC, scopeChain,r, true);3643 handlerVPC = throwException(exec, exceptionValue, vPC, r, true); 3668 3644 if (!handlerVPC) { 3669 3645 *exception = exceptionValue; … … 3690 3666 int dst = (++vPC)->u.operand; 3691 3667 int src = (++vPC)->u.operand; 3692 r[dst] = r[RegisterFile::CodeBlock].codeBlock()->unexpectedConstants[src];3668 r[dst] = codeBlock(r)->unexpectedConstants[src]; 3693 3669 3694 3670 ++vPC; … … 3707 3683 int message = (++vPC)->u.operand; 3708 3684 3709 CodeBlock* codeBlock = r[RegisterFile::CodeBlock].codeBlock();3685 CodeBlock* codeBlock = this->codeBlock(r); 3710 3686 r[dst] = Error::create(exec, (ErrorType)type, codeBlock->unexpectedConstants[message]->toString(exec), codeBlock->lineNumberForVPC(vPC), codeBlock->ownerNode->sourceId(), codeBlock->ownerNode->sourceURL()); 3711 3687 … … 3720 3696 */ 3721 3697 3722 if (r[RegisterFile::CodeBlock].codeBlock()->needsFullScopeChain) { 3698 if (codeBlock(r)->needsFullScopeChain) { 3699 ScopeChainNode* scopeChain = this->scopeChain(r); 3723 3700 ASSERT(scopeChain->refCount > 1); 3724 3701 scopeChain->deref(); … … 3744 3721 ASSERT(r[base].jsValue(exec)->isObject()); 3745 3722 JSObject* baseObj = static_cast<JSObject*>(r[base].jsValue(exec)); 3746 Identifier& ident = r[RegisterFile::CodeBlock].codeBlock()->identifiers[property];3723 Identifier& ident = codeBlock(r)->identifiers[property]; 3747 3724 ASSERT(r[function].jsValue(exec)->isObject()); 3748 3725 baseObj->defineGetter(exec, ident, static_cast<JSObject*>(r[function].jsValue(exec))); … … 3768 3745 ASSERT(r[base].jsValue(exec)->isObject()); 3769 3746 JSObject* baseObj = static_cast<JSObject*>(r[base].jsValue(exec)); 3770 Identifier& ident = r[RegisterFile::CodeBlock].codeBlock()->identifiers[property];3747 Identifier& ident = codeBlock(r)->identifiers[property]; 3771 3748 ASSERT(r[function].jsValue(exec)->isObject()); 3772 3749 baseObj->defineSetter(exec, ident, static_cast<JSObject*>(r[function].jsValue(exec))); … … 3809 3786 int lastLine = (++vPC)->u.operand; 3810 3787 3811 debug(exec, scopeChain,r, static_cast<DebugHookID>(debugHookID), firstLine, lastLine);3788 debug(exec, r, static_cast<DebugHookID>(debugHookID), firstLine, lastLine); 3812 3789 3813 3790 ++vPC; … … 3821 3798 exceptionValue = createInterruptedExecutionException(exec); 3822 3799 } 3823 handlerVPC = throwException(exec, exceptionValue, vPC, scopeChain,r, false);3800 handlerVPC = throwException(exec, exceptionValue, vPC, r, false); 3824 3801 if (!handlerVPC) { 3825 3802 *exception = exceptionValue; … … 3881 3858 3882 3859 Register* r = exec->m_callFrame; 3883 if (!r)3884 return;3885 3886 3860 Register* callerR = r[RegisterFile::CallerRegisters].r(); 3887 3861 if (!callerR) 3888 3862 return; 3889 3863 3890 CodeBlock* callerCodeBlock = c allerR[RegisterFile::CodeBlock].codeBlock();3864 CodeBlock* callerCodeBlock = codeBlock(callerR); 3891 3865 Instruction* vPC = vPCForPC(callerCodeBlock, r[RegisterFile::ReturnPC].v()); 3892 3866 lineNumber = callerCodeBlock->lineNumberForVPC(vPC - 1); … … 3903 3877 Register* Machine::callFrame(ExecState* exec, InternalFunction* function) const 3904 3878 { 3905 Register* callFrame = exec->m_callFrame; 3906 3907 while (1) { 3908 while (!callFrame) { 3909 exec = exec->m_prev; 3910 if (!exec) 3911 return 0; 3912 callFrame = exec->m_callFrame; 3913 } 3914 3915 if (callFrame[RegisterFile::Callee].jsValue(exec) == function) 3916 return callFrame; 3917 3918 callFrame = callFrame[RegisterFile::CallerRegisters].r(); 3919 } 3879 for (; exec; exec = exec->m_prev) 3880 for (Register* r = exec->m_callFrame; r; r = r[RegisterFile::CallerRegisters].r()) 3881 if (r[RegisterFile::Callee].jsValue(exec) == function) 3882 return r; 3883 3884 return 0; 3920 3885 } 3921 3886 … … 4194 4159 void Machine::cti_op_end(CTI_ARGS) 4195 4160 { 4196 ASSERT(ARG_scopeChain->refCount > 1); 4197 ARG_scopeChain->deref(); 4161 Register* r = ARG_r; 4162 ScopeChainNode* scopeChain = Machine::scopeChain(r); 4163 ASSERT(scopeChain->refCount > 1); 4164 scopeChain->deref(); 4198 4165 } 4199 4166 … … 4279 4246 baseValue->put(exec, ident, ARG_src3, slot); 4280 4247 4281 exec->machine()->tryCTICachePutByID(exec, ARG_r[RegisterFile::CodeBlock].codeBlock(), CTI_RETURN_ADDRESS, baseValue, slot); 4248 Register* r = ARG_r; 4249 exec->machine()->tryCTICachePutByID(exec, codeBlock(r), CTI_RETURN_ADDRESS, baseValue, slot); 4282 4250 4283 4251 VM_CHECK_EXCEPTION_AT_END(); … … 4333 4301 JSValue* result = baseValue->get(exec, ident, slot); 4334 4302 4335 exec->machine()->tryCTICacheGetByID(exec, ARG_r[RegisterFile::CodeBlock].codeBlock(), CTI_RETURN_ADDRESS, baseValue, ident, slot); 4303 Register* r = ARG_r; 4304 exec->machine()->tryCTICacheGetByID(exec, codeBlock(r), CTI_RETURN_ADDRESS, baseValue, ident, slot); 4336 4305 4337 4306 VM_CHECK_EXCEPTION_AT_END(); … … 4384 4353 4385 4354 if (!baseVal->isObject()) { 4386 CodeBlock* codeBlock = ARG_r[RegisterFile::CodeBlock].codeBlock(); 4355 Register* r = ARG_r; 4356 CodeBlock* codeBlock = Machine::codeBlock(r); 4387 4357 ASSERT(codeBlock->ctiReturnAddressVPCMap.contains(CTI_RETURN_ADDRESS)); 4388 4358 unsigned vPCIndex = codeBlock->ctiReturnAddressVPCMap.get(CTI_RETURN_ADDRESS); … … 4439 4409 JSValue* Machine::cti_op_new_func(CTI_ARGS) 4440 4410 { 4441 return ARG_func1->makeFunction(ARG_exec, ARG_scopeChain); 4411 Register* r = ARG_r; 4412 ScopeChainNode* scopeChain = Machine::scopeChain(r); 4413 return ARG_func1->makeFunction(ARG_exec, scopeChain); 4442 4414 } 4443 4415 … … 4474 4446 4475 4447 r[RegisterFile::CodeBlock] = newCodeBlock; 4476 r[RegisterFile:: CallerScopeChain] = ARG_scopeChain;4448 r[RegisterFile::ScopeChain] = callDataScopeChain; 4477 4449 r[RegisterFile::CallerRegisters] = savedR; 4478 4450 // RegisterFile::ReturnPC is set by callee … … 4484 4456 4485 4457 exec->m_callFrame = r; 4486 exec->m_scopeChain = callDataScopeChain;4487 4488 ARG_setScopeChain(callDataScopeChain);4489 4458 ARG_setR(r); 4459 4490 4460 return newCodeBlock->ctiCode; 4491 4461 } … … 4494 4464 { 4495 4465 ExecState* exec = ARG_exec; 4496 CodeBlock* codeBlock = ARG_r[RegisterFile::CodeBlock].codeBlock(); 4466 Register* r = ARG_r; 4467 CodeBlock* codeBlock = Machine::codeBlock(r); 4497 4468 4498 4469 if (!codeBlock->ctiCode) … … 4505 4476 { 4506 4477 ExecState* exec = ARG_exec; 4507 CodeBlock* codeBlock = ARG_r[RegisterFile::CodeBlock].codeBlock();4508 ScopeChainNode* scopeChain = ARG_scopeChain;4509 4478 Register* r = ARG_r; 4479 CodeBlock* codeBlock = Machine::codeBlock(r); 4480 ScopeChainNode* scopeChain = Machine::scopeChain(r); 4510 4481 4511 4482 JSActivation* activation = new (exec) JSActivation(exec, static_cast<FunctionBodyNode*>(codeBlock->ownerNode), r); 4512 4483 r[RegisterFile::OptionalCalleeActivation] = activation; 4513 4514 setScopeChain(exec, scopeChain, scopeChain->copy()->push(activation)); 4515 ARG_setScopeChain(scopeChain); 4484 r[RegisterFile::ScopeChain] = scopeChain->copy()->push(activation); 4516 4485 } 4517 4486 … … 4519 4488 { 4520 4489 ExecState* exec = ARG_exec; 4521 4522 4490 JSValue* funcVal = ARG_src1; 4523 4491 … … 4530 4498 int registerOffset = ARG_int2; 4531 4499 int argCount = ARG_int3; 4532 Register* r = ARG_r + registerOffset; 4533 4534 initializeCallFrame(r, 0, ARG_instr4, ARG_scopeChain, ARG_r, 0, argCount, funcVal); 4500 Register* savedR = ARG_r; 4501 Register* r = savedR + registerOffset; 4502 4503 initializeCallFrame(r, 0, ARG_instr4 + 1, scopeChain(savedR), savedR, 0, argCount, funcVal); 4535 4504 exec->m_callFrame = r; 4505 ARG_setR(r); 4536 4506 4537 4507 if (*ARG_profilerReference) … … 4544 4514 4545 4515 JSValue* returnValue = callData.native.function(exec, static_cast<JSObject*>(funcVal), argv[0].jsValue(exec), argList); 4516 exec->m_callFrame = savedR; 4517 ARG_setR(savedR); 4546 4518 VM_CHECK_EXCEPTION(JSValue*); 4547 4519 … … 4549 4521 (*ARG_profilerReference)->didExecute(exec, static_cast<JSObject*>(funcVal)); 4550 4522 4551 exec->m_callFrame = ARG_r;4552 4523 return returnValue; 4553 4524 } … … 4555 4526 ASSERT(callType == CallTypeNone); 4556 4527 4557 exec->setException(createNotAFunctionError(exec, funcVal, ARG_instr4, ARG_r[RegisterFile::CodeBlock].codeBlock())); 4528 Register* r = ARG_r; 4529 exec->setException(createNotAFunctionError(exec, funcVal, ARG_instr4, codeBlock(r))); 4558 4530 VM_CHECK_EXCEPTION_AT_END(); 4559 4531 return 0; … … 4571 4543 { 4572 4544 ExecState* exec = ARG_exec; 4573 Register* callFrame= ARG_r;4574 4575 JSActivation* activation = static_cast<JSActivation*>( callFrame[RegisterFile::OptionalCalleeActivation].jsValue(exec));4545 Register* r = ARG_r; 4546 4547 JSActivation* activation = static_cast<JSActivation*>(r[RegisterFile::OptionalCalleeActivation].jsValue(exec)); 4576 4548 ASSERT(activation); 4577 4549 4578 ASSERT(! ARG_r[RegisterFile::CodeBlock].codeBlock()->needsFullScopeChain || ARG_scopeChain->object == activation);4550 ASSERT(!codeBlock(r)->needsFullScopeChain || scopeChain(r)->object == activation); 4579 4551 ASSERT(activation->isObject(&JSActivation::info)); 4580 4552 activation->copyRegisters(); … … 4585 4557 ExecState* exec = ARG_exec; 4586 4558 4587 Register* callFrame= ARG_r;4559 Register* r = ARG_r; 4588 4560 ASSERT(*ARG_profilerReference); 4589 (*ARG_profilerReference)->didExecute(exec, static_cast<JSObject*>( callFrame[RegisterFile::Callee].jsValue(exec)));4561 (*ARG_profilerReference)->didExecute(exec, static_cast<JSObject*>(r[RegisterFile::Callee].jsValue(exec))); 4590 4562 } 4591 4563 4592 4564 void Machine::cti_op_ret_scopeChain(CTI_ARGS) 4593 4565 { 4594 ASSERT(ARG_r[RegisterFile::CodeBlock].codeBlock()->needsFullScopeChain); 4595 ARG_scopeChain->deref(); 4566 Register* r = ARG_r; 4567 ASSERT(codeBlock(r)->needsFullScopeChain); 4568 scopeChain(r)->deref(); 4596 4569 } 4597 4570 … … 4605 4578 { 4606 4579 ExecState* exec = ARG_exec; 4607 ScopeChainNode* scopeChain = ARG_scopeChain; 4580 Register* r = ARG_r; 4581 ScopeChainNode* scopeChain = Machine::scopeChain(r); 4608 4582 4609 4583 ScopeChainIterator iter = scopeChain->begin(); … … 4622 4596 } while (++iter != end); 4623 4597 4624 CodeBlock* codeBlock = ARG_r[RegisterFile::CodeBlock].codeBlock();4598 CodeBlock* codeBlock = Machine::codeBlock(r); 4625 4599 ASSERT(codeBlock->ctiReturnAddressVPCMap.contains(CTI_RETURN_ADDRESS)); 4626 4600 unsigned vPCIndex = codeBlock->ctiReturnAddressVPCMap.get(CTI_RETURN_ADDRESS); … … 4655 4629 (*ARG_profilerReference)->willExecute(exec, constructor); 4656 4630 4631 ScopeChainNode* callDataScopeChain = constructor->m_scopeChain.node(); 4632 FunctionBodyNode* functionBodyNode = constructor->m_body.get(); 4633 CodeBlock* newCodeBlock = &functionBodyNode->byteCode(callDataScopeChain); 4634 4657 4635 StructureID* structure; 4658 4636 if (constrProtoVal->isObject()) 4659 4637 structure = static_cast<JSObject*>(constrProtoVal)->inheritorID(); 4660 4638 else 4661 structure = ARG_scopeChain->globalObject()->emptyObjectStructure();4639 structure = callDataScopeChain->globalObject()->emptyObjectStructure(); 4662 4640 JSObject* newObject = new (exec) JSObject(structure); 4663 4664 ScopeChainNode* callDataScopeChain = constructor->m_scopeChain.node();4665 FunctionBodyNode* functionBodyNode = constructor->m_body.get();4666 CodeBlock* newCodeBlock = &functionBodyNode->byteCode(callDataScopeChain);4667 4641 4668 4642 r[firstArg] = newObject; // "this" value … … 4675 4649 4676 4650 r[RegisterFile::CodeBlock] = newCodeBlock; 4677 r[RegisterFile:: CallerScopeChain] = ARG_scopeChain;4651 r[RegisterFile::ScopeChain] = callDataScopeChain; 4678 4652 r[RegisterFile::CallerRegisters] = savedR; 4679 4653 // RegisterFile::ReturnPC is set by callee … … 4685 4659 4686 4660 exec->m_callFrame = r; 4687 exec->m_scopeChain = callDataScopeChain; 4688 4689 ARG_setScopeChain(callDataScopeChain); 4661 4690 4662 ARG_setR(r); 4691 4663 return newCodeBlock->ctiCode; … … 4725 4697 ASSERT(constructType == ConstructTypeNone); 4726 4698 4727 exec->setException(createNotAConstructorError(exec, constrVal, ARG_instr6, r[RegisterFile::CodeBlock].codeBlock()));4699 exec->setException(createNotAConstructorError(exec, constrVal, ARG_instr6, codeBlock(r))); 4728 4700 VM_CHECK_EXCEPTION_AT_END(); 4729 4701 return 0; … … 4765 4737 { 4766 4738 ExecState* exec = ARG_exec; 4767 ScopeChainNode* scopeChain = ARG_scopeChain; 4739 Register* r = ARG_r; 4740 ScopeChainNode* scopeChain = Machine::scopeChain(r); 4768 4741 4769 4742 ScopeChainIterator iter = scopeChain->begin(); … … 4797 4770 } while (iter != end); 4798 4771 4799 CodeBlock* codeBlock = ARG_r[RegisterFile::CodeBlock].codeBlock();4772 CodeBlock* codeBlock = Machine::codeBlock(r); 4800 4773 ASSERT(codeBlock->ctiReturnAddressVPCMap.contains(CTI_RETURN_ADDRESS)); 4801 4774 unsigned vPCIndex = codeBlock->ctiReturnAddressVPCMap.get(CTI_RETURN_ADDRESS); … … 4916 4889 JSValue* Machine::cti_op_resolve_base(CTI_ARGS) 4917 4890 { 4918 return inlineResolveBase(ARG_exec, *ARG_id1, ARG_scopeChain);4891 return inlineResolveBase(ARG_exec, *ARG_id1, scopeChain(ARG_r)); 4919 4892 } 4920 4893 … … 4922 4895 { 4923 4896 ExecState* exec = ARG_exec; 4924 ScopeChainNode* scopeChain = ARG_scopeChain; 4897 Register* r = ARG_r; 4898 ScopeChainNode* scopeChain = Machine::scopeChain(r); 4925 4899 4926 4900 int skip = ARG_int2; … … 4944 4918 } while (++iter != end); 4945 4919 4946 CodeBlock* codeBlock = ARG_r[RegisterFile::CodeBlock].codeBlock();4920 CodeBlock* codeBlock = Machine::codeBlock(r); 4947 4921 ASSERT(codeBlock->ctiReturnAddressVPCMap.contains(CTI_RETURN_ADDRESS)); 4948 4922 unsigned vPCIndex = codeBlock->ctiReturnAddressVPCMap.get(CTI_RETURN_ADDRESS); … … 4977 4951 } 4978 4952 4979 exec->setException(createUndefinedVariableError(exec, ident, vPC, ARG_r[RegisterFile::CodeBlock].codeBlock())); 4953 Register* r = ARG_r; 4954 exec->setException(createUndefinedVariableError(exec, ident, vPC, codeBlock(r))); 4980 4955 4981 4956 VM_CHECK_EXCEPTION_AT_END(); … … 5144 5119 { 5145 5120 ExecState* exec = ARG_exec; 5146 ScopeChainNode* scopeChain = ARG_scopeChain; 5121 Register* r = ARG_r; 5122 ScopeChainNode* scopeChain = Machine::scopeChain(r); 5147 5123 5148 5124 ScopeChainIterator iter = scopeChain->begin(); … … 5167 5143 } while (iter != end); 5168 5144 5169 CodeBlock* codeBlock = ARG_r[RegisterFile::CodeBlock].codeBlock();5145 CodeBlock* codeBlock = Machine::codeBlock(r); 5170 5146 ASSERT(codeBlock->ctiReturnAddressVPCMap.contains(CTI_RETURN_ADDRESS)); 5171 5147 unsigned vPCIndex = codeBlock->ctiReturnAddressVPCMap.get(CTI_RETURN_ADDRESS); … … 5178 5154 JSValue* Machine::cti_op_new_func_exp(CTI_ARGS) 5179 5155 { 5180 return ARG_funcexp1->makeFunction(ARG_exec, ARG_scopeChain);5156 return ARG_funcexp1->makeFunction(ARG_exec, scopeChain(ARG_r)); 5181 5157 } 5182 5158 … … 5257 5233 JSValue* Machine::cti_op_new_regexp(CTI_ARGS) 5258 5234 { 5259 return new (ARG_exec) RegExpObject( ARG_scopeChain->globalObject()->regExpStructure(), ARG_regexp1);5235 return new (ARG_exec) RegExpObject(scopeChain(ARG_r)->globalObject()->regExpStructure(), ARG_regexp1); 5260 5236 } 5261 5237 … … 5277 5253 RegisterFile* registerFile = ARG_registerFile; 5278 5254 Register* r = ARG_r; 5279 CodeBlock* codeBlock = r[RegisterFile::CodeBlock].codeBlock();5280 ScopeChainNode* scopeChain = ARG_scopeChain;5255 CodeBlock* codeBlock = Machine::codeBlock(r); 5256 ScopeChainNode* scopeChain = Machine::scopeChain(r); 5281 5257 5282 5258 Machine* machine = exec->machine(); … … 5301 5277 { 5302 5278 ExecState* exec = ARG_exec; 5303 ScopeChainNode* scopeChain = ARG_scopeChain;5304 5279 Register* r = ARG_r; 5305 CodeBlock* codeBlock = r[RegisterFile::CodeBlock].codeBlock();5280 CodeBlock* codeBlock = Machine::codeBlock(r); 5306 5281 5307 5282 ASSERT(codeBlock->ctiReturnAddressVPCMap.contains(CTI_RETURN_ADDRESS)); … … 5309 5284 5310 5285 JSValue* exceptionValue = ARG_src1; 5311 Instruction* handlerVPC = ARG_exec->machine()->throwException(exec, exceptionValue, codeBlock->instructions.begin() + vPCIndex, scopeChain,r, true);5286 Instruction* handlerVPC = ARG_exec->machine()->throwException(exec, exceptionValue, codeBlock->instructions.begin() + vPCIndex, r, true); 5312 5287 5313 5288 if (handlerVPC) { 5314 5289 exec->setException(exceptionValue); 5315 ARG_setScopeChain(scopeChain);5316 5290 ARG_setR(r); 5317 5291 5318 void* catchRoutine = r[RegisterFile::CodeBlock].codeBlock()->nativeExceptionCodeForHandlerVPC(handlerVPC);5292 void* catchRoutine = Machine::codeBlock(r)->nativeExceptionCodeForHandlerVPC(handlerVPC); 5319 5293 ASSERT(catchRoutine); 5320 5294 ctiSetReturnAddress(&CTI_RETURN_ADDRESS, catchRoutine); … … 5344 5318 { 5345 5319 ExecState* exec = ARG_exec; 5346 5347 5320 JSValue* v = ARG_src1; 5321 5348 5322 JSObject* o = v->toObject(exec); 5349 5323 VM_CHECK_EXCEPTION_v(); 5350 5324 5351 ScopeChainNode* newScopeChain = ARG_scopeChain->push(o); 5352 ARG_setScopeChain(newScopeChain); 5353 exec->m_scopeChain = newScopeChain; 5325 Register* r = ARG_r; 5326 r[RegisterFile::ScopeChain] = scopeChain(r)->push(o); 5354 5327 } 5355 5328 5356 5329 void Machine::cti_op_pop_scope(CTI_ARGS) 5357 5330 { 5358 ExecState* exec = ARG_exec; 5359 5360 ScopeChainNode* newScopeChain = ARG_scopeChain->pop(); 5361 ARG_setScopeChain(newScopeChain); 5362 exec->m_scopeChain = newScopeChain; 5331 Register* r = ARG_r; 5332 r[RegisterFile::ScopeChain] = scopeChain(r)->pop(); 5363 5333 } 5364 5334 … … 5439 5409 5440 5410 if (!baseVal->isObject()) { 5441 CodeBlock* codeBlock = ARG_r[RegisterFile::CodeBlock].codeBlock(); 5411 Register* r = ARG_r; 5412 CodeBlock* codeBlock = Machine::codeBlock(r); 5442 5413 ASSERT(codeBlock->ctiReturnAddressVPCMap.contains(CTI_RETURN_ADDRESS)); 5443 5414 unsigned vPCIndex = codeBlock->ctiReturnAddressVPCMap.get(CTI_RETURN_ADDRESS); … … 5463 5434 JSObject* scope = new (exec) JSStaticScopeObject(exec, *ARG_id1, ARG_src2, DontDelete); 5464 5435 5465 ScopeChainNode* newScopeChain = ARG_scopeChain->push(scope); 5466 ARG_setScopeChain(newScopeChain); 5467 exec->m_scopeChain = newScopeChain; 5468 5436 Register* r = ARG_r; 5437 r[RegisterFile::ScopeChain] = scopeChain(r)->push(scope); 5469 5438 return scope; 5470 5439 } … … 5472 5441 void Machine::cti_op_jmp_scopes(CTI_ARGS) 5473 5442 { 5474 ExecState* exec = ARG_exec;5475 5443 unsigned count = ARG_int1; 5476 5477 ScopeChainNode* tmp = ARG_scopeChain; 5444 Register* r = ARG_r; 5445 5446 ScopeChainNode* tmp = scopeChain(r); 5478 5447 while (count--) 5479 5448 tmp = tmp->pop(); 5480 5481 ARG_setScopeChain(tmp); 5482 exec->m_scopeChain = tmp; 5449 r[RegisterFile::ScopeChain] = tmp; 5483 5450 } 5484 5451 … … 5495 5462 JSValue* scrutinee = ARG_src1; 5496 5463 unsigned tableIndex = ARG_int2; 5497 5498 CodeBlock* codeBlock = ARG_r[RegisterFile::CodeBlock].codeBlock();5464 Register* r = ARG_r; 5465 CodeBlock* codeBlock = Machine::codeBlock(r); 5499 5466 5500 5467 if (JSImmediate::isNumber(scrutinee)) { … … 5510 5477 JSValue* scrutinee = ARG_src1; 5511 5478 unsigned tableIndex = ARG_int2; 5512 5513 CodeBlock* codeBlock = ARG_r[RegisterFile::CodeBlock].codeBlock();5479 Register* r = ARG_r; 5480 CodeBlock* codeBlock = Machine::codeBlock(r); 5514 5481 5515 5482 void* result = codeBlock->characterSwitchJumpTables[tableIndex].ctiDefault; … … 5528 5495 JSValue* scrutinee = ARG_src1; 5529 5496 unsigned tableIndex = ARG_int2; 5530 5531 CodeBlock* codeBlock = ARG_r[RegisterFile::CodeBlock].codeBlock();5497 Register* r = ARG_r; 5498 CodeBlock* codeBlock = Machine::codeBlock(r); 5532 5499 5533 5500 void* result = codeBlock->stringSwitchJumpTables[tableIndex].ctiDefault; … … 5589 5556 { 5590 5557 ExecState* exec = ARG_exec; 5591 CodeBlock* codeBlock = ARG_r[RegisterFile::CodeBlock].codeBlock(); 5558 Register* r = ARG_r; 5559 CodeBlock* codeBlock = Machine::codeBlock(r); 5592 5560 unsigned type = ARG_int1; 5593 5561 JSValue* message = ARG_src2; … … 5600 5568 { 5601 5569 ExecState* exec = ARG_exec; 5602 ScopeChainNode* scopeChain = ARG_scopeChain;5603 5570 Register* r = ARG_r; 5604 5571 … … 5607 5574 int lastLine = ARG_int3; 5608 5575 5609 exec->machine()->debug(exec, scopeChain,r, static_cast<DebugHookID>(debugHookID), firstLine, lastLine);5576 exec->machine()->debug(exec, r, static_cast<DebugHookID>(debugHookID), firstLine, lastLine); 5610 5577 } 5611 5578 … … 5613 5580 { 5614 5581 ExecState* exec = ARG_exec; 5615 ScopeChainNode* scopeChain = ARG_scopeChain;5616 5582 Register* r = ARG_r; 5617 CodeBlock* codeBlock = r[RegisterFile::CodeBlock].codeBlock();5583 CodeBlock* codeBlock = Machine::codeBlock(r); 5618 5584 5619 5585 ASSERT(codeBlock->ctiReturnAddressVPCMap.contains(exec->ctiReturnAddress())); … … 5624 5590 JSValue* exceptionValue = exec->exception(); 5625 5591 5626 Instruction* handlerVPC = ARG_exec->machine()->throwException(exec, exceptionValue, codeBlock->instructions.begin() + vPCIndex, scopeChain,r, false);5592 Instruction* handlerVPC = ARG_exec->machine()->throwException(exec, exceptionValue, codeBlock->instructions.begin() + vPCIndex, r, false); 5627 5593 5628 5594 if (handlerVPC) { 5629 5595 exec->setException(exceptionValue); 5630 ARG_setScopeChain(scopeChain);5631 5596 ARG_setR(r); 5632 5597 5633 void* catchRoutine = r[RegisterFile::CodeBlock].codeBlock()->nativeExceptionCodeForHandlerVPC(handlerVPC);5598 void* catchRoutine = Machine::codeBlock(r)->nativeExceptionCodeForHandlerVPC(handlerVPC); 5634 5599 ASSERT(catchRoutine); 5635 5600 ctiSetReturnAddress(&CTI_RETURN_ADDRESS, catchRoutine);
Note:
See TracChangeset
for help on using the changeset viewer.