Title: [108681] trunk/Source/_javascript_Core
- Revision
- 108681
- Author
- oli...@apple.com
- Date
- 2012-02-23 15:18:05 -0800 (Thu, 23 Feb 2012)
Log Message
Make Interpreter::getStackTrace be able to generate the line number for the top callframe if none is provided
https://bugs.webkit.org/show_bug.cgi?id=79407
Reviewed by Gavin Barraclough.
Outside of exception handling, we don't know what our source line number is. This
change allows us to pass -1 is as the initial line number, and get the correct line
number in the resultant stack trace. We can't completely elide the initial line
number (yet) due to some idiosyncrasies of the exception handling machinery.
* interpreter/Interpreter.cpp:
(JSC::getLineNumberForCallFrame):
(JSC):
(JSC::Interpreter::getStackTrace):
Modified Paths
Diff
Modified: trunk/Source/_javascript_Core/ChangeLog (108680 => 108681)
--- trunk/Source/_javascript_Core/ChangeLog 2012-02-23 23:13:44 UTC (rev 108680)
+++ trunk/Source/_javascript_Core/ChangeLog 2012-02-23 23:18:05 UTC (rev 108681)
@@ -1,3 +1,20 @@
+2012-02-23 Oliver Hunt <oli...@apple.com>
+
+ Make Interpreter::getStackTrace be able to generate the line number for the top callframe if none is provided
+ https://bugs.webkit.org/show_bug.cgi?id=79407
+
+ Reviewed by Gavin Barraclough.
+
+ Outside of exception handling, we don't know what our source line number is. This
+ change allows us to pass -1 is as the initial line number, and get the correct line
+ number in the resultant stack trace. We can't completely elide the initial line
+ number (yet) due to some idiosyncrasies of the exception handling machinery.
+
+ * interpreter/Interpreter.cpp:
+ (JSC::getLineNumberForCallFrame):
+ (JSC):
+ (JSC::Interpreter::getStackTrace):
+
2012-02-22 Filip Pizlo <fpi...@apple.com>
DFG OSR exit value profiling should have graceful handling of local variables and arguments
Modified: trunk/Source/_javascript_Core/interpreter/Interpreter.cpp (108680 => 108681)
--- trunk/Source/_javascript_Core/interpreter/Interpreter.cpp 2012-02-23 23:13:44 UTC (rev 108680)
+++ trunk/Source/_javascript_Core/interpreter/Interpreter.cpp 2012-02-23 23:18:05 UTC (rev 108681)
@@ -817,6 +817,25 @@
exception->putDirect(*globalData, globalData->propertyNames->message, jsString(globalData, message));
}
+static int getLineNumberForCallFrame(CallFrame* callFrame)
+{
+ callFrame = callFrame->removeHostCallFrameFlag();
+ CodeBlock* codeBlock = callFrame->codeBlock();
+ if (!codeBlock)
+ return -1;
+#if ENABLE(INTERPRETER)
+ if (!globalData->canUseJIT())
+ return codeBlock->lineNumberForBytecodeOffset(callFrame->bytecodeOffsetForNonDFGCode() - 1);
+#endif
+#if ENABLE(JIT)
+#if ENABLE(DFG_JIT)
+ if (codeBlock->getJITType() == JITCode::DFGJIT)
+ return codeBlock->lineNumberForBytecodeOffset(codeBlock->codeOrigin(callFrame->codeOriginIndexForDFG()).bytecodeIndex);
+#endif
+ return codeBlock->lineNumberForBytecodeOffset(callFrame->bytecodeOffsetForNonDFGCode());
+#endif
+}
+
static CallFrame* getCallerInfo(JSGlobalData* globalData, CallFrame* callFrame, int& lineNumber)
{
UNUSED_PARAM(globalData);
@@ -929,6 +948,9 @@
if (!callFrame || callFrame == CallFrame::noCaller())
return;
+ if (line == -1)
+ line = getLineNumberForCallFrame(callFrame);
+
while (callFrame && callFrame != CallFrame::noCaller()) {
UString sourceURL;
if (callFrame->codeBlock()) {
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes