Commit 418aa66f authored by Camillo Bruni's avatar Camillo Bruni Committed by V8 LUCI CQ

Reland "[web snapshot] Dehandlify more parts of the deserializer"

This is a reland of 7ddacd68

- Allocate JSObject only after the properties are fully deserialized

Original change's description:
> [web snapshot] Dehandlify more parts of the deserializer
>
> - Use Heap::AddGCEpilogueCallback to update often accessed FixedArrays
>   in the WebSnapshotDeserializer.
> - ReadValue returns now a raw value to avoid handle creation in more
>   cases
> - Drop representation support for now in ReadValue
> - Avoid a few more handles when setting up objects
>
> Bug v8:11525
>
> Change-Id: I6955b56887834bc655bdaa9c390016d9a17db82d
> Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3416242
> Reviewed-by: Marja Hölttä <marja@chromium.org>
> Commit-Queue: Camillo Bruni <cbruni@chromium.org>
> Cr-Commit-Position: refs/heads/main@{#78862}

Change-Id: I2b64e59df02d4d723f76e157aad045f94a22d2b9
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3427202
Auto-Submit: Camillo Bruni <cbruni@chromium.org>
Reviewed-by: 's avatarMarja Hölttä <marja@chromium.org>
Commit-Queue: Marja Hölttä <marja@chromium.org>
Cr-Commit-Position: refs/heads/main@{#78902}
parent 8370387f
This diff is collapsed.
...@@ -243,6 +243,14 @@ class V8_EXPORT WebSnapshotDeserializer ...@@ -243,6 +243,14 @@ class V8_EXPORT WebSnapshotDeserializer
uint32_t array_count() const { return array_count_; } uint32_t array_count() const { return array_count_; }
uint32_t object_count() const { return object_count_; } uint32_t object_count() const { return object_count_; }
static void UpdatePointersCallback(v8::Isolate* isolate, v8::GCType type,
v8::GCCallbackFlags flags,
void* deserializer) {
reinterpret_cast<WebSnapshotDeserializer*>(deserializer)->UpdatePointers();
}
void UpdatePointers();
private: private:
WebSnapshotDeserializer(Isolate* isolate, Handle<Object> script_name, WebSnapshotDeserializer(Isolate* isolate, Handle<Object> script_name,
base::Vector<const uint8_t> buffer); base::Vector<const uint8_t> buffer);
...@@ -255,7 +263,7 @@ class V8_EXPORT WebSnapshotDeserializer ...@@ -255,7 +263,7 @@ class V8_EXPORT WebSnapshotDeserializer
WebSnapshotDeserializer& operator=(const WebSnapshotDeserializer&) = delete; WebSnapshotDeserializer& operator=(const WebSnapshotDeserializer&) = delete;
void DeserializeStrings(); void DeserializeStrings();
Handle<String> ReadString(bool internalize = false); String ReadString(bool internalize = false);
void DeserializeMaps(); void DeserializeMaps();
void DeserializeContexts(); void DeserializeContexts();
Handle<ScopeInfo> CreateScopeInfo(uint32_t variable_count, bool has_parent, Handle<ScopeInfo> CreateScopeInfo(uint32_t variable_count, bool has_parent,
...@@ -269,31 +277,47 @@ class V8_EXPORT WebSnapshotDeserializer ...@@ -269,31 +277,47 @@ class V8_EXPORT WebSnapshotDeserializer
void DeserializeArrays(); void DeserializeArrays();
void DeserializeObjects(); void DeserializeObjects();
void DeserializeExports(); void DeserializeExports();
void ReadValue( Object ReadValue(
Handle<Object>& value, Representation& representation,
Handle<HeapObject> object_for_deferred_reference = Handle<HeapObject>(), Handle<HeapObject> object_for_deferred_reference = Handle<HeapObject>(),
uint32_t index_for_deferred_reference = 0); uint32_t index_for_deferred_reference = 0);
void ReadFunctionPrototype(Handle<JSFunction> function); void ReadFunctionPrototype(Handle<JSFunction> function);
bool SetFunctionPrototype(JSFunction function, JSReceiver prototype); bool SetFunctionPrototype(JSFunction function, JSReceiver prototype);
void AddDeferredReference(Handle<HeapObject> container, uint32_t index, HeapObject AddDeferredReference(Handle<HeapObject> container, uint32_t index,
ValueType target_type, ValueType target_type,
uint32_t target_object_index); uint32_t target_object_index);
void ProcessDeferredReferences(); void ProcessDeferredReferences();
// Not virtual, on purpose (because it doesn't need to be). // Not virtual, on purpose (because it doesn't need to be).
void Throw(const char* message); void Throw(const char* message);
Handle<FixedArray> strings_; Handle<FixedArray> strings_handle_;
Handle<FixedArray> maps_; FixedArray strings_;
Handle<FixedArray> contexts_;
Handle<FixedArray> functions_; Handle<FixedArray> maps_handle_;
Handle<FixedArray> classes_; FixedArray maps_;
Handle<FixedArray> arrays_;
Handle<FixedArray> objects_; Handle<FixedArray> contexts_handle_;
FixedArray contexts_;
Handle<FixedArray> functions_handle_;
FixedArray functions_;
Handle<FixedArray> classes_handle_;
FixedArray classes_;
Handle<FixedArray> arrays_handle_;
FixedArray arrays_;
Handle<FixedArray> objects_handle_;
FixedArray objects_;
Handle<ArrayList> deferred_references_; Handle<ArrayList> deferred_references_;
Handle<WeakFixedArray> shared_function_infos_; Handle<WeakFixedArray> shared_function_infos_handle_;
WeakFixedArray shared_function_infos_;
Handle<ObjectHashTable> shared_function_info_table_; Handle<ObjectHashTable> shared_function_info_table_;
Handle<Script> script_; Handle<Script> script_;
Handle<Object> script_name_; Handle<Object> script_name_;
......
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