Index: src/heap-snapshot-generator.cc |
diff --git a/src/heap-snapshot-generator.cc b/src/heap-snapshot-generator.cc |
index 217d1ca25ecfa9dae22b7270b973700c67a2a09f..882f70638f22d7620f727772d8199f1af59c3293 100644 |
--- a/src/heap-snapshot-generator.cc |
+++ b/src/heap-snapshot-generator.cc |
@@ -974,6 +974,8 @@ void V8HeapExplorer::ExtractReferences(HeapObject* obj) { |
ExtractSharedFunctionInfoReferences(entry, SharedFunctionInfo::cast(obj)); |
} else if (obj->IsScript()) { |
ExtractScriptReferences(entry, Script::cast(obj)); |
+ } else if (obj->IsAccessorPair()) { |
+ ExtractAccessorPairReferences(entry, AccessorPair::cast(obj)); |
} else if (obj->IsCodeCache()) { |
ExtractCodeCacheReferences(entry, CodeCache::cast(obj)); |
} else if (obj->IsCode()) { |
@@ -1242,6 +1244,15 @@ void V8HeapExplorer::ExtractScriptReferences(int entry, Script* script) { |
} |
+void V8HeapExplorer::ExtractAccessorPairReferences( |
+ int entry, AccessorPair* accessors) { |
+ SetInternalReference(accessors, entry, "getter", accessors->getter(), |
+ AccessorPair::kGetterOffset); |
+ SetInternalReference(accessors, entry, "setter", accessors->setter(), |
+ AccessorPair::kSetterOffset); |
+} |
+ |
+ |
void V8HeapExplorer::ExtractCodeCacheReferences( |
int entry, CodeCache* code_cache) { |
TagObject(code_cache->default_cache(), "(default code cache)"); |
@@ -1353,21 +1364,11 @@ void V8HeapExplorer::ExtractPropertyReferences(JSObject* js_obj, int entry) { |
js_obj, entry, |
descs->GetKey(i), descs->GetConstantFunction(i)); |
break; |
- case CALLBACKS: { |
- Object* callback_obj = descs->GetValue(i); |
- if (callback_obj->IsAccessorPair()) { |
- AccessorPair* accessors = AccessorPair::cast(callback_obj); |
- if (Object* getter = accessors->getter()) { |
- SetPropertyReference(js_obj, entry, descs->GetKey(i), |
- getter, "get-%s"); |
- } |
- if (Object* setter = accessors->setter()) { |
- SetPropertyReference(js_obj, entry, descs->GetKey(i), |
- setter, "set-%s"); |
- } |
- } |
+ case CALLBACKS: |
+ ExtractAccessorPairProperty( |
+ js_obj, entry, |
+ descs->GetKey(i), descs->GetValue(i)); |
break; |
- } |
case NORMAL: // only in slow mode |
case HANDLER: // only in lookup results, not in descriptors |
case INTERCEPTOR: // only in lookup results, not in descriptors |
@@ -1389,18 +1390,35 @@ void V8HeapExplorer::ExtractPropertyReferences(JSObject* js_obj, int entry) { |
Object* value = target->IsPropertyCell() |
? PropertyCell::cast(target)->value() |
: target; |
- if (k != heap_->hidden_string()) { |
- SetPropertyReference(js_obj, entry, String::cast(k), value); |
- } else { |
+ if (k == heap_->hidden_string()) { |
TagObject(value, "(hidden properties)"); |
SetInternalReference(js_obj, entry, "hidden_properties", value); |
+ continue; |
} |
+ if (ExtractAccessorPairProperty(js_obj, entry, k, value)) continue; |
+ SetPropertyReference(js_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; |
+ AccessorPair* accessors = AccessorPair::cast(callback_obj); |
+ Object* getter = accessors->getter(); |
+ if (!getter->IsOddball()) { |
+ SetPropertyReference(js_obj, entry, String::cast(key), getter, "get %s"); |
+ } |
+ Object* setter = accessors->setter(); |
+ if (!setter->IsOddball()) { |
+ SetPropertyReference(js_obj, entry, String::cast(key), setter, "set %s"); |
+ } |
+ return true; |
+} |
+ |
+ |
void V8HeapExplorer::ExtractElementReferences(JSObject* js_obj, int entry) { |
if (js_obj->HasFastObjectElements()) { |
FixedArray* elements = FixedArray::cast(js_obj->elements()); |