| 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/schedule.h" | 5 #include "src/compiler/schedule.h" |
| 6 #include "src/compiler/access-builder.h" | 6 #include "src/compiler/access-builder.h" |
| 7 #include "src/compiler/common-operator.h" | 7 #include "src/compiler/common-operator.h" |
| 8 #include "src/compiler/graph-visualizer.h" | 8 #include "src/compiler/graph-visualizer.h" |
| 9 #include "src/compiler/graph.h" | 9 #include "src/compiler/graph.h" |
| 10 #include "src/compiler/js-operator.h" | 10 #include "src/compiler/js-operator.h" |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 89 graph()->SetStart(graph()->NewNode(common()->Start(0))); | 89 graph()->SetStart(graph()->NewNode(common()->Start(0))); |
| 90 graph()->SetEnd(graph()->NewNode(common()->End(1), graph()->start())); | 90 graph()->SetEnd(graph()->NewNode(common()->End(1), graph()->start())); |
| 91 USE(Scheduler::ComputeSchedule(zone(), graph(), Scheduler::kNoFlags)); | 91 USE(Scheduler::ComputeSchedule(zone(), graph(), Scheduler::kNoFlags)); |
| 92 } | 92 } |
| 93 | 93 |
| 94 | 94 |
| 95 TEST_F(SchedulerTest, BuildScheduleOneParameter) { | 95 TEST_F(SchedulerTest, BuildScheduleOneParameter) { |
| 96 graph()->SetStart(graph()->NewNode(common()->Start(0))); | 96 graph()->SetStart(graph()->NewNode(common()->Start(0))); |
| 97 | 97 |
| 98 Node* p1 = graph()->NewNode(common()->Parameter(0), graph()->start()); | 98 Node* p1 = graph()->NewNode(common()->Parameter(0), graph()->start()); |
| 99 Node* zero = graph()->NewNode(common()->Int32Constant(0)); | 99 Node* ret = graph()->NewNode(common()->Return(), p1, graph()->start(), |
| 100 Node* ret = graph()->NewNode(common()->Return(), zero, p1, graph()->start(), | |
| 101 graph()->start()); | 100 graph()->start()); |
| 102 | 101 |
| 103 graph()->SetEnd(graph()->NewNode(common()->End(1), ret)); | 102 graph()->SetEnd(graph()->NewNode(common()->End(1), ret)); |
| 104 | 103 |
| 105 USE(Scheduler::ComputeSchedule(zone(), graph(), Scheduler::kNoFlags)); | 104 USE(Scheduler::ComputeSchedule(zone(), graph(), Scheduler::kNoFlags)); |
| 106 } | 105 } |
| 107 | 106 |
| 108 | 107 |
| 109 namespace { | 108 namespace { |
| 110 | 109 |
| (...skipping 11 matching lines...) Expand all Loading... |
| 122 | 121 |
| 123 } // namespace | 122 } // namespace |
| 124 | 123 |
| 125 | 124 |
| 126 TARGET_TEST_F(SchedulerTest, FloatingDiamond1) { | 125 TARGET_TEST_F(SchedulerTest, FloatingDiamond1) { |
| 127 Node* start = graph()->NewNode(common()->Start(1)); | 126 Node* start = graph()->NewNode(common()->Start(1)); |
| 128 graph()->SetStart(start); | 127 graph()->SetStart(start); |
| 129 | 128 |
| 130 Node* p0 = graph()->NewNode(common()->Parameter(0), start); | 129 Node* p0 = graph()->NewNode(common()->Parameter(0), start); |
| 131 Node* d1 = CreateDiamond(graph(), common(), p0); | 130 Node* d1 = CreateDiamond(graph(), common(), p0); |
| 132 Node* zero = graph()->NewNode(common()->Int32Constant(0)); | 131 Node* ret = graph()->NewNode(common()->Return(), d1, start, start); |
| 133 Node* ret = graph()->NewNode(common()->Return(), zero, d1, start, start); | |
| 134 Node* end = graph()->NewNode(common()->End(1), ret); | 132 Node* end = graph()->NewNode(common()->End(1), ret); |
| 135 | 133 |
| 136 graph()->SetEnd(end); | 134 graph()->SetEnd(end); |
| 137 | 135 |
| 138 ComputeAndVerifySchedule(14); | 136 ComputeAndVerifySchedule(13); |
| 139 } | 137 } |
| 140 | 138 |
| 141 TARGET_TEST_F(SchedulerTest, FloatingDeadDiamond1) { | 139 TARGET_TEST_F(SchedulerTest, FloatingDeadDiamond1) { |
| 142 Node* start = graph()->NewNode(common()->Start(1)); | 140 Node* start = graph()->NewNode(common()->Start(1)); |
| 143 graph()->SetStart(start); | 141 graph()->SetStart(start); |
| 144 | 142 |
| 145 Node* p0 = graph()->NewNode(common()->Parameter(0), start); | 143 Node* p0 = graph()->NewNode(common()->Parameter(0), start); |
| 146 Node* d1 = CreateDiamond(graph(), common(), p0); | 144 Node* d1 = CreateDiamond(graph(), common(), p0); |
| 147 USE(d1); | 145 USE(d1); |
| 148 Node* zero = graph()->NewNode(common()->Int32Constant(0)); | 146 Node* ret = graph()->NewNode(common()->Return(), p0, start, start); |
| 149 Node* ret = graph()->NewNode(common()->Return(), zero, p0, start, start); | |
| 150 Node* end = graph()->NewNode(common()->End(1), ret); | 147 Node* end = graph()->NewNode(common()->End(1), ret); |
| 151 | 148 |
| 152 graph()->SetEnd(end); | 149 graph()->SetEnd(end); |
| 153 | 150 |
| 154 ComputeAndVerifySchedule(5); | 151 ComputeAndVerifySchedule(4); |
| 155 } | 152 } |
| 156 | 153 |
| 157 TARGET_TEST_F(SchedulerTest, FloatingDeadDiamond2) { | 154 TARGET_TEST_F(SchedulerTest, FloatingDeadDiamond2) { |
| 158 Graph* g = graph(); | 155 Graph* g = graph(); |
| 159 Node* start = g->NewNode(common()->Start(1)); | 156 Node* start = g->NewNode(common()->Start(1)); |
| 160 g->SetStart(start); | 157 g->SetStart(start); |
| 161 | 158 |
| 162 Node* n1 = g->NewNode(common()->Parameter(1), start); | 159 Node* n1 = g->NewNode(common()->Parameter(1), start); |
| 163 | 160 |
| 164 Node* n2 = g->NewNode(common()->Branch(), n1, start); | 161 Node* n2 = g->NewNode(common()->Branch(), n1, start); |
| 165 Node* n3 = g->NewNode(common()->IfTrue(), n2); | 162 Node* n3 = g->NewNode(common()->IfTrue(), n2); |
| 166 Node* n4 = g->NewNode(common()->IfFalse(), n2); | 163 Node* n4 = g->NewNode(common()->IfFalse(), n2); |
| 167 Node* n5 = g->NewNode(common()->Int32Constant(-100)); | 164 Node* n5 = g->NewNode(common()->Int32Constant(-100)); |
| 168 Node* zero = graph()->NewNode(common()->Int32Constant(0)); | 165 Node* n6 = g->NewNode(common()->Return(), n5, start, n4); |
| 169 Node* n6 = g->NewNode(common()->Return(), zero, n5, start, n4); | |
| 170 Node* n7 = g->NewNode(common()->Int32Constant(0)); | 166 Node* n7 = g->NewNode(common()->Int32Constant(0)); |
| 171 Node* n8 = g->NewNode(common()->Return(), zero, n7, start, n3); | 167 Node* n8 = g->NewNode(common()->Return(), n7, start, n3); |
| 172 Node* n9 = g->NewNode(common()->End(2), n6, n8); | 168 Node* n9 = g->NewNode(common()->End(2), n6, n8); |
| 173 | 169 |
| 174 // Dead nodes | 170 // Dead nodes |
| 175 Node* n10 = g->NewNode(common()->Branch(), n1, n3); | 171 Node* n10 = g->NewNode(common()->Branch(), n1, n3); |
| 176 Node* n11 = g->NewNode(common()->IfTrue(), n10); | 172 Node* n11 = g->NewNode(common()->IfTrue(), n10); |
| 177 Node* n12 = g->NewNode(common()->IfFalse(), n10); | 173 Node* n12 = g->NewNode(common()->IfFalse(), n10); |
| 178 Node* n13 = g->NewNode(common()->Merge(2), n11, n12); | 174 Node* n13 = g->NewNode(common()->Merge(2), n11, n12); |
| 179 Node* n14 = | 175 Node* n14 = |
| 180 g->NewNode(common()->Phi(MachineRepresentation::kWord32, 2), n1, n7, n13); | 176 g->NewNode(common()->Phi(MachineRepresentation::kWord32, 2), n1, n7, n13); |
| 181 | 177 |
| 182 USE(n14); | 178 USE(n14); |
| 183 | 179 |
| 184 g->SetEnd(n9); | 180 g->SetEnd(n9); |
| 185 | 181 |
| 186 ComputeAndVerifySchedule(11); | 182 ComputeAndVerifySchedule(10); |
| 187 } | 183 } |
| 188 | 184 |
| 189 TARGET_TEST_F(SchedulerTest, FloatingDiamond2) { | 185 TARGET_TEST_F(SchedulerTest, FloatingDiamond2) { |
| 190 Node* start = graph()->NewNode(common()->Start(2)); | 186 Node* start = graph()->NewNode(common()->Start(2)); |
| 191 graph()->SetStart(start); | 187 graph()->SetStart(start); |
| 192 | 188 |
| 193 Node* p0 = graph()->NewNode(common()->Parameter(0), start); | 189 Node* p0 = graph()->NewNode(common()->Parameter(0), start); |
| 194 Node* p1 = graph()->NewNode(common()->Parameter(1), start); | 190 Node* p1 = graph()->NewNode(common()->Parameter(1), start); |
| 195 Node* d1 = CreateDiamond(graph(), common(), p0); | 191 Node* d1 = CreateDiamond(graph(), common(), p0); |
| 196 Node* d2 = CreateDiamond(graph(), common(), p1); | 192 Node* d2 = CreateDiamond(graph(), common(), p1); |
| 197 Node* add = graph()->NewNode(&kIntAdd, d1, d2); | 193 Node* add = graph()->NewNode(&kIntAdd, d1, d2); |
| 198 Node* zero = graph()->NewNode(common()->Int32Constant(0)); | 194 Node* ret = graph()->NewNode(common()->Return(), add, start, start); |
| 199 Node* ret = graph()->NewNode(common()->Return(), zero, add, start, start); | |
| 200 Node* end = graph()->NewNode(common()->End(1), ret); | 195 Node* end = graph()->NewNode(common()->End(1), ret); |
| 201 | 196 |
| 202 graph()->SetEnd(end); | 197 graph()->SetEnd(end); |
| 203 | 198 |
| 204 ComputeAndVerifySchedule(25); | 199 ComputeAndVerifySchedule(24); |
| 205 } | 200 } |
| 206 | 201 |
| 207 | 202 |
| 208 TARGET_TEST_F(SchedulerTest, FloatingDiamond3) { | 203 TARGET_TEST_F(SchedulerTest, FloatingDiamond3) { |
| 209 Node* start = graph()->NewNode(common()->Start(2)); | 204 Node* start = graph()->NewNode(common()->Start(2)); |
| 210 graph()->SetStart(start); | 205 graph()->SetStart(start); |
| 211 | 206 |
| 212 Node* p0 = graph()->NewNode(common()->Parameter(0), start); | 207 Node* p0 = graph()->NewNode(common()->Parameter(0), start); |
| 213 Node* p1 = graph()->NewNode(common()->Parameter(1), start); | 208 Node* p1 = graph()->NewNode(common()->Parameter(1), start); |
| 214 Node* d1 = CreateDiamond(graph(), common(), p0); | 209 Node* d1 = CreateDiamond(graph(), common(), p0); |
| 215 Node* d2 = CreateDiamond(graph(), common(), p1); | 210 Node* d2 = CreateDiamond(graph(), common(), p1); |
| 216 Node* add = graph()->NewNode(&kIntAdd, d1, d2); | 211 Node* add = graph()->NewNode(&kIntAdd, d1, d2); |
| 217 Node* d3 = CreateDiamond(graph(), common(), add); | 212 Node* d3 = CreateDiamond(graph(), common(), add); |
| 218 Node* zero = graph()->NewNode(common()->Int32Constant(0)); | 213 Node* ret = graph()->NewNode(common()->Return(), d3, start, start); |
| 219 Node* ret = graph()->NewNode(common()->Return(), zero, d3, start, start); | |
| 220 Node* end = graph()->NewNode(common()->End(1), ret); | 214 Node* end = graph()->NewNode(common()->End(1), ret); |
| 221 | 215 |
| 222 graph()->SetEnd(end); | 216 graph()->SetEnd(end); |
| 223 | 217 |
| 224 ComputeAndVerifySchedule(34); | 218 ComputeAndVerifySchedule(33); |
| 225 } | 219 } |
| 226 | 220 |
| 227 | 221 |
| 228 TARGET_TEST_F(SchedulerTest, NestedFloatingDiamonds) { | 222 TARGET_TEST_F(SchedulerTest, NestedFloatingDiamonds) { |
| 229 Node* start = graph()->NewNode(common()->Start(2)); | 223 Node* start = graph()->NewNode(common()->Start(2)); |
| 230 graph()->SetStart(start); | 224 graph()->SetStart(start); |
| 231 | 225 |
| 232 Node* p0 = graph()->NewNode(common()->Parameter(0), start); | 226 Node* p0 = graph()->NewNode(common()->Parameter(0), start); |
| 233 | 227 |
| 234 Node* fv = graph()->NewNode(common()->Int32Constant(7)); | 228 Node* fv = graph()->NewNode(common()->Int32Constant(7)); |
| (...skipping 12 matching lines...) Expand all Loading... |
| 247 Node* ffalse = graph()->NewNode(common()->Int32Constant(0)); | 241 Node* ffalse = graph()->NewNode(common()->Int32Constant(0)); |
| 248 Node* phi1 = graph()->NewNode( | 242 Node* phi1 = graph()->NewNode( |
| 249 common()->Phi(MachineRepresentation::kTagged, 2), ttrue, ffalse, m1); | 243 common()->Phi(MachineRepresentation::kTagged, 2), ttrue, ffalse, m1); |
| 250 | 244 |
| 251 | 245 |
| 252 Node* m = graph()->NewNode(common()->Merge(2), t, f); | 246 Node* m = graph()->NewNode(common()->Merge(2), t, f); |
| 253 Node* phi = graph()->NewNode(common()->Phi(MachineRepresentation::kTagged, 2), | 247 Node* phi = graph()->NewNode(common()->Phi(MachineRepresentation::kTagged, 2), |
| 254 fv, phi1, m); | 248 fv, phi1, m); |
| 255 Node* ephi1 = graph()->NewNode(common()->EffectPhi(2), start, map, m); | 249 Node* ephi1 = graph()->NewNode(common()->EffectPhi(2), start, map, m); |
| 256 | 250 |
| 257 Node* zero = graph()->NewNode(common()->Int32Constant(0)); | 251 Node* ret = graph()->NewNode(common()->Return(), phi, ephi1, start); |
| 258 Node* ret = graph()->NewNode(common()->Return(), zero, phi, ephi1, start); | |
| 259 Node* end = graph()->NewNode(common()->End(1), ret); | 252 Node* end = graph()->NewNode(common()->End(1), ret); |
| 260 | 253 |
| 261 graph()->SetEnd(end); | 254 graph()->SetEnd(end); |
| 262 | 255 |
| 263 ComputeAndVerifySchedule(24); | 256 ComputeAndVerifySchedule(23); |
| 264 } | 257 } |
| 265 | 258 |
| 266 | 259 |
| 267 TARGET_TEST_F(SchedulerTest, NestedFloatingDiamondWithChain) { | 260 TARGET_TEST_F(SchedulerTest, NestedFloatingDiamondWithChain) { |
| 268 Node* start = graph()->NewNode(common()->Start(2)); | 261 Node* start = graph()->NewNode(common()->Start(2)); |
| 269 graph()->SetStart(start); | 262 graph()->SetStart(start); |
| 270 | 263 |
| 271 Node* p0 = graph()->NewNode(common()->Parameter(0), start); | 264 Node* p0 = graph()->NewNode(common()->Parameter(0), start); |
| 272 Node* p1 = graph()->NewNode(common()->Parameter(1), start); | 265 Node* p1 = graph()->NewNode(common()->Parameter(1), start); |
| 273 Node* c = graph()->NewNode(common()->Int32Constant(7)); | 266 Node* c = graph()->NewNode(common()->Int32Constant(7)); |
| (...skipping 20 matching lines...) Expand all Loading... |
| 294 common()->Phi(MachineRepresentation::kTagged, 2), phiB1, c, mA2); | 287 common()->Phi(MachineRepresentation::kTagged, 2), phiB1, c, mA2); |
| 295 | 288 |
| 296 Node* brB2 = graph()->NewNode(common()->Branch(), phiA1, mB1); | 289 Node* brB2 = graph()->NewNode(common()->Branch(), phiA1, mB1); |
| 297 Node* tB2 = graph()->NewNode(common()->IfTrue(), brB2); | 290 Node* tB2 = graph()->NewNode(common()->IfTrue(), brB2); |
| 298 Node* fB2 = graph()->NewNode(common()->IfFalse(), brB2); | 291 Node* fB2 = graph()->NewNode(common()->IfFalse(), brB2); |
| 299 Node* mB2 = graph()->NewNode(common()->Merge(2), tB2, fB2); | 292 Node* mB2 = graph()->NewNode(common()->Merge(2), tB2, fB2); |
| 300 Node* phiB2 = graph()->NewNode( | 293 Node* phiB2 = graph()->NewNode( |
| 301 common()->Phi(MachineRepresentation::kTagged, 2), phiA1, c, mB2); | 294 common()->Phi(MachineRepresentation::kTagged, 2), phiA1, c, mB2); |
| 302 | 295 |
| 303 Node* add = graph()->NewNode(&kIntAdd, phiA2, phiB2); | 296 Node* add = graph()->NewNode(&kIntAdd, phiA2, phiB2); |
| 304 Node* zero = graph()->NewNode(common()->Int32Constant(0)); | 297 Node* ret = graph()->NewNode(common()->Return(), add, start, start); |
| 305 Node* ret = graph()->NewNode(common()->Return(), zero, add, start, start); | |
| 306 Node* end = graph()->NewNode(common()->End(1), ret); | 298 Node* end = graph()->NewNode(common()->End(1), ret); |
| 307 | 299 |
| 308 graph()->SetEnd(end); | 300 graph()->SetEnd(end); |
| 309 | 301 |
| 310 ComputeAndVerifySchedule(37); | 302 ComputeAndVerifySchedule(36); |
| 311 } | 303 } |
| 312 | 304 |
| 313 | 305 |
| 314 TARGET_TEST_F(SchedulerTest, NestedFloatingDiamondWithLoop) { | 306 TARGET_TEST_F(SchedulerTest, NestedFloatingDiamondWithLoop) { |
| 315 Node* start = graph()->NewNode(common()->Start(2)); | 307 Node* start = graph()->NewNode(common()->Start(2)); |
| 316 graph()->SetStart(start); | 308 graph()->SetStart(start); |
| 317 | 309 |
| 318 Node* p0 = graph()->NewNode(common()->Parameter(0), start); | 310 Node* p0 = graph()->NewNode(common()->Parameter(0), start); |
| 319 | 311 |
| 320 Node* fv = graph()->NewNode(common()->Int32Constant(7)); | 312 Node* fv = graph()->NewNode(common()->Int32Constant(7)); |
| (...skipping 10 matching lines...) Expand all Loading... |
| 331 Node* t1 = graph()->NewNode(common()->IfTrue(), br1); | 323 Node* t1 = graph()->NewNode(common()->IfTrue(), br1); |
| 332 Node* f1 = graph()->NewNode(common()->IfFalse(), br1); | 324 Node* f1 = graph()->NewNode(common()->IfFalse(), br1); |
| 333 | 325 |
| 334 loop->ReplaceInput(1, t1); // close loop. | 326 loop->ReplaceInput(1, t1); // close loop. |
| 335 ind->ReplaceInput(1, ind); // close induction variable. | 327 ind->ReplaceInput(1, ind); // close induction variable. |
| 336 | 328 |
| 337 Node* m = graph()->NewNode(common()->Merge(2), t, f1); | 329 Node* m = graph()->NewNode(common()->Merge(2), t, f1); |
| 338 Node* phi = graph()->NewNode(common()->Phi(MachineRepresentation::kTagged, 2), | 330 Node* phi = graph()->NewNode(common()->Phi(MachineRepresentation::kTagged, 2), |
| 339 fv, ind, m); | 331 fv, ind, m); |
| 340 | 332 |
| 341 Node* zero = graph()->NewNode(common()->Int32Constant(0)); | 333 Node* ret = graph()->NewNode(common()->Return(), phi, start, start); |
| 342 Node* ret = graph()->NewNode(common()->Return(), zero, phi, start, start); | |
| 343 Node* end = graph()->NewNode(common()->End(1), ret); | 334 Node* end = graph()->NewNode(common()->End(1), ret); |
| 344 | 335 |
| 345 graph()->SetEnd(end); | 336 graph()->SetEnd(end); |
| 346 | 337 |
| 347 ComputeAndVerifySchedule(21); | 338 ComputeAndVerifySchedule(20); |
| 348 } | 339 } |
| 349 | 340 |
| 350 | 341 |
| 351 TARGET_TEST_F(SchedulerTest, LoopedFloatingDiamond1) { | 342 TARGET_TEST_F(SchedulerTest, LoopedFloatingDiamond1) { |
| 352 Node* start = graph()->NewNode(common()->Start(2)); | 343 Node* start = graph()->NewNode(common()->Start(2)); |
| 353 graph()->SetStart(start); | 344 graph()->SetStart(start); |
| 354 | 345 |
| 355 Node* p0 = graph()->NewNode(common()->Parameter(0), start); | 346 Node* p0 = graph()->NewNode(common()->Parameter(0), start); |
| 356 | 347 |
| 357 Node* c = graph()->NewNode(common()->Int32Constant(7)); | 348 Node* c = graph()->NewNode(common()->Int32Constant(7)); |
| 358 Node* loop = graph()->NewNode(common()->Loop(2), start, start); | 349 Node* loop = graph()->NewNode(common()->Loop(2), start, start); |
| 359 Node* ind = graph()->NewNode(common()->Phi(MachineRepresentation::kTagged, 2), | 350 Node* ind = graph()->NewNode(common()->Phi(MachineRepresentation::kTagged, 2), |
| 360 p0, p0, loop); | 351 p0, p0, loop); |
| 361 Node* add = graph()->NewNode(&kIntAdd, ind, c); | 352 Node* add = graph()->NewNode(&kIntAdd, ind, c); |
| 362 | 353 |
| 363 Node* br = graph()->NewNode(common()->Branch(), add, loop); | 354 Node* br = graph()->NewNode(common()->Branch(), add, loop); |
| 364 Node* t = graph()->NewNode(common()->IfTrue(), br); | 355 Node* t = graph()->NewNode(common()->IfTrue(), br); |
| 365 Node* f = graph()->NewNode(common()->IfFalse(), br); | 356 Node* f = graph()->NewNode(common()->IfFalse(), br); |
| 366 | 357 |
| 367 Node* br1 = graph()->NewNode(common()->Branch(), p0, graph()->start()); | 358 Node* br1 = graph()->NewNode(common()->Branch(), p0, graph()->start()); |
| 368 Node* t1 = graph()->NewNode(common()->IfTrue(), br1); | 359 Node* t1 = graph()->NewNode(common()->IfTrue(), br1); |
| 369 Node* f1 = graph()->NewNode(common()->IfFalse(), br1); | 360 Node* f1 = graph()->NewNode(common()->IfFalse(), br1); |
| 370 Node* m1 = graph()->NewNode(common()->Merge(2), t1, f1); | 361 Node* m1 = graph()->NewNode(common()->Merge(2), t1, f1); |
| 371 Node* phi1 = graph()->NewNode( | 362 Node* phi1 = graph()->NewNode( |
| 372 common()->Phi(MachineRepresentation::kTagged, 2), add, p0, m1); | 363 common()->Phi(MachineRepresentation::kTagged, 2), add, p0, m1); |
| 373 | 364 |
| 374 loop->ReplaceInput(1, t); // close loop. | 365 loop->ReplaceInput(1, t); // close loop. |
| 375 ind->ReplaceInput(1, phi1); // close induction variable. | 366 ind->ReplaceInput(1, phi1); // close induction variable. |
| 376 | 367 |
| 377 Node* zero = graph()->NewNode(common()->Int32Constant(0)); | 368 Node* ret = graph()->NewNode(common()->Return(), ind, start, f); |
| 378 Node* ret = graph()->NewNode(common()->Return(), zero, ind, start, f); | |
| 379 Node* end = graph()->NewNode(common()->End(2), ret, f); | 369 Node* end = graph()->NewNode(common()->End(2), ret, f); |
| 380 | 370 |
| 381 graph()->SetEnd(end); | 371 graph()->SetEnd(end); |
| 382 | 372 |
| 383 ComputeAndVerifySchedule(21); | 373 ComputeAndVerifySchedule(20); |
| 384 } | 374 } |
| 385 | 375 |
| 386 | 376 |
| 387 TARGET_TEST_F(SchedulerTest, LoopedFloatingDiamond2) { | 377 TARGET_TEST_F(SchedulerTest, LoopedFloatingDiamond2) { |
| 388 Node* start = graph()->NewNode(common()->Start(2)); | 378 Node* start = graph()->NewNode(common()->Start(2)); |
| 389 graph()->SetStart(start); | 379 graph()->SetStart(start); |
| 390 | 380 |
| 391 Node* p0 = graph()->NewNode(common()->Parameter(0), start); | 381 Node* p0 = graph()->NewNode(common()->Parameter(0), start); |
| 392 | 382 |
| 393 Node* c = graph()->NewNode(common()->Int32Constant(7)); | 383 Node* c = graph()->NewNode(common()->Int32Constant(7)); |
| (...skipping 10 matching lines...) Expand all Loading... |
| 404 | 394 |
| 405 Node* add = graph()->NewNode(&kIntAdd, ind, phi1); | 395 Node* add = graph()->NewNode(&kIntAdd, ind, phi1); |
| 406 | 396 |
| 407 Node* br = graph()->NewNode(common()->Branch(), add, loop); | 397 Node* br = graph()->NewNode(common()->Branch(), add, loop); |
| 408 Node* t = graph()->NewNode(common()->IfTrue(), br); | 398 Node* t = graph()->NewNode(common()->IfTrue(), br); |
| 409 Node* f = graph()->NewNode(common()->IfFalse(), br); | 399 Node* f = graph()->NewNode(common()->IfFalse(), br); |
| 410 | 400 |
| 411 loop->ReplaceInput(1, t); // close loop. | 401 loop->ReplaceInput(1, t); // close loop. |
| 412 ind->ReplaceInput(1, add); // close induction variable. | 402 ind->ReplaceInput(1, add); // close induction variable. |
| 413 | 403 |
| 414 Node* zero = graph()->NewNode(common()->Int32Constant(0)); | 404 Node* ret = graph()->NewNode(common()->Return(), ind, start, f); |
| 415 Node* ret = graph()->NewNode(common()->Return(), zero, ind, start, f); | |
| 416 Node* end = graph()->NewNode(common()->End(2), ret, f); | 405 Node* end = graph()->NewNode(common()->End(2), ret, f); |
| 417 | 406 |
| 418 graph()->SetEnd(end); | 407 graph()->SetEnd(end); |
| 419 | 408 |
| 420 ComputeAndVerifySchedule(21); | 409 ComputeAndVerifySchedule(20); |
| 421 } | 410 } |
| 422 | 411 |
| 423 | 412 |
| 424 TARGET_TEST_F(SchedulerTest, LoopedFloatingDiamond3) { | 413 TARGET_TEST_F(SchedulerTest, LoopedFloatingDiamond3) { |
| 425 Node* start = graph()->NewNode(common()->Start(2)); | 414 Node* start = graph()->NewNode(common()->Start(2)); |
| 426 graph()->SetStart(start); | 415 graph()->SetStart(start); |
| 427 | 416 |
| 428 Node* p0 = graph()->NewNode(common()->Parameter(0), start); | 417 Node* p0 = graph()->NewNode(common()->Parameter(0), start); |
| 429 | 418 |
| 430 Node* c = graph()->NewNode(common()->Int32Constant(7)); | 419 Node* c = graph()->NewNode(common()->Int32Constant(7)); |
| (...skipping 23 matching lines...) Expand all Loading... |
| 454 | 443 |
| 455 Node* add = graph()->NewNode(&kIntAdd, ind, phi1); | 444 Node* add = graph()->NewNode(&kIntAdd, ind, phi1); |
| 456 | 445 |
| 457 Node* br = graph()->NewNode(common()->Branch(), add, loop); | 446 Node* br = graph()->NewNode(common()->Branch(), add, loop); |
| 458 Node* t = graph()->NewNode(common()->IfTrue(), br); | 447 Node* t = graph()->NewNode(common()->IfTrue(), br); |
| 459 Node* f = graph()->NewNode(common()->IfFalse(), br); | 448 Node* f = graph()->NewNode(common()->IfFalse(), br); |
| 460 | 449 |
| 461 loop->ReplaceInput(1, t); // close loop. | 450 loop->ReplaceInput(1, t); // close loop. |
| 462 ind->ReplaceInput(1, add); // close induction variable. | 451 ind->ReplaceInput(1, add); // close induction variable. |
| 463 | 452 |
| 464 Node* zero = graph()->NewNode(common()->Int32Constant(0)); | 453 Node* ret = graph()->NewNode(common()->Return(), ind, start, f); |
| 465 Node* ret = graph()->NewNode(common()->Return(), zero, ind, start, f); | |
| 466 Node* end = graph()->NewNode(common()->End(2), ret, f); | 454 Node* end = graph()->NewNode(common()->End(2), ret, f); |
| 467 | 455 |
| 468 graph()->SetEnd(end); | 456 graph()->SetEnd(end); |
| 469 | 457 |
| 470 ComputeAndVerifySchedule(29); | 458 ComputeAndVerifySchedule(28); |
| 471 } | 459 } |
| 472 | 460 |
| 473 | 461 |
| 474 TARGET_TEST_F(SchedulerTest, PhisPushedDownToDifferentBranches) { | 462 TARGET_TEST_F(SchedulerTest, PhisPushedDownToDifferentBranches) { |
| 475 Node* start = graph()->NewNode(common()->Start(2)); | 463 Node* start = graph()->NewNode(common()->Start(2)); |
| 476 graph()->SetStart(start); | 464 graph()->SetStart(start); |
| 477 | 465 |
| 478 Node* p0 = graph()->NewNode(common()->Parameter(0), start); | 466 Node* p0 = graph()->NewNode(common()->Parameter(0), start); |
| 479 Node* p1 = graph()->NewNode(common()->Parameter(1), start); | 467 Node* p1 = graph()->NewNode(common()->Parameter(1), start); |
| 480 | 468 |
| (...skipping 10 matching lines...) Expand all Loading... |
| 491 Node* phi2 = graph()->NewNode( | 479 Node* phi2 = graph()->NewNode( |
| 492 common()->Phi(MachineRepresentation::kTagged, 2), v3, v4, m); | 480 common()->Phi(MachineRepresentation::kTagged, 2), v3, v4, m); |
| 493 | 481 |
| 494 Node* br2 = graph()->NewNode(common()->Branch(), p1, graph()->start()); | 482 Node* br2 = graph()->NewNode(common()->Branch(), p1, graph()->start()); |
| 495 Node* t2 = graph()->NewNode(common()->IfTrue(), br2); | 483 Node* t2 = graph()->NewNode(common()->IfTrue(), br2); |
| 496 Node* f2 = graph()->NewNode(common()->IfFalse(), br2); | 484 Node* f2 = graph()->NewNode(common()->IfFalse(), br2); |
| 497 Node* m2 = graph()->NewNode(common()->Merge(2), t2, f2); | 485 Node* m2 = graph()->NewNode(common()->Merge(2), t2, f2); |
| 498 Node* phi3 = graph()->NewNode( | 486 Node* phi3 = graph()->NewNode( |
| 499 common()->Phi(MachineRepresentation::kTagged, 2), phi, phi2, m2); | 487 common()->Phi(MachineRepresentation::kTagged, 2), phi, phi2, m2); |
| 500 | 488 |
| 501 Node* zero = graph()->NewNode(common()->Int32Constant(0)); | 489 Node* ret = graph()->NewNode(common()->Return(), phi3, start, start); |
| 502 Node* ret = graph()->NewNode(common()->Return(), zero, phi3, start, start); | |
| 503 Node* end = graph()->NewNode(common()->End(1), ret); | 490 Node* end = graph()->NewNode(common()->End(1), ret); |
| 504 | 491 |
| 505 graph()->SetEnd(end); | 492 graph()->SetEnd(end); |
| 506 | 493 |
| 507 ComputeAndVerifySchedule(25); | 494 ComputeAndVerifySchedule(24); |
| 508 } | 495 } |
| 509 | 496 |
| 510 | 497 |
| 511 TARGET_TEST_F(SchedulerTest, BranchHintTrue) { | 498 TARGET_TEST_F(SchedulerTest, BranchHintTrue) { |
| 512 Node* start = graph()->NewNode(common()->Start(1)); | 499 Node* start = graph()->NewNode(common()->Start(1)); |
| 513 graph()->SetStart(start); | 500 graph()->SetStart(start); |
| 514 | 501 |
| 515 Node* p0 = graph()->NewNode(common()->Parameter(0), start); | 502 Node* p0 = graph()->NewNode(common()->Parameter(0), start); |
| 516 Node* tv = graph()->NewNode(common()->Int32Constant(6)); | 503 Node* tv = graph()->NewNode(common()->Int32Constant(6)); |
| 517 Node* fv = graph()->NewNode(common()->Int32Constant(7)); | 504 Node* fv = graph()->NewNode(common()->Int32Constant(7)); |
| 518 Node* br = graph()->NewNode(common()->Branch(BranchHint::kTrue), p0, start); | 505 Node* br = graph()->NewNode(common()->Branch(BranchHint::kTrue), p0, start); |
| 519 Node* t = graph()->NewNode(common()->IfTrue(), br); | 506 Node* t = graph()->NewNode(common()->IfTrue(), br); |
| 520 Node* f = graph()->NewNode(common()->IfFalse(), br); | 507 Node* f = graph()->NewNode(common()->IfFalse(), br); |
| 521 Node* m = graph()->NewNode(common()->Merge(2), t, f); | 508 Node* m = graph()->NewNode(common()->Merge(2), t, f); |
| 522 Node* phi = graph()->NewNode(common()->Phi(MachineRepresentation::kTagged, 2), | 509 Node* phi = graph()->NewNode(common()->Phi(MachineRepresentation::kTagged, 2), |
| 523 tv, fv, m); | 510 tv, fv, m); |
| 524 Node* zero = graph()->NewNode(common()->Int32Constant(0)); | 511 Node* ret = graph()->NewNode(common()->Return(), phi, start, start); |
| 525 Node* ret = graph()->NewNode(common()->Return(), zero, phi, start, start); | |
| 526 Node* end = graph()->NewNode(common()->End(1), ret); | 512 Node* end = graph()->NewNode(common()->End(1), ret); |
| 527 | 513 |
| 528 graph()->SetEnd(end); | 514 graph()->SetEnd(end); |
| 529 | 515 |
| 530 Schedule* schedule = ComputeAndVerifySchedule(14); | 516 Schedule* schedule = ComputeAndVerifySchedule(13); |
| 531 // Make sure the false block is marked as deferred. | 517 // Make sure the false block is marked as deferred. |
| 532 EXPECT_FALSE(schedule->block(t)->deferred()); | 518 EXPECT_FALSE(schedule->block(t)->deferred()); |
| 533 EXPECT_TRUE(schedule->block(f)->deferred()); | 519 EXPECT_TRUE(schedule->block(f)->deferred()); |
| 534 } | 520 } |
| 535 | 521 |
| 536 | 522 |
| 537 TARGET_TEST_F(SchedulerTest, BranchHintFalse) { | 523 TARGET_TEST_F(SchedulerTest, BranchHintFalse) { |
| 538 Node* start = graph()->NewNode(common()->Start(1)); | 524 Node* start = graph()->NewNode(common()->Start(1)); |
| 539 graph()->SetStart(start); | 525 graph()->SetStart(start); |
| 540 | 526 |
| 541 Node* p0 = graph()->NewNode(common()->Parameter(0), start); | 527 Node* p0 = graph()->NewNode(common()->Parameter(0), start); |
| 542 Node* tv = graph()->NewNode(common()->Int32Constant(6)); | 528 Node* tv = graph()->NewNode(common()->Int32Constant(6)); |
| 543 Node* fv = graph()->NewNode(common()->Int32Constant(7)); | 529 Node* fv = graph()->NewNode(common()->Int32Constant(7)); |
| 544 Node* br = graph()->NewNode(common()->Branch(BranchHint::kFalse), p0, start); | 530 Node* br = graph()->NewNode(common()->Branch(BranchHint::kFalse), p0, start); |
| 545 Node* t = graph()->NewNode(common()->IfTrue(), br); | 531 Node* t = graph()->NewNode(common()->IfTrue(), br); |
| 546 Node* f = graph()->NewNode(common()->IfFalse(), br); | 532 Node* f = graph()->NewNode(common()->IfFalse(), br); |
| 547 Node* m = graph()->NewNode(common()->Merge(2), t, f); | 533 Node* m = graph()->NewNode(common()->Merge(2), t, f); |
| 548 Node* phi = graph()->NewNode(common()->Phi(MachineRepresentation::kTagged, 2), | 534 Node* phi = graph()->NewNode(common()->Phi(MachineRepresentation::kTagged, 2), |
| 549 tv, fv, m); | 535 tv, fv, m); |
| 550 Node* zero = graph()->NewNode(common()->Int32Constant(0)); | 536 Node* ret = graph()->NewNode(common()->Return(), phi, start, start); |
| 551 Node* ret = graph()->NewNode(common()->Return(), zero, phi, start, start); | |
| 552 Node* end = graph()->NewNode(common()->End(1), ret); | 537 Node* end = graph()->NewNode(common()->End(1), ret); |
| 553 | 538 |
| 554 graph()->SetEnd(end); | 539 graph()->SetEnd(end); |
| 555 | 540 |
| 556 Schedule* schedule = ComputeAndVerifySchedule(14); | 541 Schedule* schedule = ComputeAndVerifySchedule(13); |
| 557 // Make sure the true block is marked as deferred. | 542 // Make sure the true block is marked as deferred. |
| 558 EXPECT_TRUE(schedule->block(t)->deferred()); | 543 EXPECT_TRUE(schedule->block(t)->deferred()); |
| 559 EXPECT_FALSE(schedule->block(f)->deferred()); | 544 EXPECT_FALSE(schedule->block(f)->deferred()); |
| 560 } | 545 } |
| 561 | 546 |
| 562 | 547 |
| 563 TARGET_TEST_F(SchedulerTest, CallException) { | 548 TARGET_TEST_F(SchedulerTest, CallException) { |
| 564 Node* start = graph()->NewNode(common()->Start(1)); | 549 Node* start = graph()->NewNode(common()->Start(1)); |
| 565 graph()->SetStart(start); | 550 graph()->SetStart(start); |
| 566 | 551 |
| 567 Node* p0 = graph()->NewNode(common()->Parameter(0), start); | 552 Node* p0 = graph()->NewNode(common()->Parameter(0), start); |
| 568 Node* c1 = graph()->NewNode(&kMockCall, start); | 553 Node* c1 = graph()->NewNode(&kMockCall, start); |
| 569 Node* ok1 = graph()->NewNode(common()->IfSuccess(), c1); | 554 Node* ok1 = graph()->NewNode(common()->IfSuccess(), c1); |
| 570 Node* ex1 = graph()->NewNode(common()->IfException(), c1, c1); | 555 Node* ex1 = graph()->NewNode(common()->IfException(), c1, c1); |
| 571 Node* c2 = graph()->NewNode(&kMockCall, ok1); | 556 Node* c2 = graph()->NewNode(&kMockCall, ok1); |
| 572 Node* ok2 = graph()->NewNode(common()->IfSuccess(), c2); | 557 Node* ok2 = graph()->NewNode(common()->IfSuccess(), c2); |
| 573 Node* ex2 = graph()->NewNode(common()->IfException(), c2, c2); | 558 Node* ex2 = graph()->NewNode(common()->IfException(), c2, c2); |
| 574 Node* hdl = graph()->NewNode(common()->Merge(2), ex1, ex2); | 559 Node* hdl = graph()->NewNode(common()->Merge(2), ex1, ex2); |
| 575 Node* m = graph()->NewNode(common()->Merge(2), ok2, hdl); | 560 Node* m = graph()->NewNode(common()->Merge(2), ok2, hdl); |
| 576 Node* phi = graph()->NewNode(common()->Phi(MachineRepresentation::kTagged, 2), | 561 Node* phi = graph()->NewNode(common()->Phi(MachineRepresentation::kTagged, 2), |
| 577 c2, p0, m); | 562 c2, p0, m); |
| 578 Node* zero = graph()->NewNode(common()->Int32Constant(0)); | 563 Node* ret = graph()->NewNode(common()->Return(), phi, start, m); |
| 579 Node* ret = graph()->NewNode(common()->Return(), zero, phi, start, m); | |
| 580 Node* end = graph()->NewNode(common()->End(1), ret); | 564 Node* end = graph()->NewNode(common()->End(1), ret); |
| 581 | 565 |
| 582 graph()->SetEnd(end); | 566 graph()->SetEnd(end); |
| 583 | 567 |
| 584 Schedule* schedule = ComputeAndVerifySchedule(18); | 568 Schedule* schedule = ComputeAndVerifySchedule(17); |
| 585 // Make sure the exception blocks as well as the handler are deferred. | 569 // Make sure the exception blocks as well as the handler are deferred. |
| 586 EXPECT_TRUE(schedule->block(ex1)->deferred()); | 570 EXPECT_TRUE(schedule->block(ex1)->deferred()); |
| 587 EXPECT_TRUE(schedule->block(ex2)->deferred()); | 571 EXPECT_TRUE(schedule->block(ex2)->deferred()); |
| 588 EXPECT_TRUE(schedule->block(hdl)->deferred()); | 572 EXPECT_TRUE(schedule->block(hdl)->deferred()); |
| 589 EXPECT_FALSE(schedule->block(m)->deferred()); | 573 EXPECT_FALSE(schedule->block(m)->deferred()); |
| 590 } | 574 } |
| 591 | 575 |
| 592 | 576 |
| 593 TARGET_TEST_F(SchedulerTest, TailCall) { | 577 TARGET_TEST_F(SchedulerTest, TailCall) { |
| 594 Node* start = graph()->NewNode(common()->Start(1)); | 578 Node* start = graph()->NewNode(common()->Start(1)); |
| (...skipping 17 matching lines...) Expand all Loading... |
| 612 Node* sw = graph()->NewNode(common()->Switch(3), p0, start); | 596 Node* sw = graph()->NewNode(common()->Switch(3), p0, start); |
| 613 Node* c0 = graph()->NewNode(common()->IfValue(0), sw); | 597 Node* c0 = graph()->NewNode(common()->IfValue(0), sw); |
| 614 Node* v0 = graph()->NewNode(common()->Int32Constant(11)); | 598 Node* v0 = graph()->NewNode(common()->Int32Constant(11)); |
| 615 Node* c1 = graph()->NewNode(common()->IfValue(1), sw); | 599 Node* c1 = graph()->NewNode(common()->IfValue(1), sw); |
| 616 Node* v1 = graph()->NewNode(common()->Int32Constant(22)); | 600 Node* v1 = graph()->NewNode(common()->Int32Constant(22)); |
| 617 Node* d = graph()->NewNode(common()->IfDefault(), sw); | 601 Node* d = graph()->NewNode(common()->IfDefault(), sw); |
| 618 Node* vd = graph()->NewNode(common()->Int32Constant(33)); | 602 Node* vd = graph()->NewNode(common()->Int32Constant(33)); |
| 619 Node* m = graph()->NewNode(common()->Merge(3), c0, c1, d); | 603 Node* m = graph()->NewNode(common()->Merge(3), c0, c1, d); |
| 620 Node* phi = graph()->NewNode(common()->Phi(MachineRepresentation::kWord32, 3), | 604 Node* phi = graph()->NewNode(common()->Phi(MachineRepresentation::kWord32, 3), |
| 621 v0, v1, vd, m); | 605 v0, v1, vd, m); |
| 622 Node* zero = graph()->NewNode(common()->Int32Constant(0)); | 606 Node* ret = graph()->NewNode(common()->Return(), phi, start, m); |
| 623 Node* ret = graph()->NewNode(common()->Return(), zero, phi, start, m); | |
| 624 Node* end = graph()->NewNode(common()->End(1), ret); | 607 Node* end = graph()->NewNode(common()->End(1), ret); |
| 625 | 608 |
| 626 graph()->SetEnd(end); | 609 graph()->SetEnd(end); |
| 627 | 610 |
| 628 ComputeAndVerifySchedule(17); | 611 ComputeAndVerifySchedule(16); |
| 629 } | 612 } |
| 630 | 613 |
| 631 | 614 |
| 632 TARGET_TEST_F(SchedulerTest, FloatingSwitch) { | 615 TARGET_TEST_F(SchedulerTest, FloatingSwitch) { |
| 633 Node* start = graph()->NewNode(common()->Start(1)); | 616 Node* start = graph()->NewNode(common()->Start(1)); |
| 634 graph()->SetStart(start); | 617 graph()->SetStart(start); |
| 635 | 618 |
| 636 Node* p0 = graph()->NewNode(common()->Parameter(0), start); | 619 Node* p0 = graph()->NewNode(common()->Parameter(0), start); |
| 637 Node* sw = graph()->NewNode(common()->Switch(3), p0, start); | 620 Node* sw = graph()->NewNode(common()->Switch(3), p0, start); |
| 638 Node* c0 = graph()->NewNode(common()->IfValue(0), sw); | 621 Node* c0 = graph()->NewNode(common()->IfValue(0), sw); |
| 639 Node* v0 = graph()->NewNode(common()->Int32Constant(11)); | 622 Node* v0 = graph()->NewNode(common()->Int32Constant(11)); |
| 640 Node* c1 = graph()->NewNode(common()->IfValue(1), sw); | 623 Node* c1 = graph()->NewNode(common()->IfValue(1), sw); |
| 641 Node* v1 = graph()->NewNode(common()->Int32Constant(22)); | 624 Node* v1 = graph()->NewNode(common()->Int32Constant(22)); |
| 642 Node* d = graph()->NewNode(common()->IfDefault(), sw); | 625 Node* d = graph()->NewNode(common()->IfDefault(), sw); |
| 643 Node* vd = graph()->NewNode(common()->Int32Constant(33)); | 626 Node* vd = graph()->NewNode(common()->Int32Constant(33)); |
| 644 Node* m = graph()->NewNode(common()->Merge(3), c0, c1, d); | 627 Node* m = graph()->NewNode(common()->Merge(3), c0, c1, d); |
| 645 Node* phi = graph()->NewNode(common()->Phi(MachineRepresentation::kWord32, 3), | 628 Node* phi = graph()->NewNode(common()->Phi(MachineRepresentation::kWord32, 3), |
| 646 v0, v1, vd, m); | 629 v0, v1, vd, m); |
| 647 Node* zero = graph()->NewNode(common()->Int32Constant(0)); | 630 Node* ret = graph()->NewNode(common()->Return(), phi, start, start); |
| 648 Node* ret = graph()->NewNode(common()->Return(), zero, phi, start, start); | |
| 649 Node* end = graph()->NewNode(common()->End(1), ret); | 631 Node* end = graph()->NewNode(common()->End(1), ret); |
| 650 | 632 |
| 651 graph()->SetEnd(end); | 633 graph()->SetEnd(end); |
| 652 | 634 |
| 653 ComputeAndVerifySchedule(17); | 635 ComputeAndVerifySchedule(16); |
| 654 } | 636 } |
| 655 | 637 |
| 656 | 638 |
| 657 TARGET_TEST_F(SchedulerTest, Terminate) { | 639 TARGET_TEST_F(SchedulerTest, Terminate) { |
| 658 Node* start = graph()->NewNode(common()->Start(1)); | 640 Node* start = graph()->NewNode(common()->Start(1)); |
| 659 graph()->SetStart(start); | 641 graph()->SetStart(start); |
| 660 | 642 |
| 661 Node* loop = graph()->NewNode(common()->Loop(2), start, start); | 643 Node* loop = graph()->NewNode(common()->Loop(2), start, start); |
| 662 loop->ReplaceInput(1, loop); // self loop, NTL. | 644 loop->ReplaceInput(1, loop); // self loop, NTL. |
| 663 | 645 |
| 664 Node* effect = graph()->NewNode(common()->EffectPhi(2), start, start, loop); | 646 Node* effect = graph()->NewNode(common()->EffectPhi(2), start, start, loop); |
| 665 effect->ReplaceInput(1, effect); // self loop. | 647 effect->ReplaceInput(1, effect); // self loop. |
| 666 | 648 |
| 667 Node* terminate = graph()->NewNode(common()->Terminate(), effect, loop); | 649 Node* terminate = graph()->NewNode(common()->Terminate(), effect, loop); |
| 668 Node* end = graph()->NewNode(common()->End(1), terminate); | 650 Node* end = graph()->NewNode(common()->End(1), terminate); |
| 669 graph()->SetEnd(end); | 651 graph()->SetEnd(end); |
| 670 | 652 |
| 671 Schedule* schedule = ComputeAndVerifySchedule(6); | 653 Schedule* schedule = ComputeAndVerifySchedule(6); |
| 672 BasicBlock* block = schedule->block(loop); | 654 BasicBlock* block = schedule->block(loop); |
| 673 EXPECT_EQ(block, schedule->block(effect)); | 655 EXPECT_EQ(block, schedule->block(effect)); |
| 674 EXPECT_GE(block->rpo_number(), 0); | 656 EXPECT_GE(block->rpo_number(), 0); |
| 675 } | 657 } |
| 676 | 658 |
| 677 } // namespace compiler | 659 } // namespace compiler |
| 678 } // namespace internal | 660 } // namespace internal |
| 679 } // namespace v8 | 661 } // namespace v8 |
| OLD | NEW |