@@ -36,16 +36,6 @@ struct PaddingSpace {
36
36
V8_EXPORT_PRIVATE std::ostream& operator <<(std::ostream& os,
37
37
PaddingSpace padding);
38
38
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
-
49
39
template <typename Next>
50
40
class ReducerBaseForwarder ;
51
41
template <typename Next>
@@ -56,9 +46,6 @@ class GraphVisitor : public Next {
56
46
template <typename N>
57
47
friend class ReducerBaseForwarder ;
58
48
59
- private:
60
- bool contains_variable_reducer_;
61
-
62
49
public:
63
50
TURBOSHAFT_REDUCER_BOILERPLATE ()
64
51
@@ -79,8 +66,7 @@ class GraphVisitor : public Next {
79
66
// `trace_reduction` is a template parameter to avoid paying for tracing at
80
67
// runtime.
81
68
template <bool trace_reduction>
82
- void VisitGraph (bool contains_variable_reducer) {
83
- contains_variable_reducer_ = contains_variable_reducer;
69
+ void VisitGraph () {
84
70
Asm ().Analyze ();
85
71
86
72
// Creating initial old-to-new Block mapping.
@@ -191,7 +177,8 @@ class GraphVisitor : public Next {
191
177
DCHECK (old_index.valid ());
192
178
OpIndex result = op_mapping_[old_index];
193
179
194
- if (contains_variable_reducer_) {
180
+ if constexpr (reducer_list_contains<typename Next::ReducerList,
181
+ VariableReducer>::value) {
195
182
if (!result.valid ()) {
196
183
// {op_mapping} doesn't have a mapping for {old_index}. The assembler
197
184
// should provide the mapping.
@@ -1307,7 +1294,8 @@ class GraphVisitor : public Next {
1307
1294
DCHECK (Asm ().input_graph ().BelongsToThisGraph (old_index));
1308
1295
DCHECK_IMPLIES (new_index.valid (),
1309
1296
Asm ().output_graph ().BelongsToThisGraph (new_index));
1310
- if (contains_variable_reducer_) {
1297
+ if constexpr (reducer_list_contains<typename Next::ReducerList,
1298
+ VariableReducer>::value) {
1311
1299
if (current_block_needs_variables_) {
1312
1300
MaybeVariable var = GetVariableFor (old_index);
1313
1301
if (!var.has_value ()) {
@@ -1404,31 +1392,29 @@ class TSAssembler;
1404
1392
template <template <class > class ... Reducers>
1405
1393
class CopyingPhaseImpl {
1406
1394
public:
1407
- template <bool contains_variable_reducer>
1408
1395
static void Run (Graph& input_graph, Zone* phase_zone,
1409
1396
bool trace_reductions = false ) {
1410
1397
TSAssembler<GraphVisitor, Reducers...> phase (
1411
1398
input_graph, input_graph.GetOrCreateCompanion (), phase_zone);
1412
1399
#ifdef DEBUG
1413
1400
if (trace_reductions) {
1414
- phase.template VisitGraph <true >(contains_variable_reducer );
1401
+ phase.template VisitGraph <true >();
1415
1402
} else {
1416
- phase.template VisitGraph <false >(contains_variable_reducer );
1403
+ phase.template VisitGraph <false >();
1417
1404
}
1418
1405
#else
1419
- phase.template VisitGraph <false >(contains_variable_reducer );
1406
+ phase.template VisitGraph <false >();
1420
1407
#endif // DEBUG
1421
1408
}
1422
1409
};
1423
1410
1424
1411
template <template <typename > typename ... Reducers>
1425
1412
class CopyingPhase {
1426
1413
public:
1427
- template <bool contains_variable_reducer>
1428
1414
static void Run (Zone* phase_zone) {
1429
1415
PipelineData& data = PipelineData::Get ();
1430
1416
Graph& input_graph = data.graph ();
1431
- CopyingPhaseImpl<Reducers...>::Run<contains_variable_reducer> (
1417
+ CopyingPhaseImpl<Reducers...>::Run (
1432
1418
input_graph, phase_zone, data.info ()->turboshaft_trace_reduction ());
1433
1419
}
1434
1420
};
0 commit comments