Commit 353211a5 authored by Marja Hölttä's avatar Marja Hölttä Committed by V8 LUCI CQ

[web snap] Perf fix: streamline setting properties in the global object

Bug: v8:11525
Change-Id: I765923f6d15959a7fc6ceddd9a6d60338316300a
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3416246Reviewed-by: 's avatarCamillo Bruni <cbruni@chromium.org>
Commit-Queue: Marja Hölttä <marja@chromium.org>
Cr-Commit-Position: refs/heads/main@{#78777}
parent aefa66da
...@@ -1765,8 +1765,11 @@ void WebSnapshotDeserializer::DeserializeExports() { ...@@ -1765,8 +1765,11 @@ void WebSnapshotDeserializer::DeserializeExports() {
dictionary = GlobalDictionary::EnsureCapacity( dictionary = GlobalDictionary::EnsureCapacity(
isolate_, dictionary, dictionary->NumberOfElements() + count, isolate_, dictionary, dictionary->NumberOfElements() + count,
AllocationType::kYoung); AllocationType::kYoung);
global->set_global_dictionary(*dictionary, kReleaseStore);
// TODO(v8:11525): The code below skips checks, in particular
// LookupIterator::UpdateProtectors and
// LookupIterator::ExtendingNonExtensible.
InternalIndex entry = InternalIndex::NotFound();
for (uint32_t i = 0; i < count; ++i) { for (uint32_t i = 0; i < count; ++i) {
Handle<String> export_name = ReadString(true); Handle<String> export_name = ReadString(true);
Handle<Object> export_value; Handle<Object> export_value;
...@@ -1783,13 +1786,19 @@ void WebSnapshotDeserializer::DeserializeExports() { ...@@ -1783,13 +1786,19 @@ void WebSnapshotDeserializer::DeserializeExports() {
return; return;
} }
auto result = PropertyDetails property_details =
Object::SetProperty(isolate_, global, export_name, export_value); PropertyDetails(PropertyKind::kData, NONE,
if (result.is_null()) { PropertyCell::InitialType(isolate_, export_value));
Throw("Setting global property failed"); Handle<PropertyCell> transition_cell = isolate_->factory()->NewPropertyCell(
return; export_name, property_details, export_value);
}
dictionary =
GlobalDictionary::Add(isolate_, dictionary, export_name,
transition_cell, property_details, &entry);
} }
global->set_global_dictionary(*dictionary, kReleaseStore);
JSObject::InvalidatePrototypeChains(global->map(isolate_));
} }
void WebSnapshotDeserializer::ReadValue( void WebSnapshotDeserializer::ReadValue(
......
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