From 8cc71e090b340286290c6491e70f6e8fa93dc3d9 Mon Sep 17 00:00:00 2001 From: StefanStojanovic Date: Sun, 21 Apr 2024 11:15:04 +0200 Subject: [PATCH] deps: patch V8 to support compilation with MSVC MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Michaƫl Zasso PR-URL: https://github.com/nodejs/node/pull/54536 Reviewed-By: Antoine du Hamel Reviewed-By: Jiawen Geng Reviewed-By: Marco Ippolito Reviewed-By: Richard Lau --- common.gypi | 2 +- deps/v8/src/compiler/js-heap-broker.cc | 2 +- deps/v8/src/execution/frames.h | 6 +++--- deps/v8/src/objects/tagged-field.h | 2 -- deps/v8/src/wasm/wasm-objects.cc | 10 ++++++++-- 5 files changed, 13 insertions(+), 9 deletions(-) diff --git a/common.gypi b/common.gypi index b5e4ea18728..bd91c2692f7 100644 --- a/common.gypi +++ b/common.gypi @@ -36,7 +36,7 @@ # Reset this number to 0 on major V8 upgrades. # Increment by one for each non-official patch applied to deps/v8. - 'v8_embedder_string': '-node.3', + 'v8_embedder_string': '-node.4', ##### V8 defaults for Node.js ##### diff --git a/deps/v8/src/compiler/js-heap-broker.cc b/deps/v8/src/compiler/js-heap-broker.cc index 2d24ee14532..213dd4f023a 100644 --- a/deps/v8/src/compiler/js-heap-broker.cc +++ b/deps/v8/src/compiler/js-heap-broker.cc @@ -879,7 +879,7 @@ ElementAccessFeedback const& JSHeapBroker::ProcessFeedbackMapsForElementAccess( Tagged transition_target; // Don't generate elements kind transitions from stable maps. - if (!map.is_stable()) { + if (!map.is_stable() && possible_transition_targets.begin() != possible_transition_targets.end()) { // The lock is needed for UnusedPropertyFields (called deep inside // FindElementsKindTransitionedMap). MapUpdaterGuardIfNeeded mumd_scope(this); diff --git a/deps/v8/src/execution/frames.h b/deps/v8/src/execution/frames.h index 95ce9b1f527..569cfef6610 100644 --- a/deps/v8/src/execution/frames.h +++ b/deps/v8/src/execution/frames.h @@ -1292,11 +1292,11 @@ class WasmFrame : public TypedFrame { FrameSummaries Summarize() const override; static WasmFrame* cast(StackFrame* frame) { - DCHECK(frame->is_wasm() #ifdef V8_ENABLE_DRUMBRAKE - && !frame->is_wasm_interpreter_entry() + DCHECK(frame->is_wasm() && !frame->is_wasm_interpreter_entry()); +#else + DCHECK(frame->is_wasm()); #endif // V8_ENABLE_DRUMBRAKE - ); return static_cast(frame); } diff --git a/deps/v8/src/objects/tagged-field.h b/deps/v8/src/objects/tagged-field.h index 0d0654b8467..0a11067b43b 100644 --- a/deps/v8/src/objects/tagged-field.h +++ b/deps/v8/src/objects/tagged-field.h @@ -121,12 +121,10 @@ static_assert(sizeof(UnalignedDoubleMember) == sizeof(double)); #define FLEXIBLE_ARRAY_MEMBER(Type, name) \ using FlexibleDataReturnType = Type[0]; \ FlexibleDataReturnType& name() { \ - static_assert(alignof(Type) <= alignof(decltype(*this))); \ using ReturnType = Type[0]; \ return reinterpret_cast(*(this + 1)); \ } \ const FlexibleDataReturnType& name() const { \ - static_assert(alignof(Type) <= alignof(decltype(*this))); \ using ReturnType = Type[0]; \ return reinterpret_cast(*(this + 1)); \ } \ diff --git a/deps/v8/src/wasm/wasm-objects.cc b/deps/v8/src/wasm/wasm-objects.cc index 49eb1149673..f24a4a2c6ea 100644 --- a/deps/v8/src/wasm/wasm-objects.cc +++ b/deps/v8/src/wasm/wasm-objects.cc @@ -2697,15 +2697,21 @@ Handle WasmExportedFunction::New( DirectHandle func_ref, DirectHandle internal_function, int arity, DirectHandle export_wrapper) { +#if V8_ENABLE_DRUMBRAKE DCHECK(CodeKind::JS_TO_WASM_FUNCTION == export_wrapper->kind() || (export_wrapper->is_builtin() && (export_wrapper->builtin_id() == Builtin::kJSToWasmWrapper || -#if V8_ENABLE_DRUMBRAKE export_wrapper->builtin_id() == Builtin::kGenericJSToWasmInterpreterWrapper || -#endif // V8_ENABLE_DRUMBRAKE export_wrapper->builtin_id() == Builtin::kWasmPromising || export_wrapper->builtin_id() == Builtin::kWasmStressSwitch))); +#else + DCHECK(CodeKind::JS_TO_WASM_FUNCTION == export_wrapper->kind() || + (export_wrapper->is_builtin() && + (export_wrapper->builtin_id() == Builtin::kJSToWasmWrapper || + export_wrapper->builtin_id() == Builtin::kWasmPromising || + export_wrapper->builtin_id() == Builtin::kWasmStressSwitch))); +#endif // V8_ENABLE_DRUMBRAKE int func_index = internal_function->function_index(); Factory* factory = isolate->factory(); DirectHandle rtt;