| 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 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 158 T.graph.SetEnd(ret); | 158 T.graph.SetEnd(ret); |
| 159 | 159 |
| 160 T.DeconstructOsr(); | 160 T.DeconstructOsr(); |
| 161 | 161 |
| 162 CheckInputs(loop, T.start, loop); | 162 CheckInputs(loop, T.start, loop); |
| 163 CheckInputs(osr_phi, T.osr_values[0], T.jsgraph.ZeroConstant(), loop); | 163 CheckInputs(osr_phi, T.osr_values[0], T.jsgraph.ZeroConstant(), loop); |
| 164 CheckInputs(ret, osr_phi, T.start, loop); | 164 CheckInputs(ret, osr_phi, T.start, loop); |
| 165 } | 165 } |
| 166 | 166 |
| 167 | 167 |
| 168 TEST(Deconstruct_osr1_type) { | |
| 169 OsrDeconstructorTester T(1); | |
| 170 | |
| 171 Node* loop = T.NewOsrLoop(1); | |
| 172 Node* osr_phi = | |
| 173 T.NewOsrPhi(loop, T.jsgraph.OneConstant(), 0, T.jsgraph.ZeroConstant()); | |
| 174 Type* type = Type::Signed32(); | |
| 175 NodeProperties::SetBounds(osr_phi, Bounds(type, type)); | |
| 176 | |
| 177 Node* ret = T.graph.NewNode(T.common.Return(), osr_phi, T.start, loop); | |
| 178 T.graph.SetEnd(ret); | |
| 179 | |
| 180 OsrHelper helper(0, 0); | |
| 181 helper.Deconstruct(&T.jsgraph, &T.common, T.main_zone()); | |
| 182 | |
| 183 CHECK_EQ(type, NodeProperties::GetBounds(T.osr_values[0]).lower); | |
| 184 CHECK_EQ(type, NodeProperties::GetBounds(T.osr_values[0]).upper); | |
| 185 | |
| 186 CheckInputs(loop, T.start, loop); | |
| 187 CheckInputs(osr_phi, T.osr_values[0], T.jsgraph.ZeroConstant(), loop); | |
| 188 CheckInputs(ret, osr_phi, T.start, loop); | |
| 189 } | |
| 190 | |
| 191 | |
| 192 TEST(Deconstruct_osr_remove_prologue) { | 168 TEST(Deconstruct_osr_remove_prologue) { |
| 193 OsrDeconstructorTester T(1); | 169 OsrDeconstructorTester T(1); |
| 194 Diamond d(&T.graph, &T.common, T.p0); | 170 Diamond d(&T.graph, &T.common, T.p0); |
| 195 d.Chain(T.osr_normal_entry); | 171 d.Chain(T.osr_normal_entry); |
| 196 | 172 |
| 197 Node* loop = T.NewOsrLoop(1, d.merge); | 173 Node* loop = T.NewOsrLoop(1, d.merge); |
| 198 Node* osr_phi = | 174 Node* osr_phi = |
| 199 T.NewOsrPhi(loop, T.jsgraph.OneConstant(), 0, T.jsgraph.ZeroConstant()); | 175 T.NewOsrPhi(loop, T.jsgraph.OneConstant(), 0, T.jsgraph.ZeroConstant()); |
| 200 | 176 |
| 201 Node* ret = T.graph.NewNode(T.common.Return(), osr_phi, T.start, loop); | 177 Node* ret = T.graph.NewNode(T.common.Return(), osr_phi, T.start, loop); |
| (...skipping 384 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 586 | 562 |
| 587 Node* new_loop0_phi = new_ret->InputAt(0); | 563 Node* new_loop0_phi = new_ret->InputAt(0); |
| 588 CHECK_EQ(IrOpcode::kPhi, new_loop0_phi->opcode()); | 564 CHECK_EQ(IrOpcode::kPhi, new_loop0_phi->opcode()); |
| 589 CHECK_EQ(new_loop0_loop, NodeProperties::GetControlInput(new_loop0_phi)); | 565 CHECK_EQ(new_loop0_loop, NodeProperties::GetControlInput(new_loop0_phi)); |
| 590 CHECK_EQ(new_loop0_phi, FindSuccessor(new_loop0_loop, IrOpcode::kPhi)); | 566 CHECK_EQ(new_loop0_phi, FindSuccessor(new_loop0_loop, IrOpcode::kPhi)); |
| 591 | 567 |
| 592 // Check that the return returns the phi from the OSR loop and control | 568 // Check that the return returns the phi from the OSR loop and control |
| 593 // depends on the copy of the outer loop0. | 569 // depends on the copy of the outer loop0. |
| 594 CheckInputs(new_ret, new_loop0_phi, T.graph.start(), new_loop0_exit); | 570 CheckInputs(new_ret, new_loop0_phi, T.graph.start(), new_loop0_exit); |
| 595 } | 571 } |
| OLD | NEW |