summaryrefslogtreecommitdiff
path: root/deps/v8/src/address-map.cc
diff options
context:
space:
mode:
Diffstat (limited to 'deps/v8/src/address-map.cc')
-rw-r--r--deps/v8/src/address-map.cc20
1 files changed, 10 insertions, 10 deletions
diff --git a/deps/v8/src/address-map.cc b/deps/v8/src/address-map.cc
index ad71a25a99..112e3134b8 100644
--- a/deps/v8/src/address-map.cc
+++ b/deps/v8/src/address-map.cc
@@ -6,6 +6,7 @@
#include "src/heap/heap.h"
#include "src/isolate.h"
#include "src/objects-inl.h"
+#include "src/objects/heap-object-inl.h"
namespace v8 {
namespace internal {
@@ -14,16 +15,16 @@ RootIndexMap::RootIndexMap(Isolate* isolate) {
map_ = isolate->root_index_map();
if (map_ != nullptr) return;
map_ = new HeapObjectToIndexHashMap();
- for (RootIndex root_index = RootIndex::kFirstStrongRoot;
- root_index <= RootIndex::kLastStrongRoot; ++root_index) {
- Object* root = isolate->heap()->root(root_index);
+ for (RootIndex root_index = RootIndex::kFirstStrongOrReadOnlyRoot;
+ root_index <= RootIndex::kLastStrongOrReadOnlyRoot; ++root_index) {
+ Object root = isolate->root(root_index);
if (!root->IsHeapObject()) continue;
// Omit root entries that can be written after initialization. They must
// not be referenced through the root list in the snapshot.
// Since we map the raw address of an root item to its root list index, the
// raw address must be constant, i.e. the object must be immovable.
- if (isolate->heap()->RootCanBeTreatedAsConstant(root_index)) {
- HeapObject* heap_object = HeapObject::cast(root);
+ if (RootsTable::IsImmortalImmovable(root_index)) {
+ HeapObject heap_object = HeapObject::cast(root);
Maybe<uint32_t> maybe_index = map_->Get(heap_object);
uint32_t index = static_cast<uint32_t>(root_index);
if (maybe_index.IsJust()) {
@@ -32,15 +33,14 @@ RootIndexMap::RootIndexMap(Isolate* isolate) {
} else {
map_->Set(heap_object, index);
}
- } else {
- // Immortal immovable root objects are constant and allocated on the first
- // page of old space. Non-constant roots cannot be immortal immovable. The
- // root index map contains all immortal immmovable root objects.
- CHECK(!Heap::RootIsImmortalImmovable(root_index));
}
}
isolate->set_root_index_map(map_);
}
+bool RootIndexMap::Lookup(Address obj, RootIndex* out_root_list) const {
+ return Lookup(HeapObject::cast(Object(obj)), out_root_list);
+}
+
} // namespace internal
} // namespace v8