OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 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/v8.h" | 5 #include "src/v8.h" |
6 | 6 |
7 #include "src/compiler/access-builder.h" | 7 #include "src/compiler/access-builder.h" |
8 #include "src/compiler/common-operator.h" | 8 #include "src/compiler/common-operator.h" |
9 #include "src/compiler/generic-node-inl.h" | 9 #include "src/compiler/generic-node-inl.h" |
10 #include "src/compiler/generic-node.h" | 10 #include "src/compiler/generic-node.h" |
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
196 BasicBlockVector* order = Scheduler::ComputeSpecialRPO(&zone_pool, &schedule); | 196 BasicBlockVector* order = Scheduler::ComputeSpecialRPO(&zone_pool, &schedule); |
197 CheckRPONumbers(order, 1, true); | 197 CheckRPONumbers(order, 1, true); |
198 BasicBlock* loop[] = {schedule.start()}; | 198 BasicBlock* loop[] = {schedule.start()}; |
199 CheckLoop(order, loop, 1); | 199 CheckLoop(order, loop, 1); |
200 } | 200 } |
201 | 201 |
202 | 202 |
203 TEST(RPOEntryLoop) { | 203 TEST(RPOEntryLoop) { |
204 HandleAndZoneScope scope; | 204 HandleAndZoneScope scope; |
205 Schedule schedule(scope.main_zone()); | 205 Schedule schedule(scope.main_zone()); |
206 schedule.AddSuccessorForTesting(schedule.start(), schedule.end()); | 206 BasicBlock* body = schedule.NewBasicBlock(); |
207 schedule.AddSuccessorForTesting(schedule.end(), schedule.start()); | 207 schedule.AddSuccessorForTesting(schedule.start(), body); |
| 208 schedule.AddSuccessorForTesting(body, schedule.start()); |
208 ZonePool zone_pool(scope.main_isolate()); | 209 ZonePool zone_pool(scope.main_isolate()); |
209 BasicBlockVector* order = Scheduler::ComputeSpecialRPO(&zone_pool, &schedule); | 210 BasicBlockVector* order = Scheduler::ComputeSpecialRPO(&zone_pool, &schedule); |
210 CheckRPONumbers(order, 2, true); | 211 CheckRPONumbers(order, 2, true); |
211 BasicBlock* loop[] = {schedule.start(), schedule.end()}; | 212 BasicBlock* loop[] = {schedule.start(), body}; |
212 CheckLoop(order, loop, 2); | 213 CheckLoop(order, loop, 2); |
213 } | 214 } |
214 | 215 |
215 | 216 |
216 TEST(RPOEndLoop) { | 217 TEST(RPOEndLoop) { |
217 HandleAndZoneScope scope; | 218 HandleAndZoneScope scope; |
218 Schedule schedule(scope.main_zone()); | 219 Schedule schedule(scope.main_zone()); |
219 SmartPointer<TestLoop> loop1(CreateLoop(&schedule, 2)); | 220 SmartPointer<TestLoop> loop1(CreateLoop(&schedule, 2)); |
220 schedule.AddSuccessorForTesting(schedule.start(), loop1->header()); | 221 schedule.AddSuccessorForTesting(schedule.start(), loop1->header()); |
221 ZonePool zone_pool(scope.main_isolate()); | 222 ZonePool zone_pool(scope.main_isolate()); |
(...skipping 427 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
649 } | 650 } |
650 | 651 |
651 | 652 |
652 TEST(RPOLoopMultibackedge) { | 653 TEST(RPOLoopMultibackedge) { |
653 HandleAndZoneScope scope; | 654 HandleAndZoneScope scope; |
654 Schedule schedule(scope.main_zone()); | 655 Schedule schedule(scope.main_zone()); |
655 | 656 |
656 BasicBlock* A = schedule.start(); | 657 BasicBlock* A = schedule.start(); |
657 BasicBlock* B = schedule.NewBasicBlock(); | 658 BasicBlock* B = schedule.NewBasicBlock(); |
658 BasicBlock* C = schedule.NewBasicBlock(); | 659 BasicBlock* C = schedule.NewBasicBlock(); |
659 BasicBlock* D = schedule.end(); | 660 BasicBlock* D = schedule.NewBasicBlock(); |
660 BasicBlock* E = schedule.NewBasicBlock(); | 661 BasicBlock* E = schedule.NewBasicBlock(); |
661 | 662 |
662 schedule.AddSuccessorForTesting(A, B); | 663 schedule.AddSuccessorForTesting(A, B); |
663 schedule.AddSuccessorForTesting(B, C); | 664 schedule.AddSuccessorForTesting(B, C); |
664 schedule.AddSuccessorForTesting(B, D); | 665 schedule.AddSuccessorForTesting(B, D); |
665 schedule.AddSuccessorForTesting(B, E); | 666 schedule.AddSuccessorForTesting(B, E); |
666 schedule.AddSuccessorForTesting(C, B); | 667 schedule.AddSuccessorForTesting(C, B); |
667 schedule.AddSuccessorForTesting(D, B); | 668 schedule.AddSuccessorForTesting(D, B); |
668 schedule.AddSuccessorForTesting(E, B); | 669 schedule.AddSuccessorForTesting(E, B); |
669 | 670 |
(...skipping 1377 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2047 graph.SetEnd(end); | 2048 graph.SetEnd(end); |
2048 | 2049 |
2049 Schedule* schedule = ComputeAndVerifySchedule(6, &graph); | 2050 Schedule* schedule = ComputeAndVerifySchedule(6, &graph); |
2050 BasicBlock* block = schedule->block(loop); | 2051 BasicBlock* block = schedule->block(loop); |
2051 CHECK_NE(NULL, loop); | 2052 CHECK_NE(NULL, loop); |
2052 CHECK_EQ(block, schedule->block(effect)); | 2053 CHECK_EQ(block, schedule->block(effect)); |
2053 CHECK_GE(block->rpo_number(), 0); | 2054 CHECK_GE(block->rpo_number(), 0); |
2054 } | 2055 } |
2055 | 2056 |
2056 #endif | 2057 #endif |
OLD | NEW |