Unreviewed, rolling out r121359.
http://trac.webkit.org/changeset/121359
https://bugs.webkit.org/show_bug.cgi?id=90115
Broke many inspector tests (Requested by jpfau on #webkit).
Patch by Sheriff Bot <webkit.review.bot@gmail.com> on 2012-06-27
Source/JavaScriptCore:
* interpreter/Interpreter.h:
(JSC::StackFrame::toString):
Source/WebCore:
* bindings/js/ScriptCallStackFactory.cpp:
(WebCore::createScriptCallStack):
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@121393 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/Source/JavaScriptCore/interpreter/Interpreter.h b/Source/JavaScriptCore/interpreter/Interpreter.h
index 1fbcfe6..adb23f2 100644
--- a/Source/JavaScriptCore/interpreter/Interpreter.h
+++ b/Source/JavaScriptCore/interpreter/Interpreter.h
@@ -1,6 +1,5 @@
/*
* Copyright (C) 2008 Apple Inc. All rights reserved.
- * Copyright (C) 2012 Research In Motion Limited. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -40,7 +39,6 @@
#include "RegisterFile.h"
#include <wtf/HashMap.h>
-#include <wtf/text/StringBuilder.h>
namespace JSC {
@@ -82,61 +80,45 @@
UString sourceURL;
UString toString(CallFrame* callFrame) const
{
- StringBuilder traceBuild;
- String functionName = friendlyFunctionName(callFrame);
- String sourceURL = friendlySourceURL();
- traceBuild.append(functionName);
- if (!functionName.isEmpty() && !sourceURL.isEmpty())
- traceBuild.append('@');
- traceBuild.append(sourceURL);
- if (line > -1) {
- traceBuild.append(':');
- traceBuild.append(String::number(line));
- }
- return traceBuild.toString().impl();
- }
- String friendlySourceURL() const
- {
- String traceLine;
-
- switch (codeType) {
- case StackFrameEvalCode:
- case StackFrameFunctionCode:
- case StackFrameGlobalCode:
- if (!sourceURL.isEmpty())
- traceLine = sourceURL.impl();
- break;
- case StackFrameNativeCode:
- traceLine = "[native code]";
- break;
- }
- return traceLine.isNull() ? emptyString() : traceLine;
- }
- String friendlyFunctionName(CallFrame* callFrame) const
- {
+ bool hasSourceURLInfo = !sourceURL.isNull() && !sourceURL.isEmpty();
+ bool hasLineInfo = line > -1;
String traceLine;
JSObject* stackFrameCallee = callee.get();
switch (codeType) {
case StackFrameEvalCode:
- traceLine = "eval code";
+ if (hasSourceURLInfo) {
+ traceLine = hasLineInfo ? String::format("eval code@%s:%d", sourceURL.ascii().data(), line)
+ : String::format("eval code@%s", sourceURL.ascii().data());
+ } else
+ traceLine = String::format("eval code");
break;
- case StackFrameNativeCode:
- if (callee)
- traceLine = getCalculatedDisplayName(callFrame, stackFrameCallee).impl();
- break;
- case StackFrameFunctionCode:
- traceLine = getCalculatedDisplayName(callFrame, stackFrameCallee).impl();
- break;
- case StackFrameGlobalCode:
- traceLine = "global code";
+ case StackFrameNativeCode: {
+ if (callee) {
+ UString functionName = getCalculatedDisplayName(callFrame, stackFrameCallee);
+ traceLine = String::format("%s@[native code]", functionName.ascii().data());
+ } else
+ traceLine = "[native code]";
break;
}
- return traceLine.isNull() ? emptyString() : traceLine;
- }
- unsigned friendlyLineNumber() const
- {
- return line > -1 ? line : 0;
+ case StackFrameFunctionCode: {
+ UString functionName = getCalculatedDisplayName(callFrame, stackFrameCallee);
+ if (hasSourceURLInfo) {
+ traceLine = hasLineInfo ? String::format("%s@%s:%d", functionName.ascii().data(), sourceURL.ascii().data(), line)
+ : String::format("%s@%s", functionName.ascii().data(), sourceURL.ascii().data());
+ } else
+ traceLine = String::format("%s\n", functionName.ascii().data());
+ break;
+ }
+ case StackFrameGlobalCode:
+ if (hasSourceURLInfo) {
+ traceLine = hasLineInfo ? String::format("global code@%s:%d", sourceURL.ascii().data(), line)
+ : String::format("global code@%s", sourceURL.ascii().data());
+ } else
+ traceLine = String::format("global code");
+
+ }
+ return traceLine.impl();
}
};