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

Side by Side Diff: src/address-map.cc

Issue 2010243003: Move hashmap into base/. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Rebase Created 4 years, 6 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
« no previous file with comments | « src/address-map.h ('k') | src/arm/simulator-arm.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 2015 the V8 project authors. All rights reserved. 1 // Copyright 2015 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/address-map.h" 5 #include "src/address-map.h"
6 #include "src/heap/heap.h" 6 #include "src/heap/heap.h"
7 #include "src/isolate.h" 7 #include "src/isolate.h"
8 #include "src/objects-inl.h" 8 #include "src/objects-inl.h"
9 9
10 namespace v8 { 10 namespace v8 {
11 namespace internal { 11 namespace internal {
12 12
13 RootIndexMap::RootIndexMap(Isolate* isolate) { 13 RootIndexMap::RootIndexMap(Isolate* isolate) {
14 map_ = isolate->root_index_map(); 14 map_ = isolate->root_index_map();
15 if (map_ != NULL) return; 15 if (map_ != NULL) return;
16 map_ = new HashMap(HashMap::PointersMatch); 16 map_ = new base::HashMap(base::HashMap::PointersMatch);
17 for (uint32_t i = 0; i < Heap::kStrongRootListLength; i++) { 17 for (uint32_t i = 0; i < Heap::kStrongRootListLength; i++) {
18 Heap::RootListIndex root_index = static_cast<Heap::RootListIndex>(i); 18 Heap::RootListIndex root_index = static_cast<Heap::RootListIndex>(i);
19 Object* root = isolate->heap()->root(root_index); 19 Object* root = isolate->heap()->root(root_index);
20 if (!root->IsHeapObject()) continue; 20 if (!root->IsHeapObject()) continue;
21 // Omit root entries that can be written after initialization. They must 21 // Omit root entries that can be written after initialization. They must
22 // not be referenced through the root list in the snapshot. 22 // not be referenced through the root list in the snapshot.
23 if (isolate->heap()->RootCanBeTreatedAsConstant(root_index)) { 23 if (isolate->heap()->RootCanBeTreatedAsConstant(root_index)) {
24 HeapObject* heap_object = HeapObject::cast(root); 24 HeapObject* heap_object = HeapObject::cast(root);
25 HashMap::Entry* entry = LookupEntry(map_, heap_object, false); 25 base::HashMap::Entry* entry = LookupEntry(map_, heap_object, false);
26 if (entry != NULL) { 26 if (entry != NULL) {
27 // Some are initialized to a previous value in the root list. 27 // Some are initialized to a previous value in the root list.
28 DCHECK_LT(GetValue(entry), i); 28 DCHECK_LT(GetValue(entry), i);
29 } else { 29 } else {
30 SetValue(LookupEntry(map_, heap_object, true), i); 30 SetValue(LookupEntry(map_, heap_object, true), i);
31 } 31 }
32 } else { 32 } else {
33 // Immortal immovable root objects are constant and allocated on the first 33 // Immortal immovable root objects are constant and allocated on the first
34 // page of old space. Non-constant roots cannot be immortal immovable. The 34 // page of old space. Non-constant roots cannot be immortal immovable. The
35 // root index map contains all immortal immmovable root objects. 35 // root index map contains all immortal immmovable root objects.
36 CHECK(!Heap::RootIsImmortalImmovable(root_index)); 36 CHECK(!Heap::RootIsImmortalImmovable(root_index));
37 } 37 }
38 } 38 }
39 isolate->set_root_index_map(map_); 39 isolate->set_root_index_map(map_);
40 } 40 }
41 41
42 } // namespace internal 42 } // namespace internal
43 } // namespace v8 43 } // namespace v8
OLDNEW
« no previous file with comments | « src/address-map.h ('k') | src/arm/simulator-arm.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698