Commit 594a1e1d authored by verwaest's avatar verwaest Committed by Commit bot

Revert of Use displayName in Error.stack rendering if present. (patchset #1...

Revert of Use displayName in Error.stack rendering if present. (patchset #1 id:1 of https://codereview.chromium.org/1706823003/ )

Reason for revert:
See Domenic's comment on the V8 bug.

Original issue's description:
> Use displayName in Error.stack rendering if present.
>
> BUG=v8:4761
> LOG=y
>
> Committed: https://crrev.com/953874e974037e7e96ef282a7078760ccc905878
> Cr-Commit-Position: refs/heads/master@{#34105}

TBR=jochen@chromium.org
# Skipping CQ checks because original CL landed less than 1 days ago.
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=v8:4761

Review URL: https://codereview.chromium.org/1713663002

Cr-Commit-Position: refs/heads/master@{#34129}
parent 4578e52a
......@@ -4455,7 +4455,7 @@ Local<Value> Function::GetDisplayName() const {
}
auto func = i::Handle<i::JSFunction>::cast(self);
i::Handle<i::String> property_name =
isolate->factory()->display_name_string();
isolate->factory()->NewStringFromStaticChars("displayName");
i::Handle<i::Object> value =
i::JSReceiver::GetDataProperty(func, property_name);
if (value->IsString()) {
......
......@@ -618,11 +618,6 @@ 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.
......@@ -681,13 +676,10 @@ function CallSiteToString() {
var line = "";
var functionName = this.getFunctionName();
var debugName = this.getDebugName();
var addSuffix = true;
var isConstructor = this.isConstructor();
var isMethodCall = !(this.isToplevel() || isConstructor);
if (debugName) {
if (isConstructor) line += "new ";
line += debugName;
} else if (isMethodCall) {
if (isMethodCall) {
var typeName = GetTypeName(GET_PRIVATE(this, callSiteReceiverSymbol), true);
var methodName = this.getMethodName();
if (functionName) {
......@@ -708,9 +700,13 @@ function CallSiteToString() {
} else if (functionName) {
line += functionName;
} else {
return line + fileLocation;
line += fileLocation;
addSuffix = false;
}
if (addSuffix) {
line += " (" + fileLocation + ")";
}
return line + " (" + fileLocation + ")";
return line;
}
utils.SetUpLockedPrototype(CallSite, ["receiver", "fun", "pos"], [
......@@ -722,7 +718,6 @@ utils.SetUpLockedPrototype(CallSite, ["receiver", "fun", "pos"], [
"getScriptNameOrSourceURL", CallSiteGetScriptNameOrSourceURL,
"getFunction", CallSiteGetFunction,
"getFunctionName", CallSiteGetFunctionName,
"getDebugName", CallSiteGetDebugName,
"getMethodName", CallSiteGetMethodName,
"getFileName", CallSiteGetFileName,
"getLineNumber", CallSiteGetLineNumber,
......
......@@ -191,14 +191,6 @@ Handle<Object> CallSite::GetFunctionName() {
return isolate_->factory()->null_value();
}
Handle<Object> CallSite::GetDebugName() {
Handle<Object> name = JSReceiver::GetDataProperty(
fun_, isolate_->factory()->display_name_string());
if (name->IsString() && String::cast(*name)->length() != 0) {
return Handle<String>::cast(name);
}
return isolate_->factory()->null_value();
}
Handle<Object> CallSite::GetScriptNameOrSourceUrl() {
Handle<Object> script_obj(fun_->shared()->script(), isolate_);
......
......@@ -51,7 +51,6 @@ class CallSite {
Handle<Object> GetFileName();
Handle<Object> GetFunctionName();
Handle<Object> GetDebugName();
Handle<Object> GetScriptNameOrSourceUrl();
Handle<Object> GetMethodName();
// Return 1-based line number, including line offset.
......
......@@ -348,7 +348,6 @@ static inline Object* ReturnBoolean(bool value, Isolate* isolate) {
CALLSITE_GET(GetFileName, ReturnDereferencedHandle)
CALLSITE_GET(GetFunctionName, ReturnDereferencedHandle)
CALLSITE_GET(GetDebugName, ReturnDereferencedHandle)
CALLSITE_GET(GetScriptNameOrSourceUrl, ReturnDereferencedHandle)
CALLSITE_GET(GetMethodName, ReturnDereferencedHandle)
CALLSITE_GET(GetLineNumber, ReturnPositiveNumberOrNull)
......
......@@ -294,6 +294,7 @@ namespace internal {
#define FOR_EACH_INTRINSIC_I18N(F)
#endif
#define FOR_EACH_INTRINSIC_INTERNAL(F) \
F(CheckIsBootstrapping, 0, 1) \
F(ExportFromRuntime, 1, 1) \
......@@ -324,7 +325,6 @@ namespace internal {
F(FormatMessageString, 4, 1) \
F(CallSiteGetFileNameRT, 1, 1) \
F(CallSiteGetFunctionNameRT, 1, 1) \
F(CallSiteGetDebugNameRT, 1, 1) \
F(CallSiteGetScriptNameOrSourceUrlRT, 1, 1) \
F(CallSiteGetMethodNameRT, 1, 1) \
F(CallSiteGetLineNumberRT, 1, 1) \
......@@ -342,6 +342,7 @@ namespace internal {
F(IncrementUseCounter, 1, 1) \
F(GetAndResetRuntimeCallStats, 0, 1)
#define FOR_EACH_INTRINSIC_JSON(F) \
F(QuoteJSONString, 1, 1) \
F(BasicJSONStringify, 1, 1) \
......
// Copyright 2016 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
var o = { f: function() { throw new Error(); } };
o.g1 = function() { o.f() }
o.g2 = o.g1;
o.h = function() { o.g1() }
o.f.displayName = "MySpecialFunction";
try {
o.h();
} catch (e) {
assertTrue(e.stack.indexOf("MySpecialFunction") != -1);
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment