Commit 0b596c00 authored by Steve Blackburn's avatar Steve Blackburn Committed by Commit Bot

Clean up of (de)serialization's dependence on read only heap.

Bug: v8:9533
Change-Id: Id51430bb2ad7a782cf30542d0d7117d271079423
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2019164Reviewed-by: 's avatarUlan Degenbaev <ulan@chromium.org>
Commit-Queue: Steve Blackburn <steveblackburn@google.com>
Cr-Commit-Position: refs/heads/master@{#65996}
parent 872bc2d1
......@@ -1712,8 +1712,7 @@ Map Factory::InitializeMap(Map map, InstanceType type, int instance_size,
map.set_constructor_or_backpointer(*null_value(), SKIP_WRITE_BARRIER);
map.set_instance_size(instance_size);
if (map.IsJSObjectMap()) {
DCHECK_IMPLIES(!V8_ENABLE_THIRD_PARTY_HEAP_BOOL,
!ReadOnlyHeap::Contains(map));
DCHECK(!ReadOnlyHeap::Contains(map));
map.SetInObjectPropertiesStartInWords(instance_size / kTaggedSize -
inobject_properties);
DCHECK_EQ(map.GetInObjectProperties(), inobject_properties);
......
......@@ -143,8 +143,13 @@ bool ReadOnlyHeap::Contains(Address address) {
// static
bool ReadOnlyHeap::Contains(HeapObject object) {
DCHECK(!V8_ENABLE_THIRD_PARTY_HEAP_BOOL);
return MemoryChunk::FromHeapObject(object)->InReadOnlySpace();
if (V8_ENABLE_THIRD_PARTY_HEAP_BOOL) {
// read only includes both TPH and the snapshot, so need both checks
return third_party_heap::Heap::InReadOnlySpace(object.address()) ||
MemoryChunk::FromHeapObject(object)->InReadOnlySpace();
} else {
return MemoryChunk::FromHeapObject(object)->InReadOnlySpace();
}
}
Object* ReadOnlyHeap::ExtendReadOnlyObjectCache() {
......@@ -166,10 +171,17 @@ ReadOnlyHeapObjectIterator::ReadOnlyHeapObjectIterator(ReadOnlyHeap* ro_heap)
ReadOnlyHeapObjectIterator::ReadOnlyHeapObjectIterator(ReadOnlySpace* ro_space)
: ro_space_(ro_space),
current_page_(ro_space->first_page()),
current_addr_(current_page_->area_start()) {}
current_page_(V8_ENABLE_THIRD_PARTY_HEAP_BOOL ? nullptr
: ro_space->first_page()),
current_addr_(V8_ENABLE_THIRD_PARTY_HEAP_BOOL
? Address()
: current_page_->area_start()) {}
HeapObject ReadOnlyHeapObjectIterator::Next() {
if (V8_ENABLE_THIRD_PARTY_HEAP_BOOL) {
return HeapObject(); // Unsupported
}
if (current_page_ == nullptr) {
return HeapObject();
}
......
......@@ -25,6 +25,8 @@ class Heap {
static bool InCodeSpace(Address address);
static bool InReadOnlySpace(Address address);
static bool IsValidHeapObject(HeapObject object);
bool CollectGarbage();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment