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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/heap-snapshot-generator.h ('k') | src/objects.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 1072 matching lines...) Expand 10 before | Expand all | Expand 10 after
1083 } 1083 }
1084 1084
1085 1085
1086 void V8HeapExplorer::ExtractJSObjectReferences( 1086 void V8HeapExplorer::ExtractJSObjectReferences(
1087 int entry, JSObject* js_obj) { 1087 int entry, JSObject* js_obj) {
1088 HeapObject* obj = js_obj; 1088 HeapObject* obj = js_obj;
1089 ExtractClosureReferences(js_obj, entry); 1089 ExtractClosureReferences(js_obj, entry);
1090 ExtractPropertyReferences(js_obj, entry); 1090 ExtractPropertyReferences(js_obj, entry);
1091 ExtractElementReferences(js_obj, entry); 1091 ExtractElementReferences(js_obj, entry);
1092 ExtractInternalReferences(js_obj, entry); 1092 ExtractInternalReferences(js_obj, entry);
1093 ExtractHiddenPropertyReferences(js_obj, entry);
1093 SetPropertyReference( 1094 SetPropertyReference(
1094 obj, entry, heap_->proto_string(), js_obj->GetPrototype()); 1095 obj, entry, heap_->proto_string(), js_obj->GetPrototype());
1095 if (obj->IsJSFunction()) { 1096 if (obj->IsJSFunction()) {
1096 JSFunction* js_fun = JSFunction::cast(js_obj); 1097 JSFunction* js_fun = JSFunction::cast(js_obj);
1097 Object* proto_or_map = js_fun->prototype_or_initial_map(); 1098 Object* proto_or_map = js_fun->prototype_or_initial_map();
1098 if (!proto_or_map->IsTheHole()) { 1099 if (!proto_or_map->IsTheHole()) {
1099 if (!proto_or_map->IsMap()) { 1100 if (!proto_or_map->IsMap()) {
1100 SetPropertyReference( 1101 SetPropertyReference(
1101 obj, entry, 1102 obj, entry,
1102 heap_->prototype_string(), proto_or_map, 1103 heap_->prototype_string(), proto_or_map,
(...skipping 485 matching lines...) Expand 10 before | Expand all | Expand 10 after
1588 continue; 1589 continue;
1589 } 1590 }
1590 if (ExtractAccessorPairProperty(js_obj, entry, k, value)) continue; 1591 if (ExtractAccessorPairProperty(js_obj, entry, k, value)) continue;
1591 SetPropertyReference(js_obj, entry, String::cast(k), value); 1592 SetPropertyReference(js_obj, entry, String::cast(k), value);
1592 } 1593 }
1593 } 1594 }
1594 } 1595 }
1595 } 1596 }
1596 1597
1597 1598
1599 void V8HeapExplorer::ExtractHiddenPropertyReferences(JSObject* obj, int entry) {
1600 if (obj->IsJSGlobalProxy()) {
1601 // For a proxy, use the prototype as target object.
1602 Object* proxy_parent = obj->GetPrototype();
1603 // If the proxy is detached, return undefined.
1604 if (proxy_parent->IsNull())
1605 return;
1606 ASSERT(proxy_parent->IsJSGlobalObject());
1607 obj = JSObject::cast(proxy_parent);
1608 }
1609 ASSERT(!obj->IsJSGlobalProxy());
1610 Object* inline_value = obj->GetHiddenPropertiesHashTable();
1611 if (!inline_value->IsHashTable())
1612 return;
1613 ObjectHashTable* hashtable = ObjectHashTable::cast(inline_value);
1614 int capacity = hashtable->Capacity();
1615 for (int i = 0; i < capacity; i++) {
1616 Object* k = hashtable->KeyAt(i);
1617 if (!k->IsString()) continue;
1618 Object* value = hashtable->Lookup(k);
1619 SetPropertyReference(obj, entry, String::cast(k), value);
1620 }
1621 }
1622
1623
1598 bool V8HeapExplorer::ExtractAccessorPairProperty( 1624 bool V8HeapExplorer::ExtractAccessorPairProperty(
1599 JSObject* js_obj, int entry, Object* key, Object* callback_obj) { 1625 JSObject* js_obj, int entry, Object* key, Object* callback_obj) {
1600 if (!callback_obj->IsAccessorPair()) return false; 1626 if (!callback_obj->IsAccessorPair()) return false;
1601 AccessorPair* accessors = AccessorPair::cast(callback_obj); 1627 AccessorPair* accessors = AccessorPair::cast(callback_obj);
1602 Object* getter = accessors->getter(); 1628 Object* getter = accessors->getter();
1603 if (!getter->IsOddball()) { 1629 if (!getter->IsOddball()) {
1604 SetPropertyReference(js_obj, entry, String::cast(key), getter, "get %s"); 1630 SetPropertyReference(js_obj, entry, String::cast(key), getter, "get %s");
1605 } 1631 }
1606 Object* setter = accessors->setter(); 1632 Object* setter = accessors->setter();
1607 if (!setter->IsOddball()) { 1633 if (!setter->IsOddball()) {
(...skipping 1457 matching lines...) Expand 10 before | Expand all | Expand 10 after
3065 writer_->AddString("\"<dummy>\""); 3091 writer_->AddString("\"<dummy>\"");
3066 for (int i = 1; i < sorted_strings.length(); ++i) { 3092 for (int i = 1; i < sorted_strings.length(); ++i) {
3067 writer_->AddCharacter(','); 3093 writer_->AddCharacter(',');
3068 SerializeString(sorted_strings[i]); 3094 SerializeString(sorted_strings[i]);
3069 if (writer_->aborted()) return; 3095 if (writer_->aborted()) return;
3070 } 3096 }
3071 } 3097 }
3072 3098
3073 3099
3074 } } // namespace v8::internal 3100 } } // namespace v8::internal
OLDNEW
« 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