| OLD | NEW |
| 1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 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/control-flow-optimizer.h" | 5 #include "src/compiler/control-flow-optimizer.h" |
| 6 #include "src/compiler/js-graph.h" | 6 #include "src/compiler/js-graph.h" |
| 7 #include "src/compiler/js-operator.h" | 7 #include "src/compiler/js-operator.h" |
| 8 #include "src/compiler/machine-operator.h" | 8 #include "src/compiler/machine-operator.h" |
| 9 #include "test/unittests/compiler/graph-unittest.h" | 9 #include "test/unittests/compiler/graph-unittest.h" |
| 10 #include "test/unittests/compiler/node-test-utils.h" | 10 #include "test/unittests/compiler/node-test-utils.h" |
| 11 #include "testing/gmock-support.h" | 11 #include "testing/gmock-support.h" |
| 12 | 12 |
| 13 using testing::AllOf; | 13 using testing::AllOf; |
| 14 using testing::Capture; | 14 using testing::Capture; |
| 15 using testing::CaptureEq; | 15 using testing::CaptureEq; |
| 16 | 16 |
| 17 namespace v8 { | 17 namespace v8 { |
| 18 namespace internal { | 18 namespace internal { |
| 19 namespace compiler { | 19 namespace compiler { |
| 20 | 20 |
| 21 class ControlFlowOptimizerTest : public GraphTest { | 21 class ControlFlowOptimizerTest : public GraphTest { |
| 22 public: | 22 public: |
| 23 explicit ControlFlowOptimizerTest(int num_parameters = 3) | 23 explicit ControlFlowOptimizerTest(int num_parameters = 3) |
| 24 : GraphTest(num_parameters), | 24 : GraphTest(num_parameters), |
| 25 machine_(zone()), | 25 machine_(zone()), |
| 26 javascript_(zone()), | 26 javascript_(zone()), |
| 27 jsgraph_(isolate(), graph(), common(), javascript(), machine()) {} | 27 jsgraph_(isolate(), graph(), common(), javascript(), machine()) {} |
| 28 ~ControlFlowOptimizerTest() OVERRIDE {} | 28 ~ControlFlowOptimizerTest() override {} |
| 29 | 29 |
| 30 protected: | 30 protected: |
| 31 void Optimize() { | 31 void Optimize() { |
| 32 ControlFlowOptimizer optimizer(jsgraph(), zone()); | 32 ControlFlowOptimizer optimizer(jsgraph(), zone()); |
| 33 optimizer.Optimize(); | 33 optimizer.Optimize(); |
| 34 } | 34 } |
| 35 | 35 |
| 36 Node* EmptyFrameState() { return jsgraph()->EmptyFrameState(); } | 36 Node* EmptyFrameState() { return jsgraph()->EmptyFrameState(); } |
| 37 | 37 |
| 38 JSGraph* jsgraph() { return &jsgraph_; } | 38 JSGraph* jsgraph() { return &jsgraph_; } |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 131 IsIfTrue(CaptureEq(&branch2_capture))), | 131 IsIfTrue(CaptureEq(&branch2_capture))), |
| 132 IsMerge(IsIfFalse(AllOf(CaptureEq(&branch1_capture), | 132 IsMerge(IsIfFalse(AllOf(CaptureEq(&branch1_capture), |
| 133 IsBranch(cond1, control1))), | 133 IsBranch(cond1, control1))), |
| 134 IsIfFalse(AllOf(CaptureEq(&branch2_capture), | 134 IsIfFalse(AllOf(CaptureEq(&branch2_capture), |
| 135 IsBranch(cond2, control2))))))); | 135 IsBranch(cond2, control2))))))); |
| 136 } | 136 } |
| 137 | 137 |
| 138 } // namespace compiler | 138 } // namespace compiler |
| 139 } // namespace internal | 139 } // namespace internal |
| 140 } // namespace v8 | 140 } // namespace v8 |
| OLD | NEW |