Title: [153183] trunk/Source
Revision
153183
Author
oli...@apple.com
Date
2013-07-24 21:01:06 -0700 (Wed, 24 Jul 2013)

Log Message

fourthTier: Remove Interpreter::retrieveLastCaller().

This merge is complicated by the trunk js stack reporting logic.

Remove Interpreter::retrieveLastCaller().
https://bugs.webkit.org/show_bug.cgi?id=116753.

Reviewed by Geoffrey Garen.

This is part of the refactoring effort to get rid of functions walking
the JS stack in their own way.

../_javascript_Core:

* API/JSContextRef.cpp:
(JSContextCreateBacktrace):
* interpreter/CallFrame.cpp:
* interpreter/Interpreter.cpp:
(JSC::Interpreter::Interpreter):
(JSC::Interpreter::getStackTrace):
(JSC::Interpreter::addStackTraceIfNecessary):
* interpreter/Interpreter.h:
(StackFrame):
(JSC::StackFrame::StackFrame):
(Interpreter):
* jsc.cpp:
(functionJSCStack):
* profiler/ProfileGenerator.cpp:
(JSC::ProfileGenerator::addParentForConsoleStart):

../WebCore:

No new tests.

* bindings/js/JSXMLHttpRequestCustom.cpp:
(WebCore::JSXMLHttpRequest::send):
* bindings/js/ScriptCallStackFactory.cpp:
(WebCore::createScriptCallStack):

Modified Paths

Diff

Modified: trunk/Source/_javascript_Core/API/JSContextRef.cpp (153182 => 153183)


--- trunk/Source/_javascript_Core/API/JSContextRef.cpp	2013-07-25 04:01:03 UTC (rev 153182)
+++ trunk/Source/_javascript_Core/API/JSContextRef.cpp	2013-07-25 04:01:06 UTC (rev 153183)
@@ -245,7 +245,7 @@
         builder.append('#');
         builder.appendNumber(i);
         builder.append(' ');
-        builder.append(functionName);
+        builder.append(stackTrace[i].friendlyFunctionName(exec));
         builder.appendLiteral("() at ");
         builder.append(urlString);
         if (frame.codeType != StackFrameNativeCode) {
@@ -255,6 +255,7 @@
         if (!function)
             break;
     }
+
     return OpaqueJSString::create(builder.toString()).leakRef();
 }
 

Modified: trunk/Source/_javascript_Core/ChangeLog (153182 => 153183)


--- trunk/Source/_javascript_Core/ChangeLog	2013-07-25 04:01:03 UTC (rev 153182)
+++ trunk/Source/_javascript_Core/ChangeLog	2013-07-25 04:01:06 UTC (rev 153183)
@@ -1,3 +1,29 @@
+2013-05-25  Mark Lam  <mark....@apple.com>
+
+        Remove Interpreter::retrieveLastCaller().
+        https://bugs.webkit.org/show_bug.cgi?id=116753.
+
+        Reviewed by Geoffrey Garen.
+
+        This is part of the refactoring effort to get rid of functions walking
+        the JS stack in their own way.
+
+        * API/JSContextRef.cpp:
+        (JSContextCreateBacktrace):
+        * interpreter/CallFrame.cpp:
+        * interpreter/Interpreter.cpp:
+        (JSC::Interpreter::Interpreter):
+        (JSC::Interpreter::getStackTrace):
+        (JSC::Interpreter::addStackTraceIfNecessary):
+        * interpreter/Interpreter.h:
+        (StackFrame):
+        (JSC::StackFrame::StackFrame):
+        (Interpreter):
+        * jsc.cpp:
+        (functionJSCStack):
+        * profiler/ProfileGenerator.cpp:
+        (JSC::ProfileGenerator::addParentForConsoleStart):
+
 2013-05-24  Filip Pizlo  <fpi...@apple.com>
 
         fourthTier: FTL boolify should support ObjectOrOtherUse

Modified: trunk/Source/_javascript_Core/interpreter/CallFrame.cpp (153182 => 153183)


