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 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
115 } | 115 } |
116 | 116 |
117 void DeconstructOsr() { | 117 void DeconstructOsr() { |
118 OsrHelper helper(0, 0); | 118 OsrHelper helper(0, 0); |
119 helper.Deconstruct(&jsgraph, &common, main_zone()); | 119 helper.Deconstruct(&jsgraph, &common, main_zone()); |
120 AllNodes nodes(main_zone(), &graph); | 120 AllNodes nodes(main_zone(), &graph); |
121 // Should be edited out. | 121 // Should be edited out. |
122 CHECK(!nodes.IsLive(osr_normal_entry)); | 122 CHECK(!nodes.IsLive(osr_normal_entry)); |
123 CHECK(!nodes.IsLive(osr_loop_entry)); | 123 CHECK(!nodes.IsLive(osr_loop_entry)); |
124 // No dangling nodes should be left over. | 124 // No dangling nodes should be left over. |
125 CHECK_EQ(0u, nodes.gray.size()); | 125 for (Node* const node : nodes.live) { |
| 126 for (Node* const use : node->uses()) { |
| 127 CHECK(std::find(nodes.live.begin(), nodes.live.end(), use) != |
| 128 nodes.live.end()); |
| 129 } |
| 130 } |
126 } | 131 } |
127 }; | 132 }; |
128 | 133 |
129 | 134 |
130 TEST(Deconstruct_osr0) { | 135 TEST(Deconstruct_osr0) { |
131 OsrDeconstructorTester T(0); | 136 OsrDeconstructorTester T(0); |
132 | 137 |
133 Node* loop = T.NewOsrLoop(1); | 138 Node* loop = T.NewOsrLoop(1); |
134 | 139 |
135 T.graph.SetEnd(loop); | 140 T.graph.SetEnd(loop); |
(...skipping 341 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
477 | 482 |
478 // Check structure of inner loop. | 483 // Check structure of inner loop. |
479 Node* new_inner_loop = FindSuccessor(new_outer_if_true, IrOpcode::kLoop); | 484 Node* new_inner_loop = FindSuccessor(new_outer_if_true, IrOpcode::kLoop); |
480 Node* new_inner_phi = FindSuccessor(new_inner_loop, IrOpcode::kPhi); | 485 Node* new_inner_phi = FindSuccessor(new_inner_loop, IrOpcode::kPhi); |
481 | 486 |
482 CheckInputs(new_inner_phi, T.jsgraph.OneConstant(), T.jsgraph.ZeroConstant(), | 487 CheckInputs(new_inner_phi, T.jsgraph.OneConstant(), T.jsgraph.ZeroConstant(), |
483 new_inner_loop); | 488 new_inner_loop); |
484 CheckInputs(new_outer_phi, new_entry_phi, new_inner_phi, | 489 CheckInputs(new_outer_phi, new_entry_phi, new_inner_phi, |
485 T.jsgraph.ZeroConstant(), new_outer_loop); | 490 T.jsgraph.ZeroConstant(), new_outer_loop); |
486 } | 491 } |
OLD | NEW |