Skip to content

Commit 28bf2ca

Browse files
committed
Revert "V8 v12.2 Windows patch (nodejs#13)"
This reverts commit 1b8b110.
1 parent 59e2848 commit 28bf2ca

30 files changed

+129
-121
lines changed

deps/v8/src/builtins/builtins-collections-gen.cc

+4-3
Original file line numberDiff line numberDiff line change
@@ -2782,9 +2782,10 @@ TNode<Word32T> WeakCollectionsBuiltinsAssembler::ShouldShrink(
27822782

27832783
TNode<IntPtrT> WeakCollectionsBuiltinsAssembler::ValueIndexFromKeyIndex(
27842784
TNode<IntPtrT> key_index) {
2785-
return IntPtrAdd(key_index,
2786-
IntPtrConstant(EphemeronHashTable::ShapeT::kEntryValueIndex -
2787-
EphemeronHashTable::kEntryKeyIndex));
2785+
return IntPtrAdd(
2786+
key_index,
2787+
IntPtrConstant(EphemeronHashTable::TodoShape::kEntryValueIndex -
2788+
EphemeronHashTable::kEntryKeyIndex));
27882789
}
27892790

27902791
TF_BUILTIN(WeakMapConstructor, WeakCollectionsBuiltinsAssembler) {

deps/v8/src/codegen/code-stub-assembler.cc

+1-1
Original file line numberDiff line numberDiff line change
@@ -9455,7 +9455,7 @@ void CodeStubAssembler::NameDictionaryLookup(
94559455
CAST(UnsafeLoadFixedArrayElement(dictionary, index));
94569456
GotoIf(TaggedEqual(current, undefined), if_not_found);
94579457
if (mode == kFindExisting) {
9458-
if (Dictionary::ShapeT::kMatchNeedsHoleCheck) {
9458+
if (Dictionary::TodoShape::kMatchNeedsHoleCheck) {
94599459
GotoIf(TaggedEqual(current, TheHoleConstant()), &next_probe);
94609460
}
94619461
current = LoadName<Dictionary>(current);

deps/v8/src/compiler/turboshaft/assembler.h

+2-3
Original file line numberDiff line numberDiff line change
@@ -3934,9 +3934,8 @@ class TSAssembler
39343934
: public Assembler<reducer_list<TurboshaftAssemblerOpInterface, Reducers...,
39353935
TSReducerBase>> {
39363936
public:
3937-
explicit TSAssembler(Graph& input_graph, Graph& output_graph,
3938-
Zone* phase_zone)
3939-
: Assembler(input_graph, output_graph, phase_zone) {}
3937+
using Assembler<reducer_list<TurboshaftAssemblerOpInterface, Reducers...,
3938+
TSReducerBase>>::Assembler;
39403939
};
39413940

39423941
#include "src/compiler/turboshaft/undef-assembler-macros.inc"

deps/v8/src/compiler/turboshaft/code-elimination-and-simplification-phase.cc

+1-2
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,7 @@ void CodeEliminationAndSimplificationPhase::Run(Zone* temp_zone) {
3232
// (which, for simplificy, doesn't use the Assembler helper
3333
// methods, but only calls Next::ReduceLoad/Store).
3434
DuplicationOptimizationReducer,
35-
ValueNumberingReducer,
36-
VariableReducerHotfix>::Run<false>(temp_zone);
35+
ValueNumberingReducer>::Run(temp_zone);
3736
}
3837

3938
} // namespace v8::internal::compiler::turboshaft

deps/v8/src/compiler/turboshaft/copying-phase.h

+9-23
Original file line numberDiff line numberDiff line change
@@ -36,16 +36,6 @@ struct PaddingSpace {
3636
V8_EXPORT_PRIVATE std::ostream& operator<<(std::ostream& os,
3737
PaddingSpace padding);
3838

39-
template <class Next>
40-
class VariableReducerHotfix : public Next {
41-
public:
42-
void SetVariable(Variable var, OpIndex new_index) {}
43-
Variable NewLoopInvariantVariable(MaybeRegisterRepresentation rep) { return Variable(); }
44-
45-
OpIndex GetVariable(Variable var) { return OpIndex(); }
46-
OpIndex GetPredecessorValue(Variable var, int predecessor_index) { return OpIndex(); }
47-
};
48-
4939
template <typename Next>
5040
class ReducerBaseForwarder;
5141
template <typename Next>
@@ -56,9 +46,6 @@ class GraphVisitor : public Next {
5646
template <typename N>
5747
friend class ReducerBaseForwarder;
5848

59-
private:
60-
bool contains_variable_reducer_;
61-
6249
public:
6350
TURBOSHAFT_REDUCER_BOILERPLATE()
6451

@@ -79,8 +66,7 @@ class GraphVisitor : public Next {
7966
// `trace_reduction` is a template parameter to avoid paying for tracing at
8067
// runtime.
8168
template <bool trace_reduction>
82-
void VisitGraph(bool contains_variable_reducer) {
83-
contains_variable_reducer_ = contains_variable_reducer;
69+
void VisitGraph() {
8470
Asm().Analyze();
8571

8672
// Creating initial old-to-new Block mapping.
@@ -191,7 +177,8 @@ class GraphVisitor : public Next {
191177
DCHECK(old_index.valid());
192178
OpIndex result = op_mapping_[old_index];
193179

194-
if (contains_variable_reducer_) {
180+
if constexpr (reducer_list_contains<typename Next::ReducerList,
181+
VariableReducer>::value) {
195182
if (!result.valid()) {
196183
// {op_mapping} doesn't have a mapping for {old_index}. The assembler
197184
// should provide the mapping.
@@ -1307,7 +1294,8 @@ class GraphVisitor : public Next {
13071294
DCHECK(Asm().input_graph().BelongsToThisGraph(old_index));
13081295
DCHECK_IMPLIES(new_index.valid(),
13091296
Asm().output_graph().BelongsToThisGraph(new_index));
1310-
if (contains_variable_reducer_) {
1297+
if constexpr (reducer_list_contains<typename Next::ReducerList,
1298+
VariableReducer>::value) {
13111299
if (current_block_needs_variables_) {
13121300
MaybeVariable var = GetVariableFor(old_index);
13131301
if (!var.has_value()) {
@@ -1404,31 +1392,29 @@ class TSAssembler;
14041392
template <template <class> class... Reducers>
14051393
class CopyingPhaseImpl {
14061394
public:
1407-
template <bool contains_variable_reducer>
14081395
static void Run(Graph& input_graph, Zone* phase_zone,
14091396
bool trace_reductions = false) {
14101397
TSAssembler<GraphVisitor, Reducers...> phase(
14111398
input_graph, input_graph.GetOrCreateCompanion(), phase_zone);
14121399
#ifdef DEBUG
14131400
if (trace_reductions) {
1414-
phase.template VisitGraph<true>(contains_variable_reducer);
1401+
phase.template VisitGraph<true>();
14151402
} else {
1416-
phase.template VisitGraph<false>(contains_variable_reducer);
1403+
phase.template VisitGraph<false>();
14171404
}
14181405
#else
1419-
phase.template VisitGraph<false>(contains_variable_reducer);
1406+
phase.template VisitGraph<false>();
14201407
#endif // DEBUG
14211408
}
14221409
};
14231410

14241411
template <template <typename> typename... Reducers>
14251412
class CopyingPhase {
14261413
public:
1427-
template <bool contains_variable_reducer>
14281414
static void Run(Zone* phase_zone) {
14291415
PipelineData& data = PipelineData::Get();
14301416
Graph& input_graph = data.graph();
1431-
CopyingPhaseImpl<Reducers...>::Run<contains_variable_reducer>(
1417+
CopyingPhaseImpl<Reducers...>::Run(
14321418
input_graph, phase_zone, data.info()->turboshaft_trace_reduction());
14331419
}
14341420
};

deps/v8/src/compiler/turboshaft/csa-optimize-phase.cc

+5-5
Original file line numberDiff line numberDiff line change
@@ -25,23 +25,23 @@ namespace v8::internal::compiler::turboshaft {
2525
void CsaLoadEliminationPhase::Run(Zone* temp_zone) {
2626
CopyingPhase<VariableReducer, MachineOptimizationReducer,
2727
RequiredOptimizationReducer,
28-
ValueNumberingReducer>::Run<true>(temp_zone);
28+
ValueNumberingReducer>::Run(temp_zone);
2929

3030
CopyingPhase<VariableReducer, LateLoadEliminationReducer,
3131
MachineOptimizationReducer, RequiredOptimizationReducer,
32-
ValueNumberingReducer>::Run<true>(temp_zone);
32+
ValueNumberingReducer>::Run(temp_zone);
3333
}
3434

3535
void CsaLateEscapeAnalysisPhase::Run(Zone* temp_zone) {
3636
CopyingPhase<VariableReducer, LateEscapeAnalysisReducer,
3737
MachineOptimizationReducer, RequiredOptimizationReducer,
38-
ValueNumberingReducer>::Run<true>(temp_zone);
38+
ValueNumberingReducer>::Run(temp_zone);
3939
}
4040

4141
void CsaBranchEliminationPhase::Run(Zone* temp_zone) {
4242
CopyingPhase<VariableReducer, MachineOptimizationReducer,
4343
BranchEliminationReducer, RequiredOptimizationReducer,
44-
ValueNumberingReducer>::Run<true>(temp_zone);
44+
ValueNumberingReducer>::Run(temp_zone);
4545
}
4646

4747
void CsaOptimizePhase::Run(Zone* temp_zone) {
@@ -51,7 +51,7 @@ void CsaOptimizePhase::Run(Zone* temp_zone) {
5151
CopyingPhase<VariableReducer, PretenuringPropagationReducer,
5252
MachineOptimizationReducer, MemoryOptimizationReducer,
5353
RequiredOptimizationReducer,
54-
ValueNumberingReducer>::Run<true>(temp_zone);
54+
ValueNumberingReducer>::Run(temp_zone);
5555
}
5656

5757
} // namespace v8::internal::compiler::turboshaft

deps/v8/src/compiler/turboshaft/debug-feature-lowering-phase.cc

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ namespace v8::internal::compiler::turboshaft {
1111

1212
void DebugFeatureLoweringPhase::Run(Zone* temp_zone) {
1313
#ifdef V8_ENABLE_DEBUG_CODE
14-
turboshaft::CopyingPhase<turboshaft::DebugFeatureLoweringReducer>::Run<false>(
14+
turboshaft::CopyingPhase<turboshaft::DebugFeatureLoweringReducer>::Run(
1515
temp_zone);
1616
#endif
1717
}

deps/v8/src/compiler/turboshaft/int64-lowering-phase.cc

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ void Int64LoweringPhase::Run(Zone* temp_zone) {
1616
#if V8_TARGET_ARCH_32_BIT
1717
turboshaft::CopyingPhase<
1818
turboshaft::Int64LoweringReducer, turboshaft::VariableReducer,
19-
turboshaft::RequiredOptimizationReducer>::Run<true>(temp_zone);
19+
turboshaft::RequiredOptimizationReducer>::Run(temp_zone);
2020
#else
2121
UNREACHABLE();
2222
#endif

deps/v8/src/compiler/turboshaft/loop-peeling-phase.cc

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ void LoopPeelingPhase::Run(Zone* temp_zone) {
2323
turboshaft::VariableReducer,
2424
turboshaft::MachineOptimizationReducer,
2525
turboshaft::RequiredOptimizationReducer,
26-
turboshaft::ValueNumberingReducer>::Run<true>(temp_zone);
26+
turboshaft::ValueNumberingReducer>::Run(temp_zone);
2727
}
2828

2929
} // namespace v8::internal::compiler::turboshaft

deps/v8/src/compiler/turboshaft/loop-unrolling-phase.cc

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ void LoopUnrollingPhase::Run(Zone* temp_zone) {
2222
turboshaft::VariableReducer,
2323
turboshaft::MachineOptimizationReducer,
2424
turboshaft::RequiredOptimizationReducer,
25-
turboshaft::ValueNumberingReducer>::Run<true>(temp_zone);
25+
turboshaft::ValueNumberingReducer>::Run(temp_zone);
2626
PipelineData::Get().clear_loop_unrolling_analyzer();
2727
}
2828
}

deps/v8/src/compiler/turboshaft/machine-lowering-phase.cc

+2-2
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,11 @@ void MachineLoweringPhase::Run(Zone* temp_zone) {
2020
CopyingPhase<DataViewReducer, VariableReducer, MachineLoweringReducer,
2121
FastApiCallReducer, RequiredOptimizationReducer,
2222
SelectLoweringReducer,
23-
MachineOptimizationReducer>::Run<true>(temp_zone);
23+
MachineOptimizationReducer>::Run(temp_zone);
2424
} else {
2525
CopyingPhase<DataViewReducer, VariableReducer, MachineLoweringReducer,
2626
FastApiCallReducer, RequiredOptimizationReducer,
27-
SelectLoweringReducer>::Run<true>(temp_zone);
27+
SelectLoweringReducer>::Run(temp_zone);
2828
}
2929
}
3030

deps/v8/src/compiler/turboshaft/machine-optimization-reducer.h

+40-10
Original file line numberDiff line numberDiff line change
@@ -1333,23 +1333,53 @@ class MachineOptimizationReducer : public Next {
13331333
if (matcher.MatchConstantShiftRightArithmeticShiftOutZeros(
13341334
left, &x, rep_w, &k1) &&
13351335
matcher.MatchIntegralWordConstant(right, rep_w, &k2) &&
1336-
CountLeadingSignBits(k2, rep_w) > k1 &&
1337-
matcher.Get(left).saturated_use_count.IsZero()) {
1338-
return __ Comparison(
1339-
x, __ WordConstant(base::bits::Unsigned(k2) << k1, rep_w), kind,
1340-
rep_w);
1336+
CountLeadingSignBits(k2, rep_w) > k1) {
1337+
if (matcher.Get(left).saturated_use_count.IsZero()) {
1338+
return __ Comparison(
1339+
x, __ WordConstant(base::bits::Unsigned(k2) << k1, rep_w), kind,
1340+
rep_w);
1341+
} else if constexpr (reducer_list_contains<
1342+
ReducerList, ValueNumberingReducer>::value) {
1343+
// If the shift has uses, we only apply the transformation if the
1344+
// result would be GVNed away.
1345+
OpIndex rhs =
1346+
__ WordConstant(base::bits::Unsigned(k2) << k1, rep_w);
1347+
static_assert(ComparisonOp::input_count == 2);
1348+
static_assert(sizeof(ComparisonOp) == 8);
1349+
base::SmallVector<OperationStorageSlot, 32> storage;
1350+
ComparisonOp* cmp =
1351+
CreateOperation<ComparisonOp>(storage, x, rhs, kind, rep_w);
1352+
if (__ WillGVNOp(*cmp)) {
1353+
return __ Comparison(x, rhs, kind, rep_w);
1354+
}
1355+
}
13411356
}
13421357
// k2 </<= (x >> k1) => (k2 << k1) </<= x if shifts reversible
13431358
// Only perform the transformation if the shift is not used yet, to
13441359
// avoid keeping both the shift and x alive.
13451360
if (matcher.MatchConstantShiftRightArithmeticShiftOutZeros(
13461361
right, &x, rep_w, &k1) &&
13471362
matcher.MatchIntegralWordConstant(left, rep_w, &k2) &&
1348-
CountLeadingSignBits(k2, rep_w) > k1 &&
1349-
matcher.Get(right).saturated_use_count.IsZero()) {
1350-
return __ Comparison(
1351-
__ WordConstant(base::bits::Unsigned(k2) << k1, rep_w), x, kind,
1352-
rep_w);
1363+
CountLeadingSignBits(k2, rep_w) > k1) {
1364+
if (matcher.Get(right).saturated_use_count.IsZero()) {
1365+
return __ Comparison(
1366+
__ WordConstant(base::bits::Unsigned(k2) << k1, rep_w), x, kind,
1367+
rep_w);
1368+
} else if constexpr (reducer_list_contains<
1369+
ReducerList, ValueNumberingReducer>::value) {
1370+
// If the shift has uses, we only apply the transformation if the
1371+
// result would be GVNed away.
1372+
OpIndex lhs =
1373+
__ WordConstant(base::bits::Unsigned(k2) << k1, rep_w);
1374+
static_assert(ComparisonOp::input_count == 2);
1375+
static_assert(sizeof(ComparisonOp) == 8);
1376+
base::SmallVector<OperationStorageSlot, 32> storage;
1377+
ComparisonOp* cmp =
1378+
CreateOperation<ComparisonOp>(storage, lhs, x, kind, rep_w);
1379+
if (__ WillGVNOp(*cmp)) {
1380+
return __ Comparison(lhs, x, kind, rep_w);
1381+
}
1382+
}
13531383
}
13541384
}
13551385
// Map 64bit to 32bit comparisons.

deps/v8/src/compiler/turboshaft/optimize-phase.cc

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ void OptimizePhase::Run(Zone* temp_zone) {
3030
turboshaft::MemoryOptimizationReducer,
3131
turboshaft::MachineOptimizationReducer,
3232
turboshaft::RequiredOptimizationReducer,
33-
turboshaft::ValueNumberingReducer>::Run<true>(temp_zone);
33+
turboshaft::ValueNumberingReducer>::Run(temp_zone);
3434
}
3535

3636
} // namespace v8::internal::compiler::turboshaft

deps/v8/src/compiler/turboshaft/simplified-lowering-phase.cc

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
namespace v8::internal::compiler::turboshaft {
1111

1212
void SimplifiedLoweringPhase::Run(Zone* temp_zone) {
13-
CopyingPhase<SimplifiedLoweringReducer, VariableReducerHotfix>::Run<false>(temp_zone);
13+
CopyingPhase<SimplifiedLoweringReducer>::Run(temp_zone);
1414
}
1515

1616
} // namespace v8::internal::compiler::turboshaft

deps/v8/src/compiler/turboshaft/simplified-lowering-reducer.h

+7-7
Original file line numberDiff line numberDiff line change
@@ -32,18 +32,18 @@ class SimplifiedLoweringReducer : public Next {
3232
OpIndex ig_index, const SpeculativeNumberBinopOp& op) {
3333
DCHECK_EQ(op.kind, SpeculativeNumberBinopOp::Kind::kSafeIntegerAdd);
3434

35-
OpIndex frame_state = MapImpl(op.frame_state());
36-
V<Word32> left = ProcessInput(MapImpl(op.left()), Rep::Word32(),
35+
OpIndex frame_state = Map(op.frame_state());
36+
V<Word32> left = ProcessInput(Map(op.left()), Rep::Word32(),
3737
CheckKind::kSigned32, frame_state);
38-
V<Word32> right = ProcessInput(MapImpl(op.right()), Rep::Word32(),
38+
V<Word32> right = ProcessInput(Map(op.right()), Rep::Word32(),
3939
CheckKind::kSigned32, frame_state);
4040

4141
V<Word32> result = __ OverflowCheckedBinop(
4242
left, right, OverflowCheckedBinopOp::Kind::kSignedAdd,
4343
WordRepresentation::Word32());
4444

4545
V<Word32> overflow = __ Projection(result, 1, Rep::Word32());
46-
__ DeoptimizeIf(overflow, MapImpl(op.frame_state()),
46+
__ DeoptimizeIf(overflow, Map(op.frame_state()),
4747
DeoptimizeReason::kOverflow, FeedbackSource{});
4848
return __ Projection(result, 0, Rep::Word32());
4949
}
@@ -52,10 +52,10 @@ class SimplifiedLoweringReducer : public Next {
5252
base::SmallVector<OpIndex, 8> return_values;
5353
for (OpIndex input : ret.return_values()) {
5454
return_values.push_back(
55-
ProcessInput(MapImpl(input), Rep::Tagged(), CheckKind::kNone, {}));
55+
ProcessInput(Map(input), Rep::Tagged(), CheckKind::kNone, {}));
5656
}
5757

58-
__ Return(MapImpl(ret.pop_count()), base::VectorOf(return_values));
58+
__ Return(Map(ret.pop_count()), base::VectorOf(return_values));
5959
return OpIndex::Invalid();
6060
}
6161

@@ -94,7 +94,7 @@ class SimplifiedLoweringReducer : public Next {
9494
}
9595
}
9696

97-
inline OpIndex MapImpl(OpIndex ig_index) { return __ MapToNewGraph(ig_index); }
97+
inline OpIndex Map(OpIndex ig_index) { return __ MapToNewGraph(ig_index); }
9898
};
9999

100100
#include "src/compiler/turboshaft/undef-assembler-macros.inc"

deps/v8/src/compiler/turboshaft/store-store-elimination-phase.cc

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ void StoreStoreEliminationPhase::Run(Zone* temp_zone) {
2323
turboshaft::MachineOptimizationReducer,
2424
turboshaft::RequiredOptimizationReducer,
2525
turboshaft::BranchEliminationReducer,
26-
turboshaft::ValueNumberingReducer>::Run<true>(temp_zone);
26+
turboshaft::ValueNumberingReducer>::Run(temp_zone);
2727
}
2828

2929
} // namespace v8::internal::compiler::turboshaft

deps/v8/src/compiler/turboshaft/type-assertions-phase.cc

+1-2
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,7 @@ void TypeAssertionsPhase::Run(Zone* temp_zone) {
2323

2424
turboshaft::CopyingPhase<turboshaft::AssertTypesReducer,
2525
turboshaft::ValueNumberingReducer,
26-
turboshaft::VariableReducerHotfix,
27-
turboshaft::TypeInferenceReducer>::Run<false>(temp_zone);
26+
turboshaft::TypeInferenceReducer>::Run(temp_zone);
2827
}
2928

3029
} // namespace v8::internal::compiler::turboshaft

deps/v8/src/compiler/turboshaft/typed-optimizations-phase.cc

+1-2
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,7 @@ void TypedOptimizationsPhase::Run(Zone* temp_zone) {
2323
turboshaft::TypeInferenceReducerArgs::OutputGraphTyping::kNone};
2424

2525
turboshaft::CopyingPhase<turboshaft::TypedOptimizationsReducer,
26-
turboshaft::VariableReducerHotfix,
27-
turboshaft::TypeInferenceReducer>::Run<false>(temp_zone);
26+
turboshaft::TypeInferenceReducer>::Run(temp_zone);
2827
}
2928

3029
} // namespace v8::internal::compiler::turboshaft

deps/v8/src/compiler/turboshaft/wasm-dead-code-elimination-phase.cc

+1-2
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,7 @@ void WasmDeadCodeEliminationPhase::Run(Zone* temp_zone) {
2828
// (which, for simplificy, doesn't use the Assembler helper
2929
// methods, but only calls Next::ReduceLoad/Store).
3030
DuplicationOptimizationReducer,
31-
ValueNumberingReducer,
32-
VariableReducerHotfix>::Run<false>(temp_zone);
31+
ValueNumberingReducer>::Run(temp_zone);
3332
}
3433

3534
} // namespace v8::internal::compiler::turboshaft

deps/v8/src/compiler/turboshaft/wasm-gc-optimize-phase.cc

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ namespace v8::internal::compiler::turboshaft {
1515
void WasmGCOptimizePhase::Run(Zone* temp_zone) {
1616
UnparkedScopeIfNeeded scope(PipelineData::Get().broker(),
1717
v8_flags.turboshaft_trace_reduction);
18-
CopyingPhase<WasmLoadEliminationReducer, WasmGCTypeReducer, VariableReducerHotfix>::Run<false>(temp_zone);
18+
CopyingPhase<WasmLoadEliminationReducer, WasmGCTypeReducer>::Run(temp_zone);
1919
}
2020

2121
} // namespace v8::internal::compiler::turboshaft

0 commit comments

Comments
 (0)