Changeset 37730 in webkit for trunk/JavaScriptCore/VM/Machine.cpp
- Timestamp:
- Oct 20, 2008, 9:48:30 AM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/VM/Machine.cpp
r37728 r37730 590 590 return program; 591 591 592 Profiler** profiler = Profiler::enabledProfilerReference();593 if (*profiler)594 (*profiler)->willExecute(callFrame, scopeChain->globalObject()->evalFunction());595 596 592 UString programSource = asString(program)->value(); 597 593 … … 602 598 if (evalNode) 603 599 result = callFrame->globalData().machine->execute(evalNode.get(), callFrame, thisObj, callFrame->registers() - registerFile->start() + argv + 1 + RegisterFile::CallFrameHeaderSize, scopeChain, &exceptionValue); 604 605 if (*profiler)606 (*profiler)->didExecute(callFrame, scopeChain->globalObject()->evalFunction());607 600 608 601 return result; … … 845 838 } 846 839 840 // If we throw in the middle of a call instruction, we need to notify 841 // the profiler manually that the call instruction has returned, since 842 // we'll never reach the relevant op_profile_did_call. 843 if (Profiler* profiler = *Profiler::enabledProfilerReference()) { 844 if (isCallOpcode(vPC[0].u.opcode)) 845 profiler->didExecute(callFrame, callFrame[vPC[2].u.operand].jsValue(callFrame)); 846 else if (vPC[8].u.opcode == getOpcode(op_construct)) 847 profiler->didExecute(callFrame, callFrame[vPC[10].u.operand].jsValue(callFrame)); 848 } 849 847 850 // Calculate an exception handler vPC, unwinding call frames as necessary. 848 851 … … 993 996 #endif 994 997 m_reentryDepth--; 998 999 if (*profiler) 1000 (*profiler)->didExecute(newCallFrame, function); 995 1001 996 1002 MACHINE_SAMPLING_privateExecuteReturned(); … … 2149 2155 object. 2150 2156 */ 2151 int dst = (++vPC)->u.operand;2152 int value = (++vPC)->u.operand;2153 int base = (++vPC)->u.operand;2154 int baseProto = (++vPC)->u.operand;2157 int dst = vPC[1].u.operand; 2158 int value = vPC[2].u.operand; 2159 int base = vPC[3].u.operand; 2160 int baseProto = vPC[4].u.operand; 2155 2161 2156 2162 JSValuePtr baseVal = callFrame[base].jsValue(callFrame); … … 2162 2168 callFrame[dst] = jsBoolean(baseObj->structureID()->typeInfo().implementsHasInstance() ? baseObj->hasInstance(callFrame, callFrame[value].jsValue(callFrame), callFrame[baseProto].jsValue(callFrame)) : false); 2163 2169 2164 ++vPC;2170 vPC += 5; 2165 2171 NEXT_OPCODE; 2166 2172 } … … 3209 3215 */ 3210 3216 3211 int dst = (++vPC)->u.operand; 3212 int func = (++vPC)->u.operand; 3213 int thisVal = (++vPC)->u.operand; 3214 int firstArg = (++vPC)->u.operand; 3215 int argCount = (++vPC)->u.operand; 3216 ++vPC; // registerOffset 3217 int dst = vPC[1].u.operand; 3218 int func = vPC[2].u.operand; 3219 int thisVal = vPC[3].u.operand; 3220 int firstArg = vPC[4].u.operand; 3221 int argCount = vPC[5].u.operand; 3217 3222 3218 3223 JSValuePtr funcVal = callFrame[func].jsValue(callFrame); … … 3228 3233 callFrame[dst] = result; 3229 3234 3230 ++vPC;3235 vPC += 7; 3231 3236 NEXT_OPCODE; 3232 3237 } … … 3235 3240 // this instruction as a normal function call, supplying the proper 'this' 3236 3241 // value. 3237 vPC -= 6;3238 3242 callFrame[thisVal] = baseVal->toThisObject(callFrame); 3239 3243 … … 3283 3287 */ 3284 3288 3285 int dst = (++vPC)->u.operand;3286 int func = (++vPC)->u.operand;3287 int thisVal = (++vPC)->u.operand;3288 int firstArg = (++vPC)->u.operand;3289 int argCount = (++vPC)->u.operand;3290 int registerOffset = (++vPC)->u.operand;3289 int dst = vPC[1].u.operand; 3290 int func = vPC[2].u.operand; 3291 int thisVal = vPC[3].u.operand; 3292 int firstArg = vPC[4].u.operand; 3293 int argCount = vPC[5].u.operand; 3294 int registerOffset = vPC[6].u.operand; 3291 3295 3292 3296 JSValuePtr v = callFrame[func].jsValue(callFrame); … … 3311 3315 } 3312 3316 3313 callFrame->init(newCodeBlock, vPC + 1, callDataScopeChain, previousCallFrame, dst, argCount, asFunction(v)); 3314 3315 if (*enabledProfilerReference) 3316 (*enabledProfilerReference)->willExecute(callFrame, asObject(v)); 3317 3317 callFrame->init(newCodeBlock, vPC + 7, callDataScopeChain, previousCallFrame, dst, argCount, asFunction(v)); 3318 3318 vPC = newCodeBlock->instructions.begin(); 3319 3319 … … 3331 3331 ScopeChainNode* scopeChain = callFrame->scopeChain(); 3332 3332 CallFrame* newCallFrame = CallFrame::create(callFrame->registers() + registerOffset); 3333 newCallFrame->init(0, vPC + 1, scopeChain, callFrame, dst, argCount, 0); 3334 3335 if (*enabledProfilerReference) 3336 (*enabledProfilerReference)->willExecute(newCallFrame, asObject(v)); 3333 newCallFrame->init(0, vPC + 7, scopeChain, callFrame, dst, argCount, 0); 3337 3334 3338 3335 MACHINE_SAMPLING_callingHostFunction(); … … 3343 3340 callFrame[dst] = returnValue; 3344 3341 3345 if (*enabledProfilerReference) 3346 (*enabledProfilerReference)->didExecute(callFrame, asObject(v)); 3347 3348 ++vPC; 3342 vPC += 7; 3349 3343 NEXT_OPCODE; 3350 3344 } … … 3384 3378 int result = (++vPC)->u.operand; 3385 3379 3386 if (*enabledProfilerReference)3387 (*enabledProfilerReference)->didExecute(callFrame, callFrame->callee());3388 3389 3380 if (callFrame->codeBlock()->needsFullScopeChain) 3390 3381 callFrame->scopeChain()->deref(); … … 3498 3489 */ 3499 3490 3500 int dst = (++vPC)->u.operand;3501 int constr = (++vPC)->u.operand;3502 int constrProto = (++vPC)->u.operand;3503 int firstArg = (++vPC)->u.operand;3504 int argCount = (++vPC)->u.operand;3505 int registerOffset = (++vPC)->u.operand;3491 int dst = vPC[1].u.operand; 3492 int constr = vPC[2].u.operand; 3493 int constrProto = vPC[3].u.operand; 3494 int firstArg = vPC[4].u.operand; 3495 int argCount = vPC[5].u.operand; 3496 int registerOffset = vPC[6].u.operand; 3506 3497 3507 3498 JSValuePtr v = callFrame[constr].jsValue(callFrame); … … 3511 3502 3512 3503 if (constructType == ConstructTypeJS) { 3513 if (*enabledProfilerReference)3514 (*enabledProfilerReference)->willExecute(callFrame, asObject(v));3515 3516 3504 ScopeChainNode* callDataScopeChain = constructData.js.scopeChain; 3517 3505 FunctionBodyNode* functionBodyNode = constructData.js.functionBody; … … 3537 3525 } 3538 3526 3539 callFrame->init(newCodeBlock, vPC + 1, callDataScopeChain, previousCallFrame, dst, argCount, asFunction(v)); 3540 3541 if (*enabledProfilerReference) 3542 (*enabledProfilerReference)->didExecute(callFrame, asObject(v)); 3543 3527 callFrame->init(newCodeBlock, vPC + 7, callDataScopeChain, previousCallFrame, dst, argCount, asFunction(v)); 3544 3528 vPC = newCodeBlock->instructions.begin(); 3545 3529 … … 3555 3539 3556 3540 ScopeChainNode* scopeChain = callFrame->scopeChain(); 3557 CallFrame::create(callFrame->registers() + registerOffset)->init(0, vPC + 1, scopeChain, callFrame, dst, argCount, 0); 3558 callFrame = CallFrame::create(callFrame->registers() + registerOffset); 3559 3560 if (*enabledProfilerReference) 3561 (*enabledProfilerReference)->willExecute(callFrame, asObject(v)); 3541 CallFrame* newCallFrame = CallFrame::create(callFrame->registers() + registerOffset); 3542 newCallFrame->init(0, vPC + 7, scopeChain, callFrame, dst, argCount, 0); 3562 3543 3563 3544 MACHINE_SAMPLING_callingHostFunction(); 3564 3545 3565 JSValuePtr returnValue = constructData.native.function(callFrame, asObject(v), args); 3566 callFrame = CallFrame::create(callFrame->registers() - registerOffset); 3546 JSValuePtr returnValue = constructData.native.function(newCallFrame, asObject(v), args); 3567 3547 3568 3548 VM_CHECK_EXCEPTION(); 3569 3549 callFrame[dst] = returnValue; 3570 3550 3571 if (*enabledProfilerReference) 3572 (*enabledProfilerReference)->didExecute(callFrame, asObject(v)); 3573 3574 ++vPC; 3551 vPC += 7; 3575 3552 NEXT_OPCODE; 3576 3553 } … … 3881 3858 3882 3859 ++vPC; 3860 NEXT_OPCODE; 3861 } 3862 BEGIN_OPCODE(op_profile_will_call) { 3863 /* op_profile_will_call function(r) 3864 3865 Notifies the profiler of the beginning of a function call. This opcode 3866 is only generated if developer tools are enabled. 3867 */ 3868 int function = vPC[1].u.operand; 3869 3870 if (*enabledProfilerReference) 3871 (*enabledProfilerReference)->willExecute(callFrame, callFrame[function].jsValue(callFrame)); 3872 3873 vPC += 2; 3874 NEXT_OPCODE; 3875 } 3876 BEGIN_OPCODE(op_profile_did_call) { 3877 /* op_profile_did_call function(r) 3878 3879 Notifies the profiler of the end of a function call. This opcode 3880 is only generated if developer tools are enabled. 3881 */ 3882 int function = vPC[1].u.operand; 3883 3884 if (*enabledProfilerReference) 3885 (*enabledProfilerReference)->didExecute(callFrame, callFrame[function].jsValue(callFrame)); 3886 3887 vPC += 2; 3883 3888 NEXT_OPCODE; 3884 3889 } … … 4612 4617 } 4613 4618 4614 void Machine::cti_op_call_profiler(CTI_ARGS)4615 {4616 CTI_STACK_HACK();4617 4618 ASSERT(*ARG_profilerReference);4619 (*ARG_profilerReference)->willExecute(ARG_callFrame, asFunction(ARG_src1));4620 }4621 4622 4619 VoidPtrPair Machine::cti_op_call_JSFunction(CTI_ARGS) 4623 4620 { … … 4727 4724 ARG_setCallFrame(callFrame); 4728 4725 4729 if (*ARG_profilerReference)4730 (*ARG_profilerReference)->willExecute(callFrame, asObject(funcVal));4731 4732 4726 Register* argv = ARG_callFrame->registers() - RegisterFile::CallFrameHeaderSize - argCount; 4733 4727 ArgList argList(argv + 1, argCount - 1); … … 4739 4733 VM_CHECK_EXCEPTION(); 4740 4734 4741 if (*ARG_profilerReference)4742 (*ARG_profilerReference)->didExecute(previousCallFrame, asObject(funcVal));4743 4744 4735 return returnValue.payload(); 4745 4736 } … … 4762 4753 void Machine::cti_op_create_arguments_no_params(CTI_ARGS) 4763 4754 { 4755 CTI_STACK_HACK(); 4756 4764 4757 Arguments* arguments = new (ARG_globalData) Arguments(ARG_callFrame, Arguments::ArgumentsNoParameters); 4765 4758 ARG_callFrame->setCalleeArguments(arguments); … … 4783 4776 } 4784 4777 4785 void Machine::cti_op_ ret_profiler(CTI_ARGS)4778 void Machine::cti_op_profile_will_call(CTI_ARGS) 4786 4779 { 4787 4780 CTI_STACK_HACK(); 4788 4781 4789 4782 ASSERT(*ARG_profilerReference); 4790 (*ARG_profilerReference)->didExecute(ARG_callFrame, ARG_callFrame->callee()); 4783 (*ARG_profilerReference)->willExecute(ARG_callFrame, ARG_src1); 4784 } 4785 4786 void Machine::cti_op_profile_did_call(CTI_ARGS) 4787 { 4788 CTI_STACK_HACK(); 4789 4790 ASSERT(*ARG_profilerReference); 4791 (*ARG_profilerReference)->didExecute(ARG_callFrame, ARG_src1); 4791 4792 } 4792 4793 … … 4929 4930 4930 4931 if (constructType == ConstructTypeHost) { 4931 JSObject* constructor = asObject(constrVal);4932 4933 if (*ARG_profilerReference)4934 (*ARG_profilerReference)->willExecute(callFrame, constructor);4935 4936 4932 ArgList argList(callFrame->registers() + firstArg + 1, argCount - 1); 4937 4933 4938 4934 CTI_MACHINE_SAMPLING_callingHostFunction(); 4939 4935 4940 JSValuePtr returnValue = constructData.native.function(callFrame, constructor, argList);4936 JSValuePtr returnValue = constructData.native.function(callFrame, asObject(constrVal), argList); 4941 4937 VM_CHECK_EXCEPTION(); 4942 4943 if (*ARG_profilerReference)4944 (*ARG_profilerReference)->didExecute(callFrame, constructor);4945 4938 4946 4939 return returnValue.payload();
Note:
See TracChangeset
for help on using the changeset viewer.