| 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/codegen.h" | 5 #include "src/codegen.h" |
| 6 #include "src/compiler/common-operator.h" | 6 #include "src/compiler/common-operator.h" |
| 7 #include "src/compiler/diamond.h" | 7 #include "src/compiler/diamond.h" |
| 8 #include "src/compiler/graph.h" | 8 #include "src/compiler/graph.h" |
| 9 #include "src/compiler/js-graph.h" | 9 #include "src/compiler/js-graph.h" |
| 10 #include "src/compiler/js-operator.h" | 10 #include "src/compiler/js-operator.h" |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 141 | 141 |
| 142 OsrHelper helper(0, 0); | 142 OsrHelper helper(0, 0); |
| 143 helper.Deconstruct(&T.jsgraph, &T.common, T.main_zone()); | 143 helper.Deconstruct(&T.jsgraph, &T.common, T.main_zone()); |
| 144 | 144 |
| 145 CheckInputs(loop, T.start, loop); | 145 CheckInputs(loop, T.start, loop); |
| 146 CheckInputs(osr_phi, T.osr_values[0], T.jsgraph.ZeroConstant(), loop); | 146 CheckInputs(osr_phi, T.osr_values[0], T.jsgraph.ZeroConstant(), loop); |
| 147 CheckInputs(ret, osr_phi, T.start, loop); | 147 CheckInputs(ret, osr_phi, T.start, loop); |
| 148 } | 148 } |
| 149 | 149 |
| 150 | 150 |
| 151 TEST(Deconstruct_osr1_type) { |
| 152 OsrDeconstructorTester T(1); |
| 153 |
| 154 Node* loop = T.NewOsrLoop(1); |
| 155 Node* osr_phi = |
| 156 T.NewOsrPhi(loop, T.jsgraph.OneConstant(), 0, T.jsgraph.ZeroConstant()); |
| 157 Type* type = Type::Signed32(); |
| 158 NodeProperties::SetBounds(osr_phi, Bounds(type, type)); |
| 159 |
| 160 Node* ret = T.graph.NewNode(T.common.Return(), osr_phi, T.start, loop); |
| 161 T.graph.SetEnd(ret); |
| 162 |
| 163 OsrHelper helper(0, 0); |
| 164 helper.Deconstruct(&T.jsgraph, &T.common, T.main_zone()); |
| 165 |
| 166 CHECK_EQ(type, NodeProperties::GetBounds(T.osr_values[0]).lower); |
| 167 CHECK_EQ(type, NodeProperties::GetBounds(T.osr_values[0]).upper); |
| 168 |
| 169 CheckInputs(loop, T.start, loop); |
| 170 CheckInputs(osr_phi, T.osr_values[0], T.jsgraph.ZeroConstant(), loop); |
| 171 CheckInputs(ret, osr_phi, T.start, loop); |
| 172 } |
| 173 |
| 174 |
| 151 TEST(Deconstruct_osr_remove_prologue) { | 175 TEST(Deconstruct_osr_remove_prologue) { |
| 152 OsrDeconstructorTester T(1); | 176 OsrDeconstructorTester T(1); |
| 153 Diamond d(&T.graph, &T.common, T.p0); | 177 Diamond d(&T.graph, &T.common, T.p0); |
| 154 d.Chain(T.osr_normal_entry); | 178 d.Chain(T.osr_normal_entry); |
| 155 | 179 |
| 156 Node* loop = T.NewOsrLoop(1, d.merge); | 180 Node* loop = T.NewOsrLoop(1, d.merge); |
| 157 Node* osr_phi = | 181 Node* osr_phi = |
| 158 T.NewOsrPhi(loop, T.jsgraph.OneConstant(), 0, T.jsgraph.ZeroConstant()); | 182 T.NewOsrPhi(loop, T.jsgraph.OneConstant(), 0, T.jsgraph.ZeroConstant()); |
| 159 | 183 |
| 160 Node* ret = T.graph.NewNode(T.common.Return(), osr_phi, T.start, loop); | 184 Node* ret = T.graph.NewNode(T.common.Return(), osr_phi, T.start, loop); |
| (...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 448 | 472 |
| 449 // Check structure of inner loop. | 473 // Check structure of inner loop. |
| 450 Node* new_inner_loop = FindSuccessor(new_outer_if_true, IrOpcode::kLoop); | 474 Node* new_inner_loop = FindSuccessor(new_outer_if_true, IrOpcode::kLoop); |
| 451 Node* new_inner_phi = FindSuccessor(new_inner_loop, IrOpcode::kPhi); | 475 Node* new_inner_phi = FindSuccessor(new_inner_loop, IrOpcode::kPhi); |
| 452 | 476 |
| 453 CheckInputs(new_inner_phi, T.jsgraph.OneConstant(), T.jsgraph.ZeroConstant(), | 477 CheckInputs(new_inner_phi, T.jsgraph.OneConstant(), T.jsgraph.ZeroConstant(), |
| 454 new_inner_loop); | 478 new_inner_loop); |
| 455 CheckInputs(new_outer_phi, new_entry_phi, new_inner_phi, | 479 CheckInputs(new_outer_phi, new_entry_phi, new_inner_phi, |
| 456 T.jsgraph.ZeroConstant(), new_outer_loop); | 480 T.jsgraph.ZeroConstant(), new_outer_loop); |
| 457 } | 481 } |
| OLD | NEW |