return true;
}
-#if JAVASCRIPT_PROFILING
-static NEVER_INLINE JSValue* callEval(ExecState* exec, JSObject* evalFunction, JSObject* thisObj, ScopeChainNode* scopeChain, RegisterFile* registerFile, Register* r, int argv, int argc, JSValue*& exceptionValue)
-{
- Profiler::profiler()->willExecute(exec, evalFunction);
-#else
static NEVER_INLINE JSValue* callEval(ExecState* exec, JSObject* thisObj, ScopeChainNode* scopeChain, RegisterFile* registerFile, Register* r, int argv, int argc, JSValue*& exceptionValue)
{
-#endif
+ Profiler** profiler = Profiler::enabledProfilerReference();
+ JSObject* evalFunction = scopeChain->globalObject()->evalFunction();
+ if (*profiler)
+ (*profiler)->willExecute(exec, evalFunction);
JSValue* x = argc >= 2 ? r[argv + 1].u.jsValue : jsUndefined();
return 0;
}
-#if JAVASCRIPT_PROFILING
JSValue* result = machine().execute(evalNode.get(), exec, thisObj, registerFile, r - (*registerFile->basePointer()) + argv + argc, scopeChain, &exceptionValue);
- Profiler::profiler()->didExecute(exec, evalFunction);
+ if ((*profiler))
+ (*profiler)->didExecute(exec, evalFunction);
return result;
-#else
- return machine().execute(evalNode.get(), exec, thisObj, registerFile, r - (*registerFile->basePointer()) + argv + argc, scopeChain, &exceptionValue);
-#endif
}
Machine& machine()
exec->m_callFrameOffset = callerRegisterOffset - codeBlock->numLocals - CallFrameHeaderSize;
vPC = callFrame[ReturnVPC].u.vPC;
-#if JAVASCRIPT_PROFILING
- Profiler::profiler()->didExecute(exec, callFrame[Callee].u.jsObject);
-#endif
+ if (Profiler* profiler = *Profiler::enabledProfilerReference())
+ profiler->didExecute(exec, callFrame[Callee].u.jsObject);
return true;
}
return 0;
}
-#if JAVASCRIPT_PROFILING
- Profiler::profiler()->willExecute(exec, programNode->sourceURL(), programNode->lineNo());
-#endif
-
RegisterFile* registerFile = registerFileStack->pushGlobalRegisterFile();
ASSERT(registerFile->numGlobalSlots());
CodeBlock* codeBlock = &programNode->code(scopeChain, !registerFileStack->inImplicitCall());
if (codeBlock->needsFullScopeChain)
scopeChain = scopeChain->copy();
-
+
+ Profiler** profiler = Profiler::enabledProfilerReference();
+ if (*profiler)
+ (*profiler)->willExecute(exec, programNode->sourceURL(), programNode->lineNo());
+
ExecState newExec(exec, this, registerFile, scopeChain, -1);
m_reentryDepth++;
registerFileStack->popGlobalRegisterFile();
-#if JAVASCRIPT_PROFILING
- Profiler::profiler()->didExecute(exec, programNode->sourceURL(), programNode->lineNo());
-#endif
+ if (*profiler)
+ (*profiler)->didExecute(exec, programNode->sourceURL(), programNode->lineNo());
return result;
}
return 0;
}
-#if JAVASCRIPT_PROFILING
- Profiler::profiler()->willExecute(exec, function);
-#endif
-
RegisterFile* registerFile = registerFileStack->current();
int argv = CallFrameHeaderSize;
scopeChain = scopeChainForCall(functionBodyNode, newCodeBlock, scopeChain, registerBase, r);
ExecState newExec(exec, this, registerFile, scopeChain, callFrameOffset);
+
+ Profiler** profiler = Profiler::enabledProfilerReference();
+ if (*profiler)
+ (*profiler)->willExecute(exec, function);
m_reentryDepth++;
JSValue* result = privateExecute(Normal, &newExec, registerFile, r, scopeChain, newCodeBlock, exception);
m_reentryDepth--;
+ if (*profiler)
+ (*profiler)->didExecute(exec, function);
+
registerFile->shrink(oldSize);
return result;
}
return 0;
}
-#if JAVASCRIPT_PROFILING
- Profiler::profiler()->willExecute(exec, evalNode->sourceURL(), evalNode->lineNo());
-#endif
-
EvalCodeBlock* codeBlock = &evalNode->code(scopeChain);
JSVariableObject* variableObject;
if (codeBlock->needsFullScopeChain)
scopeChain = scopeChain->copy();
+ Profiler** profiler = Profiler::enabledProfilerReference();
+ if (*profiler)
+ (*profiler)->willExecute(exec, evalNode->sourceURL(), evalNode->lineNo());
+
ExecState newExec(exec, this, registerFile, scopeChain, -1);
m_reentryDepth++;
registerFile->shrink(oldSize);
-#if JAVASCRIPT_PROFILING
- Profiler::profiler()->didExecute(exec, evalNode->sourceURL(), evalNode->lineNo());
-#endif
+ if (*profiler)
+ (*profiler)->didExecute(exec, evalNode->sourceURL(), evalNode->lineNo());
return result;
}
JSValue* exceptionValue = 0;
Instruction* handlerVPC = 0;
-
+
Register** registerBase = registerFile->basePointer();
Instruction* vPC = codeBlock->instructions.begin();
JSValue** k = codeBlock->jsValues.data();
+ Profiler** enabledProfilerReference = Profiler::enabledProfilerReference();
+#if HAVE(COMPUTED_GOTO)
+ // Yet another hack around GCC's various foibles, in this case fetching the
+ // profiler reference results in a regression. Removing this indirection
+ // results in a 0.8% regression.
+ goto *(&&profilerFetchHack);
+ profilerFetchHack:
+#endif
+
registerFile->setSafeForReentry(false);
#define VM_CHECK_EXCEPTION() \
do { \
JSObject* thisObject = r[codeBlock->thisRegister].u.jsObject;
registerFile->setSafeForReentry(true);
-#if JAVASCRIPT_PROFILING
- JSValue* result = callEval(exec, static_cast<JSObject*>(v), thisObject, scopeChain, registerFile, r, argv, argc, exceptionValue);
-#else
+
JSValue* result = callEval(exec, thisObject, scopeChain, registerFile, r, argv, argc, exceptionValue);
-#endif
+
registerFile->setSafeForReentry(false);
r = (*registerBase) + registerOffset;
CallType callType = v->getCallData(callData);
if (callType == CallTypeJS) {
-#if JAVASCRIPT_PROFILING
- Profiler::profiler()->willExecute(exec, static_cast<JSObject*>(v));
-#endif
+ if (*enabledProfilerReference)
+ (*enabledProfilerReference)->willExecute(exec, static_cast<JSObject*>(v));
int registerOffset = r - (*registerBase);
Register* callFrame = r + argv - CallFrameHeaderSize;
int callFrameOffset = registerOffset + argv - CallFrameHeaderSize;
}
if (callType == CallTypeNative) {
-#if JAVASCRIPT_PROFILING
- Profiler::profiler()->willExecute(exec, static_cast<JSObject*>(v));
-#endif
+ if (*enabledProfilerReference)
+ (*enabledProfilerReference)->willExecute(exec, static_cast<JSObject*>(v));
int registerOffset = r - (*registerBase);
r[argv].u.jsValue = base == missingThisObjectMarker() ? exec->globalThisValue() : (r[base].u.jsValue)->toObject(exec); // "this" value
r = (*registerBase) + registerOffset;
r[dst].u.jsValue = returnValue;
-#if JAVASCRIPT_PROFILING
- Profiler::profiler()->didExecute(exec, static_cast<JSObject*>(v));
-#endif
+ if (*enabledProfilerReference)
+ (*enabledProfilerReference)->didExecute(exec, static_cast<JSObject*>(v));
VM_CHECK_EXCEPTION();
++vPC;
exec->m_callFrameOffset = callerRegisterOffset - codeBlock->numLocals - CallFrameHeaderSize;
int r0 = callFrame[ReturnValueRegister].u.i;
r[r0].u.jsValue = returnValue;
-
-#if JAVASCRIPT_PROFILING
- Profiler::profiler()->didExecute(exec, callFrame[Callee].u.jsObject);
-#endif
+
+ if (*enabledProfilerReference)
+ (*enabledProfilerReference)->didExecute(exec, callFrame[Callee].u.jsObject);
+
NEXT_OPCODE;
}
BEGIN_OPCODE(op_construct) {
JSObject* constructor = static_cast<JSObject*>(funcVal);
if (constructType == ConstructTypeJS) {
-#if JAVASCRIPT_PROFILING
- Profiler::profiler()->willExecute(exec, constructor);
-#endif
+ if (*enabledProfilerReference)
+ (*enabledProfilerReference)->willExecute(exec, constructor);
+
int registerOffset = r - (*registerBase);
Register* callFrame = r + argv - CallFrameHeaderSize;
int callFrameOffset = registerOffset + argv - CallFrameHeaderSize;
}
if (constructType == ConstructTypeNative) {
-#if JAVASCRIPT_PROFILING
- Profiler::profiler()->willExecute(exec, constructor);
-#endif
+ if (*enabledProfilerReference)
+ (*enabledProfilerReference)->willExecute(exec, constructor);
+
int registerOffset = r - (*registerBase);
List args(&r[argv + 1].u.jsValue, argc - 1);
VM_CHECK_EXCEPTION();
r[dst].u.jsValue = returnValue;
-#if JAVASCRIPT_PROFILING
- Profiler::profiler()->didExecute(exec, constructor);
-#endif
+ if (*enabledProfilerReference)
+ (*enabledProfilerReference)->didExecute(exec, constructor);
+
++vPC;
NEXT_OPCODE;
}