OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 1991 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2002 | 2002 |
2003 | 2003 |
2004 void V8HeapExplorer::ExtractMapReferences(int entry, Map* map) { | 2004 void V8HeapExplorer::ExtractMapReferences(int entry, Map* map) { |
2005 SetInternalReference(map, entry, | 2005 SetInternalReference(map, entry, |
2006 "prototype", map->prototype(), Map::kPrototypeOffset); | 2006 "prototype", map->prototype(), Map::kPrototypeOffset); |
2007 SetInternalReference(map, entry, | 2007 SetInternalReference(map, entry, |
2008 "constructor", map->constructor(), | 2008 "constructor", map->constructor(), |
2009 Map::kConstructorOffset); | 2009 Map::kConstructorOffset); |
2010 if (map->HasTransitionArray()) { | 2010 if (map->HasTransitionArray()) { |
2011 TransitionArray* transitions = map->transitions(); | 2011 TransitionArray* transitions = map->transitions(); |
2012 if (!transitions->descriptors()->IsEmpty()) { | 2012 JSGlobalPropertyCell* pointer = transitions->descriptors_pointer(); |
2013 DescriptorArray* descriptors = transitions->descriptors(); | 2013 DescriptorArray* descriptors = transitions->descriptors(); |
2014 TagObject(descriptors, "(map descriptors)"); | 2014 TagObject(descriptors, "(map descriptors)"); |
2015 SetInternalReference(transitions, entry, | 2015 SetInternalReference(pointer, entry, |
2016 "descriptors", descriptors, | 2016 "descriptors", descriptors, |
2017 TransitionArray::kDescriptorsOffset); | 2017 JSGlobalPropertyCell::kValueOffset); |
2018 IndexedReferencesExtractor refs_extractor( | 2018 IndexedReferencesExtractor pointer_refs(this, pointer, entry); |
2019 this, transitions, entry); | 2019 pointer->Iterate(&pointer_refs); |
2020 transitions->Iterate(&refs_extractor); | 2020 |
2021 } | 2021 Object* back_pointer = transitions->back_pointer_storage(); |
| 2022 TagObject(transitions->back_pointer_storage(), "(back pointer)"); |
| 2023 SetInternalReference(transitions, entry, |
| 2024 "backpointer", back_pointer, |
| 2025 TransitionArray::kBackPointerStorageOffset); |
| 2026 IndexedReferencesExtractor transitions_refs(this, transitions, entry); |
| 2027 transitions->Iterate(&transitions_refs); |
| 2028 |
2022 TagObject(transitions, "(transition array)"); | 2029 TagObject(transitions, "(transition array)"); |
2023 SetInternalReference(map, entry, | 2030 SetInternalReference(map, entry, |
2024 "transitions", transitions, | 2031 "transitions", transitions, |
2025 Map::kTransitionsOrBackPointerOffset); | 2032 Map::kTransitionsOrBackPointerOffset); |
| 2033 } else { |
| 2034 Object* back_pointer = map->GetBackPointer(); |
| 2035 TagObject(back_pointer, "(back pointer)"); |
| 2036 SetInternalReference(map, entry, |
| 2037 "backpointer", back_pointer, |
| 2038 Map::kTransitionsOrBackPointerOffset); |
2026 } | 2039 } |
2027 SetInternalReference(map, entry, | 2040 SetInternalReference(map, entry, |
2028 "code_cache", map->code_cache(), | 2041 "code_cache", map->code_cache(), |
2029 Map::kCodeCacheOffset); | 2042 Map::kCodeCacheOffset); |
2030 } | 2043 } |
2031 | 2044 |
2032 | 2045 |
2033 void V8HeapExplorer::ExtractSharedFunctionInfoReferences( | 2046 void V8HeapExplorer::ExtractSharedFunctionInfoReferences( |
2034 int entry, SharedFunctionInfo* shared) { | 2047 int entry, SharedFunctionInfo* shared) { |
2035 HeapObject* obj = shared; | 2048 HeapObject* obj = shared; |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2172 SetClosureReference(js_obj, entry, name, context->get(idx)); | 2185 SetClosureReference(js_obj, entry, name, context->get(idx)); |
2173 } | 2186 } |
2174 } | 2187 } |
2175 } | 2188 } |
2176 } | 2189 } |
2177 | 2190 |
2178 | 2191 |
2179 void V8HeapExplorer::ExtractPropertyReferences(JSObject* js_obj, int entry) { | 2192 void V8HeapExplorer::ExtractPropertyReferences(JSObject* js_obj, int entry) { |
2180 if (js_obj->HasFastProperties()) { | 2193 if (js_obj->HasFastProperties()) { |
2181 DescriptorArray* descs = js_obj->map()->instance_descriptors(); | 2194 DescriptorArray* descs = js_obj->map()->instance_descriptors(); |
| 2195 int real_size = js_obj->map()->NumberOfOwnDescriptors(); |
2182 for (int i = 0; i < descs->number_of_descriptors(); i++) { | 2196 for (int i = 0; i < descs->number_of_descriptors(); i++) { |
| 2197 if (descs->GetDetails(i).descriptor_index() > real_size) continue; |
2183 switch (descs->GetType(i)) { | 2198 switch (descs->GetType(i)) { |
2184 case FIELD: { | 2199 case FIELD: { |
2185 int index = descs->GetFieldIndex(i); | 2200 int index = descs->GetFieldIndex(i); |
2186 | 2201 |
2187 String* k = descs->GetKey(i); | 2202 String* k = descs->GetKey(i); |
2188 if (index < js_obj->map()->inobject_properties()) { | 2203 if (index < js_obj->map()->inobject_properties()) { |
2189 Object* value = js_obj->InObjectPropertyAt(index); | 2204 Object* value = js_obj->InObjectPropertyAt(index); |
2190 if (k != heap_->hidden_symbol()) { | 2205 if (k != heap_->hidden_symbol()) { |
2191 SetPropertyReference( | 2206 SetPropertyReference( |
2192 js_obj, entry, | 2207 js_obj, entry, |
(...skipping 1373 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3566 | 3581 |
3567 | 3582 |
3568 void HeapSnapshotJSONSerializer::SortHashMap( | 3583 void HeapSnapshotJSONSerializer::SortHashMap( |
3569 HashMap* map, List<HashMap::Entry*>* sorted_entries) { | 3584 HashMap* map, List<HashMap::Entry*>* sorted_entries) { |
3570 for (HashMap::Entry* p = map->Start(); p != NULL; p = map->Next(p)) | 3585 for (HashMap::Entry* p = map->Start(); p != NULL; p = map->Next(p)) |
3571 sorted_entries->Add(p); | 3586 sorted_entries->Add(p); |
3572 sorted_entries->Sort(SortUsingEntryValue); | 3587 sorted_entries->Sort(SortUsingEntryValue); |
3573 } | 3588 } |
3574 | 3589 |
3575 } } // namespace v8::internal | 3590 } } // namespace v8::internal |
OLD | NEW |