diff --git a/patches/v8/.patches b/patches/v8/.patches index 80aaafd7cf..7f06612a19 100644 --- a/patches/v8/.patches +++ b/patches/v8/.patches @@ -3,3 +3,4 @@ do_not_export_private_v8_symbols_on_windows.patch fix_build_deprecated_attribute_for_older_msvc_versions.patch fix_disable_implies_dcheck_for_node_stream_array_buffers.patch chore_allow_customizing_microtask_policy_per_context.patch +fix_set_proper_instruction_start_for_builtin.patch diff --git a/patches/v8/fix_set_proper_instruction_start_for_builtin.patch b/patches/v8/fix_set_proper_instruction_start_for_builtin.patch new file mode 100644 index 0000000000..e2f969576c --- /dev/null +++ b/patches/v8/fix_set_proper_instruction_start_for_builtin.patch @@ -0,0 +1,35 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: mjhenkes +Date: Mon, 22 May 2023 15:52:36 -0500 +Subject: Fix: Set proper instruction start for builtin + +Added in this CL: https://chromium-review.googlesource.com/c/v8/v8/+/4547712 + +This patch makes the mksnapshot fix available sooner. + +This patch can be removed when v8 reaches version 11.6.21 + +diff --git a/src/execution/isolate.cc b/src/execution/isolate.cc +index 40d1b394ef30c7cdf1d5aa05a051d3a497abf28e..9b646b1527e9e6595cc2530983feb0279452c7dc 100644 +--- a/src/execution/isolate.cc ++++ b/src/execution/isolate.cc +@@ -3904,14 +3904,16 @@ void FinalizeBuiltinCodeObjects(Isolate* isolate) { + DCHECK_NOT_NULL(isolate->embedded_blob_data()); + DCHECK_NE(0, isolate->embedded_blob_data_size()); + ++ EmbeddedData d = EmbeddedData::FromBlob(isolate); + HandleScope scope(isolate); + static_assert(Builtins::kAllBuiltinsAreIsolateIndependent); + for (Builtin builtin = Builtins::kFirst; builtin <= Builtins::kLast; + ++builtin) { + Handle old_code = isolate->builtins()->code_handle(builtin); +- // Note we use `instruction_start` as given by the old code object (instead +- // of asking EmbeddedData) due to MaybeRemapEmbeddedBuiltinsIntoCodeRange. +- Address instruction_start = old_code->instruction_start(); ++ // Note that `old_code.instruction_start` might point to `old_code`'s ++ // InstructionStream which might be GCed once we replace the old code ++ // with the new code. ++ Address instruction_start = d.InstructionStartOf(builtin); + Handle new_code = isolate->factory()->NewCodeObjectForEmbeddedBuiltin( + old_code, instruction_start); +