Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

V8 v12.2 Windows patch #13

Merged
merged 3 commits into from
Jan 29, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
v12.1 patch
StefanStojanovic committed Jan 24, 2024
commit eb13291eccbcd4fee29b99b8b4789530651adec0
5 changes: 3 additions & 2 deletions deps/v8/src/compiler/turboshaft/assembler.h
Original file line number Diff line number Diff line change
@@ -3934,8 +3934,9 @@ class TSAssembler
: public Assembler<reducer_list<TurboshaftAssemblerOpInterface, Reducers...,
TSReducerBase>> {
public:
using Assembler<reducer_list<TurboshaftAssemblerOpInterface, Reducers...,
TSReducerBase>>::Assembler;
explicit TSAssembler(Graph& input_graph, Graph& output_graph,
Zone* phase_zone)
: Assembler(input_graph, output_graph, phase_zone) {}
};

#include "src/compiler/turboshaft/undef-assembler-macros.inc"
Original file line number Diff line number Diff line change
@@ -32,7 +32,8 @@ void CodeEliminationAndSimplificationPhase::Run(Zone* temp_zone) {
// (which, for simplificy, doesn't use the Assembler helper
// methods, but only calls Next::ReduceLoad/Store).
DuplicationOptimizationReducer,
ValueNumberingReducer>::Run(temp_zone);
ValueNumberingReducer,
VariableReducerHotfix>::Run<false>(temp_zone);
}

} // namespace v8::internal::compiler::turboshaft
32 changes: 23 additions & 9 deletions deps/v8/src/compiler/turboshaft/copying-phase.h
Original file line number Diff line number Diff line change
@@ -36,6 +36,16 @@ struct PaddingSpace {
V8_EXPORT_PRIVATE std::ostream& operator<<(std::ostream& os,
PaddingSpace padding);

template <class Next>
class VariableReducerHotfix : public Next {
public:
void SetVariable(Variable var, OpIndex new_index) {}
Variable NewLoopInvariantVariable(MaybeRegisterRepresentation rep) { return Variable(); }

OpIndex GetVariable(Variable var) { return OpIndex(); }
OpIndex GetPredecessorValue(Variable var, int predecessor_index) { return OpIndex(); }
};

template <typename Next>
class ReducerBaseForwarder;
template <typename Next>
@@ -46,6 +56,9 @@ class GraphVisitor : public Next {
template <typename N>
friend class ReducerBaseForwarder;

private:
bool contains_variable_reducer_;

public:
TURBOSHAFT_REDUCER_BOILERPLATE()

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

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

if constexpr (reducer_list_contains<typename Next::ReducerList,
VariableReducer>::value) {
if (contains_variable_reducer_) {
if (!result.valid()) {
// {op_mapping} doesn't have a mapping for {old_index}. The assembler
// should provide the mapping.
@@ -1294,8 +1307,7 @@ class GraphVisitor : public Next {
DCHECK(Asm().input_graph().BelongsToThisGraph(old_index));
DCHECK_IMPLIES(new_index.valid(),
Asm().output_graph().BelongsToThisGraph(new_index));
if constexpr (reducer_list_contains<typename Next::ReducerList,
VariableReducer>::value) {
if (contains_variable_reducer_) {
if (current_block_needs_variables_) {
MaybeVariable var = GetVariableFor(old_index);
if (!var.has_value()) {
@@ -1392,29 +1404,31 @@ class TSAssembler;
template <template <class> class... Reducers>
class CopyingPhaseImpl {
public:
template <bool contains_variable_reducer>
static void Run(Graph& input_graph, Zone* phase_zone,
bool trace_reductions = false) {
TSAssembler<GraphVisitor, Reducers...> phase(
input_graph, input_graph.GetOrCreateCompanion(), phase_zone);
#ifdef DEBUG
if (trace_reductions) {
phase.template VisitGraph<true>();
phase.template VisitGraph<true>(contains_variable_reducer);
} else {
phase.template VisitGraph<false>();
phase.template VisitGraph<false>(contains_variable_reducer);
}
#else
phase.template VisitGraph<false>();
phase.template VisitGraph<false>(contains_variable_reducer);
#endif // DEBUG
}
};

template <template <typename> typename... Reducers>
class CopyingPhase {
public:
template <bool contains_variable_reducer>
static void Run(Zone* phase_zone) {
PipelineData& data = PipelineData::Get();
Graph& input_graph = data.graph();
CopyingPhaseImpl<Reducers...>::Run(
CopyingPhaseImpl<Reducers...>::Run<contains_variable_reducer>(
input_graph, phase_zone, data.info()->turboshaft_trace_reduction());
}
};
10 changes: 5 additions & 5 deletions deps/v8/src/compiler/turboshaft/csa-optimize-phase.cc
Original file line number Diff line number Diff line change
@@ -25,23 +25,23 @@ namespace v8::internal::compiler::turboshaft {
void CsaLoadEliminationPhase::Run(Zone* temp_zone) {
CopyingPhase<VariableReducer, MachineOptimizationReducer,
RequiredOptimizationReducer,
ValueNumberingReducer>::Run(temp_zone);
ValueNumberingReducer>::Run<true>(temp_zone);

CopyingPhase<VariableReducer, LateLoadEliminationReducer,
MachineOptimizationReducer, RequiredOptimizationReducer,
ValueNumberingReducer>::Run(temp_zone);
ValueNumberingReducer>::Run<true>(temp_zone);
}

void CsaLateEscapeAnalysisPhase::Run(Zone* temp_zone) {
CopyingPhase<VariableReducer, LateEscapeAnalysisReducer,
MachineOptimizationReducer, RequiredOptimizationReducer,
ValueNumberingReducer>::Run(temp_zone);
ValueNumberingReducer>::Run<true>(temp_zone);
}

void CsaBranchEliminationPhase::Run(Zone* temp_zone) {
CopyingPhase<VariableReducer, MachineOptimizationReducer,
BranchEliminationReducer, RequiredOptimizationReducer,
ValueNumberingReducer>::Run(temp_zone);
ValueNumberingReducer>::Run<true>(temp_zone);
}

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

} // namespace v8::internal::compiler::turboshaft
Original file line number Diff line number Diff line change
@@ -11,7 +11,7 @@ namespace v8::internal::compiler::turboshaft {

void DebugFeatureLoweringPhase::Run(Zone* temp_zone) {
#ifdef V8_ENABLE_DEBUG_CODE
turboshaft::CopyingPhase<turboshaft::DebugFeatureLoweringReducer>::Run(
turboshaft::CopyingPhase<turboshaft::DebugFeatureLoweringReducer>::Run<false>(
temp_zone);
#endif
}
2 changes: 1 addition & 1 deletion deps/v8/src/compiler/turboshaft/int64-lowering-phase.cc
Original file line number Diff line number Diff line change
@@ -16,7 +16,7 @@ void Int64LoweringPhase::Run(Zone* temp_zone) {
#if V8_TARGET_ARCH_32_BIT
turboshaft::CopyingPhase<
turboshaft::Int64LoweringReducer, turboshaft::VariableReducer,
turboshaft::RequiredOptimizationReducer>::Run(temp_zone);
turboshaft::RequiredOptimizationReducer>::Run<true>(temp_zone);
#else
UNREACHABLE();
#endif
2 changes: 1 addition & 1 deletion deps/v8/src/compiler/turboshaft/loop-peeling-phase.cc
Original file line number Diff line number Diff line change
@@ -23,7 +23,7 @@ void LoopPeelingPhase::Run(Zone* temp_zone) {
turboshaft::VariableReducer,
turboshaft::MachineOptimizationReducer,
turboshaft::RequiredOptimizationReducer,
turboshaft::ValueNumberingReducer>::Run(temp_zone);
turboshaft::ValueNumberingReducer>::Run<true>(temp_zone);
}

} // namespace v8::internal::compiler::turboshaft
2 changes: 1 addition & 1 deletion deps/v8/src/compiler/turboshaft/loop-unrolling-phase.cc
Original file line number Diff line number Diff line change
@@ -22,7 +22,7 @@ void LoopUnrollingPhase::Run(Zone* temp_zone) {
turboshaft::VariableReducer,
turboshaft::MachineOptimizationReducer,
turboshaft::RequiredOptimizationReducer,
turboshaft::ValueNumberingReducer>::Run(temp_zone);
turboshaft::ValueNumberingReducer>::Run<true>(temp_zone);
PipelineData::Get().clear_loop_unrolling_analyzer();
}
}
4 changes: 2 additions & 2 deletions deps/v8/src/compiler/turboshaft/machine-lowering-phase.cc
Original file line number Diff line number Diff line change
@@ -20,11 +20,11 @@ void MachineLoweringPhase::Run(Zone* temp_zone) {
CopyingPhase<DataViewReducer, VariableReducer, MachineLoweringReducer,
FastApiCallReducer, RequiredOptimizationReducer,
SelectLoweringReducer,
MachineOptimizationReducer>::Run(temp_zone);
MachineOptimizationReducer>::Run<true>(temp_zone);
} else {
CopyingPhase<DataViewReducer, VariableReducer, MachineLoweringReducer,
FastApiCallReducer, RequiredOptimizationReducer,
SelectLoweringReducer>::Run(temp_zone);
SelectLoweringReducer>::Run<true>(temp_zone);
}
}

2 changes: 1 addition & 1 deletion deps/v8/src/compiler/turboshaft/optimize-phase.cc
Original file line number Diff line number Diff line change
@@ -30,7 +30,7 @@ void OptimizePhase::Run(Zone* temp_zone) {
turboshaft::MemoryOptimizationReducer,
turboshaft::MachineOptimizationReducer,
turboshaft::RequiredOptimizationReducer,
turboshaft::ValueNumberingReducer>::Run(temp_zone);
turboshaft::ValueNumberingReducer>::Run<true>(temp_zone);
}

} // namespace v8::internal::compiler::turboshaft
Original file line number Diff line number Diff line change
@@ -10,7 +10,7 @@
namespace v8::internal::compiler::turboshaft {

void SimplifiedLoweringPhase::Run(Zone* temp_zone) {
CopyingPhase<SimplifiedLoweringReducer>::Run(temp_zone);
CopyingPhase<SimplifiedLoweringReducer>::Run<false>(temp_zone);
}

} // namespace v8::internal::compiler::turboshaft
Original file line number Diff line number Diff line change
@@ -23,7 +23,7 @@ void StoreStoreEliminationPhase::Run(Zone* temp_zone) {
turboshaft::MachineOptimizationReducer,
turboshaft::RequiredOptimizationReducer,
turboshaft::BranchEliminationReducer,
turboshaft::ValueNumberingReducer>::Run(temp_zone);
turboshaft::ValueNumberingReducer>::Run<true>(temp_zone);
}

} // namespace v8::internal::compiler::turboshaft
3 changes: 2 additions & 1 deletion deps/v8/src/compiler/turboshaft/type-assertions-phase.cc
Original file line number Diff line number Diff line change
@@ -23,7 +23,8 @@ void TypeAssertionsPhase::Run(Zone* temp_zone) {

turboshaft::CopyingPhase<turboshaft::AssertTypesReducer,
turboshaft::ValueNumberingReducer,
turboshaft::TypeInferenceReducer>::Run(temp_zone);
turboshaft::VariableReducerHotfix,
turboshaft::TypeInferenceReducer>::Run<false>(temp_zone);
}

} // namespace v8::internal::compiler::turboshaft
3 changes: 2 additions & 1 deletion deps/v8/src/compiler/turboshaft/typed-optimizations-phase.cc
Original file line number Diff line number Diff line change
@@ -23,7 +23,8 @@ void TypedOptimizationsPhase::Run(Zone* temp_zone) {
turboshaft::TypeInferenceReducerArgs::OutputGraphTyping::kNone};

turboshaft::CopyingPhase<turboshaft::TypedOptimizationsReducer,
turboshaft::TypeInferenceReducer>::Run(temp_zone);
turboshaft::VariableReducerHotfix,
turboshaft::TypeInferenceReducer>::Run<false>(temp_zone);
}

} // namespace v8::internal::compiler::turboshaft
Original file line number Diff line number Diff line change
@@ -28,7 +28,8 @@ void WasmDeadCodeEliminationPhase::Run(Zone* temp_zone) {
// (which, for simplificy, doesn't use the Assembler helper
// methods, but only calls Next::ReduceLoad/Store).
DuplicationOptimizationReducer,
ValueNumberingReducer>::Run(temp_zone);
ValueNumberingReducer,
VariableReducerHotfix>::Run<false>(temp_zone);
}

} // namespace v8::internal::compiler::turboshaft
2 changes: 1 addition & 1 deletion deps/v8/src/compiler/turboshaft/wasm-gc-optimize-phase.cc
Original file line number Diff line number Diff line change
@@ -15,7 +15,7 @@ namespace v8::internal::compiler::turboshaft {
void WasmGCOptimizePhase::Run(Zone* temp_zone) {
UnparkedScopeIfNeeded scope(PipelineData::Get().broker(),
v8_flags.turboshaft_trace_reduction);
CopyingPhase<WasmLoadEliminationReducer, WasmGCTypeReducer>::Run(temp_zone);
CopyingPhase<WasmLoadEliminationReducer, WasmGCTypeReducer, VariableReducerHotfix>::Run<false>(temp_zone);
}

} // namespace v8::internal::compiler::turboshaft
2 changes: 1 addition & 1 deletion deps/v8/src/compiler/turboshaft/wasm-lowering-phase.cc
Original file line number Diff line number Diff line change
@@ -21,7 +21,7 @@ void WasmLoweringPhase::Run(Zone* temp_zone) {
// Also run the MachineOptimizationReducer as it can help the late load
// elimination that follows this phase eliminate more loads.
CopyingPhase<WasmLoweringReducer, VariableReducer, MachineOptimizationReducer,
RequiredOptimizationReducer>::Run(temp_zone);
RequiredOptimizationReducer>::Run<true>(temp_zone);
}

} // namespace v8::internal::compiler::turboshaft
2 changes: 1 addition & 1 deletion deps/v8/src/compiler/turboshaft/wasm-optimize-phase.cc
Original file line number Diff line number Diff line change
@@ -27,7 +27,7 @@ void WasmOptimizePhase::Run(Zone* temp_zone) {
MemoryOptimizationReducer, VariableReducer,
RequiredOptimizationReducer, BranchEliminationReducer,
LateLoadEliminationReducer,
ValueNumberingReducer>::Run(temp_zone);
ValueNumberingReducer>::Run<true>(temp_zone);
}

} // namespace v8::internal::compiler::turboshaft
2 changes: 1 addition & 1 deletion deps/v8/src/compiler/turboshaft/wasm-revec-phase.cc
Original file line number Diff line number Diff line change
@@ -17,7 +17,7 @@ void WasmRevecPhase::Run(Zone* temp_zone) {
PipelineData::Get().set_wasm_revec_analyzer(&analyzer);
UnparkedScopeIfNeeded scope(PipelineData::Get().broker(),
v8_flags.turboshaft_trace_reduction);
CopyingPhase<WasmRevecReducer>::Run(temp_zone);
CopyingPhase<WasmRevecReducer>::Run<false>(temp_zone);
PipelineData::Get().clear_wasm_revec_analyzer();
}
}