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

Unified Diff: src/js/messages.js

Issue 1706823003: Use displayName in Error.stack rendering if present. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 10 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 | « src/api.cc ('k') | src/messages.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/js/messages.js
diff --git a/src/js/messages.js b/src/js/messages.js
index feb14d378844a690de97e4d4e1d4dd323c0841b3..db66fd38c56d87ca6190ad7957204ac469338301 100644
--- a/src/js/messages.js
+++ b/src/js/messages.js
@@ -618,6 +618,11 @@ function CallSiteGetFunctionName() {
return %CallSiteGetFunctionNameRT(this);
}
+function CallSiteGetDebugName() {
+ // See if the function knows its own name
+ return %CallSiteGetDebugNameRT(this);
+}
+
function CallSiteGetMethodName() {
// See if we can find a unique property on the receiver that holds
// this function.
@@ -676,10 +681,13 @@ function CallSiteToString() {
var line = "";
var functionName = this.getFunctionName();
- var addSuffix = true;
+ var debugName = this.getDebugName();
var isConstructor = this.isConstructor();
var isMethodCall = !(this.isToplevel() || isConstructor);
- if (isMethodCall) {
+ if (debugName) {
+ if (isConstructor) line += "new ";
+ line += debugName;
+ } else if (isMethodCall) {
var typeName = GetTypeName(GET_PRIVATE(this, callSiteReceiverSymbol), true);
var methodName = this.getMethodName();
if (functionName) {
@@ -700,13 +708,9 @@ function CallSiteToString() {
} else if (functionName) {
line += functionName;
} else {
- line += fileLocation;
- addSuffix = false;
- }
- if (addSuffix) {
- line += " (" + fileLocation + ")";
+ return line + fileLocation;
}
- return line;
+ return line + " (" + fileLocation + ")";
}
utils.SetUpLockedPrototype(CallSite, ["receiver", "fun", "pos"], [
@@ -718,6 +722,7 @@ utils.SetUpLockedPrototype(CallSite, ["receiver", "fun", "pos"], [
"getScriptNameOrSourceURL", CallSiteGetScriptNameOrSourceURL,
"getFunction", CallSiteGetFunction,
"getFunctionName", CallSiteGetFunctionName,
+ "getDebugName", CallSiteGetDebugName,
"getMethodName", CallSiteGetMethodName,
"getFileName", CallSiteGetFileName,
"getLineNumber", CallSiteGetLineNumber,
« no previous file with comments | « src/api.cc ('k') | src/messages.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698