Changeset 35593 in webkit for trunk/JavaScriptCore/VM/Machine.cpp
- Timestamp:
- Aug 6, 2008, 3:37:34 AM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/VM/Machine.cpp
r35586 r35593 380 380 { 381 381 size_t registerOffset = argv + newCodeBlock->numLocals; 382 size_t size = r - registerBase + registerOffset + newCodeBlock->num Temporaries;382 size_t size = r - registerBase + registerOffset + newCodeBlock->numConstants + newCodeBlock->numTemporaries; 383 383 384 384 if (argc == newCodeBlock->numParameters) { // correct number of arguments … … 419 419 for (Register* it = r - newCodeBlock->numVars; it != r; ++it) 420 420 (*it) = jsUndefined(); 421 422 423 for (size_t i = 0; i < newCodeBlock->constantRegisters.size(); ++i) 424 r[i] = newCodeBlock->constantRegisters[i]; 421 425 422 426 return r; … … 584 588 } 585 589 586 NEVER_INLINE bool Machine::unwindCallFrame(ExecState* exec, JSValue* exceptionValue, const Instruction*& vPC, CodeBlock*& codeBlock, Register*& k,ScopeChainNode*& scopeChain, Register*& r)590 NEVER_INLINE bool Machine::unwindCallFrame(ExecState* exec, JSValue* exceptionValue, const Instruction*& vPC, CodeBlock*& codeBlock, ScopeChainNode*& scopeChain, Register*& r) 587 591 { 588 592 CodeBlock* oldCodeBlock = codeBlock; … … 617 621 return false; 618 622 619 k = codeBlock->registers.data();620 623 scopeChain = callFrame[RegisterFile::CallerScopeChain].scopeChain(); 621 624 r = callFrame[RegisterFile::CallerRegisters].r(); … … 626 629 } 627 630 628 NEVER_INLINE Instruction* Machine::throwException(ExecState* exec, JSValue*& exceptionValue, const Instruction* vPC, CodeBlock*& codeBlock, Register*& k,ScopeChainNode*& scopeChain, Register*& r, bool explicitThrow)631 NEVER_INLINE Instruction* Machine::throwException(ExecState* exec, JSValue*& exceptionValue, const Instruction* vPC, CodeBlock*& codeBlock, ScopeChainNode*& scopeChain, Register*& r, bool explicitThrow) 629 632 { 630 633 // Set up the exception object … … 660 663 661 664 if (exception->isWatchdogException()) { 662 while (unwindCallFrame(exec, exceptionValue, vPC, codeBlock, k,scopeChain, r)) {665 while (unwindCallFrame(exec, exceptionValue, vPC, codeBlock, scopeChain, r)) { 663 666 // Don't need handler checks or anything, we just want to unroll all the JS callframes possible. 664 667 } … … 679 682 680 683 while (!codeBlock->getHandlerForVPC(vPC, handlerVPC, scopeDepth)) { 681 if (!unwindCallFrame(exec, exceptionValue, vPC, codeBlock, k,scopeChain, r))684 if (!unwindCallFrame(exec, exceptionValue, vPC, codeBlock, scopeChain, r)) 682 685 return 0; 683 686 } … … 705 708 706 709 size_t oldSize = m_registerFile.size(); 707 size_t newSize = oldSize + RegisterFile::CallFrameHeaderSize + codeBlock->numVars + codeBlock->num Temporaries;710 size_t newSize = oldSize + RegisterFile::CallFrameHeaderSize + codeBlock->numVars + codeBlock->numConstants + codeBlock->numTemporaries; 708 711 if (!m_registerFile.grow(newSize)) { 709 712 *exception = createStackOverflowError(exec); … … 722 725 Register* r = callFrame + RegisterFile::CallFrameHeaderSize + codeBlock->numVars; 723 726 r[codeBlock->thisRegister] = thisObj; 727 728 for (size_t i = 0; i < codeBlock->constantRegisters.size(); ++i) 729 r[i] = codeBlock->constantRegisters[i]; 724 730 725 731 if (codeBlock->needsFullScopeChain) … … 840 846 841 847 size_t oldSize = m_registerFile.size(); 842 size_t newSize = registerOffset + codeBlock->numVars + codeBlock->num Temporaries + RegisterFile::CallFrameHeaderSize;848 size_t newSize = registerOffset + codeBlock->numVars + codeBlock->numConstants + codeBlock->numTemporaries + RegisterFile::CallFrameHeaderSize; 843 849 if (!m_registerFile.grow(newSize)) { 844 850 *exception = createStackOverflowError(exec); … … 853 859 Register* r = callFrame + RegisterFile::CallFrameHeaderSize + codeBlock->numVars; 854 860 r[codeBlock->thisRegister] = thisObj; 861 862 for (size_t i = 0; i < codeBlock->constantRegisters.size(); ++i) 863 r[i] = codeBlock->constantRegisters[i]; 855 864 856 865 if (codeBlock->needsFullScopeChain) … … 1035 1044 Register* registerBase = registerFile->base(); 1036 1045 Instruction* vPC = codeBlock->instructions.begin(); 1037 Register* k = codeBlock->registers.data();1038 1046 Profiler** enabledProfilerReference = Profiler::enabledProfilerReference(); 1039 1047 unsigned tickCount = m_ticksUntilNextTimeoutCheck + 1; … … 1077 1085 #endif 1078 1086 { 1079 BEGIN_OPCODE(op_load) {1080 /* load dst(r) src(k)1081 1082 Copies constant src to register dst.1083 */1084 int dst = (++vPC)->u.operand;1085 int src = (++vPC)->u.operand;1086 r[dst] = k[src];1087 1088 ++vPC;1089 NEXT_OPCODE;1090 }1091 1087 BEGIN_OPCODE(op_new_object) { 1092 1088 /* new_object dst(r) … … 2376 2372 codeBlock = newCodeBlock; 2377 2373 setScopeChain(exec, scopeChain, scopeChainForCall(exec, functionBodyNode, codeBlock, callDataScopeChain, r)); 2378 k = codeBlock->registers.data();2379 2374 vPC = codeBlock->instructions.begin(); 2380 2375 … … 2447 2442 return returnValue; 2448 2443 2449 k = codeBlock->registers.data();2450 2444 vPC = callFrame[RegisterFile::ReturnVPC].vPC(); 2451 2445 setScopeChain(exec, scopeChain, callFrame[RegisterFile::CallerScopeChain].scopeChain()); … … 2509 2503 codeBlock = newCodeBlock; 2510 2504 setScopeChain(exec, scopeChain, scopeChainForCall(exec, functionBodyNode, codeBlock, callDataScopeChain, r)); 2511 k = codeBlock->registers.data();2512 2505 vPC = codeBlock->instructions.begin(); 2513 2506 … … 2672 2665 exceptionValue = r[ex].jsValue(exec); 2673 2666 2674 handlerVPC = throwException(exec, exceptionValue, vPC, codeBlock, k,scopeChain, r, true);2667 handlerVPC = throwException(exec, exceptionValue, vPC, codeBlock, scopeChain, r, true); 2675 2668 if (!handlerVPC) { 2676 2669 *exception = exceptionValue; … … 2690 2683 NEXT_OPCODE; 2691 2684 } 2685 BEGIN_OPCODE(op_unexpected_load) { 2686 /* unexpected_load load dst(r) src(k) 2687 2688 Copies constant src to register dst. 2689 */ 2690 int dst = (++vPC)->u.operand; 2691 int src = (++vPC)->u.operand; 2692 r[dst] = codeBlock->unexpectedConstants[src]; 2693 2694 ++vPC; 2695 NEXT_OPCODE; 2696 } 2692 2697 BEGIN_OPCODE(op_new_error) { 2693 2698 /* new_error dst(r) type(n) message(k) … … 2702 2707 int message = (++vPC)->u.operand; 2703 2708 2704 r[dst] = Error::create(exec, (ErrorType)type, k[message].jsValue(exec)->toString(exec), codeBlock->lineNumberForVPC(vPC), codeBlock->ownerNode->sourceId(), codeBlock->ownerNode->sourceURL());2709 r[dst] = Error::create(exec, (ErrorType)type, codeBlock->unexpectedConstants[message]->toString(exec), codeBlock->lineNumberForVPC(vPC), codeBlock->ownerNode->sourceId(), codeBlock->ownerNode->sourceURL()); 2705 2710 2706 2711 ++vPC; … … 2812 2817 exceptionValue = createInterruptedExecutionException(exec); 2813 2818 } 2814 handlerVPC = throwException(exec, exceptionValue, vPC, codeBlock, k,scopeChain, r, false);2819 handlerVPC = throwException(exec, exceptionValue, vPC, codeBlock, scopeChain, r, false); 2815 2820 if (!handlerVPC) { 2816 2821 *exception = exceptionValue;
Note:
See TracChangeset
for help on using the changeset viewer.