Commit 572210e7 authored by Toon Verwaest's avatar Toon Verwaest Committed by Commit Bot

[runtime] Minor cleanup of inferred-name handling

Bug: 
Change-Id: Iccc0241859970ad4e04b9a6e5f206491aa7c442e
Reviewed-on: https://chromium-review.googlesource.com/781939Reviewed-by: 's avatarCamillo Bruni <cbruni@chromium.org>
Commit-Queue: Camillo Bruni <cbruni@chromium.org>
Cr-Commit-Position: refs/heads/master@{#49541}
parent 742b6d1b
......@@ -3707,8 +3707,7 @@ Handle<String> JSReceiver::GetConstructorName(Handle<JSReceiver> receiver) {
Object* maybe_constructor = receiver->map()->GetConstructor();
if (maybe_constructor->IsJSFunction()) {
JSFunction* constructor = JSFunction::cast(maybe_constructor);
String* name = constructor->shared()->name();
if (name->length() == 0) name = constructor->shared()->inferred_name();
String* name = constructor->shared()->DebugName();
if (name->length() != 0 &&
!name->Equals(isolate->heap()->Object_string())) {
return handle(name, isolate);
......@@ -3735,8 +3734,7 @@ Handle<String> JSReceiver::GetConstructorName(Handle<JSReceiver> receiver) {
Handle<String> result = isolate->factory()->Object_string();
if (maybe_constructor->IsJSFunction()) {
JSFunction* constructor = JSFunction::cast(*maybe_constructor);
String* name = constructor->shared()->name();
if (name->length() == 0) name = constructor->shared()->inferred_name();
String* name = constructor->shared()->DebugName();
if (name->length() > 0) result = handle(name, isolate);
}
......@@ -13572,9 +13570,8 @@ void SharedFunctionInfo::set_debugger_hints(int value) {
}
String* SharedFunctionInfo::DebugName() {
String* n = name();
if (String::cast(n)->length() == 0) return inferred_name();
return String::cast(n);
if (name()->length() == 0) return inferred_name();
return name();
}
bool SharedFunctionInfo::HasNoSideEffect() {
......
......@@ -362,9 +362,9 @@ String* SharedFunctionInfo::inferred_name() {
if (HasInferredName()) {
return String::cast(function_identifier());
}
Isolate* isolate = GetIsolate();
DCHECK(function_identifier()->IsUndefined(isolate) || HasBuiltinFunctionId());
return isolate->heap()->empty_string();
DCHECK(function_identifier()->IsUndefined(GetIsolate()) ||
HasBuiltinFunctionId());
return GetHeap()->empty_string();
}
void SharedFunctionInfo::set_inferred_name(String* inferred_name) {
......
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