Skip to content

Commit d082d66

Browse files
committed
deps: V8: backport 7b677a590459
Original commit message: Reland "[cache] Don't compare host defined options if the script was deserialized" This is a reland of commit b9cfb8b7cfdbf195c3baf87735865948dfa5907e Original change's description: > [cache] Don't compare host defined options if the script was deserialized > > We don't serialize host defined options (see > CodeSerializer::SerializeObjectImpl()). > > Change-Id: Icab9fe910a5ec93b5eacc4869aba75034ad8b447 > Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/4805329 > Reviewed-by: Camillo Bruni <[email protected]> > Reviewed-by: Toon Verwaest <[email protected]> > Commit-Queue: Tao Pan <[email protected]> > Cr-Commit-Position: refs/heads/main@{#90698} Change-Id: I7ea5e9355056104ebd25b385aba63c1233d42260 Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/4998581 Reviewed-by: Camillo Bruni <[email protected]> Reviewed-by: Toon Verwaest <[email protected]> Commit-Queue: Tao Pan <[email protected]> Cr-Commit-Position: refs/heads/main@{#90711} Refs: v8/v8@7b677a5
1 parent 595e71b commit d082d66

File tree

6 files changed

+22
-3
lines changed

6 files changed

+22
-3
lines changed

common.gypi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636

3737
# Reset this number to 0 on major V8 upgrades.
3838
# Increment by one for each non-official patch applied to deps/v8.
39-
'v8_embedder_string': '-node.25',
39+
'v8_embedder_string': '-node.26',
4040

4141
##### V8 defaults for Node.js #####
4242

deps/v8/src/objects/compilation-cache-table.cc

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -268,6 +268,13 @@ bool ScriptCacheKey::MatchesOrigin(Script script) {
268268
return false;
269269
}
270270

271+
// Don't compare host options if the script was deserialized because we didn't
272+
// serialize host options (see CodeSerializer::SerializeObjectImpl())
273+
if (script.deserialized() &&
274+
script.host_defined_options() ==
275+
ReadOnlyRoots(isolate_).empty_fixed_array()) {
276+
return true;
277+
}
271278
// TODO(cbruni, chromium:1244145): Remove once migrated to the context
272279
Handle<Object> maybe_host_defined_options;
273280
if (!host_defined_options_.ToHandle(&maybe_host_defined_options)) {

deps/v8/src/objects/script-inl.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,12 @@ void Script::set_produce_compile_hints(bool produce_compile_hints) {
135135
set_flags(ProduceCompileHintsBit::update(flags(), produce_compile_hints));
136136
}
137137

138+
bool Script::deserialized() const { return DeserializedBit::decode(flags()); }
139+
140+
void Script::set_deserialized(bool value) {
141+
set_flags(DeserializedBit::update(flags(), value));
142+
}
143+
138144
bool Script::is_repl_mode() const { return IsReplModeBit::decode(flags()); }
139145

140146
void Script::set_is_repl_mode(bool value) {

deps/v8/src/objects/script.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,9 @@ class Script : public TorqueGeneratedScript<Script, Struct> {
124124
inline bool produce_compile_hints() const;
125125
inline void set_produce_compile_hints(bool produce_compile_hints);
126126

127+
inline bool deserialized() const;
128+
inline void set_deserialized(bool value);
129+
127130
// [compilation_state]: determines whether the script has already been
128131
// compiled. Encoded in the 'flags' field.
129132
inline CompilationState compilation_state();

deps/v8/src/objects/script.tq

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ bitfield struct ScriptFlags extends uint31 {
1313
// Whether an instrumentation breakpoint is set for this script (wasm only).
1414
break_on_entry: bool: 1 bit;
1515
produce_compile_hints: bool: 1 bit;
16+
deserialized: bool: 1 bit;
1617
}
1718

1819
extern class Script extends Struct {

deps/v8/src/snapshot/code-serializer.cc

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -462,8 +462,9 @@ MaybeHandle<SharedFunctionInfo> CodeSerializer::Deserialize(
462462
result = merge.CompleteMergeInForeground(isolate, new_script);
463463
}
464464

465-
BaselineBatchCompileIfSparkplugCompiled(isolate,
466-
Script::cast(result->script()));
465+
Script script = Script::cast(result->script());
466+
script.set_deserialized(true);
467+
BaselineBatchCompileIfSparkplugCompiled(isolate, script);
467468
if (v8_flags.profile_deserialization) {
468469
double ms = timer.Elapsed().InMillisecondsF();
469470
int length = cached_data->length();
@@ -595,6 +596,7 @@ MaybeHandle<SharedFunctionInfo> CodeSerializer::FinishOffThreadDeserialize(
595596
// Fix up the script list to include the newly deserialized script.
596597
Handle<WeakArrayList> list = isolate->factory()->script_list();
597598
for (Handle<Script> script : data.scripts) {
599+
script->set_deserialized(true);
598600
BaselineBatchCompileIfSparkplugCompiled(isolate, *script);
599601
DCHECK(data.persistent_handles->Contains(script.location()));
600602
list = WeakArrayList::AddToEnd(isolate, list,

0 commit comments

Comments
 (0)