Index: src/objects.cc |
diff --git a/src/objects.cc b/src/objects.cc |
index 883d7896c57e91dc31a1990845fd96557532eb63..32649bde542405b7c56f6e82a959aeb951158945 100644 |
--- a/src/objects.cc |
+++ b/src/objects.cc |
@@ -1180,7 +1180,11 @@ String* JSObject::constructor_name() { |
if (map()->constructor()->IsJSFunction()) { |
JSFunction* constructor = JSFunction::cast(map()->constructor()); |
String* name = String::cast(constructor->shared()->name()); |
- return name->length() > 0 ? name : constructor->shared()->inferred_name(); |
+ if (name->length() > 0) return name; |
+ String* inferred_name = constructor->shared()->inferred_name(); |
+ if (inferred_name->length() > 0) return inferred_name; |
+ Object* proto = GetPrototype(); |
+ if (proto->IsJSObject()) return JSObject::cast(proto)->constructor_name(); |
} |
// If the constructor is not present, return "Object". |
return Heap::Object_symbol(); |