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

Unified Diff: src/heap-snapshot-generator.cc

Issue 171683013: Add object hidden properties to heap snapshot (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 10 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/heap-snapshot-generator.h ('k') | src/objects.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/heap-snapshot-generator.cc
diff --git a/src/heap-snapshot-generator.cc b/src/heap-snapshot-generator.cc
index b67aa0f3764ad1c190243c98ec4921c2d1c6454d..2e6590d5497ec50db55619c6b7905271ff4894a6 100644
--- a/src/heap-snapshot-generator.cc
+++ b/src/heap-snapshot-generator.cc
@@ -1090,6 +1090,7 @@ void V8HeapExplorer::ExtractJSObjectReferences(
ExtractPropertyReferences(js_obj, entry);
ExtractElementReferences(js_obj, entry);
ExtractInternalReferences(js_obj, entry);
+ ExtractHiddenPropertyReferences(js_obj, entry);
SetPropertyReference(
obj, entry, heap_->proto_string(), js_obj->GetPrototype());
if (obj->IsJSFunction()) {
@@ -1595,6 +1596,31 @@ void V8HeapExplorer::ExtractPropertyReferences(JSObject* js_obj, int entry) {
}
+void V8HeapExplorer::ExtractHiddenPropertyReferences(JSObject* obj, int entry) {
+ if (obj->IsJSGlobalProxy()) {
+ // For a proxy, use the prototype as target object.
+ Object* proxy_parent = obj->GetPrototype();
+ // If the proxy is detached, return undefined.
+ if (proxy_parent->IsNull())
+ return;
+ ASSERT(proxy_parent->IsJSGlobalObject());
+ obj = JSObject::cast(proxy_parent);
+ }
+ ASSERT(!obj->IsJSGlobalProxy());
+ Object* inline_value = obj->GetHiddenPropertiesHashTable();
+ if (!inline_value->IsHashTable())
+ return;
+ ObjectHashTable* hashtable = ObjectHashTable::cast(inline_value);
+ int capacity = hashtable->Capacity();
+ for (int i = 0; i < capacity; i++) {
+ Object* k = hashtable->KeyAt(i);
+ if (!k->IsString()) continue;
+ Object* value = hashtable->Lookup(k);
+ SetPropertyReference(obj, entry, String::cast(k), value);
+ }
+}
+
+
bool V8HeapExplorer::ExtractAccessorPairProperty(
JSObject* js_obj, int entry, Object* key, Object* callback_obj) {
if (!callback_obj->IsAccessorPair()) return false;
« no previous file with comments | « src/heap-snapshot-generator.h ('k') | src/objects.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698