diff options
author | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2020-10-12 14:27:29 +0200 |
---|---|---|
committer | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2020-10-13 09:35:20 +0000 |
commit | c30a6232df03e1efbd9f3b226777b07e087a1122 (patch) | |
tree | e992f45784689f373bcc38d1b79a239ebe17ee23 /chromium/v8/src/snapshot/object-deserializer.cc | |
parent | 7b5b123ac58f58ffde0f4f6e488bcd09aa4decd3 (diff) | |
download | qtwebengine-chromium-85-based.tar.gz |
BASELINE: Update Chromium to 85.0.4183.14085-based
Change-Id: Iaa42f4680837c57725b1344f108c0196741f6057
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Diffstat (limited to 'chromium/v8/src/snapshot/object-deserializer.cc')
-rw-r--r-- | chromium/v8/src/snapshot/object-deserializer.cc | 106 |
1 files changed, 62 insertions, 44 deletions
diff --git a/chromium/v8/src/snapshot/object-deserializer.cc b/chromium/v8/src/snapshot/object-deserializer.cc index 2de08846d4c..caae792c42e 100644 --- a/chromium/v8/src/snapshot/object-deserializer.cc +++ b/chromium/v8/src/snapshot/object-deserializer.cc @@ -6,6 +6,7 @@ #include "src/codegen/assembler-inl.h" #include "src/execution/isolate.h" +#include "src/execution/local-isolate-wrapper-inl.h" #include "src/heap/heap-inl.h" #include "src/objects/allocation-site-inl.h" #include "src/objects/objects.h" @@ -26,75 +27,92 @@ ObjectDeserializer::DeserializeSharedFunctionInfo( d.AddAttachedObject(source); Handle<HeapObject> result; - return d.Deserialize(isolate).ToHandle(&result) + return d.Deserialize(LocalIsolateWrapper(isolate)).ToHandle(&result) ? Handle<SharedFunctionInfo>::cast(result) : MaybeHandle<SharedFunctionInfo>(); } -MaybeHandle<HeapObject> ObjectDeserializer::Deserialize(Isolate* isolate) { - Initialize(isolate); +MaybeHandle<SharedFunctionInfo> +ObjectDeserializer::DeserializeSharedFunctionInfoOffThread( + OffThreadIsolate* isolate, const SerializedCodeData* data, + Handle<String> source) { + DCHECK(ReadOnlyHeap::Contains(*source) || Heap::InOffThreadSpace(*source)); + + ObjectDeserializer d(data); + + d.AddAttachedObject(source); + + Handle<HeapObject> result; + return d.Deserialize(LocalIsolateWrapper(isolate)).ToHandle(&result) + ? Handle<SharedFunctionInfo>::cast(result) + : MaybeHandle<SharedFunctionInfo>(); +} + +MaybeHandle<HeapObject> ObjectDeserializer::Deserialize( + LocalIsolateWrapper local_isolate) { + Initialize(local_isolate); if (!allocator()->ReserveSpace()) return MaybeHandle<HeapObject>(); DCHECK(deserializing_user_code()); - HandleScope scope(isolate); + LocalHandleScopeWrapper scope(local_isolate); Handle<HeapObject> result; { DisallowHeapAllocation no_gc; Object root; VisitRootPointer(Root::kStartupObjectCache, nullptr, FullObjectSlot(&root)); DeserializeDeferredObjects(); - FlushICache(); - LinkAllocationSites(); - LogNewMapEvents(); - result = handle(HeapObject::cast(root), isolate); - Rehash(); - allocator()->RegisterDeserializedObjectsForBlackAllocation(); + CHECK(new_code_objects().empty()); + if (is_main_thread()) { + LinkAllocationSites(); + LogNewMapEvents(); + } + result = handle(HeapObject::cast(root), local_isolate); + if (is_main_thread()) { + allocator()->RegisterDeserializedObjectsForBlackAllocation(); + } } + + Rehash(); CommitPostProcessedObjects(); return scope.CloseAndEscape(result); } -void ObjectDeserializer::FlushICache() { - DCHECK(deserializing_user_code()); - for (Code code : new_code_objects()) { - // Record all references to embedded objects in the new code object. -#ifndef V8_DISABLE_WRITE_BARRIERS - WriteBarrierForCode(code); -#endif - FlushInstructionCache(code.raw_instruction_start(), - code.raw_instruction_size()); - } -} - void ObjectDeserializer::CommitPostProcessedObjects() { - CHECK_LE(new_internalized_strings().size(), kMaxInt); - StringTable::EnsureCapacityForDeserialization( - isolate(), static_cast<int>(new_internalized_strings().size())); - for (Handle<String> string : new_internalized_strings()) { - DisallowHeapAllocation no_gc; - StringTableInsertionKey key(*string); - StringTable::AddKeyNoResize(isolate(), &key); + if (is_main_thread()) { + CHECK_LE(new_internalized_strings().size(), kMaxInt); + StringTable::EnsureCapacityForDeserialization( + isolate(), static_cast<int>(new_internalized_strings().size())); + for (Handle<String> string : new_internalized_strings()) { + DisallowHeapAllocation no_gc; + StringTableInsertionKey key(*string); + StringTable::AddKeyNoResize(isolate(), &key); + } + + for (Handle<JSArrayBuffer> buffer : new_off_heap_array_buffers()) { + uint32_t store_index = buffer->GetBackingStoreRefForDeserialization(); + auto bs = backing_store(store_index); + SharedFlag shared = + bs && bs->is_shared() ? SharedFlag::kShared : SharedFlag::kNotShared; + buffer->Setup(shared, bs); + } + } else { + CHECK_EQ(new_internalized_strings().size(), 0); + CHECK_EQ(new_off_heap_array_buffers().size(), 0); } - Heap* heap = isolate()->heap(); - Factory* factory = isolate()->factory(); for (Handle<Script> script : new_scripts()) { // Assign a new script id to avoid collision. - script->set_id(isolate()->GetNextScriptId()); + script->set_id(local_isolate()->GetNextScriptId()); LogScriptEvents(*script); // Add script to list. - Handle<WeakArrayList> list = factory->script_list(); - list = WeakArrayList::AddToEnd(isolate(), list, - MaybeObjectHandle::Weak(script)); - heap->SetRootScriptList(*list); - } - - for (Handle<JSArrayBuffer> buffer : new_off_heap_array_buffers()) { - uint32_t store_index = buffer->GetBackingStoreRefForDeserialization(); - auto bs = backing_store(store_index); - SharedFlag shared = - bs && bs->is_shared() ? SharedFlag::kShared : SharedFlag::kNotShared; - buffer->Setup(shared, bs); + if (is_main_thread()) { + Handle<WeakArrayList> list = isolate()->factory()->script_list(); + list = WeakArrayList::AddToEnd(isolate(), list, + MaybeObjectHandle::Weak(script)); + isolate()->heap()->SetRootScriptList(*list); + } else { + local_isolate().off_thread()->heap()->AddToScriptList(script); + } } } |