| 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/all-nodes.h" | 6 #include "src/compiler/all-nodes.h" |
| 7 #include "src/compiler/common-operator.h" | 7 #include "src/compiler/common-operator.h" |
| 8 #include "src/compiler/diamond.h" | 8 #include "src/compiler/diamond.h" |
| 9 #include "src/compiler/graph.h" | 9 #include "src/compiler/graph.h" |
| 10 #include "src/compiler/js-graph.h" | 10 #include "src/compiler/js-graph.h" |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 151 T.graph.SetEnd(ret); | 151 T.graph.SetEnd(ret); |
| 152 | 152 |
| 153 T.DeconstructOsr(); | 153 T.DeconstructOsr(); |
| 154 | 154 |
| 155 CheckInputs(loop, T.start, loop); | 155 CheckInputs(loop, T.start, loop); |
| 156 CheckInputs(osr_phi, T.osr_values[0], T.jsgraph.ZeroConstant(), loop); | 156 CheckInputs(osr_phi, T.osr_values[0], T.jsgraph.ZeroConstant(), loop); |
| 157 CheckInputs(ret, osr_phi, T.start, loop); | 157 CheckInputs(ret, osr_phi, T.start, loop); |
| 158 } | 158 } |
| 159 | 159 |
| 160 | 160 |
| 161 TEST(Deconstruct_osr1_type) { |
| 162 OsrDeconstructorTester T(1); |
| 163 |
| 164 Node* loop = T.NewOsrLoop(1); |
| 165 Node* osr_phi = |
| 166 T.NewOsrPhi(loop, T.jsgraph.OneConstant(), 0, T.jsgraph.ZeroConstant()); |
| 167 Type* type = Type::Signed32(); |
| 168 NodeProperties::SetBounds(osr_phi, Bounds(type, type)); |
| 169 |
| 170 Node* ret = T.graph.NewNode(T.common.Return(), osr_phi, T.start, loop); |
| 171 T.graph.SetEnd(ret); |
| 172 |
| 173 OsrHelper helper(0, 0); |
| 174 helper.Deconstruct(&T.jsgraph, &T.common, T.main_zone()); |
| 175 |
| 176 CHECK_EQ(type, NodeProperties::GetBounds(T.osr_values[0]).lower); |
| 177 CHECK_EQ(type, NodeProperties::GetBounds(T.osr_values[0]).upper); |
| 178 |
| 179 CheckInputs(loop, T.start, loop); |
| 180 CheckInputs(osr_phi, T.osr_values[0], T.jsgraph.ZeroConstant(), loop); |
| 181 CheckInputs(ret, osr_phi, T.start, loop); |
| 182 } |
| 183 |
| 184 |
| 161 TEST(Deconstruct_osr_remove_prologue) { | 185 TEST(Deconstruct_osr_remove_prologue) { |
| 162 OsrDeconstructorTester T(1); | 186 OsrDeconstructorTester T(1); |
| 163 Diamond d(&T.graph, &T.common, T.p0); | 187 Diamond d(&T.graph, &T.common, T.p0); |
| 164 d.Chain(T.osr_normal_entry); | 188 d.Chain(T.osr_normal_entry); |
| 165 | 189 |
| 166 Node* loop = T.NewOsrLoop(1, d.merge); | 190 Node* loop = T.NewOsrLoop(1, d.merge); |
| 167 Node* osr_phi = | 191 Node* osr_phi = |
| 168 T.NewOsrPhi(loop, T.jsgraph.OneConstant(), 0, T.jsgraph.ZeroConstant()); | 192 T.NewOsrPhi(loop, T.jsgraph.OneConstant(), 0, T.jsgraph.ZeroConstant()); |
| 169 | 193 |
| 170 Node* ret = T.graph.NewNode(T.common.Return(), osr_phi, T.start, loop); | 194 Node* ret = T.graph.NewNode(T.common.Return(), osr_phi, T.start, loop); |
| (...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 453 | 477 |
| 454 // Check structure of inner loop. | 478 // Check structure of inner loop. |
| 455 Node* new_inner_loop = FindSuccessor(new_outer_if_true, IrOpcode::kLoop); | 479 Node* new_inner_loop = FindSuccessor(new_outer_if_true, IrOpcode::kLoop); |
| 456 Node* new_inner_phi = FindSuccessor(new_inner_loop, IrOpcode::kPhi); | 480 Node* new_inner_phi = FindSuccessor(new_inner_loop, IrOpcode::kPhi); |
| 457 | 481 |
| 458 CheckInputs(new_inner_phi, T.jsgraph.OneConstant(), T.jsgraph.ZeroConstant(), | 482 CheckInputs(new_inner_phi, T.jsgraph.OneConstant(), T.jsgraph.ZeroConstant(), |
| 459 new_inner_loop); | 483 new_inner_loop); |
| 460 CheckInputs(new_outer_phi, new_entry_phi, new_inner_phi, | 484 CheckInputs(new_outer_phi, new_entry_phi, new_inner_phi, |
| 461 T.jsgraph.ZeroConstant(), new_outer_loop); | 485 T.jsgraph.ZeroConstant(), new_outer_loop); |
| 462 } | 486 } |
| OLD | NEW |