[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();
|
||||
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) {
|
||||
|
Loading…
Reference in New Issue
Block a user