Changeset 37297 in webkit for trunk/JavaScriptCore
- Timestamp:
- Oct 4, 2008, 2:12:54 PM (17 years ago)
- Location:
- trunk/JavaScriptCore
- Files:
-
- 22 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/ChangeLog
r37294 r37297 1 2008-10-04 Darin Adler <[email protected]> 2 3 Reviewed by Cameron Zwarich. 4 5 - https://bugs.webkit.org/show_bug.cgi?id=21295 6 Bug 21295: Replace ExecState with a call frame Register pointer 7 8 10% faster on Richards; other v8 benchmarks faster too. 9 A wash on SunSpider. 10 11 This does the minimum necessary to get the speedup. Next step in 12 cleaning this up is to replace ExecState with a CallFrame class, 13 and be more judicious about when to pass a call frame and when 14 to pass a global data pointer, global object pointer, or perhaps 15 something else entirely. 16 17 * VM/CTI.cpp: Remove the debug-only check of the exception in 18 ctiVMThrowTrampoline -- already checked in the code the trampoline 19 jumps to, so not all that useful. Removed the exec argument from 20 ctiTrampoline. Removed emitDebugExceptionCheck -- no longer needed. 21 (JSC::CTI::emitCall): Removed code to set ExecState::m_callFrame. 22 (JSC::CTI::privateCompileMainPass): Removed code in catch to extract 23 the exception from ExecState::m_exception; instead, the code that 24 jumps into catch will make sure the exception is already in eax. 25 * VM/CTI.h: Removed exec from the ctiTrampoline. Also removed the 26 non-helpful "volatile". Temporarily left ARG_exec in as a synonym 27 for ARG_r; I'll change that on a future cleanup pass when introducing 28 more use of the CallFrame type. 29 (JSC::CTI::execute): Removed the ExecState* argument. 30 31 * VM/ExceptionHelpers.cpp: 32 (JSC::InterruptedExecutionError::InterruptedExecutionError): Take 33 JSGlobalData* instead of ExecState*. 34 (JSC::createInterruptedExecutionException): Ditto. 35 * VM/ExceptionHelpers.h: Ditto. Also removed an unneeded include. 36 37 * VM/Machine.cpp: 38 (JSC::slideRegisterWindowForCall): Removed the exec and 39 exceptionValue arguments. Changed to return 0 when there's a stack 40 overflow rather than using a separate exception argument to cut 41 down on memory accesses in the calling convention. 42 (JSC::Machine::unwindCallFrame): Removed the exec argument when 43 constructing a DebuggerCallFrame. Also removed code to set 44 ExecState::m_callFrame. 45 (JSC::Machine::throwException): Removed the exec argument when 46 construction a DebuggerCallFrame. 47 (JSC::Machine::execute): Updated to use the register instead of 48 ExecState and also removed various uses of ExecState. 49 (JSC::Machine::debug): 50 (JSC::Machine::privateExecute): Put globalData into a local 51 variable so it can be used throughout the interpreter. Changed 52 the VM_CHECK_EXCEPTION to get the exception in globalData instead 53 of through ExecState. 54 (JSC::Machine::retrieveLastCaller): Turn exec into a registers 55 pointer by calling registers() instead of by getting m_callFrame. 56 (JSC::Machine::callFrame): Ditto. 57 Tweaked exception macros. Made new versions for when you know 58 you have an exception. Get at global exception with ARG_globalData. 59 Got rid of the need to pass in the return value type. 60 (JSC::Machine::cti_op_add): Update to use new version of exception 61 macros. 62 (JSC::Machine::cti_op_pre_inc): Ditto. 63 (JSC::Machine::cti_timeout_check): Ditto. 64 (JSC::Machine::cti_op_instanceof): Ditto. 65 (JSC::Machine::cti_op_new_func): Ditto. 66 (JSC::Machine::cti_op_call_JSFunction): Optimized by using the 67 ARG values directly instead of through local variables -- this gets 68 rid of code that just shuffles things around in the stack frame. 69 Also get rid of ExecState and update for the new way exceptions are 70 handled in slideRegisterWindowForCall. 71 (JSC::Machine::cti_vm_compile): Update to make exec out of r since 72 they are both the same thing now. 73 (JSC::Machine::cti_op_call_NotJSFunction): Ditto. 74 (JSC::Machine::cti_op_init_arguments): Ditto. 75 (JSC::Machine::cti_op_resolve): Ditto. 76 (JSC::Machine::cti_op_construct_JSConstruct): Ditto. 77 (JSC::Machine::cti_op_construct_NotJSConstruct): Ditto. 78 (JSC::Machine::cti_op_resolve_func): Ditto. 79 (JSC::Machine::cti_op_put_by_val): Ditto. 80 (JSC::Machine::cti_op_put_by_val_array): Ditto. 81 (JSC::Machine::cti_op_resolve_skip): Ditto. 82 (JSC::Machine::cti_op_resolve_global): Ditto. 83 (JSC::Machine::cti_op_post_inc): Ditto. 84 (JSC::Machine::cti_op_resolve_with_base): Ditto. 85 (JSC::Machine::cti_op_post_dec): Ditto. 86 (JSC::Machine::cti_op_call_eval): Ditto. 87 (JSC::Machine::cti_op_throw): Ditto. Also rearranged to return 88 the exception value as the return value so it can be used by 89 op_catch. 90 (JSC::Machine::cti_op_push_scope): Ditto. 91 (JSC::Machine::cti_op_in): Ditto. 92 (JSC::Machine::cti_op_del_by_val): Ditto. 93 (JSC::Machine::cti_vm_throw): Ditto. Also rearranged to return 94 the exception value as the return value so it can be used by 95 op_catch. 96 97 * kjs/DebuggerCallFrame.cpp: 98 (JSC::DebuggerCallFrame::functionName): Pass globalData. 99 (JSC::DebuggerCallFrame::evaluate): Eliminated code to make a 100 new ExecState. 101 * kjs/DebuggerCallFrame.h: Removed ExecState argument from 102 constructor. 103 104 * kjs/ExecState.h: Eliminated all data members and made ExecState 105 inherit privately from Register instead. Also added a typedef to 106 the future name for this class, which is CallFrame. It's just a 107 Register* that knows it's a pointer at a call frame. The new class 108 can't be constructed or copied. Changed all functions to use 109 the this pointer instead of m_callFrame. Changed exception-related 110 functions to access an exception in JSGlobalData. Removed functions 111 used by CTI to pass the return address to the throw machinery -- 112 this is now done directly with a global in the global data. 113 114 * kjs/FunctionPrototype.cpp: 115 (JSC::functionProtoFuncToString): Pass globalData instead of exec. 116 117 * kjs/InternalFunction.cpp: 118 (JSC::InternalFunction::name): Take globalData instead of exec. 119 * kjs/InternalFunction.h: Ditto. 120 121 * kjs/JSGlobalData.cpp: Initialize the new exception global to 0. 122 * kjs/JSGlobalData.h: Declare two new globals. One for the current 123 exception and another for the return address used by CTI to 124 implement the throw operation. 125 126 * kjs/JSGlobalObject.cpp: 127 (JSC::JSGlobalObject::init): Removed code to set up globalExec, 128 which is now the same thing as globalCallFrame. 129 (JSC::JSGlobalObject::reset): Get globalExec from our globalExec 130 function so we don't have to repeat the logic twice. 131 (JSC::JSGlobalObject::mark): Removed code to mark the exception; 132 the exception is now stored in JSGlobalData and marked there. 133 (JSC::JSGlobalObject::globalExec): Return a pointer to the end 134 of the global call frame. 135 * kjs/JSGlobalObject.h: Removed the globalExec data member. 136 137 * kjs/JSObject.cpp: 138 (JSC::JSObject::putDirectFunction): Pass globalData instead of exec. 139 140 * kjs/collector.cpp: 141 (JSC::Heap::collect): Mark the global exception. 142 143 * profiler/ProfileGenerator.cpp: 144 (JSC::ProfileGenerator::addParentForConsoleStart): Pass globalData 145 instead of exec to createCallIdentifier. 146 147 * profiler/Profiler.cpp: 148 (JSC::Profiler::willExecute): Pass globalData instead of exec to 149 createCallIdentifier. 150 (JSC::Profiler::didExecute): Ditto. 151 (JSC::Profiler::createCallIdentifier): Take globalData instead of 152 exec. 153 (JSC::createCallIdentifierFromFunctionImp): Ditto. 154 * profiler/Profiler.h: Change interface to take a JSGlobalData 155 instead of an ExecState. 156 1 157 2008-10-04 Cameron Zwarich <[email protected]> 2 158 -
trunk/JavaScriptCore/VM/CTI.cpp
r37294 r37297 75 75 76 76 #if COMPILER(GCC) && PLATFORM(X86) 77 77 78 asm( 78 79 ".globl _ctiTrampoline" "\n" … … 82 83 "subl $0x24, %esp" "\n" 83 84 "movl $512, %esi" "\n" 84 "call *0x30(%esp)" "\n" // Ox30 = 0x0C * 4, 0x0C = CTI_ARGS_code85 "call *0x30(%esp)" "\n" // Ox30 = 0x0C * 4, 0x0C = CTI_ARGS_code 85 86 "addl $0x24, %esp" "\n" 86 87 "popl %edi" "\n" … … 92 93 ".globl _ctiVMThrowTrampoline" "\n" 93 94 "_ctiVMThrowTrampoline:" "\n" 94 #ifndef NDEBUG95 "movl 0x34(%esp), %ecx" "\n" //Ox34 = 0x0D * 4, 0x0D = CTI_ARGS_exec96 "cmpl $0, 8(%ecx)" "\n"97 "jne 1f" "\n"98 "int3" "\n"99 "1:" "\n"100 #endif101 95 "call __ZN3JSC7Machine12cti_vm_throwEPv" "\n" 102 96 "addl $0x24, %esp" "\n" … … 107 101 108 102 #elif COMPILER(MSVC) 109 extern "C" 110 {103 104 extern "C" { 111 105 112 __declspec(naked) JSValue* ctiTrampoline(void* code, ExecState* exec, RegisterFile* registerFile, Register* r, JSValue** exception, Profiler**, JSGlobalData*)106 __declspec(naked) JSValue* ctiTrampoline(void* code, RegisterFile*, Register*, JSValue** exception, Profiler**, JSGlobalData*) 113 107 { 114 108 __asm { … … 129 123 { 130 124 __asm { 131 mov [esp], esp;125 mov [esp], esp; 132 126 call JSC::Machine::cti_vm_throw; 133 127 add esp, 0x24; … … 247 241 } 248 242 249 #ifdef NDEBUG 250 251 ALWAYS_INLINE void CTI::emitDebugExceptionCheck() 252 { 253 } 254 255 #else 256 257 ALWAYS_INLINE void CTI::emitDebugExceptionCheck() 258 { 259 emitGetCTIParam(CTI_ARGS_exec, X86::ecx); 260 m_jit.cmpl_i32m(0, OBJECT_OFFSET(ExecState, m_exception), X86::ecx); 261 X86Assembler::JmpSrc noException = m_jit.emitUnlinkedJe(); 262 m_jit.emitInt3(); 263 m_jit.link(noException, m_jit.label()); 264 } 243 #ifndef NDEBUG 265 244 266 245 void CTI::printOpcodeOperandTypes(unsigned src1, unsigned src2) … … 305 284 X86Assembler::JmpSrc call = m_jit.emitCall(r); 306 285 m_calls.append(CallRecord(call, opcodeIndex)); 307 emitDebugExceptionCheck();308 286 309 287 return call; … … 318 296 X86Assembler::JmpSrc call = m_jit.emitCall(); 319 297 m_calls.append(CallRecord(call, helper, opcodeIndex)); 320 emitDebugExceptionCheck();321 298 #if ENABLE(SAMPLING_TOOL) 322 299 m_jit.movl_i32m(0, &inCalledCode); … … 334 311 X86Assembler::JmpSrc call = m_jit.emitCall(); 335 312 m_calls.append(CallRecord(call, helper, opcodeIndex)); 336 emitDebugExceptionCheck();337 313 #if ENABLE(SAMPLING_TOOL) 338 314 m_jit.movl_i32m(0, &inCalledCode); … … 350 326 X86Assembler::JmpSrc call = m_jit.emitCall(); 351 327 m_calls.append(CallRecord(call, helper, opcodeIndex)); 352 emitDebugExceptionCheck();353 328 #if ENABLE(SAMPLING_TOOL) 354 329 m_jit.movl_i32m(0, &inCalledCode); … … 366 341 X86Assembler::JmpSrc call = m_jit.emitCall(); 367 342 m_calls.append(CallRecord(call, helper, opcodeIndex)); 368 emitDebugExceptionCheck();369 343 #if ENABLE(SAMPLING_TOOL) 370 344 m_jit.movl_i32m(0, &inCalledCode); … … 382 356 X86Assembler::JmpSrc call = m_jit.emitCall(); 383 357 m_calls.append(CallRecord(call, helper, opcodeIndex)); 384 emitDebugExceptionCheck();385 358 #if ENABLE(SAMPLING_TOOL) 386 359 m_jit.movl_i32m(0, &inCalledCode); … … 1224 1197 1225 1198 // Restore our caller's "r". 1226 emitGetCTIParam(CTI_ARGS_exec, X86::ecx);1227 1199 emitGetArg(RegisterFile::CallerRegisters, X86::edi); 1228 1200 emitPutCTIParam(X86::edi, CTI_ARGS_r); 1229 m_jit.movl_rm(X86::edi, OBJECT_OFFSET(ExecState, m_callFrame), X86::ecx);1230 1201 1231 1202 // Return. … … 1787 1758 case op_catch: { 1788 1759 emitGetCTIParam(CTI_ARGS_r, X86::edi); // edi := r 1789 emitGetCTIParam(CTI_ARGS_exec, X86::ecx);1790 m_jit.movl_mr(OBJECT_OFFSET(ExecState, m_exception), X86::ecx, X86::eax);1791 m_jit.movl_i32m(0, OBJECT_OFFSET(ExecState, m_exception), X86::ecx);1792 1760 emitPutResult(instruction[i + 1].u.operand); 1793 1761 i += 2; -
trunk/JavaScriptCore/VM/CTI.h
r37257 r37297 53 53 54 54 #define CTI_ARGS_code 0x0C 55 #define CTI_ARGS_exec 0x0D 56 #define CTI_ARGS_registerFile 0x0E 57 #define CTI_ARGS_r 0x0F 58 #define CTI_ARGS_exception 0x10 59 #define CTI_ARGS_profilerReference 0x11 60 #define CTI_ARGS_globalData 0x12 61 #define ARG_exec ((ExecState*)(ARGS)[CTI_ARGS_exec]) 55 #define CTI_ARGS_registerFile 0x0D 56 #define CTI_ARGS_r 0x0E 57 #define CTI_ARGS_exception 0x0F 58 #define CTI_ARGS_profilerReference 0x10 59 #define CTI_ARGS_globalData 0x11 62 60 #define ARG_registerFile ((RegisterFile*)(ARGS)[CTI_ARGS_registerFile]) 63 61 #define ARG_r ((Register*)(ARGS)[CTI_ARGS_r]) … … 66 64 #define ARG_globalData ((JSGlobalData*)(ARGS)[CTI_ARGS_globalData]) 67 65 68 #define ARG_setR(newR) (*(volatile Register**)&(ARGS)[CTI_ARGS_r] = newR) 69 #define ARG_set2ndResult(new2ndResult) (*(volatile JSValue**)&(ARGS)[CTI_ARGS_2ndResult] = new2ndResult) 66 #define ARG_exec CallFrame::create(ARG_r) 67 68 #define ARG_setR(newR) (*(Register**)&(ARGS)[CTI_ARGS_r] = newR) 69 #define ARG_set2ndResult(new2ndResult) (*(JSValue**)&(ARGS)[CTI_ARGS_2ndResult] = new2ndResult) 70 70 71 71 #define ARG_src1 ((JSValue*)((ARGS)[1])) … … 235 235 236 236 extern "C" { 237 JSValue* ctiTrampoline(void* code, ExecState*,RegisterFile*, Register* callFrame, JSValue** exception, Profiler**, JSGlobalData*);237 JSValue* ctiTrampoline(void* code, RegisterFile*, Register* callFrame, JSValue** exception, Profiler**, JSGlobalData*); 238 238 void ctiVMThrowTrampoline(); 239 239 }; … … 324 324 } 325 325 326 inline static JSValue* execute(void* code, ExecState* exec,RegisterFile* registerFile, Register* r, JSGlobalData* globalData, JSValue** exception)327 { 328 JSValue* value = ctiTrampoline(code, exec,registerFile, r, exception, Profiler::enabledProfilerReference(), globalData);326 inline static JSValue* execute(void* code, RegisterFile* registerFile, Register* r, JSGlobalData* globalData, JSValue** exception) 327 { 328 JSValue* value = ctiTrampoline(code, registerFile, r, exception, Profiler::enabledProfilerReference(), globalData); 329 329 #if ENABLE(SAMPLING_TOOL) 330 330 currentOpcodeID = static_cast<OpcodeID>(-1); … … 394 394 void emitTagAsBoolImmediate(X86Assembler::RegisterID reg); 395 395 396 void emitDebugExceptionCheck();397 398 396 X86Assembler::JmpSrc emitCall(unsigned opcodeIndex, X86::RegisterID); 399 397 X86Assembler::JmpSrc emitCall(unsigned opcodeIndex, CTIHelper_j); -
trunk/JavaScriptCore/VM/ExceptionHelpers.cpp
r37184 r37297 51 51 class InterruptedExecutionError : public JSObject { 52 52 public: 53 InterruptedExecutionError( ExecState* exec)54 : JSObject( exec->globalData().nullProtoStructureID)53 InterruptedExecutionError(JSGlobalData* globalData) 54 : JSObject(globalData->nullProtoStructureID) 55 55 { 56 56 } … … 59 59 }; 60 60 61 JSValue* createInterruptedExecutionException( ExecState* exec)62 { 63 return new ( exec) InterruptedExecutionError(exec);61 JSValue* createInterruptedExecutionException(JSGlobalData* globalData) 62 { 63 return new (globalData) InterruptedExecutionError(globalData); 64 64 } 65 65 -
trunk/JavaScriptCore/VM/ExceptionHelpers.h
r36604 r37297 30 30 #define ExceptionHelpers_h 31 31 32 #include "JSObject.h"33 34 32 namespace JSC { 35 33 34 class CodeBlock; 35 class ExecState; 36 class Identifier; 37 class Instruction; 38 class JSGlobalData; 39 class JSNotAnObjectErrorStub; 40 class JSObject; 41 class JSValue; 36 42 class Node; 37 class CodeBlock;38 class Instruction;39 class JSNotAnObjectErrorStub;40 43 41 JSValue* createInterruptedExecutionException( ExecState* exec);44 JSValue* createInterruptedExecutionException(JSGlobalData*); 42 45 JSValue* createStackOverflowError(ExecState*); 43 46 JSValue* createUndefinedVariableError(ExecState*, const Identifier&, const Instruction*, CodeBlock*); -
trunk/JavaScriptCore/VM/Machine.cpp
r37294 r37297 533 533 } 534 534 535 ALWAYS_INLINE Register* slideRegisterWindowForCall( ExecState* exec, CodeBlock* newCodeBlock, RegisterFile* registerFile, Register* r, size_t registerOffset, int argc, JSValue*& exceptionValue)535 ALWAYS_INLINE Register* slideRegisterWindowForCall(CodeBlock* newCodeBlock, RegisterFile* registerFile, Register* r, size_t registerOffset, int argc) 536 536 { 537 537 Register* newEnd = r + registerOffset + newCodeBlock->numCalleeRegisters; 538 538 539 if (argc == newCodeBlock->numParameters) { // correct number of arguments 540 if (!registerFile->grow(newEnd)) { 541 exceptionValue = createStackOverflowError(exec); 542 return r; 543 } 539 if (LIKELY(argc == newCodeBlock->numParameters)) { // correct number of arguments 540 if (UNLIKELY(!registerFile->grow(newEnd))) 541 return 0; 544 542 r += registerOffset; 545 543 } else if (argc < newCodeBlock->numParameters) { // too few arguments -- fill in the blanks … … 547 545 registerOffset += omittedArgCount; 548 546 newEnd += omittedArgCount; 549 if (!registerFile->grow(newEnd)) { 550 exceptionValue = createStackOverflowError(exec); 551 return r; 552 } 547 if (!registerFile->grow(newEnd)) 548 return 0; 553 549 r += registerOffset; 554 550 … … 561 557 newEnd += numParameters; 562 558 563 if (!registerFile->grow(newEnd)) { 564 exceptionValue = createStackOverflowError(exec); 565 return r; 566 } 559 if (!registerFile->grow(newEnd)) 560 return 0; 567 561 r += registerOffset; 568 562 … … 627 621 { 628 622 initTimeout(); 629 privateExecute(InitializeAndReturn );623 privateExecute(InitializeAndReturn, 0, 0, 0); 630 624 631 625 // Bizarrely, calling fastMalloc here is faster than allocating space on the stack. … … 768 762 769 763 if (Debugger* debugger = exec->dynamicGlobalObject()->debugger()) { 770 DebuggerCallFrame debuggerCallFrame(exec , exec->dynamicGlobalObject(), codeBlock, scopeChain, r, exceptionValue);764 DebuggerCallFrame debuggerCallFrame(exec->dynamicGlobalObject(), codeBlock, scopeChain, r, exceptionValue); 771 765 if (r[RegisterFile::Callee].jsValue(exec)) 772 766 debugger->returnEvent(debuggerCallFrame, codeBlock->ownerNode->sourceID(), codeBlock->ownerNode->lastLine()); … … 799 793 return false; 800 794 801 exec->m_callFrame = r;802 795 codeBlock = this->codeBlock(r); 803 796 vPC = vPCForPC(codeBlock, returnPC); … … 850 843 if (Debugger* debugger = exec->dynamicGlobalObject()->debugger()) { 851 844 ScopeChainNode* scopeChain = this->scopeChain(r); 852 DebuggerCallFrame debuggerCallFrame(exec , exec->dynamicGlobalObject(), codeBlock, scopeChain, r, exceptionValue);845 DebuggerCallFrame debuggerCallFrame(exec->dynamicGlobalObject(), codeBlock, scopeChain, r, exceptionValue); 853 846 debugger->exception(debuggerCallFrame, codeBlock->ownerNode->sourceID(), codeBlock->lineNumberForVPC(vPC)); 854 847 } … … 905 898 scopeChain = scopeChain->copy(); 906 899 907 ExecState newExec(r);908 909 900 Profiler** profiler = Profiler::enabledProfilerReference(); 910 901 if (*profiler) … … 915 906 if (!codeBlock->ctiCode) 916 907 CTI::compile(this, exec, codeBlock); 917 JSValue* result = CTI::execute(codeBlock->ctiCode, & newExec, &m_registerFile, r, &newExec.globalData(), exception);908 JSValue* result = CTI::execute(codeBlock->ctiCode, &m_registerFile, r, scopeChain->globalData, exception); 918 909 #else 919 JSValue* result = privateExecute(Normal, & newExec, &m_registerFile, r, exception);910 JSValue* result = privateExecute(Normal, &m_registerFile, r, exception); 920 911 #endif 921 912 m_reentryDepth--; … … 959 950 960 951 CodeBlock* codeBlock = &functionBodyNode->byteCode(scopeChain); 961 Register* r = slideRegisterWindowForCall(exec, codeBlock, &m_registerFile, argv, argc + RegisterFile::CallFrameHeaderSize, argc, *exception); 962 if (UNLIKELY(*exception != 0)) { 952 Register* r = slideRegisterWindowForCall(codeBlock, &m_registerFile, argv, argc + RegisterFile::CallFrameHeaderSize, argc); 953 if (UNLIKELY(!r)) { 954 *exception = createStackOverflowError(exec); 963 955 m_registerFile.shrink(oldEnd); 964 956 return jsNull(); 965 957 } 966 958 // a 0 codeBlock indicates a built-in caller 967 initializeCallFrame(r, codeBlock, 0, scopeChain, makeHostCallFramePointer(exec->m_callFrame), 0, argc, function); 968 969 ExecState newExec(r); 959 initializeCallFrame(r, codeBlock, 0, scopeChain, makeHostCallFramePointer(exec->registers()), 0, argc, function); 970 960 971 961 Profiler** profiler = Profiler::enabledProfilerReference(); … … 977 967 if (!codeBlock->ctiCode) 978 968 CTI::compile(this, exec, codeBlock); 979 JSValue* result = CTI::execute(codeBlock->ctiCode, & newExec, &m_registerFile, r, &newExec.globalData(), exception);969 JSValue* result = CTI::execute(codeBlock->ctiCode, &m_registerFile, r, scopeChain->globalData, exception); 980 970 #else 981 JSValue* result = privateExecute(Normal, & newExec, &m_registerFile, r, exception);971 JSValue* result = privateExecute(Normal, &m_registerFile, r, exception); 982 972 #endif 983 973 m_reentryDepth--; … … 1048 1038 // a 0 codeBlock indicates a built-in caller 1049 1039 r[codeBlock->thisRegister] = thisObj; 1050 initializeCallFrame(r, codeBlock, 0, scopeChain, makeHostCallFramePointer(exec-> m_callFrame), 0, 0, 0);1040 initializeCallFrame(r, codeBlock, 0, scopeChain, makeHostCallFramePointer(exec->registers()), 0, 0, 0); 1051 1041 1052 1042 if (codeBlock->needsFullScopeChain) 1053 1043 scopeChain = scopeChain->copy(); 1054 1055 ExecState newExec(r);1056 1044 1057 1045 Profiler** profiler = Profiler::enabledProfilerReference(); … … 1063 1051 if (!codeBlock->ctiCode) 1064 1052 CTI::compile(this, exec, codeBlock); 1065 JSValue* result = CTI::execute(codeBlock->ctiCode, & newExec, &m_registerFile, r, &newExec.globalData(), exception);1053 JSValue* result = CTI::execute(codeBlock->ctiCode, &m_registerFile, r, scopeChain->globalData, exception); 1066 1054 #else 1067 JSValue* result = privateExecute(Normal, & newExec, &m_registerFile, r, exception);1055 JSValue* result = privateExecute(Normal, &m_registerFile, r, exception); 1068 1056 #endif 1069 1057 m_reentryDepth--; … … 1086 1074 CodeBlock* codeBlock = this->codeBlock(r); 1087 1075 ScopeChainNode* scopeChain = this->scopeChain(r); 1088 DebuggerCallFrame debuggerCallFrame(exec , exec->dynamicGlobalObject(), codeBlock, scopeChain, r, 0);1076 DebuggerCallFrame debuggerCallFrame(exec->dynamicGlobalObject(), codeBlock, scopeChain, r, 0); 1089 1077 1090 1078 switch (debugHookID) { … … 1419 1407 } 1420 1408 1421 JSValue* Machine::privateExecute(ExecutionFlag flag, ExecState* exec,RegisterFile* registerFile, Register* r, JSValue** exception)1409 JSValue* Machine::privateExecute(ExecutionFlag flag, RegisterFile* registerFile, Register* r, JSValue** exception) 1422 1410 { 1423 1411 // One-time initialization of our address tables. We have to put this code … … 1444 1432 #endif 1445 1433 1434 #define exec CallFrame::create(r) 1435 1436 JSGlobalData* globalData = &exec->globalData(); 1446 1437 JSValue* exceptionValue = 0; 1447 1438 Instruction* handlerVPC = 0; … … 1453 1444 #define VM_CHECK_EXCEPTION() \ 1454 1445 do { \ 1455 if (UNLIKELY( exec->hadException())) { \1456 exceptionValue = exec->exception(); \1446 if (UNLIKELY(globalData->exception != 0)) { \ 1447 exceptionValue = globalData->exception; \ 1457 1448 goto vm_throw; \ 1458 1449 } \ … … 1527 1518 int dst = (++vPC)->u.operand; 1528 1519 int regExp = (++vPC)->u.operand; 1529 r[dst] = new ( exec) RegExpObject(scopeChain(r)->globalObject()->regExpStructure(), codeBlock(r)->regexps[regExp]);1520 r[dst] = new (globalData) RegExpObject(scopeChain(r)->globalObject()->regExpStructure(), codeBlock(r)->regexps[regExp]); 1530 1521 1531 1522 ++vPC; … … 3284 3275 Register* savedR = r; 3285 3276 3286 r = slideRegisterWindowForCall(exec, newCodeBlock, registerFile, r, registerOffset, argCount, exceptionValue); 3287 exec->m_callFrame = r; 3288 if (UNLIKELY(exceptionValue != 0)) 3277 r = slideRegisterWindowForCall(newCodeBlock, registerFile, r, registerOffset, argCount); 3278 if (UNLIKELY(!r)) { 3279 r = savedR; 3280 exceptionValue = createStackOverflowError(CallFrame::create(r)); 3289 3281 goto vm_throw; 3282 } 3290 3283 3291 3284 initializeCallFrame(r, newCodeBlock, vPC + 1, callDataScopeChain, savedR, dst, argCount, v); … … 3309 3302 ScopeChainNode* scopeChain = this->scopeChain(r); 3310 3303 initializeCallFrame(r + registerOffset, 0, vPC + 1, scopeChain, r, dst, argCount, v); 3311 exec->m_callFrame = r + registerOffset;3304 ExecState* callFrame = CallFrame::create(r + registerOffset); 3312 3305 3313 3306 if (*enabledProfilerReference) 3314 (*enabledProfilerReference)->willExecute( exec, static_cast<JSObject*>(v));3307 (*enabledProfilerReference)->willExecute(callFrame, static_cast<JSObject*>(v)); 3315 3308 3316 3309 MACHINE_SAMPLING_callingHostFunction(); 3317 3310 3318 JSValue* returnValue = callData.native.function(exec, static_cast<JSObject*>(v), thisValue, args); 3319 exec->m_callFrame = r; 3311 JSValue* returnValue = callData.native.function(callFrame, static_cast<JSObject*>(v), thisValue, args); 3320 3312 VM_CHECK_EXCEPTION(); 3321 3313 … … 3323 3315 3324 3316 if (*enabledProfilerReference) 3325 (*enabledProfilerReference)->didExecute( exec, static_cast<JSObject*>(v));3317 (*enabledProfilerReference)->didExecute(CallFrame::create(r), static_cast<JSObject*>(v)); 3326 3318 3327 3319 ++vPC; … … 3367 3359 int dst = r[RegisterFile::ReturnValueRegister].i(); 3368 3360 r = r[RegisterFile::CallerRegisters].r(); 3369 exec->m_callFrame = r;3370 3361 3371 3362 if (isHostCallFrame(r)) … … 3422 3413 r[i] = codeBlock->constantRegisters[j]; 3423 3414 3424 JSActivation* activation = new ( exec) JSActivation(exec, static_cast<FunctionBodyNode*>(codeBlock->ownerNode), r);3415 JSActivation* activation = new (globalData) JSActivation(exec, static_cast<FunctionBodyNode*>(codeBlock->ownerNode), r); 3425 3416 r[RegisterFile::OptionalCalleeActivation] = activation; 3426 3417 r[RegisterFile::ScopeChain] = scopeChain(r)->copy()->push(activation); … … 3453 3444 if (activation) { 3454 3445 ASSERT(activation->isObject(&JSActivation::info)); 3455 arguments = new ( exec) Arguments(exec, static_cast<JSActivation*>(activation));3446 arguments = new (globalData) Arguments(exec, static_cast<JSActivation*>(activation)); 3456 3447 } else 3457 arguments = new ( exec) Arguments(exec, r);3448 arguments = new (globalData) Arguments(exec, r); 3458 3449 r[RegisterFile::OptionalCalleeArguments] = arguments; 3459 3450 r[RegisterFile::ArgumentsRegister] = arguments; … … 3503 3494 else 3504 3495 structure = callDataScopeChain->globalObject()->emptyObjectStructure(); 3505 JSObject* newObject = new ( exec) JSObject(structure);3496 JSObject* newObject = new (globalData) JSObject(structure); 3506 3497 3507 3498 r[firstArg] = newObject; // "this" value … … 3509 3500 Register* savedR = r; 3510 3501 3511 r = slideRegisterWindowForCall(exec, newCodeBlock, registerFile, r, registerOffset, argCount, exceptionValue); 3512 exec->m_callFrame = r; 3513 if (UNLIKELY(exceptionValue != 0)) 3502 r = slideRegisterWindowForCall(newCodeBlock, registerFile, r, registerOffset, argCount); 3503 if (UNLIKELY(!r)) { 3504 r = savedR; 3505 exceptionValue = createStackOverflowError(CallFrame::create(r)); 3514 3506 goto vm_throw; 3507 } 3515 3508 3516 3509 initializeCallFrame(r, newCodeBlock, vPC + 1, callDataScopeChain, savedR, dst, argCount, v); … … 3533 3526 ScopeChainNode* scopeChain = this->scopeChain(r); 3534 3527 initializeCallFrame(r + registerOffset, 0, vPC + 1, scopeChain, r, dst, argCount, v); 3535 exec->m_callFrame = r +registerOffset;3528 r += registerOffset; 3536 3529 3537 3530 if (*enabledProfilerReference) … … 3541 3534 3542 3535 JSValue* returnValue = constructData.native.function(exec, static_cast<JSObject*>(v), args); 3543 exec->m_callFrame = r;3536 r -= registerOffset; 3544 3537 3545 3538 VM_CHECK_EXCEPTION(); … … 3861 3854 } 3862 3855 vm_throw: { 3863 exec->clearException();3856 globalData->exception = 0; 3864 3857 if (!tickCount) { 3865 3858 // The exceptionValue is a lie! (GCC produces bad code for reasons I 3866 3859 // cannot fathom if we don't assign to the exceptionValue before branching) 3867 exceptionValue = createInterruptedExecutionException( exec);3860 exceptionValue = createInterruptedExecutionException(globalData); 3868 3861 } 3869 3862 handlerVPC = throwException(exec, exceptionValue, vPC, r, false); … … 3880 3873 #undef VM_CHECK_EXCEPTION 3881 3874 #undef CHECK_FOR_TIMEOUT 3875 #undef exec 3882 3876 } 3883 3877 … … 3934 3928 sourceURL = UString(); 3935 3929 3936 Register* r = exec-> m_callFrame;3930 Register* r = exec->registers(); 3937 3931 Register* callerR = r[RegisterFile::CallerRegisters].r(); 3938 3932 if (isHostCallFrame(callerR)) … … 3965 3959 Register* Machine::callFrame(ExecState* exec, InternalFunction* function) const 3966 3960 { 3967 for (Register* r = exec-> m_callFrame; r; r = stripHostCallFrameBit(r[RegisterFile::CallerRegisters].r()))3961 for (Register* r = exec->registers(); r; r = stripHostCallFrameBit(r[RegisterFile::CallerRegisters].r())) 3968 3962 if (r[RegisterFile::Callee].getJSValue() == function) 3969 3963 return r; … … 3993 3987 NEVER_INLINE static void doSetReturnAddressVMThrowTrampoline(void** returnAddress) 3994 3988 { 3995 ctiSetReturnAddress(returnAddress, (void*)ctiVMThrowTrampoline);3989 ctiSetReturnAddress(returnAddress, reinterpret_cast<void*>(ctiVMThrowTrampoline)); 3996 3990 } 3997 3991 … … 4208 4202 } 4209 4203 4210 4211 #define JSVALUE_VM_CHECK_EXCEPTION_ARG(exception) \ 4204 #define VM_THROW_EXCEPTION() \ 4212 4205 do { \ 4213 if (UNLIKELY(exception != 0)) { \ 4214 exec->setException(exception); \ 4215 exec->setCTIReturnAddress(CTI_RETURN_ADDRESS); \ 4216 doSetReturnAddressVMThrowTrampoline(&CTI_RETURN_ADDRESS); \ 4217 return 0; \ 4218 } \ 4206 VM_THROW_EXCEPTION_AT_END(); \ 4207 return 0; \ 4219 4208 } while (0) 4220 #define VM_ CHECK_EXCEPTION_v() \4209 #define VM_THROW_EXCEPTION_AT_END() \ 4221 4210 do { \ 4222 if (UNLIKELY(exec->hadException())) { \ 4223 exec->setCTIReturnAddress(CTI_RETURN_ADDRESS); \ 4224 doSetReturnAddressVMThrowTrampoline(&CTI_RETURN_ADDRESS); \ 4225 return; \ 4226 } \ 4211 ASSERT(ARG_globalData->exception); \ 4212 ARG_globalData->throwReturnAddress = CTI_RETURN_ADDRESS; \ 4213 doSetReturnAddressVMThrowTrampoline(&CTI_RETURN_ADDRESS); \ 4227 4214 } while (0) 4228 #define VM_CHECK_EXCEPTION(type) \ 4215 4216 #define VM_CHECK_EXCEPTION() \ 4229 4217 do { \ 4230 if (UNLIKELY(exec->hadException())) { \ 4231 exec->setCTIReturnAddress(CTI_RETURN_ADDRESS); \ 4232 doSetReturnAddressVMThrowTrampoline(&CTI_RETURN_ADDRESS); \ 4233 return (type)0; \ 4218 if (UNLIKELY(ARG_globalData->exception != 0)) \ 4219 VM_THROW_EXCEPTION(); \ 4220 } while (0) 4221 #define VM_CHECK_EXCEPTION_ARG(exceptionValue) \ 4222 do { \ 4223 if (UNLIKELY((exceptionValue) != 0)) { \ 4224 ARG_globalData->exception = (exceptionValue); \ 4225 VM_THROW_EXCEPTION(); \ 4234 4226 } \ 4235 4227 } while (0) 4236 4228 #define VM_CHECK_EXCEPTION_AT_END() \ 4237 4229 do { \ 4238 if (UNLIKELY(exec->hadException())) { \ 4239 /*printf("VM_CHECK_EXCEPTION_AT_END()\n");*/ \ 4240 exec->setCTIReturnAddress(CTI_RETURN_ADDRESS); \ 4241 doSetReturnAddressVMThrowTrampoline(&CTI_RETURN_ADDRESS); \ 4230 if (UNLIKELY(ARG_globalData->exception != 0)) \ 4231 VM_THROW_EXCEPTION_AT_END(); \ 4232 } while (0) 4233 #define VM_CHECK_EXCEPTION_VOID() \ 4234 do { \ 4235 if (UNLIKELY(ARG_globalData->exception != 0)) { \ 4236 VM_THROW_EXCEPTION_AT_END(); \ 4237 return; \ 4242 4238 } \ 4243 4239 } while (0) 4244 4245 4240 4246 4241 JSValue* Machine::cti_op_convert_this(CTI_ARGS) … … 4280 4275 RefPtr<UString::Rep> value = concatenate(static_cast<JSString*>(v1)->value().rep(), static_cast<JSString*>(v2)->value().rep()); 4281 4276 if (UNLIKELY(!value)) { 4282 JSValue* result = throwOutOfMemoryError(exec); 4283 VM_CHECK_EXCEPTION_AT_END(); 4284 return result; 4277 throwOutOfMemoryError(exec); 4278 VM_THROW_EXCEPTION(); 4285 4279 } 4286 4280 … … 4294 4288 4295 4289 if (UNLIKELY(!value)) { 4296 JSValue* result = throwOutOfMemoryError(exec); 4297 VM_CHECK_EXCEPTION_AT_END(); 4298 return result; 4290 throwOutOfMemoryError(exec); 4291 VM_THROW_EXCEPTION(); 4299 4292 } 4300 4293 return jsString(ARG_globalData, value.release()); … … 4312 4305 4313 4306 ExecState* exec = ARG_exec; 4314 JSValue* result = jsNumber( exec, v->toNumber(exec) + 1);4307 JSValue* result = jsNumber(ARG_globalData, v->toNumber(exec) + 1); 4315 4308 VM_CHECK_EXCEPTION_AT_END(); 4316 4309 return result; … … 4319 4312 void Machine::cti_timeout_check(CTI_ARGS) 4320 4313 { 4321 ExecState* exec = ARG_exec; 4322 4323 if (ARG_globalData->machine->checkTimeout(exec->dynamicGlobalObject())) 4324 exec->setException(createInterruptedExecutionException(exec)); 4325 4326 VM_CHECK_EXCEPTION_AT_END(); 4314 if (ARG_globalData->machine->checkTimeout(ARG_exec->dynamicGlobalObject())) { 4315 ARG_globalData->exception = createInterruptedExecutionException(ARG_globalData); 4316 VM_THROW_EXCEPTION_AT_END(); 4317 } 4327 4318 } 4328 4319 … … 4487 4478 ASSERT(codeBlock->ctiReturnAddressVPCMap.contains(CTI_RETURN_ADDRESS)); 4488 4479 unsigned vPCIndex = codeBlock->ctiReturnAddressVPCMap.get(CTI_RETURN_ADDRESS); 4489 exec->setException(createInvalidParamError(exec, "instanceof", baseVal, codeBlock->instructions.begin() + vPCIndex, codeBlock));4490 VM_ CHECK_EXCEPTION(JSValue*);4480 ARG_globalData->exception = createInvalidParamError(exec, "instanceof", baseVal, codeBlock->instructions.begin() + vPCIndex, codeBlock); 4481 VM_THROW_EXCEPTION(); 4491 4482 } 4492 4483 … … 4496 4487 if (!proto->isObject()) { 4497 4488 throwError(exec, TypeError, "instanceof called on an object with an invalid prototype property."); 4498 VM_ CHECK_EXCEPTION(JSValue*);4489 VM_THROW_EXCEPTION(); 4499 4490 } 4500 4491 … … 4538 4529 JSValue* Machine::cti_op_new_func(CTI_ARGS) 4539 4530 { 4540 Register* r = ARG_r; 4541 ScopeChainNode* scopeChain = Machine::scopeChain(r); 4542 return ARG_func1->makeFunction(ARG_exec, scopeChain); 4531 return ARG_func1->makeFunction(ARG_exec, Machine::scopeChain(ARG_r)); 4543 4532 } 4544 4533 4545 4534 void* Machine::cti_op_call_JSFunction(CTI_ARGS) 4546 4535 { 4547 ExecState* exec = ARG_exec;4548 RegisterFile* registerFile = ARG_registerFile;4549 Register* r = ARG_r;4550 4551 JSValue* funcVal = ARG_src1;4552 int registerOffset = ARG_int2;4553 int argCount = ARG_int3;4554 4555 4536 #ifndef NDEBUG 4556 4537 CallData callData; 4557 ASSERT( funcVal->getCallData(callData) == CallTypeJS);4538 ASSERT(ARG_src1->getCallData(callData) == CallTypeJS); 4558 4539 #endif 4559 4540 4560 if (*ARG_profilerReference) 4561 (*ARG_profilerReference)->willExecute(exec, static_cast<JSObject*>(funcVal)); 4562 4563 ScopeChainNode* callDataScopeChain = static_cast<JSFunction*>(funcVal)->m_scopeChain.node(); 4564 FunctionBodyNode* functionBodyNode = static_cast<JSFunction*>(funcVal)->m_body.get(); 4565 4566 CodeBlock* newCodeBlock = &functionBodyNode->byteCode(callDataScopeChain); 4567 4568 Register* savedR = r; 4569 4570 JSValue* exceptionValue = 0; 4571 r = slideRegisterWindowForCall(exec, newCodeBlock, registerFile, r, registerOffset, argCount, exceptionValue); 4572 JSVALUE_VM_CHECK_EXCEPTION_ARG(exceptionValue); 4541 if (UNLIKELY(*ARG_profilerReference != 0)) 4542 (*ARG_profilerReference)->willExecute(CallFrame::create(ARG_r), static_cast<JSObject*>(ARG_src1)); 4543 4544 ScopeChainNode* callDataScopeChain = static_cast<JSFunction*>(ARG_src1)->m_scopeChain.node(); 4545 CodeBlock* newCodeBlock = &static_cast<JSFunction*>(ARG_src1)->m_body->byteCode(callDataScopeChain); 4546 4547 Register* r = slideRegisterWindowForCall(newCodeBlock, ARG_registerFile, ARG_r, ARG_int2, ARG_int3); 4548 if (UNLIKELY(!r)) { 4549 ARG_globalData->exception = createStackOverflowError(CallFrame::create(ARG_r)); 4550 VM_THROW_EXCEPTION(); 4551 } 4573 4552 4574 4553 r[RegisterFile::CodeBlock] = newCodeBlock; 4575 4554 r[RegisterFile::ScopeChain] = callDataScopeChain; 4576 r[RegisterFile::CallerRegisters] = savedR;4555 r[RegisterFile::CallerRegisters] = ARG_r; 4577 4556 // RegisterFile::ReturnPC is set by callee 4578 4557 // RegisterFile::ReturnValueRegister is set by caller 4579 r[RegisterFile::ArgumentCount] = argCount; // original argument count (for the sake of the "arguments" object)4580 r[RegisterFile::Callee] = funcVal;4558 r[RegisterFile::ArgumentCount] = ARG_int3; // original argument count (for the sake of the "arguments" object) 4559 r[RegisterFile::Callee] = ARG_src1; 4581 4560 r[RegisterFile::OptionalCalleeActivation] = nullJSValue; 4582 4561 r[RegisterFile::OptionalCalleeArguments] = nullJSValue; 4583 4562 4584 exec->m_callFrame = r;4585 4563 ARG_setR(r); 4586 4564 … … 4590 4568 void* Machine::cti_vm_compile(CTI_ARGS) 4591 4569 { 4592 ExecState* exec = ARG_exec;4593 4570 Register* r = ARG_r; 4594 4571 CodeBlock* codeBlock = Machine::codeBlock(r); 4595 4572 4596 4573 if (!codeBlock->ctiCode) 4597 CTI::compile(ARG_globalData->machine, exec, codeBlock);4574 CTI::compile(ARG_globalData->machine, CallFrame::create(r), codeBlock); 4598 4575 4599 4576 return codeBlock->ctiCode; … … 4607 4584 ScopeChainNode* scopeChain = Machine::scopeChain(r); 4608 4585 4609 JSActivation* activation = new ( exec) JSActivation(exec, static_cast<FunctionBodyNode*>(codeBlock->ownerNode), r);4586 JSActivation* activation = new (ARG_globalData) JSActivation(exec, static_cast<FunctionBodyNode*>(codeBlock->ownerNode), r); 4610 4587 r[RegisterFile::OptionalCalleeActivation] = activation; 4611 4588 r[RegisterFile::ScopeChain] = scopeChain->copy()->push(activation); … … 4614 4591 JSValue* Machine::cti_op_call_NotJSFunction(CTI_ARGS) 4615 4592 { 4616 ExecState* exec = ARG_exec;4617 4593 JSValue* funcVal = ARG_src1; 4618 4594 … … 4629 4605 4630 4606 initializeCallFrame(r, 0, ARG_instr4 + 1, scopeChain(savedR), savedR, 0, argCount, funcVal); 4631 exec->m_callFrame = r;4632 4607 ARG_setR(r); 4633 4608 4634 4609 if (*ARG_profilerReference) 4635 (*ARG_profilerReference)->willExecute( exec, static_cast<JSObject*>(funcVal));4610 (*ARG_profilerReference)->willExecute(CallFrame::create(r), static_cast<JSObject*>(funcVal)); 4636 4611 4637 4612 Register* argv = r - RegisterFile::CallFrameHeaderSize - argCount; … … 4640 4615 CTI_MACHINE_SAMPLING_callingHostFunction(); 4641 4616 4642 JSValue* returnValue = callData.native.function(exec, static_cast<JSObject*>(funcVal), argv[0].jsValue(exec), argList); 4643 exec->m_callFrame = savedR; 4617 JSValue* returnValue = callData.native.function(CallFrame::create(r), static_cast<JSObject*>(funcVal), argv[0].jsValue(CallFrame::create(r)), argList); 4644 4618 ARG_setR(savedR); 4645 VM_CHECK_EXCEPTION( JSValue*);4619 VM_CHECK_EXCEPTION(); 4646 4620 4647 4621 if (*ARG_profilerReference) 4648 (*ARG_profilerReference)->didExecute( exec, static_cast<JSObject*>(funcVal));4622 (*ARG_profilerReference)->didExecute(CallFrame::create(savedR), static_cast<JSObject*>(funcVal)); 4649 4623 4650 4624 return returnValue; … … 4653 4627 ASSERT(callType == CallTypeNone); 4654 4628 4655 Register* r = ARG_r; 4656 exec->setException(createNotAFunctionError(exec, funcVal, ARG_instr4, codeBlock(r))); 4657 VM_CHECK_EXCEPTION_AT_END(); 4658 return 0; 4629 ARG_globalData->exception = createNotAFunctionError(CallFrame::create(ARG_r), funcVal, ARG_instr4, codeBlock(ARG_r)); 4630 VM_THROW_EXCEPTION(); 4659 4631 } 4660 4632 … … 4668 4640 if (activation) { 4669 4641 ASSERT(activation->isObject(&JSActivation::info)); 4670 arguments = new ( exec) Arguments(exec, static_cast<JSActivation*>(activation));4642 arguments = new (ARG_globalData) Arguments(exec, static_cast<JSActivation*>(activation)); 4671 4643 } else 4672 arguments = new ( exec) Arguments(exec, r);4644 arguments = new (ARG_globalData) Arguments(exec, r); 4673 4645 r[RegisterFile::OptionalCalleeArguments] = arguments; 4674 4646 r[RegisterFile::ArgumentsRegister] = arguments; … … 4737 4709 unsigned vPCIndex = codeBlock->ctiReturnAddressVPCMap.get(CTI_RETURN_ADDRESS); 4738 4710 exec->setException(createUndefinedVariableError(exec, ident, codeBlock->instructions.begin() + vPCIndex, codeBlock)); 4739 4740 VM_CHECK_EXCEPTION_AT_END(); 4741 return 0; 4711 VM_THROW_EXCEPTION(); 4742 4712 } 4743 4713 4744 4714 void* Machine::cti_op_construct_JSConstruct(CTI_ARGS) 4745 4715 { 4746 ExecState* exec = ARG_exec;4747 4716 RegisterFile* registerFile = ARG_registerFile; 4748 4717 Register* r = ARG_r; … … 4762 4731 4763 4732 if (*ARG_profilerReference) 4764 (*ARG_profilerReference)->willExecute( exec, constructor);4733 (*ARG_profilerReference)->willExecute(CallFrame::create(r), constructor); 4765 4734 4766 4735 ScopeChainNode* callDataScopeChain = constructor->m_scopeChain.node(); … … 4773 4742 else 4774 4743 structure = callDataScopeChain->globalObject()->emptyObjectStructure(); 4775 JSObject* newObject = new ( exec) JSObject(structure);4744 JSObject* newObject = new (ARG_globalData) JSObject(structure); 4776 4745 4777 4746 r[firstArg] = newObject; // "this" value 4778 4747 4779 Register* savedR = r;4780 4781 JSValue* exceptionValue = 0;4782 r = slideRegisterWindowForCall(exec, newCodeBlock, registerFile, r, registerOffset, argCount, exceptionValue);4783 JSVALUE_VM_CHECK_EXCEPTION_ARG(exceptionValue);4748 r = slideRegisterWindowForCall(newCodeBlock, registerFile, r, registerOffset, argCount); 4749 if (UNLIKELY(!r)) { 4750 ARG_globalData->exception = createStackOverflowError(CallFrame::create(ARG_r)); 4751 VM_THROW_EXCEPTION(); 4752 } 4784 4753 4785 4754 r[RegisterFile::CodeBlock] = newCodeBlock; 4786 4755 r[RegisterFile::ScopeChain] = callDataScopeChain; 4787 r[RegisterFile::CallerRegisters] = savedR;4756 r[RegisterFile::CallerRegisters] = ARG_r; 4788 4757 // RegisterFile::ReturnPC is set by callee 4789 4758 // RegisterFile::ReturnValueRegister is set by caller … … 4793 4762 r[RegisterFile::OptionalCalleeArguments] = nullJSValue; 4794 4763 4795 exec->m_callFrame = r;4796 4797 4764 ARG_setR(r); 4798 4765 return newCodeBlock->ctiCode; … … 4822 4789 4823 4790 JSValue* returnValue = constructData.native.function(exec, constructor, argList); 4824 VM_CHECK_EXCEPTION( JSValue*);4791 VM_CHECK_EXCEPTION(); 4825 4792 4826 4793 if (*ARG_profilerReference) … … 4833 4800 4834 4801 exec->setException(createNotAConstructorError(exec, constrVal, ARG_instr6, codeBlock(r))); 4835 VM_CHECK_EXCEPTION_AT_END(); 4836 return 0; 4802 VM_THROW_EXCEPTION(); 4837 4803 } 4838 4804 … … 4909 4875 unsigned vPCIndex = codeBlock->ctiReturnAddressVPCMap.get(CTI_RETURN_ADDRESS); 4910 4876 exec->setException(createUndefinedVariableError(exec, ident, codeBlock->instructions.begin() + vPCIndex, codeBlock)); 4911 4912 VM_CHECK_EXCEPTION_AT_END(); 4913 return 0; 4877 VM_THROW_EXCEPTION(); 4914 4878 } 4915 4879 … … 4953 4917 } else { 4954 4918 Identifier property(exec, subscript->toString(exec)); 4955 if (! exec->hadException()) { // Don't put to an object if toString threw an exception.4919 if (!ARG_globalData->exception) { // Don't put to an object if toString threw an exception. 4956 4920 PutPropertySlot slot; 4957 4921 baseValue->put(exec, property, value, slot); … … 4977 4941 Identifier property(exec, JSImmediate::from(i)->toString(exec)); 4978 4942 // FIXME: can toString throw an exception here? 4979 if (! exec->hadException()) { // Don't put to an object if toString threw an exception.4943 if (!ARG_globalData->exception) { // Don't put to an object if toString threw an exception. 4980 4944 PutPropertySlot slot; 4981 4945 baseValue->put(exec, property, value, slot); … … 5054 5018 unsigned vPCIndex = codeBlock->ctiReturnAddressVPCMap.get(CTI_RETURN_ADDRESS); 5055 5019 exec->setException(createUndefinedVariableError(exec, ident, codeBlock->instructions.begin() + vPCIndex, codeBlock)); 5056 5057 VM_CHECK_EXCEPTION_AT_END(); 5058 return 0; 5020 VM_THROW_EXCEPTION(); 5059 5021 } 5060 5022 … … 5084 5046 5085 5047 Register* r = ARG_r; 5086 exec->setException(createUndefinedVariableError(exec, ident, vPC, codeBlock(r))); 5087 5088 VM_CHECK_EXCEPTION_AT_END(); 5089 return 0; 5048 exec->setException(createUndefinedVariableError(exec, ident, vPC, codeBlock(r))); 5049 VM_THROW_EXCEPTION(); 5090 5050 } 5091 5051 … … 5156 5116 5157 5117 JSValue* number = v->toJSNumber(exec); 5158 VM_CHECK_EXCEPTION( JSValue*);5118 VM_CHECK_EXCEPTION(); 5159 5119 ARG_set2ndResult(jsNumber(ARG_globalData, number->uncheckedGetNumber() + 1)); 5160 5120 return number; … … 5271 5231 unsigned vPCIndex = codeBlock->ctiReturnAddressVPCMap.get(CTI_RETURN_ADDRESS); 5272 5232 exec->setException(createUndefinedVariableError(exec, ident, codeBlock->instructions.begin() + vPCIndex, codeBlock)); 5273 5274 VM_CHECK_EXCEPTION_AT_END(); 5275 return 0; 5233 VM_THROW_EXCEPTION(); 5276 5234 } 5277 5235 … … 5321 5279 5322 5280 JSValue* number = v->toJSNumber(exec); 5323 VM_CHECK_EXCEPTION( JSValue*);5281 VM_CHECK_EXCEPTION(); 5324 5282 5325 5283 ARG_set2ndResult(jsNumber(ARG_globalData, number->uncheckedGetNumber() - 1)); … … 5357 5315 JSValue* Machine::cti_op_new_regexp(CTI_ARGS) 5358 5316 { 5359 return new (ARG_ exec) RegExpObject(scopeChain(ARG_r)->globalObject()->regExpStructure(), ARG_regexp1);5317 return new (ARG_globalData) RegExpObject(scopeChain(ARG_r)->globalObject()->regExpStructure(), ARG_regexp1); 5360 5318 } 5361 5319 … … 5391 5349 JSValue* exceptionValue = 0; 5392 5350 JSValue* result = machine->callEval(exec, thisObject, scopeChain, registerFile, r, registerOffset - RegisterFile::CallFrameHeaderSize - argCount, argCount, exceptionValue); 5393 JSVALUE_VM_CHECK_EXCEPTION_ARG(exceptionValue);5351 VM_CHECK_EXCEPTION_ARG(exceptionValue); 5394 5352 return result; 5395 5353 } … … 5408 5366 5409 5367 JSValue* exceptionValue = ARG_src1; 5368 ASSERT(exceptionValue); 5369 5410 5370 Instruction* handlerVPC = ARG_globalData->machine->throwException(exec, exceptionValue, codeBlock->instructions.begin() + vPCIndex, r, true); 5411 5371 5412 if (handlerVPC) { 5413 exec->setException(exceptionValue); 5414 ARG_setR(r); 5415 5416 void* catchRoutine = Machine::codeBlock(r)->nativeExceptionCodeForHandlerVPC(handlerVPC); 5417 ASSERT(catchRoutine); 5418 ctiSetReturnAddress(&CTI_RETURN_ADDRESS, catchRoutine); 5419 return catchRoutine; 5420 } else { 5421 exec->clearException(); 5372 if (!handlerVPC) { 5422 5373 *ARG_exception = exceptionValue; 5423 5374 return JSImmediate::nullImmediate(); 5424 5375 } 5376 5377 ARG_setR(r); 5378 void* catchRoutine = Machine::codeBlock(r)->nativeExceptionCodeForHandlerVPC(handlerVPC); 5379 ASSERT(catchRoutine); 5380 ctiSetReturnAddress(&CTI_RETURN_ADDRESS, catchRoutine); 5381 return exceptionValue; 5425 5382 } 5426 5383 … … 5445 5402 5446 5403 JSObject* o = v->toObject(exec); 5447 VM_CHECK_EXCEPTION_ v();5404 VM_CHECK_EXCEPTION_VOID(); 5448 5405 5449 5406 Register* r = ARG_r; … … 5538 5495 unsigned vPCIndex = codeBlock->ctiReturnAddressVPCMap.get(CTI_RETURN_ADDRESS); 5539 5496 exec->setException(createInvalidParamError(exec, "in", baseVal, codeBlock->instructions.begin() + vPCIndex, codeBlock)); 5540 VM_ CHECK_EXCEPTION(JSValue*);5497 VM_THROW_EXCEPTION(); 5541 5498 } 5542 5499 … … 5549 5506 5550 5507 Identifier property(exec, propName->toString(exec)); 5551 VM_CHECK_EXCEPTION( JSValue*);5508 VM_CHECK_EXCEPTION(); 5552 5509 return jsBoolean(baseObj->hasProperty(exec, property)); 5553 5510 } … … 5555 5512 JSValue* Machine::cti_op_push_new_scope(CTI_ARGS) 5556 5513 { 5557 ExecState* exec = ARG_exec; 5558 JSObject* scope = new (exec) JSStaticScopeObject(exec, *ARG_id1, ARG_src2, DontDelete); 5514 JSObject* scope = new (ARG_globalData) JSStaticScopeObject(ARG_exec, *ARG_id1, ARG_src2, DontDelete); 5559 5515 5560 5516 Register* r = ARG_r; … … 5645 5601 result = jsBoolean(baseObj->deleteProperty(exec, i)); 5646 5602 else { 5647 VM_CHECK_EXCEPTION( JSValue*);5603 VM_CHECK_EXCEPTION(); 5648 5604 Identifier property(exec, subscript->toString(exec)); 5649 VM_CHECK_EXCEPTION( JSValue*);5605 VM_CHECK_EXCEPTION(); 5650 5606 result = jsBoolean(baseObj->deleteProperty(exec, property)); 5651 5607 } … … 5707 5663 CodeBlock* codeBlock = Machine::codeBlock(r); 5708 5664 5709 ASSERT(codeBlock->ctiReturnAddressVPCMap.contains( exec->ctiReturnAddress()));5710 unsigned vPCIndex = codeBlock->ctiReturnAddressVPCMap.get( exec->ctiReturnAddress());5711 5712 ASSERT(exec->hadException());5713 5714 JSValue* exceptionValue = exec->exception();5665 ASSERT(codeBlock->ctiReturnAddressVPCMap.contains(ARG_globalData->throwReturnAddress)); 5666 unsigned vPCIndex = codeBlock->ctiReturnAddressVPCMap.get(ARG_globalData->throwReturnAddress); 5667 5668 JSValue* exceptionValue = ARG_globalData->exception; 5669 ASSERT(exceptionValue); 5670 ARG_globalData->exception = 0; 5715 5671 5716 5672 Instruction* handlerVPC = ARG_globalData->machine->throwException(exec, exceptionValue, codeBlock->instructions.begin() + vPCIndex, r, false); 5717 5673 5718 if (handlerVPC) { 5719 exec->setException(exceptionValue); 5720 ARG_setR(r); 5721 5722 void* catchRoutine = Machine::codeBlock(r)->nativeExceptionCodeForHandlerVPC(handlerVPC); 5723 ASSERT(catchRoutine); 5724 ctiSetReturnAddress(&CTI_RETURN_ADDRESS, catchRoutine); 5725 return catchRoutine; 5726 } else { 5727 exec->clearException(); 5674 if (!handlerVPC) { 5728 5675 *ARG_exception = exceptionValue; 5729 5676 return JSImmediate::nullImmediate(); 5730 5677 } 5678 5679 ARG_setR(r); 5680 void* catchRoutine = Machine::codeBlock(r)->nativeExceptionCodeForHandlerVPC(handlerVPC); 5681 ASSERT(catchRoutine); 5682 ctiSetReturnAddress(&CTI_RETURN_ADDRESS, catchRoutine); 5683 return exceptionValue; 5731 5684 } 5732 5685 5733 5686 #undef VM_CHECK_EXCEPTION 5734 #undef VM_CHECK_EXCEPTION_ v5687 #undef VM_CHECK_EXCEPTION_ARG 5735 5688 #undef VM_CHECK_EXCEPTION_AT_END 5689 #undef VM_CHECK_EXCEPTION_VOID 5736 5690 5737 5691 #endif // ENABLE(CTI) -
trunk/JavaScriptCore/VM/Machine.h
r37294 r37297 269 269 Register* callFrame(ExecState*, InternalFunction*) const; 270 270 271 JSValue* privateExecute(ExecutionFlag, ExecState* = 0, RegisterFile* = 0, Register* = 0, JSValue** exception = 0);271 JSValue* privateExecute(ExecutionFlag, RegisterFile*, Register*, JSValue** exception); 272 272 273 273 void dumpCallFrame(const RegisterFile*, const Register*); -
trunk/JavaScriptCore/kjs/DebuggerCallFrame.cpp
r37257 r37297 45 45 if (!function) 46 46 return 0; 47 return &function->name(m_ exec);47 return &function->name(m_scopeChain->globalData); 48 48 } 49 49 … … 69 69 return 0; 70 70 71 ExecState newExec(m_registers);72 73 71 int errLine; 74 72 UString errMsg; 75 73 SourceCode source = makeSource(script); 76 RefPtr<EvalNode> evalNode = newExec.parser()->parse<EvalNode>(&newExec, source, &errLine, &errMsg);74 RefPtr<EvalNode> evalNode = m_scopeChain->globalData->parser->parse<EvalNode>(CallFrame::create(m_registers), source, &errLine, &errMsg); 77 75 if (!evalNode) 78 return Error::create( &newExec, SyntaxError, errMsg, errLine, source.provider()->asID(), source.provider()->url());76 return Error::create(CallFrame::create(m_registers), SyntaxError, errMsg, errLine, source.provider()->asID(), source.provider()->url()); 79 77 80 return newExec.machine()->execute(evalNode.get(), &newExec, thisObject(), m_scopeChain, &exception);78 return m_scopeChain->globalData->machine->execute(evalNode.get(), CallFrame::create(m_registers), thisObject(), m_scopeChain, &exception); 81 79 } 82 80 -
trunk/JavaScriptCore/kjs/DebuggerCallFrame.h
r36821 r37297 49 49 }; 50 50 51 DebuggerCallFrame(ExecState* exec, JSGlobalObject* dynamicGlobalObject, const CodeBlock* codeBlock, ScopeChainNode* scopeChain, Register* r, JSValue* exception) 52 : m_exec(exec) 53 , m_dynamicGlobalObject(dynamicGlobalObject) 51 DebuggerCallFrame(JSGlobalObject* dynamicGlobalObject, const CodeBlock* codeBlock, ScopeChainNode* scopeChain, Register* r, JSValue* exception) 52 : m_dynamicGlobalObject(dynamicGlobalObject) 54 53 , m_codeBlock(codeBlock) 55 54 , m_scopeChain(scopeChain) … … 62 61 const ScopeChainNode* scopeChain() const { return m_scopeChain; } 63 62 const UString* functionName() const; 64 DebuggerCallFrame::Type type() const;63 Type type() const; 65 64 JSObject* thisObject() const; 66 65 JSValue* evaluate(const UString&, JSValue*& exception) const; … … 68 67 69 68 private: 70 ExecState* m_exec;71 69 JSGlobalObject* m_dynamicGlobalObject; 72 70 const CodeBlock* m_codeBlock; -
trunk/JavaScriptCore/kjs/ExecState.h
r37257 r37297 30 30 namespace JSC { 31 31 32 class ExecState; 32 33 class JSValue; 33 34 class Register; 34 35 36 typedef ExecState CallFrame; 37 35 38 // Represents the current state of script execution. 36 39 // Passed as the first argument to most functions. 37 class ExecState : Noncopyable { 38 #if ENABLE(CTI) 39 friend class CTI; 40 #endif 41 friend class Machine; 42 friend class DebuggerCallFrame; 40 class ExecState : private Register, Noncopyable { 43 41 public: 44 explicit ExecState(Register* callFrame) 45 : m_exception(0) 46 , m_callFrame(callFrame) 42 static CallFrame* create(Register* callFrameBase) { return static_cast<CallFrame*>(callFrameBase); } 43 Register* registers() { return this; } 44 45 // Global object in which execution began. 46 JSGlobalObject* dynamicGlobalObject() 47 47 { 48 return Machine::scopeChain(Machine::firstCallFrame(this))->globalObject(); 48 49 } 49 50 50 // Global object in which execution began. 51 JSGlobalObject* dynamicGlobalObject() const 51 // Global object in which the currently executing code was defined. 52 // Differs from dynamicGlobalObject() during function calls across web browser frames. 53 JSGlobalObject* lexicalGlobalObject() 52 54 { 53 return Machine::scopeChain( Machine::firstCallFrame(m_callFrame))->globalObject();55 return Machine::scopeChain(this)->globalObject(); 54 56 } 55 57 56 // Global object in which the current script was defined. (Can differ57 // from dynamicGlobalObject() during function calls across frames.)58 JS GlobalObject* lexicalGlobalObject() const58 // Differs from lexicalGlobalObject because this will have DOM window shell rather than 59 // the actual DOM window. 60 JSObject* globalThisValue() 59 61 { 60 return Machine::scopeChain( m_callFrame)->globalObject();62 return Machine::scopeChain(this)->globalThisObject(); 61 63 } 62 64 63 JS Object* globalThisValue() const65 JSGlobalData& globalData() 64 66 { 65 return Machine::scopeChain(m_callFrame)->globalThisObject();67 return *Machine::scopeChain(this)->globalData; 66 68 } 67 69 68 // Exception propogation. 69 void setException(JSValue* exception) { m_exception = exception; } 70 void clearException() { m_exception = 0; } 71 JSValue* exception() const { return m_exception; } 72 JSValue** exceptionSlot() { return &m_exception; } 73 bool hadException() const { return !!m_exception; } 74 #if ENABLE(CTI) 75 void setCTIReturnAddress(void* ctiRA) { m_ctiReturnAddress = ctiRA; } 76 void* ctiReturnAddress() const { return m_ctiReturnAddress; } 77 #endif 70 // Convenience functions for access to global data. 78 71 79 JSGlobalData& globalData() const 80 { 81 return *Machine::scopeChain(m_callFrame)->globalData; 82 } 72 void setException(JSValue* exception) { globalData().exception = exception; } 73 void clearException() { globalData().exception = 0; } 74 JSValue* exception() { return globalData().exception; } 75 JSValue** exceptionSlot() { return &globalData().exception; } 76 bool hadException() { return !!globalData().exception; } 83 77 84 78 IdentifierTable* identifierTable() { return globalData().identifierTable; } 85 const CommonIdentifiers& propertyNames() const{ return *globalData().propertyNames; }86 const ArgList& emptyList() const{ return *globalData().emptyList; }79 const CommonIdentifiers& propertyNames() { return *globalData().propertyNames; } 80 const ArgList& emptyList() { return *globalData().emptyList; } 87 81 Lexer* lexer() { return globalData().lexer; } 88 82 Parser* parser() { return globalData().parser; } 89 Machine* machine() const { return globalData().machine; } 90 static const HashTable* arrayTable(ExecState* exec) { return exec->globalData().arrayTable; } 91 static const HashTable* dateTable(ExecState* exec) { return exec->globalData().dateTable; } 92 static const HashTable* mathTable(ExecState* exec) { return exec->globalData().mathTable; } 93 static const HashTable* numberTable(ExecState* exec) { return exec->globalData().numberTable; } 94 static const HashTable* regExpTable(ExecState* exec) { return exec->globalData().regExpTable; } 95 static const HashTable* regExpConstructorTable(ExecState* exec) { return exec->globalData().regExpConstructorTable; } 96 static const HashTable* stringTable(ExecState* exec) { return exec->globalData().stringTable; } 83 Machine* machine() { return globalData().machine; } 84 Heap* heap() { return &globalData().heap; } 97 85 98 Heap* heap() const { return &globalData().heap; } 86 static const HashTable* arrayTable(CallFrame* callFrame) { return callFrame->globalData().arrayTable; } 87 static const HashTable* dateTable(CallFrame* callFrame) { return callFrame->globalData().dateTable; } 88 static const HashTable* mathTable(CallFrame* callFrame) { return callFrame->globalData().mathTable; } 89 static const HashTable* numberTable(CallFrame* callFrame) { return callFrame->globalData().numberTable; } 90 static const HashTable* regExpTable(CallFrame* callFrame) { return callFrame->globalData().regExpTable; } 91 static const HashTable* regExpConstructorTable(CallFrame* callFrame) { return callFrame->globalData().regExpConstructorTable; } 92 static const HashTable* stringTable(CallFrame* callFrame) { return callFrame->globalData().stringTable; } 99 93 100 94 private: 101 // Default constructor required for gcc 3. 102 ExecState() { } 103 104 bool isGlobalObject(JSObject*) const; 105 106 JSValue* m_exception; 107 #if ENABLE(CTI) 108 void* m_ctiReturnAddress; 109 #endif 110 Register* m_callFrame; // The most recent call frame. 95 ExecState(); 96 ~ExecState(); 111 97 }; 112 98 -
trunk/JavaScriptCore/kjs/FunctionPrototype.cpp
r37257 r37297 68 68 if (thisValue->isObject(&JSFunction::info)) { 69 69 JSFunction* function = static_cast<JSFunction*>(thisValue); 70 return jsString(exec, "function " + function->name( exec) + "(" + function->m_body->paramString() + ") " + function->m_body->toSourceString());70 return jsString(exec, "function " + function->name(&exec->globalData()) + "(" + function->m_body->paramString() + ") " + function->m_body->toSourceString()); 71 71 } 72 72 73 73 if (thisValue->isObject(&InternalFunction::info)) { 74 74 InternalFunction* function = static_cast<InternalFunction*>(thisValue); 75 return jsString(exec, "function " + function->name( exec) + "() {\n [native code]\n}");75 return jsString(exec, "function " + function->name(&exec->globalData()) + "() {\n [native code]\n}"); 76 76 } 77 77 -
trunk/JavaScriptCore/kjs/InternalFunction.cpp
r37257 r37297 50 50 } 51 51 52 const UString& InternalFunction::name( ExecState* exec)52 const UString& InternalFunction::name(JSGlobalData* globalData) 53 53 { 54 JSValue* v = getDirect( exec->propertyNames().name);54 JSValue* v = getDirect(globalData->propertyNames->name); 55 55 ASSERT(v->isString()); 56 56 return static_cast<JSString*>(v)->value(); -
trunk/JavaScriptCore/kjs/InternalFunction.h
r37257 r37297 37 37 static const ClassInfo info; 38 38 39 const UString& name( ExecState*);39 const UString& name(JSGlobalData*); 40 40 41 41 static PassRefPtr<StructureID> createStructureID(JSValue* proto) -
trunk/JavaScriptCore/kjs/JSGlobalData.cpp
r37285 r37297 61 61 JSGlobalData::JSGlobalData(bool isShared) 62 62 : machine(new Machine) 63 , exception(0) 63 64 #if ENABLE(JSC_MULTIPLE_THREADS) 64 65 , arrayTable(new HashTable(JSC::arrayTable)) -
trunk/JavaScriptCore/kjs/JSGlobalData.h
r37285 r37297 65 65 Machine* machine; 66 66 67 JSValue* exception; 68 #if ENABLE(CTI) 69 void* throwReturnAddress; 70 #endif 71 67 72 const HashTable* arrayTable; 68 73 const HashTable* dateTable; -
trunk/JavaScriptCore/kjs/JSGlobalObject.cpp
r37257 r37297 143 143 d()->debugger = 0; 144 144 145 d()->globalExec.set(new ExecState(d()->globalCallFrame + RegisterFile::CallFrameHeaderSize));146 147 145 d()->profileGroup = 0; 148 146 … … 199 197 void JSGlobalObject::reset(JSValue* prototype) 200 198 { 201 ExecState* exec = d()->globalExec.get();199 ExecState* exec = JSGlobalObject::globalExec(); 202 200 203 201 // Prototypes … … 365 363 registerFile.markGlobals(&globalData()->heap); 366 364 367 markIfNeeded(d()->globalExec->exception());368 369 365 markIfNeeded(d()->regExpConstructor); 370 366 markIfNeeded(d()->errorConstructor); … … 411 407 ExecState* JSGlobalObject::globalExec() 412 408 { 413 return d()->globalExec.get();409 return CallFrame::create(d()->globalCallFrame + RegisterFile::CallFrameHeaderSize); 414 410 } 415 411 -
trunk/JavaScriptCore/kjs/JSGlobalObject.h
r37257 r37297 92 92 ScopeChain globalScopeChain; 93 93 Register globalCallFrame[RegisterFile::CallFrameHeaderSize]; 94 OwnPtr<ExecState> globalExec;95 94 96 95 int recursion; -
trunk/JavaScriptCore/kjs/JSObject.cpp
r36977 r37297 482 482 void JSObject::putDirectFunction(ExecState* exec, InternalFunction* function, unsigned attr) 483 483 { 484 putDirect(Identifier(exec, function->name( exec)), function, attr);484 putDirect(Identifier(exec, function->name(&exec->globalData())), function, attr); 485 485 } 486 486 -
trunk/JavaScriptCore/kjs/collector.cpp
r37215 r37297 982 982 if (m_markListSet && m_markListSet->size()) 983 983 ArgList::markLists(*m_markListSet); 984 if (m_globalData->exception && !m_globalData->exception->marked()) 985 m_globalData->exception->mark(); 984 986 m_globalData->machine->registerFile().markCallFrames(this); 985 987 m_globalData->smallStrings.mark(); -
trunk/JavaScriptCore/profiler/ProfileGenerator.cpp
r37184 r37297 63 63 64 64 exec->machine()->retrieveLastCaller(exec, lineNumber, sourceID, sourceURL, function); 65 m_currentNode = ProfileNode::create(Profiler::createCallIdentifier( exec, function ? function->toThisObject(exec) : 0, sourceURL, lineNumber), m_head.get(), m_head.get());65 m_currentNode = ProfileNode::create(Profiler::createCallIdentifier(&exec->globalData(), function ? function->toThisObject(exec) : 0, sourceURL, lineNumber), m_head.get(), m_head.get()); 66 66 m_head->insertNode(m_currentNode.get()); 67 67 } -
trunk/JavaScriptCore/profiler/Profiler.cpp
r36263 r37297 45 45 static unsigned ProfilesUID = 0; 46 46 47 static CallIdentifier createCallIdentifierFromFunctionImp( ExecState*, JSFunction*);47 static CallIdentifier createCallIdentifierFromFunctionImp(JSGlobalData*, JSFunction*); 48 48 49 49 Profiler* Profiler::s_sharedProfiler = 0; … … 106 106 ASSERT(!m_currentProfiles.isEmpty()); 107 107 108 dispatchFunctionToProfiles(m_currentProfiles, &ProfileGenerator::willExecute, createCallIdentifier( exec, calledFunction, "", 0), exec->lexicalGlobalObject()->profileGroup());108 dispatchFunctionToProfiles(m_currentProfiles, &ProfileGenerator::willExecute, createCallIdentifier(&exec->globalData(), calledFunction, "", 0), exec->lexicalGlobalObject()->profileGroup()); 109 109 } 110 110 … … 113 113 ASSERT(!m_currentProfiles.isEmpty()); 114 114 115 CallIdentifier callIdentifier = createCallIdentifier( exec, 0, sourceURL, startingLineNumber);115 CallIdentifier callIdentifier = createCallIdentifier(&exec->globalData(), 0, sourceURL, startingLineNumber); 116 116 117 117 dispatchFunctionToProfiles(m_currentProfiles, &ProfileGenerator::willExecute, callIdentifier, exec->lexicalGlobalObject()->profileGroup()); … … 122 122 ASSERT(!m_currentProfiles.isEmpty()); 123 123 124 dispatchFunctionToProfiles(m_currentProfiles, &ProfileGenerator::didExecute, createCallIdentifier( exec, calledFunction, "", 0), exec->lexicalGlobalObject()->profileGroup());124 dispatchFunctionToProfiles(m_currentProfiles, &ProfileGenerator::didExecute, createCallIdentifier(&exec->globalData(), calledFunction, "", 0), exec->lexicalGlobalObject()->profileGroup()); 125 125 } 126 126 … … 129 129 ASSERT(!m_currentProfiles.isEmpty()); 130 130 131 dispatchFunctionToProfiles(m_currentProfiles, &ProfileGenerator::didExecute, createCallIdentifier( exec, 0, sourceURL, startingLineNumber), exec->lexicalGlobalObject()->profileGroup());131 dispatchFunctionToProfiles(m_currentProfiles, &ProfileGenerator::didExecute, createCallIdentifier(&exec->globalData(), 0, sourceURL, startingLineNumber), exec->lexicalGlobalObject()->profileGroup()); 132 132 } 133 133 134 CallIdentifier Profiler::createCallIdentifier( ExecState* exec, JSObject* calledFunction, const UString& defaultSourceURL, int defaultLineNumber)134 CallIdentifier Profiler::createCallIdentifier(JSGlobalData* globalData, JSObject* calledFunction, const UString& defaultSourceURL, int defaultLineNumber) 135 135 { 136 136 if (!calledFunction) … … 138 138 139 139 if (calledFunction->inherits(&JSFunction::info)) 140 return createCallIdentifierFromFunctionImp( exec, static_cast<JSFunction*>(calledFunction));140 return createCallIdentifierFromFunctionImp(globalData, static_cast<JSFunction*>(calledFunction)); 141 141 if (calledFunction->inherits(&InternalFunction::info)) 142 return CallIdentifier(static_cast<InternalFunction*>(calledFunction)->name( exec), defaultSourceURL, defaultLineNumber);142 return CallIdentifier(static_cast<InternalFunction*>(calledFunction)->name(globalData), defaultSourceURL, defaultLineNumber); 143 143 144 144 UString name = "(" + calledFunction->className() + " object)"; … … 146 146 } 147 147 148 CallIdentifier createCallIdentifierFromFunctionImp( ExecState* exec, JSFunction* function)148 CallIdentifier createCallIdentifierFromFunctionImp(JSGlobalData* globalData, JSFunction* function) 149 149 { 150 const UString& name = function->name( exec);150 const UString& name = function->name(globalData); 151 151 return CallIdentifier(name.isEmpty() ? AnonymousFunction : name, function->m_body->sourceURL(), function->m_body->lineNo()); 152 152 } -
trunk/JavaScriptCore/profiler/Profiler.h
r36263 r37297 39 39 class CallIdentifier; 40 40 class ExecState; 41 class JSGlobalData; 41 42 class JSObject; 42 43 class ProfileGenerator; … … 51 52 52 53 static Profiler* profiler(); 53 static CallIdentifier createCallIdentifier( ExecState*, JSObject*, const UString& sourceURL, int lineNumber);54 static CallIdentifier createCallIdentifier(JSGlobalData*, JSObject*, const UString& sourceURL, int lineNumber); 54 55 55 56 void startProfiling(ExecState*, const UString& title);
Note:
See TracChangeset
for help on using the changeset viewer.