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/profiler/heap-snapshot-generator.h" | 5 #include "src/profiler/heap-snapshot-generator.h" |
6 | 6 |
7 #include "src/code-stubs.h" | 7 #include "src/code-stubs.h" |
8 #include "src/conversions.h" | 8 #include "src/conversions.h" |
9 #include "src/debug/debug.h" | 9 #include "src/debug/debug.h" |
10 #include "src/objects-body-descriptors.h" | 10 #include "src/objects-body-descriptors.h" |
(...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
348 // HeapObjectsMap::GenerateId) and odds for native objects. | 348 // HeapObjectsMap::GenerateId) and odds for native objects. |
349 const SnapshotObjectId HeapObjectsMap::kInternalRootObjectId = 1; | 349 const SnapshotObjectId HeapObjectsMap::kInternalRootObjectId = 1; |
350 const SnapshotObjectId HeapObjectsMap::kGcRootsObjectId = | 350 const SnapshotObjectId HeapObjectsMap::kGcRootsObjectId = |
351 HeapObjectsMap::kInternalRootObjectId + HeapObjectsMap::kObjectIdStep; | 351 HeapObjectsMap::kInternalRootObjectId + HeapObjectsMap::kObjectIdStep; |
352 const SnapshotObjectId HeapObjectsMap::kGcRootsFirstSubrootId = | 352 const SnapshotObjectId HeapObjectsMap::kGcRootsFirstSubrootId = |
353 HeapObjectsMap::kGcRootsObjectId + HeapObjectsMap::kObjectIdStep; | 353 HeapObjectsMap::kGcRootsObjectId + HeapObjectsMap::kObjectIdStep; |
354 const SnapshotObjectId HeapObjectsMap::kFirstAvailableObjectId = | 354 const SnapshotObjectId HeapObjectsMap::kFirstAvailableObjectId = |
355 HeapObjectsMap::kGcRootsFirstSubrootId + | 355 HeapObjectsMap::kGcRootsFirstSubrootId + |
356 VisitorSynchronization::kNumberOfSyncTags * HeapObjectsMap::kObjectIdStep; | 356 VisitorSynchronization::kNumberOfSyncTags * HeapObjectsMap::kObjectIdStep; |
357 | 357 |
358 | |
359 static bool AddressesMatch(void* key1, void* key2) { | |
360 return key1 == key2; | |
361 } | |
362 | |
363 | |
364 HeapObjectsMap::HeapObjectsMap(Heap* heap) | 358 HeapObjectsMap::HeapObjectsMap(Heap* heap) |
365 : next_id_(kFirstAvailableObjectId), | 359 : next_id_(kFirstAvailableObjectId), entries_map_(), heap_(heap) { |
marja
2016/09/30 10:27:33
Since entries_map_ can now use the default ctor, c
Leszek Swirski
2016/09/30 10:44:28
Done.
| |
366 entries_map_(AddressesMatch), | |
367 heap_(heap) { | |
368 // This dummy element solves a problem with entries_map_. | 360 // This dummy element solves a problem with entries_map_. |
369 // When we do lookup in HashMap we see no difference between two cases: | 361 // When we do lookup in HashMap we see no difference between two cases: |
370 // it has an entry with NULL as the value or it has created | 362 // it has an entry with NULL as the value or it has created |
371 // a new entry on the fly with NULL as the default value. | 363 // a new entry on the fly with NULL as the default value. |
372 // With such dummy element we have a guaranty that all entries_map_ entries | 364 // With such dummy element we have a guaranty that all entries_map_ entries |
373 // will have the value field grater than 0. | 365 // will have the value field grater than 0. |
374 // This fact is using in MoveObject method. | 366 // This fact is using in MoveObject method. |
375 entries_.Add(EntryInfo(0, NULL, 0)); | 367 entries_.Add(EntryInfo(0, NULL, 0)); |
376 } | 368 } |
377 | 369 |
(...skipping 2744 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3122 for (int i = 1; i < sorted_strings.length(); ++i) { | 3114 for (int i = 1; i < sorted_strings.length(); ++i) { |
3123 writer_->AddCharacter(','); | 3115 writer_->AddCharacter(','); |
3124 SerializeString(sorted_strings[i]); | 3116 SerializeString(sorted_strings[i]); |
3125 if (writer_->aborted()) return; | 3117 if (writer_->aborted()) return; |
3126 } | 3118 } |
3127 } | 3119 } |
3128 | 3120 |
3129 | 3121 |
3130 } // namespace internal | 3122 } // namespace internal |
3131 } // namespace v8 | 3123 } // namespace v8 |
OLD | NEW |