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/node.h" | 7 #include "src/compiler/node.h" |
8 #include "src/compiler/operator.h" | 8 #include "src/compiler/operator.h" |
9 #include "test/unittests/test-utils.h" | 9 #include "test/unittests/test-utils.h" |
10 #include "testing/gmock/include/gmock/gmock.h" | 10 #include "testing/gmock/include/gmock/gmock.h" |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 return Replace( | 94 return Replace( |
95 graph_->NewNode(&kOpB2, node->InputAt(0), node->InputAt(1))); | 95 graph_->NewNode(&kOpB2, node->InputAt(0), node->InputAt(1))); |
96 } | 96 } |
97 return NoChange(); | 97 return NoChange(); |
98 } | 98 } |
99 Graph* graph_; | 99 Graph* graph_; |
100 }; | 100 }; |
101 | 101 |
102 | 102 |
103 // Wraps all "kOpA0" nodes in "kOpB1" operators by allocating new nodes. | 103 // Wraps all "kOpA0" nodes in "kOpB1" operators by allocating new nodes. |
104 class A0Wrapper FINAL : public Reducer { | 104 class A0Wrapper final : public Reducer { |
105 public: | 105 public: |
106 explicit A0Wrapper(Graph* graph) : graph_(graph) {} | 106 explicit A0Wrapper(Graph* graph) : graph_(graph) {} |
107 virtual Reduction Reduce(Node* node) OVERRIDE { | 107 virtual Reduction Reduce(Node* node) override { |
108 switch (node->op()->opcode()) { | 108 switch (node->op()->opcode()) { |
109 case kOpcodeA0: | 109 case kOpcodeA0: |
110 EXPECT_EQ(0, node->InputCount()); | 110 EXPECT_EQ(0, node->InputCount()); |
111 return Replace(graph_->NewNode(&kOpB1, node)); | 111 return Replace(graph_->NewNode(&kOpB1, node)); |
112 } | 112 } |
113 return NoChange(); | 113 return NoChange(); |
114 } | 114 } |
115 Graph* graph_; | 115 Graph* graph_; |
116 }; | 116 }; |
117 | 117 |
118 | 118 |
119 // Wraps all "kOpB0" nodes in two "kOpC1" operators by allocating new nodes. | 119 // Wraps all "kOpB0" nodes in two "kOpC1" operators by allocating new nodes. |
120 class B0Wrapper FINAL : public Reducer { | 120 class B0Wrapper final : public Reducer { |
121 public: | 121 public: |
122 explicit B0Wrapper(Graph* graph) : graph_(graph) {} | 122 explicit B0Wrapper(Graph* graph) : graph_(graph) {} |
123 virtual Reduction Reduce(Node* node) OVERRIDE { | 123 virtual Reduction Reduce(Node* node) override { |
124 switch (node->op()->opcode()) { | 124 switch (node->op()->opcode()) { |
125 case kOpcodeB0: | 125 case kOpcodeB0: |
126 EXPECT_EQ(0, node->InputCount()); | 126 EXPECT_EQ(0, node->InputCount()); |
127 return Replace(graph_->NewNode(&kOpC1, graph_->NewNode(&kOpC1, node))); | 127 return Replace(graph_->NewNode(&kOpC1, graph_->NewNode(&kOpC1, node))); |
128 } | 128 } |
129 return NoChange(); | 129 return NoChange(); |
130 } | 130 } |
131 Graph* graph_; | 131 Graph* graph_; |
132 }; | 132 }; |
133 | 133 |
(...skipping 530 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
664 EXPECT_EQ(&kOpC1, end->op()); | 664 EXPECT_EQ(&kOpC1, end->op()); |
665 EXPECT_EQ(n1, end->InputAt(0)); | 665 EXPECT_EQ(n1, end->InputAt(0)); |
666 } | 666 } |
667 } | 667 } |
668 } | 668 } |
669 | 669 |
670 | 670 |
671 } // namespace compiler | 671 } // namespace compiler |
672 } // namespace internal | 672 } // namespace internal |
673 } // namespace v8 | 673 } // namespace v8 |
OLD | NEW |