| OLD | NEW |
| 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 #ifndef V8_ADDRESS_MAP_H_ | 5 #ifndef V8_ADDRESS_MAP_H_ |
| 6 #define V8_ADDRESS_MAP_H_ | 6 #define V8_ADDRESS_MAP_H_ |
| 7 | 7 |
| 8 #include "include/v8.h" | 8 #include "include/v8.h" |
| 9 #include "src/assert-scope.h" | 9 #include "src/assert-scope.h" |
| 10 #include "src/base/hashmap.h" | 10 #include "src/base/hashmap.h" |
| (...skipping 20 matching lines...) Expand all Loading... |
| 31 Entry* entry = Lookup(key, Hash(key)); | 31 Entry* entry = Lookup(key, Hash(key)); |
| 32 if (entry == nullptr) return Nothing<uint32_t>(); | 32 if (entry == nullptr) return Nothing<uint32_t>(); |
| 33 return Just(entry->value); | 33 return Just(entry->value); |
| 34 } | 34 } |
| 35 | 35 |
| 36 private: | 36 private: |
| 37 static uintptr_t Key(Type value) { | 37 static uintptr_t Key(Type value) { |
| 38 return reinterpret_cast<uintptr_t>(value); | 38 return reinterpret_cast<uintptr_t>(value); |
| 39 } | 39 } |
| 40 | 40 |
| 41 static uint32_t Hash(uintptr_t key) { | 41 static uint32_t Hash(uintptr_t key) { return static_cast<uint32_t>(key); } |
| 42 return static_cast<uint32_t>(key >> kPointerSizeLog2); | |
| 43 } | |
| 44 }; | 42 }; |
| 45 | 43 |
| 46 class AddressToIndexHashMap : public PointerToIndexHashMap<Address> {}; | 44 class AddressToIndexHashMap : public PointerToIndexHashMap<Address> {}; |
| 47 class HeapObjectToIndexHashMap : public PointerToIndexHashMap<HeapObject*> {}; | 45 class HeapObjectToIndexHashMap : public PointerToIndexHashMap<HeapObject*> {}; |
| 48 | 46 |
| 49 class RootIndexMap { | 47 class RootIndexMap { |
| 50 public: | 48 public: |
| 51 explicit RootIndexMap(Isolate* isolate); | 49 explicit RootIndexMap(Isolate* isolate); |
| 52 | 50 |
| 53 static const int kInvalidRootIndex = -1; | 51 static const int kInvalidRootIndex = -1; |
| (...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 218 DisallowHeapAllocation no_allocation_; | 216 DisallowHeapAllocation no_allocation_; |
| 219 HeapObjectToIndexHashMap map_; | 217 HeapObjectToIndexHashMap map_; |
| 220 int attached_reference_index_; | 218 int attached_reference_index_; |
| 221 DISALLOW_COPY_AND_ASSIGN(SerializerReferenceMap); | 219 DISALLOW_COPY_AND_ASSIGN(SerializerReferenceMap); |
| 222 }; | 220 }; |
| 223 | 221 |
| 224 } // namespace internal | 222 } // namespace internal |
| 225 } // namespace v8 | 223 } // namespace v8 |
| 226 | 224 |
| 227 #endif // V8_ADDRESS_MAP_H_ | 225 #endif // V8_ADDRESS_MAP_H_ |
| OLD | NEW |