5 #ifndef V8_ADDRESS_MAP_H_ 6 #define V8_ADDRESS_MAP_H_ 8 #include "include/v8.h" 9 #include "src/assert-scope.h" 10 #include "src/base/hashmap.h" 11 #include "src/objects.h" 16 template <
typename Type>
19 base::KeyEqualityMatcher<intptr_t>,
20 base::DefaultAllocationPolicy> {
26 LookupOrInsert(key, Hash(key))->value = index;
31 Entry* entry = Lookup(key, Hash(key));
32 if (entry ==
nullptr)
return Nothing<uint32_t>();
33 return Just(entry->value);
47 template <
typename Type>
48 inline uintptr_t PointerToIndexHashMap<Type>::Key(
Type value) {
49 return reinterpret_cast<uintptr_t>(value);
60 bool Lookup(
HeapObject* obj, RootIndex* out_root_list)
const {
62 if (maybe_index.IsJust()) {
63 *out_root_list =
static_cast<RootIndex
>(maybe_index.
FromJust());
68 bool Lookup(
Address obj, RootIndex* out_root_list) {
69 return Lookup(reinterpret_cast<HeapObject*>(obj), out_root_list);
81 #endif // V8_ADDRESS_MAP_H_
V8_INLINE T FromJust() const