| Index: src/profile-generator.cc
|
| ===================================================================
|
| --- src/profile-generator.cc (revision 9006)
|
| +++ src/profile-generator.cc (working copy)
|
| @@ -1663,7 +1663,7 @@
|
| } 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 @@
|
| return AddEntry(object,
|
| HeapEntry::kObject,
|
| collection_->names()->GetName(
|
| - GetConstructorNameForHeapProfile(
|
| - JSObject::cast(object))),
|
| + GetConstructorName(JSObject::cast(object))),
|
| children_count,
|
| retainers_count);
|
| } else if (object->IsString()) {
|
| @@ -2110,6 +2109,31 @@
|
| }
|
|
|
|
|
| +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);
|
| @@ -3292,10 +3316,4 @@
|
| sorted_entries->Sort(SortUsingEntryValue);
|
| }
|
|
|
| -
|
| -String* GetConstructorNameForHeapProfile(JSObject* object) {
|
| - if (object->IsJSFunction()) return HEAP->closure_symbol();
|
| - return object->constructor_name();
|
| -}
|
| -
|
| } } // namespace v8::internal
|
|
|