| Index: src/profile-generator.cc
|
| diff --git a/src/profile-generator.cc b/src/profile-generator.cc
|
| index 07426f293992dab657bcdd02101b1fe265142d73..db9f8928de7f6c508f7cdb690f0b8df04d62effa 100644
|
| --- a/src/profile-generator.cc
|
| +++ b/src/profile-generator.cc
|
| @@ -1663,7 +1663,7 @@ HeapEntry* V8HeapExplorer::AddEntry(HeapObject* object,
|
| } else if (object->IsJSGlobalObject()) {
|
| const char* tag = objects_tags_.GetTag(object);
|
| const char* name = collection_->names()->GetName(
|
| - GetConstructorNameForHeapProfile(JSObject::cast(object)));
|
| + GetConstructorName(JSObject::cast(object)));
|
| if (tag != NULL) {
|
| name = collection_->names()->GetFormatted("%s / %s", name, tag);
|
| }
|
| @@ -1691,8 +1691,7 @@ HeapEntry* V8HeapExplorer::AddEntry(HeapObject* object,
|
| return AddEntry(object,
|
| HeapEntry::kObject,
|
| collection_->names()->GetName(
|
| - GetConstructorNameForHeapProfile(
|
| - JSObject::cast(object))),
|
| + GetConstructorName(JSObject::cast(object))),
|
| children_count,
|
| retainers_count);
|
| } else if (object->IsString()) {
|
| @@ -2101,6 +2100,31 @@ void V8HeapExplorer::ExtractInternalReferences(JSObject* js_obj,
|
| }
|
|
|
|
|
| +String* V8HeapExplorer::GetConstructorName(JSObject* object) {
|
| + if (object->IsJSFunction()) return HEAP->closure_symbol();
|
| + String* constructor_name = object->constructor_name();
|
| + if (constructor_name == HEAP->Object_symbol()) {
|
| + // Look up an immediate "constructor" property, if it is a function,
|
| + // return its name. This is for instances of binding objects, which
|
| + // have prototype constructor type "Object".
|
| + Object* constructor_prop = NULL;
|
| + LookupResult result;
|
| + object->LocalLookupRealNamedProperty(HEAP->constructor_symbol(), &result);
|
| + if (result.IsProperty()) {
|
| + constructor_prop = result.GetLazyValue();
|
| + }
|
| + if (constructor_prop->IsJSFunction()) {
|
| + Object* maybe_name = JSFunction::cast(constructor_prop)->shared()->name();
|
| + if (maybe_name->IsString()) {
|
| + String* name = String::cast(maybe_name);
|
| + if (name->length() > 0) return name;
|
| + }
|
| + }
|
| + }
|
| + return object->constructor_name();
|
| +}
|
| +
|
| +
|
| HeapEntry* V8HeapExplorer::GetEntry(Object* obj) {
|
| if (!obj->IsHeapObject()) return NULL;
|
| return filler_->FindOrAddEntry(obj, this);
|
| @@ -3250,10 +3274,4 @@ void HeapSnapshotJSONSerializer::SortHashMap(
|
| sorted_entries->Sort(SortUsingEntryValue);
|
| }
|
|
|
| -
|
| -String* GetConstructorNameForHeapProfile(JSObject* object) {
|
| - if (object->IsJSFunction()) return HEAP->closure_symbol();
|
| - return object->constructor_name();
|
| -}
|
| -
|
| } } // namespace v8::internal
|
|
|