diff options
Diffstat (limited to 'chromium/v8/src/snapshot/read-only-serializer.cc')
-rw-r--r-- | chromium/v8/src/snapshot/read-only-serializer.cc | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/chromium/v8/src/snapshot/read-only-serializer.cc b/chromium/v8/src/snapshot/read-only-serializer.cc index 06c5094782c..3dc5af0b0d7 100644 --- a/chromium/v8/src/snapshot/read-only-serializer.cc +++ b/chromium/v8/src/snapshot/read-only-serializer.cc @@ -74,6 +74,10 @@ void ReadOnlySerializer::SerializeReadOnlyRoots() { isolate()->handle_scope_implementer()->blocks()->empty()); ReadOnlyRoots(isolate()).Iterate(this); + + if (reconstruct_read_only_object_cache_for_testing()) { + ReconstructReadOnlyObjectCacheForTesting(); + } } void ReadOnlySerializer::FinalizeSerialization() { @@ -129,5 +133,18 @@ bool ReadOnlySerializer::SerializeUsingReadOnlyObjectCache( return true; } +void ReadOnlySerializer::ReconstructReadOnlyObjectCacheForTesting() { + ReadOnlyHeap* ro_heap = isolate()->read_only_heap(); + DCHECK(ro_heap->read_only_object_cache_is_initialized()); + for (size_t i = 0, size = ro_heap->read_only_object_cache_size(); i < size; + i++) { + Handle<HeapObject> obj( + HeapObject::cast(ro_heap->cached_read_only_object(i)), isolate()); + int cache_index = SerializeInObjectCache(obj); + USE(cache_index); + DCHECK_EQ(cache_index, i); + } +} + } // namespace internal } // namespace v8 |