--- trunk/Source/_javascript_Core/interpreter/CallFrame.cpp	2013-07-25 04:01:03 UTC (rev 153182)
+++ trunk/Source/_javascript_Core/interpreter/CallFrame.cpp	2013-07-25 04:01:06 UTC (rev 153183)
@@ -33,17 +33,6 @@
 namespace JSC {
 
 #ifndef NDEBUG
-void CallFrame::dumpCaller()
-{
-    int signedLineNumber;
-    intptr_t sourceID;
-    String urlString;
-    JSValue function;
-    
-    interpreter()->retrieveLastCaller(this, signedLineNumber, sourceID, urlString, function);
-    dataLogF("Callpoint => %s:%d\n", urlString.utf8().data(), signedLineNumber);
-}
-
 JSStack* CallFrame::stack()
 {
     return &interpreter()->stack();

Modified: trunk/Source/_javascript_Core/interpreter/Interpreter.cpp (153182 => 153183)


--- trunk/Source/_javascript_Core/interpreter/Interpreter.cpp	2013-07-25 04:01:03 UTC (rev 153182)
+++ trunk/Source/_javascript_Core/interpreter/Interpreter.cpp	2013-07-25 04:01:06 UTC (rev 153183)
@@ -239,6 +239,7 @@
 
 Interpreter::Interpreter(VM& vm)
     : m_sampleEntryDepth(0)
+    , m_vm(vm)
     , m_stack(vm)
     , m_errorHandlingModeReentry(0)
 #if !ASSERT_DISABLED
@@ -1376,27 +1377,6 @@
     return caller;
 }
 
-void Interpreter::retrieveLastCaller(CallFrame* callFrame, int& lineNumber, intptr_t& sourceID, String& sourceURL, JSValue& function) const
-{
-    function = JSValue();
-    lineNumber = -1;
-    sourceURL = String();
-
-    CallFrame* callerFrame = callFrame->callerFrame();
-    if (callerFrame->hasHostCallFrameFlag())
-        return;
-
-    CodeBlock* callerCodeBlock = callerFrame->codeBlock();
-    if (!callerCodeBlock)
-        return;
-    unsigned bytecodeOffset = 0;
-    bytecodeOffset = callerCodeBlock->bytecodeOffset(callerFrame, callFrame->returnPC());
-    lineNumber = callerCodeBlock->lineNumberForBytecodeOffset(bytecodeOffset - 1);
-    sourceID = callerCodeBlock->ownerExecutable()->sourceID();
-    sourceURL = callerCodeBlock->ownerExecutable()->sourceURL();
-    function = callerFrame->callee();
-}
-
 CallFrame* Interpreter::findFunctionCallFrameFromVMCode(CallFrame* callFrame, JSFunction* function)
 {
     for (CallFrame* candidate = callFrame->trueCallFrameFromVMCode(); candidate; candidate = candidate->trueCallerFrame()) {

Modified: trunk/Source/_javascript_Core/interpreter/Interpreter.h (153182 => 153183)


--- trunk/Source/_javascript_Core/interpreter/Interpreter.h	2013-07-25 04:01:03 UTC (rev 153182)
+++ trunk/Source/_javascript_Core/interpreter/Interpreter.h	2013-07-25 04:01:06 UTC (rev 153183)
@@ -212,7 +212,6 @@
 
         JSValue retrieveArgumentsFromVMCode(CallFrame*, JSFunction*) const;
         JSValue retrieveCallerFromVMCode(CallFrame*, JSFunction*) const;
-        JS_EXPORT_PRIVATE void retrieveLastCaller(CallFrame*, int& lineNumber, intptr_t& sourceID, String& sourceURL, JSValue& function) const;
         
         void getArgumentsData(CallFrame*, JSFunction*&, ptrdiff_t& firstParameterIndex, Register*& argv, int& argc);
         
@@ -251,6 +250,7 @@
         int m_sampleEntryDepth;
         OwnPtr<SamplingTool> m_sampler;
 
+        VM& m_vm;
         JSStack m_stack;
         int m_errorHandlingModeReentry;
         

Modified: trunk/Source/_javascript_Core/profiler/ProfileGenerator.cpp (153182 => 153183)


--- trunk/Source/_javascript_Core/profiler/ProfileGenerator.cpp	2013-07-25 04:01:03 UTC (rev 153182)
+++ trunk/Source/_javascript_Core/profiler/ProfileGenerator.cpp	2013-07-25 04:01:06 UTC (rev 153183)
@@ -58,13 +58,14 @@
 
 void ProfileGenerator::addParentForConsoleStart(ExecState* exec)
 {
-    int lineNumber;
-    intptr_t sourceID;
-    String sourceURL;
-    JSValue function;
-
-    exec->interpreter()->retrieveLastCaller(exec, lineNumber, sourceID, sourceURL, function);
-    m_currentNode = ProfileNode::create(exec, LegacyProfiler::createCallIdentifier(exec, function, sourceURL, lineNumber), m_head.get(), m_head.get());
+    Vector<StackFrame> stackTrace;
+    Interpreter::getStackTrace(&exec->vm(), stackTrace, 2);
+    if (stackTrace.size() < 2)
+        return;
+    unsigned line = 0;
+    unsigned unusedColumn = 0;
+    stackTrace[1].computeLineAndColumn(line, unusedColumn);
+    m_currentNode = ProfileNode::create(exec, LegacyProfiler::createCallIdentifier(exec, stackTrace[1].callee.get(), stackTrace[1].sourceURL, line), m_head.get(), m_head.get());
     m_head->insertNode(m_currentNode.get());
 }
 

Modified: trunk/Source/WebCore/ChangeLog (153182 => 153183)


--- trunk/Source/WebCore/ChangeLog	2013-07-25 04:01:03 UTC (rev 153182)
+++ trunk/Source/WebCore/ChangeLog	2013-07-25 04:01:06 UTC (rev 153183)
@@ -1,3 +1,20 @@
+2013-05-25  Mark Lam  <mark....@apple.com>
+
+        Remove Interpreter::retrieveLastCaller().
+        https://bugs.webkit.org/show_bug.cgi?id=116753.
+
+        Reviewed by Geoffrey Garen.
+
+        This is part of the refactoring effort to get rid of functions walking
+        the JS stack in their own way.
+
+        No new tests.
+
+        * bindings/js/JSXMLHttpRequestCustom.cpp:
+        (WebCore::JSXMLHttpRequest::send):
+        * bindings/js/ScriptCallStackFactory.cpp:
+        (WebCore::createScriptCallStack):
+
 2013-05-05  Geoffrey Garen  <gga...@apple.com>
 
         Rolled back in r149527 with crash fixed.

Modified: trunk/Source/WebCore/bindings/js/JSXMLHttpRequestCustom.cpp (153182 => 153183)


--- trunk/Source/WebCore/bindings/js/JSXMLHttpRequestCustom.cpp	2013-07-25 04:01:03 UTC (rev 153182)
+++ trunk/Source/WebCore/bindings/js/JSXMLHttpRequestCustom.cpp	2013-07-25 04:01:06 UTC (rev 153183)
@@ -47,8 +47,9 @@
 #include "JSEvent.h"
 #include "JSEventListener.h"
 #include "XMLHttpRequest.h"
+#include <interpreter/Interpreter.h>
+#include <parser/SourceProvider.h>
 #include <runtime/Error.h>
-#include <interpreter/Interpreter.h>
 #include <wtf/ArrayBuffer.h>
 
 using namespace JSC;
@@ -133,14 +134,15 @@
             impl()->send(val.toString(exec)->value(exec), ec);
     }
 
-    int signedLineNumber;
-    intptr_t sourceID;
-    String sourceURL;
-    JSValue function;
-    exec->interpreter()->retrieveLastCaller(exec, signedLineNumber, sourceID, sourceURL, function);
-    impl()->setLastSendLineNumber(signedLineNumber >= 0 ? signedLineNumber : 0);
-    impl()->setLastSendURL(sourceURL);
-
+    Vector<StackFrame> stackTrace(2);
+    Interpreter::getStackTrace(&exec->vm(), stackTrace, 2);
+    if (stackTrace.size() == 2) {
+        unsigned line = 0;
+        unsigned unusuedColumn = 0;
+        stackTrace[1].computeLineAndColumn(line, unusuedColumn);
+        impl()->setLastSendLineNumber(line);
+        impl()->setLastSendURL(stackTrace[1].sourceURL);
+    }
     setDOMException(exec, ec);
     return jsUndefined();
 }
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to