Index: src/heap-snapshot-generator.cc |
diff --git a/src/heap-snapshot-generator.cc b/src/heap-snapshot-generator.cc |
index b7b290e363b52b123a405786c50e4fa028b96b1d..196eb130a5d81d24a4da525b77dbdd48362fb80e 100644 |
--- a/src/heap-snapshot-generator.cc |
+++ b/src/heap-snapshot-generator.cc |
@@ -1626,50 +1626,32 @@ void V8HeapExplorer::ExtractPropertyReferences(JSObject* js_obj, int entry) { |
DescriptorArray* descs = js_obj->map()->instance_descriptors(); |
int real_size = js_obj->map()->NumberOfOwnDescriptors(); |
for (int i = 0; i < real_size; i++) { |
- switch (descs->GetType(i)) { |
- case FIELD: { |
- Representation r = descs->GetDetails(i).representation(); |
+ PropertyDetails details = descs->GetDetails(i); |
+ switch (details.location()) { |
+ case IN_OBJECT: { |
+ Representation r = details.representation(); |
if (r.IsSmi() || r.IsDouble()) break; |
- int index = descs->GetFieldIndex(i); |
Name* k = descs->GetKey(i); |
- if (index < js_obj->map()->inobject_properties()) { |
- Object* value = js_obj->InObjectPropertyAt(index); |
- if (k != heap_->hidden_string()) { |
- SetPropertyReference( |
- js_obj, entry, |
- k, value, |
- NULL, |
- js_obj->GetInObjectPropertyOffset(index)); |
- } else { |
- TagObject(value, "(hidden properties)"); |
- SetInternalReference( |
- js_obj, entry, |
- "hidden_properties", value, |
- js_obj->GetInObjectPropertyOffset(index)); |
- } |
+ FieldIndex field_index = FieldIndex::ForDescriptor(js_obj->map(), i); |
+ Object* value = js_obj->RawFastPropertyAt(field_index); |
+ int field_offset = |
+ field_index.is_inobject() ? field_index.offset() : -1; |
+ |
+ if (k != heap_->hidden_string()) { |
+ SetDataOrAccessorPropertyReference(details.kind(), js_obj, entry, k, |
+ value, NULL, field_offset); |
} else { |
- FieldIndex field_index = |
- FieldIndex::ForDescriptor(js_obj->map(), i); |
- Object* value = js_obj->RawFastPropertyAt(field_index); |
- if (k != heap_->hidden_string()) { |
- SetPropertyReference(js_obj, entry, k, value); |
- } else { |
- TagObject(value, "(hidden properties)"); |
- SetInternalReference(js_obj, entry, "hidden_properties", value); |
- } |
+ TagObject(value, "(hidden properties)"); |
+ SetInternalReference(js_obj, entry, "hidden_properties", value, |
+ field_offset); |
} |
break; |
} |
- case CONSTANT: |
- SetPropertyReference( |
- js_obj, entry, |
- descs->GetKey(i), descs->GetConstant(i)); |
- break; |
- case CALLBACKS: |
- ExtractAccessorPairProperty( |
- js_obj, entry, |
- descs->GetKey(i), descs->GetValue(i)); |
+ case IN_DESCRIPTOR: |
+ SetDataOrAccessorPropertyReference(details.kind(), js_obj, entry, |
+ descs->GetKey(i), |
+ descs->GetValue(i)); |
break; |
} |
} |
@@ -1689,27 +1671,30 @@ void V8HeapExplorer::ExtractPropertyReferences(JSObject* js_obj, int entry) { |
SetInternalReference(js_obj, entry, "hidden_properties", value); |
continue; |
} |
- if (ExtractAccessorPairProperty(js_obj, entry, k, value)) continue; |
- SetPropertyReference(js_obj, entry, Name::cast(k), value); |
+ PropertyDetails details = dictionary->DetailsAt(i); |
+ SetDataOrAccessorPropertyReference(details.kind(), js_obj, entry, |
+ Name::cast(k), value); |
} |
} |
} |
} |
-bool V8HeapExplorer::ExtractAccessorPairProperty( |
- JSObject* js_obj, int entry, Object* key, Object* callback_obj) { |
- if (!callback_obj->IsAccessorPair()) return false; |
+void V8HeapExplorer::ExtractAccessorPairProperty(JSObject* js_obj, int entry, |
+ Name* key, |
+ Object* callback_obj, |
+ int field_offset) { |
+ if (!callback_obj->IsAccessorPair()) return; |
AccessorPair* accessors = AccessorPair::cast(callback_obj); |
+ SetPropertyReference(js_obj, entry, key, accessors, NULL, field_offset); |
Object* getter = accessors->getter(); |
if (!getter->IsOddball()) { |
- SetPropertyReference(js_obj, entry, Name::cast(key), getter, "get %s"); |
+ SetPropertyReference(js_obj, entry, key, getter, "get %s"); |
} |
Object* setter = accessors->setter(); |
if (!setter->IsOddball()) { |
- SetPropertyReference(js_obj, entry, Name::cast(key), setter, "set %s"); |
+ SetPropertyReference(js_obj, entry, key, setter, "set %s"); |
} |
- return true; |
} |
@@ -2048,6 +2033,20 @@ void V8HeapExplorer::SetWeakReference(HeapObject* parent_obj, |
} |
+void V8HeapExplorer::SetDataOrAccessorPropertyReference( |
+ PropertyKind kind, JSObject* parent_obj, int parent_entry, |
+ Name* reference_name, Object* child_obj, const char* name_format_string, |
+ int field_offset) { |
+ if (kind == ACCESSOR) { |
+ ExtractAccessorPairProperty(parent_obj, parent_entry, reference_name, |
+ child_obj, field_offset); |
+ } else { |
+ SetPropertyReference(parent_obj, parent_entry, reference_name, child_obj, |
+ name_format_string, field_offset); |
+ } |
+} |
+ |
+ |
void V8HeapExplorer::SetPropertyReference(HeapObject* parent_obj, |
int parent_entry, |
Name* reference_name, |