#include "test/unittests/compiler/graph-reducer-unittest.h"
#include "src/codegen/tick-counter.h"
#include "src/compiler/common-operator.h"
#include "src/compiler/graph.h"
#include "src/compiler/node-properties.h"
#include "src/compiler/node.h"
#include "src/compiler/operator.h"
#include "test/unittests/test-utils.h"
_;
DefaultValue;
ElementsAre;
Return;
Sequence;
StrictMock;
UnorderedElementsAre;
namespace v8 {
namespace internal {
namespace compiler {
namespace graph_reducer_unittest {
namespace {
struct TestOperator : public Operator { … };
const uint8_t kOpcodeA0 = …;
const uint8_t kOpcodeA1 = …;
const uint8_t kOpcodeA2 = …;
const uint8_t kOpcodeB0 = …;
const uint8_t kOpcodeB1 = …;
const uint8_t kOpcodeB2 = …;
const uint8_t kOpcodeC0 = …;
const uint8_t kOpcodeC1 = …;
const uint8_t kOpcodeC2 = …;
static TestOperator kOpA0(kOpcodeA0, Operator::kNoWrite, "opa1", 0, 1);
static TestOperator kOpA1(kOpcodeA1, Operator::kNoProperties, "opa2", 1, 1);
static TestOperator kOpA2(kOpcodeA2, Operator::kNoProperties, "opa3", 2, 1);
static TestOperator kOpB0(kOpcodeB0, Operator::kNoWrite, "opb0", 0, 1);
static TestOperator kOpB1(kOpcodeB1, Operator::kNoWrite, "opb1", 1, 1);
static TestOperator kOpB2(kOpcodeB2, Operator::kNoWrite, "opb2", 2, 1);
static TestOperator kOpC0(kOpcodeC0, Operator::kNoWrite, "opc0", 0, 1);
static TestOperator kOpC1(kOpcodeC1, Operator::kNoWrite, "opc1", 1, 1);
static TestOperator kOpC2(kOpcodeC2, Operator::kNoWrite, "opc2", 2, 1);
struct MockReducer : public Reducer { … };
class InPlaceABReducer final : public Reducer { … };
class NewABReducer final : public Reducer { … };
class A0Wrapper final : public Reducer { … };
class B0Wrapper final : public Reducer { … };
class A1Forwarder final : public Reducer { … };
class B1Forwarder final : public Reducer { … };
class InPlaceBCReducer final : public Reducer { … };
class AB2Sorter final : public Reducer { … };
}
class AdvancedReducerTest : public TestWithZone { … };
TEST_F(AdvancedReducerTest, Replace) { … }
TEST_F(AdvancedReducerTest, Revisit) { … }
namespace {
struct ReplaceWithValueReducer final : public AdvancedReducer { … };
const Operator kMockOperator(IrOpcode::kDead, Operator::kNoProperties,
"MockOperator", 0, 0, 0, 1, 0, 0);
const Operator kMockOpEffect(IrOpcode::kDead, Operator::kNoProperties,
"MockOpEffect", 0, 1, 0, 1, 1, 0);
const Operator kMockOpControl(IrOpcode::kDead, Operator::kNoProperties,
"MockOpControl", 0, 0, 1, 1, 0, 1);
}
TEST_F(AdvancedReducerTest, ReplaceWithValue_ValueUse) { … }
TEST_F(AdvancedReducerTest, ReplaceWithValue_EffectUse) { … }
TEST_F(AdvancedReducerTest, ReplaceWithValue_ControlUse1) { … }
TEST_F(AdvancedReducerTest, ReplaceWithValue_ControlUse2) { … }
TEST_F(AdvancedReducerTest, ReplaceWithValue_ControlUse3) { … }
class GraphReducerTest : public TestWithZone { … };
TEST_F(GraphReducerTest, NodeIsDeadAfterReplace) { … }
TEST_F(GraphReducerTest, ReduceOnceForEveryReducer) { … }
TEST_F(GraphReducerTest, ReduceAgainAfterChanged) { … }
TEST_F(GraphReducerTest, ReduceGraphFromEnd1) { … }
TEST_F(GraphReducerTest, ReduceGraphFromEnd2) { … }
TEST_F(GraphReducerTest, ReduceInPlace1) { … }
TEST_F(GraphReducerTest, ReduceInPlace2) { … }
TEST_F(GraphReducerTest, ReduceNew1) { … }
TEST_F(GraphReducerTest, Wrapping1) { … }
TEST_F(GraphReducerTest, Wrapping2) { … }
TEST_F(GraphReducerTest, Forwarding1) { … }
TEST_F(GraphReducerTest, Forwarding2) { … }
TEST_F(GraphReducerTest, Forwarding3) { … }
TEST_F(GraphReducerTest, ReduceForward1) { … }
TEST_F(GraphReducerTest, Sorter1) { … }
namespace {
void GenDAG(Graph* graph, int* p3, int* p2, int* p1) { … }
}
TEST_F(GraphReducerTest, SortForwardReduce) { … }
TEST_F(GraphReducerTest, Order) { … }
}
}
}
}