Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(924)

Unified Diff: src/profile-generator.cc

Issue 7778013: NewGC: Merge bleeding edge up to 9009. (Closed) Base URL: http://v8.googlecode.com/svn/branches/experimental/gc/
Patch Set: Created 9 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/profile-generator.h ('k') | src/regexp.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « src/profile-generator.h ('k') | src/regexp.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698