Skip to content

Commit c934649

Browse files
StefanStojanovictargos
authored andcommitted
deps: patch V8 to support compilation with MSVC
Co-Authored-By: Michaël Zasso <[email protected]>
1 parent 3a0416d commit c934649

File tree

7 files changed

+21
-9
lines changed

7 files changed

+21
-9
lines changed

Diff for: common.gypi

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737

3838
# Reset this number to 0 on major V8 upgrades.
3939
# Increment by one for each non-official patch applied to deps/v8.
40-
'v8_embedder_string': '-node.3',
40+
'v8_embedder_string': '-node.4',
4141

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

Diff for: deps/v8/src/compiler/js-heap-broker.cc

+1-1
Original file line numberDiff line numberDiff line change
@@ -879,7 +879,7 @@ ElementAccessFeedback const& JSHeapBroker::ProcessFeedbackMapsForElementAccess(
879879
Tagged<Map> transition_target;
880880

881881
// Don't generate elements kind transitions from stable maps.
882-
if (!map.is_stable()) {
882+
if (!map.is_stable() && possible_transition_targets.begin() != possible_transition_targets.end()) {
883883
// The lock is needed for UnusedPropertyFields (called deep inside
884884
// FindElementsKindTransitionedMap).
885885
MapUpdaterGuardIfNeeded mumd_scope(this);

Diff for: deps/v8/src/execution/frames.h

+3-3
Original file line numberDiff line numberDiff line change
@@ -1292,11 +1292,11 @@ class WasmFrame : public TypedFrame {
12921292
FrameSummaries Summarize() const override;
12931293

12941294
static WasmFrame* cast(StackFrame* frame) {
1295-
DCHECK(frame->is_wasm()
12961295
#ifdef V8_ENABLE_DRUMBRAKE
1297-
&& !frame->is_wasm_interpreter_entry()
1296+
DCHECK(frame->is_wasm() && !frame->is_wasm_interpreter_entry());
1297+
#else
1298+
DCHECK(frame->is_wasm());
12981299
#endif // V8_ENABLE_DRUMBRAKE
1299-
);
13001300
return static_cast<WasmFrame*>(frame);
13011301
}
13021302

Diff for: deps/v8/src/execution/isolate.h

+4
Original file line numberDiff line numberDiff line change
@@ -564,10 +564,14 @@ using DebugObjectCache = std::vector<Handle<HeapObject>>;
564564
#define THREAD_LOCAL_TOP_ADDRESS(type, name) \
565565
inline type* name##_address() { return &thread_local_top()->name##_; }
566566

567+
#if defined(_MSC_VER)
568+
extern thread_local Isolate* g_current_isolate_ V8_CONSTINIT;
569+
#else
567570
// Do not use this variable directly, use Isolate::Current() instead.
568571
// Defined outside of Isolate because Isolate uses V8_EXPORT_PRIVATE.
569572
__attribute__((tls_model(V8_TLS_MODEL))) extern thread_local Isolate*
570573
g_current_isolate_ V8_CONSTINIT;
574+
#endif // defined(_MSC_VER)
571575

572576
// HiddenFactory exists so Isolate can privately inherit from it without making
573577
// Factory's members available to Isolate directly.

Diff for: deps/v8/src/heap/local-heap.h

+4
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,14 @@ class MarkingBarrier;
3333
class MutablePageMetadata;
3434
class Safepoint;
3535

36+
#if defined(_MSC_VER)
37+
extern thread_local LocalHeap* g_current_local_heap_ V8_CONSTINIT;
38+
#else
3639
// Do not use this variable directly, use LocalHeap::Current() instead.
3740
// Defined outside of LocalHeap because LocalHeap uses V8_EXPORT_PRIVATE.
3841
__attribute__((tls_model(V8_TLS_MODEL))) extern thread_local LocalHeap*
3942
g_current_local_heap_ V8_CONSTINIT;
43+
#endif // defined(_MSC_VER)
4044

4145
// LocalHeap is used by the GC to track all threads with heap access in order to
4246
// stop them before performing a collection. LocalHeaps can be either Parked or

Diff for: deps/v8/src/objects/tagged-field.h

-2
Original file line numberDiff line numberDiff line change
@@ -121,12 +121,10 @@ static_assert(sizeof(UnalignedDoubleMember) == sizeof(double));
121121
#define FLEXIBLE_ARRAY_MEMBER(Type, name) \
122122
using FlexibleDataReturnType = Type[0]; \
123123
FlexibleDataReturnType& name() { \
124-
static_assert(alignof(Type) <= alignof(decltype(*this))); \
125124
using ReturnType = Type[0]; \
126125
return reinterpret_cast<ReturnType&>(*(this + 1)); \
127126
} \
128127
const FlexibleDataReturnType& name() const { \
129-
static_assert(alignof(Type) <= alignof(decltype(*this))); \
130128
using ReturnType = Type[0]; \
131129
return reinterpret_cast<const ReturnType&>(*(this + 1)); \
132130
} \

Diff for: deps/v8/src/wasm/wasm-objects.cc

+8-2
Original file line numberDiff line numberDiff line change
@@ -2763,15 +2763,21 @@ DirectHandle<WasmExportedFunction> WasmExportedFunction::New(
27632763
DirectHandle<WasmFuncRef> func_ref,
27642764
DirectHandle<WasmInternalFunction> internal_function, int arity,
27652765
DirectHandle<Code> export_wrapper) {
2766+
#if V8_ENABLE_DRUMBRAKE
27662767
DCHECK(CodeKind::JS_TO_WASM_FUNCTION == export_wrapper->kind() ||
27672768
(export_wrapper->is_builtin() &&
27682769
(export_wrapper->builtin_id() == Builtin::kJSToWasmWrapper ||
2769-
#if V8_ENABLE_DRUMBRAKE
27702770
export_wrapper->builtin_id() ==
27712771
Builtin::kGenericJSToWasmInterpreterWrapper ||
2772-
#endif // V8_ENABLE_DRUMBRAKE
27732772
export_wrapper->builtin_id() == Builtin::kWasmPromising ||
27742773
export_wrapper->builtin_id() == Builtin::kWasmStressSwitch)));
2774+
#else
2775+
DCHECK(CodeKind::JS_TO_WASM_FUNCTION == export_wrapper->kind() ||
2776+
(export_wrapper->is_builtin() &&
2777+
(export_wrapper->builtin_id() == Builtin::kJSToWasmWrapper ||
2778+
export_wrapper->builtin_id() == Builtin::kWasmPromising ||
2779+
export_wrapper->builtin_id() == Builtin::kWasmStressSwitch)));
2780+
#endif // V8_ENABLE_DRUMBRAKE
27752781
int func_index = internal_function->function_index();
27762782
Factory* factory = isolate->factory();
27772783
DirectHandle<Map> rtt;

0 commit comments

Comments
 (0)