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

Unified Diff: src/profile-generator.cc

Issue 3590029: Better align heap snapshots contents with debugger info. (Closed)
Patch Set: Created 10 years, 2 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') | test/cctest/test-heap-profiler.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/profile-generator.cc
diff --git a/src/profile-generator.cc b/src/profile-generator.cc
index 08ee046970fe657b8a3557ed34a956b25e8965ec..fe3bc669cb2a00b211fbf557a18f8cd9c7150a8c 100644
--- a/src/profile-generator.cc
+++ b/src/profile-generator.cc
@@ -1001,6 +1001,7 @@ const char* HeapEntry::TypeAsString() {
case kString: return "/string/";
case kCode: return "/code/";
case kArray: return "/array/";
+ case kRegExp: return "/regexp/";
default: return "???";
}
}
@@ -1284,11 +1285,16 @@ HeapEntry* HeapSnapshot::AddEntry(HeapObject* object,
} else if (object->IsJSFunction()) {
JSFunction* func = JSFunction::cast(object);
SharedFunctionInfo* shared = func->shared();
- String* name = String::cast(shared->name())->length() > 0 ?
- String::cast(shared->name()) : shared->inferred_name();
return AddEntry(object,
HeapEntry::kClosure,
- collection_->GetFunctionName(name),
+ collection_->GetName(String::cast(shared->name())),
+ children_count,
+ retainers_count);
+ } else if (object->IsJSRegExp()) {
+ JSRegExp* re = JSRegExp::cast(object);
+ return AddEntry(object,
+ HeapEntry::kRegExp,
+ collection_->GetName(re->Pattern()),
children_count,
retainers_count);
} else if (object->IsJSObject()) {
@@ -1342,6 +1348,7 @@ HeapEntry* HeapSnapshot::AddEntry(HeapObject* object,
bool HeapSnapshot::WillAddEntry(HeapObject* object) {
return object == kInternalRootObject
|| object->IsJSFunction()
+ || object->IsJSRegExp()
|| object->IsJSObject()
|| object->IsString()
|| object->IsCode()
@@ -1905,12 +1912,19 @@ void HeapSnapshotGenerator::ExtractReferences(HeapObject* obj) {
ExtractPropertyReferences(js_obj, entry);
ExtractElementReferences(js_obj, entry);
SetPropertyReference(
- obj, entry, Heap::prototype_symbol(), js_obj->map()->prototype());
+ obj, entry, Heap::Proto_symbol(), js_obj->GetPrototype());
+ if (obj->IsJSFunction()) {
+ JSFunction* js_fun = JSFunction::cast(obj);
+ if (js_fun->has_prototype()) {
+ SetPropertyReference(
+ obj, entry, Heap::prototype_symbol(), js_fun->prototype());
+ }
+ }
} else if (obj->IsString()) {
if (obj->IsConsString()) {
ConsString* cs = ConsString::cast(obj);
- SetElementReference(obj, entry, 0, cs->first());
- SetElementReference(obj, entry, 1, cs->second());
+ SetInternalReference(obj, entry, "1", cs->first());
+ SetInternalReference(obj, entry, "2", cs->second());
}
} else if (obj->IsCode() || obj->IsSharedFunctionInfo() || obj->IsScript()) {
IndexedReferencesExtractor refs_extractor(this, obj, entry);
@@ -2055,7 +2069,9 @@ void HeapSnapshotGenerator::SetPropertyReference(HeapObject* parent_obj,
Object* child_obj) {
HeapEntry* child_entry = GetEntry(child_obj);
if (child_entry != NULL) {
- filler_->SetNamedReference(HeapGraphEdge::kProperty,
+ HeapGraphEdge::Type type = reference_name->length() > 0 ?
+ HeapGraphEdge::kProperty : HeapGraphEdge::kInternal;
+ filler_->SetNamedReference(type,
parent_obj,
parent_entry,
collection_->GetName(reference_name),
@@ -2351,7 +2367,8 @@ void HeapSnapshotJSONSerializer::SerializeNodes() {
"," JSON_S("string")
"," JSON_S("object")
"," JSON_S("code")
- "," JSON_S("closure"))
+ "," JSON_S("closure")
+ "," JSON_S("regexp"))
"," JSON_S("string")
"," JSON_S("number")
"," JSON_S("number")
« no previous file with comments | « src/profile-generator.h ('k') | test/cctest/test-heap-profiler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698