Changeset 35918 in webkit for trunk/JavaScriptCore/VM/Machine.cpp


Ignore:
Timestamp:
Aug 25, 2008, 11:18:01 AM (17 years ago)
Author:
[email protected]
Message:

JavaScriptCore:

2008-08-25 Kevin McCullough <[email protected]>

Reviewed by Geoff, Tim and Mark.

<rdar://problem/6150623> JSProfiler: It would be nice if the profiles
in the console said what file and line number they came from

  • Lay the foundation for getting line numbers and other data from the JavaScript engine. With the cleanup in kjs/ExecState this is actually a slight performance improvement.
  • JavaScriptCore.exp: Export retrieveLastCaller() for WebCore.
  • JavaScriptCore.xcodeproj/project.pbxproj:
  • VM/Machine.cpp: Now Host and JS functions set a call frame on the exec state, so this and the profiler code were pulled out of the branches. (KJS::Machine::privateExecute): (KJS::Machine::retrieveLastCaller): This get's the lineNumber, sourceID and sourceURL for the previously called function.
  • VM/Machine.h:
  • kjs/ExecState.cpp: Remove references to JSFunction since it's not used anywhere.
  • kjs/ExecState.h:

WebCore:

2008-08-22 Kevin McCullough <[email protected]>

Reviewed by Geoff, Mark and Tim.

<rdar://problem/6150623> JSProfiler: It would be nice if the profiles
in the console said what file and line number they came from

  • Lay the foundation for getting line numbers and other data from the JavaScript engine.
  • ForwardingHeaders/VM: Added.
  • ForwardingHeaders/VM/Machine.h: Added.
  • page/Console.cpp: Gather the line number and file information when profileEnd has been called, but don't use it until didFinishProfiling is called. We won't need to wait once we remove the profiler "zombie" mode which this patch helps pave the foundation for. (WebCore::Console::Console): (WebCore::Console::profileEnd): (WebCore::Console::finishedProfiling):
  • page/Console.h:
  • page/InspectorController.cpp: Modify calls to addProfileMessageToConsole to satisfy the new arguments it takes. (WebCore::InspectorController::finishedProfiling): (WebCore::InspectorController::addProfile): (WebCore::InspectorController::addProfileMessageToConsole): (WebCore::InspectorController::finishedProfiling):
  • page/InspectorController.h:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/VM/Machine.cpp

    r35898 r35918  
    24232423        CallType callType = v->getCallData(callData);
    24242424
     2425        if (*enabledProfilerReference)
     2426            (*enabledProfilerReference)->willExecute(exec, static_cast<JSObject*>(v));
     2427
     2428        Register* callFrame = r + firstArg - RegisterFile::CallFrameHeaderSize;
     2429        initializeCallFrame(callFrame, codeBlock, vPC, scopeChain, r, dst, firstArg, argCount, 0, v);
     2430        exec->m_callFrame = callFrame;
     2431
    24252432        if (callType == CallTypeJS) {
    2426             if (*enabledProfilerReference)
    2427                 (*enabledProfilerReference)->willExecute(exec, static_cast<JSObject*>(v));
    24282433
    24292434            ScopeChainNode* callDataScopeChain = callData.js.scopeChain;
     
    24322437
    24332438            r[firstArg] = thisVal == missingThisObjectMarker() ? exec->globalThisValue() : r[thisVal].jsValue(exec);
    2434 
    2435             Register* callFrame = r + firstArg - RegisterFile::CallFrameHeaderSize;
    2436             initializeCallFrame(callFrame, codeBlock, vPC, scopeChain, r, dst, firstArg, argCount, 0, v);
    2437             exec->m_callFrame = callFrame;
    24382439
    24392440            r = slideRegisterWindowForCall(exec, newCodeBlock, registerFile, registerBase, r, firstArg, argCount, exceptionValue);
     
    24532454
    24542455        if (callType == CallTypeHost) {
    2455             if (*enabledProfilerReference)
    2456                 (*enabledProfilerReference)->willExecute(exec, static_cast<JSObject*>(v));
    2457 
    24582456            JSValue* thisValue = thisVal == missingThisObjectMarker() ? exec->globalThisValue() : r[thisVal].jsValue(exec);
    24592457            ArgList args(r + firstArg + 1, argCount - 1);
     
    29352933}
    29362934
     2935void Machine::retrieveLastCaller(ExecState* exec, int& lineNumber, int& sourceId, UString& sourceURL) const
     2936{
     2937    lineNumber = -1;
     2938    sourceURL = UString();
     2939
     2940    Register* callFrame = exec->m_callFrame;
     2941    if (!callFrame)
     2942        return;
     2943
     2944    CodeBlock* callerCodeBlock = callFrame[RegisterFile::CallerCodeBlock].codeBlock();
     2945    if (!callerCodeBlock)
     2946        return;
     2947
     2948    Instruction* vPC = callFrame[RegisterFile::ReturnVPC].vPC();
     2949    lineNumber = callerCodeBlock->lineNumberForVPC(vPC - 1);
     2950    sourceId = callerCodeBlock->ownerNode->sourceId();
     2951    sourceURL = callerCodeBlock->ownerNode->sourceURL();
     2952}
     2953
    29372954Register* Machine::callFrame(ExecState* exec, JSFunction* function) const
    29382955{
Note: See TracChangeset for help on using the changeset viewer.