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