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