#ifndef V8_UTILS_ADDRESS_MAP_H_
#define V8_UTILS_ADDRESS_MAP_H_
#include "src/base/hashmap.h"
#include "src/common/assert-scope.h"
#include "src/objects/heap-object.h"
#include "src/roots/roots.h"
namespace v8 {
namespace internal {
template <typename Type>
class PointerToIndexHashMap
: public base::TemplateHashMapImpl<uintptr_t, uint32_t,
base::KeyEqualityMatcher<intptr_t>,
base::DefaultAllocationPolicy> { … };
template <>
inline uintptr_t PointerToIndexHashMap<Address>::Key(Address value) {
return static_cast<uintptr_t>(value);
}
template <>
inline uintptr_t PointerToIndexHashMap<Tagged<HeapObject>>::Key(
Tagged<HeapObject> value) {
return value.ptr();
}
class AddressToIndexHashMap : public PointerToIndexHashMap<Address> { … };
class HeapObjectToIndexHashMap
: public PointerToIndexHashMap<Tagged<HeapObject>> { … };
class RootIndexMap { … };
}
}
#endif