Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(484)

Unified Diff: src/messages.js

Issue 10384196: messages.js: Get better function names in stack traces. (Closed) Base URL: git://github.com/v8/v8.git@master
Patch Set: Fixes + tests Created 8 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | test/mjsunit/stack-traces.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/messages.js
diff --git a/src/messages.js b/src/messages.js
index ab71936725a0daf88b106a682d3aa93202ca7d09..f39f4d57a219a8d62e8c35b3ab1de8609c6b7058 100644
--- a/src/messages.js
+++ b/src/messages.js
@@ -830,15 +830,8 @@ function CallSiteGetFunctionName() {
var name = this.fun.name;
if (name) {
return name;
- } else {
- return %FunctionGetInferredName(this.fun);
- }
- // Maybe this is an evaluation?
- var script = %FunctionGetScript(this.fun);
- if (script && script.compilation_type == COMPILATION_TYPE_EVAL) {
- return "eval";
}
- return null;
+ return %FunctionGetInferredName(this.fun);
Christian Plesner Hansen 2012/05/24 02:15:18 I wonder if the eval case should have been reached
marja 2012/05/24 08:38:16 Done.
}
function CallSiteGetMethodName() {
@@ -952,20 +945,25 @@ function CallSiteToString() {
fileLocation = "unknown source";
}
var line = "";
- var functionName = this.getFunction().name;
- var addPrefix = true;
+ var functionName = this.getFunctionName();
+ var addSuffix = true;
Christian Plesner Hansen 2012/05/24 02:15:18 I always get suffix and prefix mixed up. I do the
var isConstructor = this.isConstructor();
var isMethodCall = !(this.isToplevel() || isConstructor);
if (isMethodCall) {
+ var typeNamePrefix = this.getTypeName() + ".";
var methodName = this.getMethodName();
- line += this.getTypeName() + ".";
if (functionName) {
+ if (typeNamePrefix[0] != '[' &&
Christian Plesner Hansen 2012/05/24 02:15:18 Something to consider to make this case easier to
marja 2012/05/24 08:38:16 Done.
+ functionName.indexOf(typeNamePrefix) != 0) {
+ line += typeNamePrefix;
+ }
line += functionName;
- if (methodName && (methodName != functionName)) {
+ if (methodName && functionName.indexOf("." + methodName) !=
Christian Plesner Hansen 2012/05/24 02:15:18 Is this equivalent to (methodName != this.getFunct
marja 2012/05/24 08:38:16 Not equivalent; kept this, but fixed indexof -> la
+ functionName.length - methodName.length - 1) {
line += " [as " + methodName + "]";
}
} else {
- line += methodName || "<anonymous>";
+ line += (typeNamePrefix + (methodName || "<anonymous>"));
}
} else if (isConstructor) {
line += "new " + (functionName || "<anonymous>");
@@ -973,9 +971,9 @@ function CallSiteToString() {
line += functionName;
} else {
line += fileLocation;
- addPrefix = false;
+ addSuffix = false;
}
- if (addPrefix) {
+ if (addSuffix) {
line += " (" + fileLocation + ")";
}
return line;
« no previous file with comments | « no previous file | test/mjsunit/stack-traces.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698