OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "src/v8.h" | 5 #include "src/v8.h" |
6 | 6 |
7 #include "src/heap-snapshot-generator-inl.h" | 7 #include "src/heap-snapshot-generator-inl.h" |
8 | 8 |
9 #include "src/allocation-tracker.h" | 9 #include "src/allocation-tracker.h" |
10 #include "src/code-stubs.h" | 10 #include "src/code-stubs.h" |
(...skipping 1271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1282 STATIC_ASSERT(Context::FIRST_WEAK_SLOT + 4 == | 1282 STATIC_ASSERT(Context::FIRST_WEAK_SLOT + 4 == |
1283 Context::NATIVE_CONTEXT_SLOTS); | 1283 Context::NATIVE_CONTEXT_SLOTS); |
1284 } | 1284 } |
1285 } | 1285 } |
1286 | 1286 |
1287 | 1287 |
1288 void V8HeapExplorer::ExtractMapReferences(int entry, Map* map) { | 1288 void V8HeapExplorer::ExtractMapReferences(int entry, Map* map) { |
1289 if (map->HasTransitionArray()) { | 1289 if (map->HasTransitionArray()) { |
1290 TransitionArray* transitions = map->transitions(); | 1290 TransitionArray* transitions = map->transitions(); |
1291 int transitions_entry = GetEntry(transitions)->index(); | 1291 int transitions_entry = GetEntry(transitions)->index(); |
1292 Object* back_pointer = transitions->back_pointer_storage(); | |
1293 TagObject(back_pointer, "(back pointer)"); | |
1294 SetInternalReference(transitions, transitions_entry, | |
1295 "back_pointer", back_pointer); | |
1296 | 1292 |
1297 if (FLAG_collect_maps && map->CanTransition()) { | 1293 if (FLAG_collect_maps && map->CanTransition()) { |
1298 if (!transitions->IsSimpleTransition()) { | 1294 if (!transitions->IsSimpleTransition()) { |
1299 if (transitions->HasPrototypeTransitions()) { | 1295 if (transitions->HasPrototypeTransitions()) { |
1300 FixedArray* prototype_transitions = | 1296 FixedArray* prototype_transitions = |
1301 transitions->GetPrototypeTransitions(); | 1297 transitions->GetPrototypeTransitions(); |
1302 MarkAsWeakContainer(prototype_transitions); | 1298 MarkAsWeakContainer(prototype_transitions); |
1303 TagObject(prototype_transitions, "(prototype transitions"); | 1299 TagObject(prototype_transitions, "(prototype transitions"); |
1304 SetInternalReference(transitions, transitions_entry, | 1300 SetInternalReference(transitions, transitions_entry, |
1305 "prototype_transitions", prototype_transitions); | 1301 "prototype_transitions", prototype_transitions); |
1306 } | 1302 } |
1307 // TODO(alph): transitions keys are strong links. | 1303 // TODO(alph): transitions keys are strong links. |
1308 MarkAsWeakContainer(transitions); | 1304 MarkAsWeakContainer(transitions); |
1309 } | 1305 } |
1310 } | 1306 } |
1311 | 1307 |
1312 TagObject(transitions, "(transition array)"); | 1308 TagObject(transitions, "(transition array)"); |
1313 SetInternalReference(map, entry, | 1309 SetInternalReference(map, entry, "transitions", transitions, |
1314 "transitions", transitions, | 1310 Map::kTransitionsOffset); |
1315 Map::kTransitionsOrBackPointerOffset); | |
1316 } else { | |
1317 Object* back_pointer = map->GetBackPointer(); | |
1318 TagObject(back_pointer, "(back pointer)"); | |
1319 SetInternalReference(map, entry, | |
1320 "back_pointer", back_pointer, | |
1321 Map::kTransitionsOrBackPointerOffset); | |
1322 } | 1311 } |
1323 DescriptorArray* descriptors = map->instance_descriptors(); | 1312 DescriptorArray* descriptors = map->instance_descriptors(); |
1324 TagObject(descriptors, "(map descriptors)"); | 1313 TagObject(descriptors, "(map descriptors)"); |
1325 SetInternalReference(map, entry, | 1314 SetInternalReference(map, entry, |
1326 "descriptors", descriptors, | 1315 "descriptors", descriptors, |
1327 Map::kDescriptorsOffset); | 1316 Map::kDescriptorsOffset); |
1328 | 1317 |
1329 MarkAsWeakContainer(map->code_cache()); | 1318 MarkAsWeakContainer(map->code_cache()); |
1330 SetInternalReference(map, entry, | 1319 SetInternalReference(map, entry, |
1331 "code_cache", map->code_cache(), | 1320 "code_cache", map->code_cache(), |
1332 Map::kCodeCacheOffset); | 1321 Map::kCodeCacheOffset); |
1333 SetInternalReference(map, entry, | 1322 SetInternalReference(map, entry, |
1334 "prototype", map->prototype(), Map::kPrototypeOffset); | 1323 "prototype", map->prototype(), Map::kPrototypeOffset); |
1335 SetInternalReference(map, entry, | 1324 Object* constructor_or_backpointer = map->constructor_or_backpointer(); |
1336 "constructor", map->constructor(), | 1325 if (constructor_or_backpointer->IsMap()) { |
1337 Map::kConstructorOffset); | 1326 TagObject(constructor_or_backpointer, "(back pointer)"); |
| 1327 SetInternalReference(map, entry, "back_pointer", constructor_or_backpointer, |
| 1328 Map::kConstructorOrBackPointerOffset); |
| 1329 } else { |
| 1330 SetInternalReference(map, entry, "constructor", constructor_or_backpointer, |
| 1331 Map::kConstructorOrBackPointerOffset); |
| 1332 } |
1338 TagObject(map->dependent_code(), "(dependent code)"); | 1333 TagObject(map->dependent_code(), "(dependent code)"); |
1339 MarkAsWeakContainer(map->dependent_code()); | 1334 MarkAsWeakContainer(map->dependent_code()); |
1340 SetInternalReference(map, entry, | 1335 SetInternalReference(map, entry, |
1341 "dependent_code", map->dependent_code(), | 1336 "dependent_code", map->dependent_code(), |
1342 Map::kDependentCodeOffset); | 1337 Map::kDependentCodeOffset); |
1343 } | 1338 } |
1344 | 1339 |
1345 | 1340 |
1346 void V8HeapExplorer::ExtractSharedFunctionInfoReferences( | 1341 void V8HeapExplorer::ExtractSharedFunctionInfoReferences( |
1347 int entry, SharedFunctionInfo* shared) { | 1342 int entry, SharedFunctionInfo* shared) { |
(...skipping 1783 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3131 writer_->AddString("\"<dummy>\""); | 3126 writer_->AddString("\"<dummy>\""); |
3132 for (int i = 1; i < sorted_strings.length(); ++i) { | 3127 for (int i = 1; i < sorted_strings.length(); ++i) { |
3133 writer_->AddCharacter(','); | 3128 writer_->AddCharacter(','); |
3134 SerializeString(sorted_strings[i]); | 3129 SerializeString(sorted_strings[i]); |
3135 if (writer_->aborted()) return; | 3130 if (writer_->aborted()) return; |
3136 } | 3131 } |
3137 } | 3132 } |
3138 | 3133 |
3139 | 3134 |
3140 } } // namespace v8::internal | 3135 } } // namespace v8::internal |
OLD | NEW |