| 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" |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 69 IsEnd(IsMerge(IsIfValue(0, CaptureEq(&switch_capture)), | 69 IsEnd(IsMerge(IsIfValue(0, CaptureEq(&switch_capture)), |
| 70 IsIfValue(1, CaptureEq(&switch_capture)), | 70 IsIfValue(1, CaptureEq(&switch_capture)), |
| 71 IsIfDefault(AllOf(CaptureEq(&switch_capture), | 71 IsIfDefault(AllOf(CaptureEq(&switch_capture), |
| 72 IsSwitch(index, start())))))); | 72 IsSwitch(index, start())))))); |
| 73 } | 73 } |
| 74 | 74 |
| 75 | 75 |
| 76 TEST_F(ControlFlowOptimizerTest, BuildSwitch2) { | 76 TEST_F(ControlFlowOptimizerTest, BuildSwitch2) { |
| 77 Node* input = Parameter(0); | 77 Node* input = Parameter(0); |
| 78 Node* context = Parameter(1); | 78 Node* context = Parameter(1); |
| 79 Node* index = FLAG_turbo_deoptimization | 79 Node* index = graph()->NewNode(javascript()->ToNumber(), input, context, |
| 80 ? graph()->NewNode(javascript()->ToNumber(), input, context, | 80 EmptyFrameState(), start(), start()); |
| 81 EmptyFrameState(), start(), start()) | |
| 82 : graph()->NewNode(javascript()->ToNumber(), input, context, | |
| 83 start(), start()); | |
| 84 Node* if_success = graph()->NewNode(common()->IfSuccess(), index); | 81 Node* if_success = graph()->NewNode(common()->IfSuccess(), index); |
| 85 Node* branch0 = graph()->NewNode( | 82 Node* branch0 = graph()->NewNode( |
| 86 common()->Branch(), | 83 common()->Branch(), |
| 87 graph()->NewNode(machine()->Word32Equal(), index, Int32Constant(0)), | 84 graph()->NewNode(machine()->Word32Equal(), index, Int32Constant(0)), |
| 88 if_success); | 85 if_success); |
| 89 Node* if_true0 = graph()->NewNode(common()->IfTrue(), branch0); | 86 Node* if_true0 = graph()->NewNode(common()->IfTrue(), branch0); |
| 90 Node* if_false0 = graph()->NewNode(common()->IfFalse(), branch0); | 87 Node* if_false0 = graph()->NewNode(common()->IfFalse(), branch0); |
| 91 Node* branch1 = graph()->NewNode( | 88 Node* branch1 = graph()->NewNode( |
| 92 common()->Branch(), | 89 common()->Branch(), |
| 93 graph()->NewNode(machine()->Word32Equal(), index, Int32Constant(1)), | 90 graph()->NewNode(machine()->Word32Equal(), index, Int32Constant(1)), |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 131 IsIfTrue(CaptureEq(&branch2_capture))), | 128 IsIfTrue(CaptureEq(&branch2_capture))), |
| 132 IsMerge(IsIfFalse(AllOf(CaptureEq(&branch1_capture), | 129 IsMerge(IsIfFalse(AllOf(CaptureEq(&branch1_capture), |
| 133 IsBranch(cond1, control1))), | 130 IsBranch(cond1, control1))), |
| 134 IsIfFalse(AllOf(CaptureEq(&branch2_capture), | 131 IsIfFalse(AllOf(CaptureEq(&branch2_capture), |
| 135 IsBranch(cond2, control2))))))); | 132 IsBranch(cond2, control2))))))); |
| 136 } | 133 } |
| 137 | 134 |
| 138 } // namespace compiler | 135 } // namespace compiler |
| 139 } // namespace internal | 136 } // namespace internal |
| 140 } // namespace v8 | 137 } // namespace v8 |
| OLD | NEW |