OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "src/compiler/graph.h" | 5 #include "src/compiler/graph.h" |
6 #include "src/compiler/graph-reducer.h" | 6 #include "src/compiler/graph-reducer.h" |
7 #include "src/compiler/operator.h" | 7 #include "src/compiler/operator.h" |
8 #include "test/unittests/test-utils.h" | 8 #include "test/unittests/test-utils.h" |
9 #include "testing/gmock/include/gmock/gmock.h" | 9 #include "testing/gmock/include/gmock/gmock.h" |
10 | 10 |
11 using testing::_; | 11 using testing::_; |
12 using testing::DefaultValue; | 12 using testing::DefaultValue; |
13 using testing::Return; | 13 using testing::Return; |
14 using testing::Sequence; | 14 using testing::Sequence; |
15 using testing::StrictMock; | 15 using testing::StrictMock; |
16 | 16 |
17 namespace v8 { | 17 namespace v8 { |
18 namespace internal { | 18 namespace internal { |
19 namespace compiler { | 19 namespace compiler { |
20 | 20 |
| 21 struct TestOperator : public Operator { |
| 22 TestOperator(Operator::Opcode opcode, Operator::Properties properties, |
| 23 size_t value_in, size_t value_out) |
| 24 : Operator(opcode, properties, "TestOp", value_in, 0, 0, value_out, 0, |
| 25 0) {} |
| 26 }; |
| 27 |
| 28 |
21 namespace { | 29 namespace { |
22 | 30 |
23 SimpleOperator OP0(0, Operator::kNoWrite, 0, 1, "op0"); | 31 TestOperator OP0(0, Operator::kNoWrite, 0, 1); |
24 SimpleOperator OP1(1, Operator::kNoProperties, 1, 1, "op1"); | 32 TestOperator OP1(1, Operator::kNoProperties, 1, 1); |
25 | 33 |
26 | 34 |
27 struct MockReducer : public Reducer { | 35 struct MockReducer : public Reducer { |
28 MOCK_METHOD1(Reduce, Reduction(Node*)); | 36 MOCK_METHOD1(Reduce, Reduction(Node*)); |
29 }; | 37 }; |
30 | 38 |
31 } // namespace | 39 } // namespace |
32 | 40 |
33 | 41 |
34 class GraphReducerTest : public TestWithZone { | 42 class GraphReducerTest : public TestWithZone { |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 Return(Reducer::Changed(node0))); | 114 Return(Reducer::Changed(node0))); |
107 EXPECT_CALL(r1, Reduce(node0)).InSequence(s1); | 115 EXPECT_CALL(r1, Reduce(node0)).InSequence(s1); |
108 EXPECT_CALL(r2, Reduce(node0)).InSequence(s2); | 116 EXPECT_CALL(r2, Reduce(node0)).InSequence(s2); |
109 EXPECT_CALL(r3, Reduce(node0)).InSequence(s3); | 117 EXPECT_CALL(r3, Reduce(node0)).InSequence(s3); |
110 ReduceNode(node0, &r1, &r2, &r3); | 118 ReduceNode(node0, &r1, &r2, &r3); |
111 } | 119 } |
112 | 120 |
113 } // namespace compiler | 121 } // namespace compiler |
114 } // namespace internal | 122 } // namespace internal |
115 } // namespace v8 | 123 } // namespace v8 |
OLD | NEW |