[runtime] Minor cleanup of inferred-name handling
Bug: Change-Id: Iccc0241859970ad4e04b9a6e5f206491aa7c442e Reviewed-on: https://chromium-review.googlesource.com/781939 Reviewed-by: Camillo Bruni <cbruni@chromium.org> Commit-Queue: Camillo Bruni <cbruni@chromium.org> Cr-Commit-Position: refs/heads/master@{#49541}
This commit is contained in:
parent
742b6d1b96
commit
572210e731
@ -3707,8 +3707,7 @@ Handle<String> JSReceiver::GetConstructorName(Handle<JSReceiver> receiver) {
|
|||||||
Object* maybe_constructor = receiver->map()->GetConstructor();
|
Object* maybe_constructor = receiver->map()->GetConstructor();
|
||||||
if (maybe_constructor->IsJSFunction()) {
|
if (maybe_constructor->IsJSFunction()) {
|
||||||
JSFunction* constructor = JSFunction::cast(maybe_constructor);
|
JSFunction* constructor = JSFunction::cast(maybe_constructor);
|
||||||
String* name = constructor->shared()->name();
|
String* name = constructor->shared()->DebugName();
|
||||||
if (name->length() == 0) name = constructor->shared()->inferred_name();
|
|
||||||
if (name->length() != 0 &&
|
if (name->length() != 0 &&
|
||||||
!name->Equals(isolate->heap()->Object_string())) {
|
!name->Equals(isolate->heap()->Object_string())) {
|
||||||
return handle(name, isolate);
|
return handle(name, isolate);
|
||||||
@ -3735,8 +3734,7 @@ Handle<String> JSReceiver::GetConstructorName(Handle<JSReceiver> receiver) {
|
|||||||
Handle<String> result = isolate->factory()->Object_string();
|
Handle<String> result = isolate->factory()->Object_string();
|
||||||
if (maybe_constructor->IsJSFunction()) {
|
if (maybe_constructor->IsJSFunction()) {
|
||||||
JSFunction* constructor = JSFunction::cast(*maybe_constructor);
|
JSFunction* constructor = JSFunction::cast(*maybe_constructor);
|
||||||
String* name = constructor->shared()->name();
|
String* name = constructor->shared()->DebugName();
|
||||||
if (name->length() == 0) name = constructor->shared()->inferred_name();
|
|
||||||
if (name->length() > 0) result = handle(name, isolate);
|
if (name->length() > 0) result = handle(name, isolate);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -13572,9 +13570,8 @@ void SharedFunctionInfo::set_debugger_hints(int value) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
String* SharedFunctionInfo::DebugName() {
|
String* SharedFunctionInfo::DebugName() {
|
||||||
String* n = name();
|
if (name()->length() == 0) return inferred_name();
|
||||||
if (String::cast(n)->length() == 0) return inferred_name();
|
return name();
|
||||||
return String::cast(n);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SharedFunctionInfo::HasNoSideEffect() {
|
bool SharedFunctionInfo::HasNoSideEffect() {
|
||||||
|
@ -362,9 +362,9 @@ String* SharedFunctionInfo::inferred_name() {
|
|||||||
if (HasInferredName()) {
|
if (HasInferredName()) {
|
||||||
return String::cast(function_identifier());
|
return String::cast(function_identifier());
|
||||||
}
|
}
|
||||||
Isolate* isolate = GetIsolate();
|
DCHECK(function_identifier()->IsUndefined(GetIsolate()) ||
|
||||||
DCHECK(function_identifier()->IsUndefined(isolate) || HasBuiltinFunctionId());
|
HasBuiltinFunctionId());
|
||||||
return isolate->heap()->empty_string();
|
return GetHeap()->empty_string();
|
||||||
}
|
}
|
||||||
|
|
||||||
void SharedFunctionInfo::set_inferred_name(String* inferred_name) {
|
void SharedFunctionInfo::set_inferred_name(String* inferred_name) {
|
||||||
|
Loading…
Reference in New Issue
Block a user