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 #include "test/cctest/cctest.h" | 6 #include "test/cctest/cctest.h" |
7 | 7 |
8 #include "src/compiler/access-builder.h" | 8 #include "src/compiler/access-builder.h" |
9 #include "src/compiler/common-operator.h" | 9 #include "src/compiler/common-operator.h" |
10 #include "src/compiler/generic-node-inl.h" | 10 #include "src/compiler/generic-node-inl.h" |
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
193 BasicBlockVector* order = Scheduler::ComputeSpecialRPO(&zone_pool, &schedule); | 193 BasicBlockVector* order = Scheduler::ComputeSpecialRPO(&zone_pool, &schedule); |
194 CheckRPONumbers(order, 1, true); | 194 CheckRPONumbers(order, 1, true); |
195 BasicBlock* loop[] = {schedule.start()}; | 195 BasicBlock* loop[] = {schedule.start()}; |
196 CheckLoop(order, loop, 1); | 196 CheckLoop(order, loop, 1); |
197 } | 197 } |
198 | 198 |
199 | 199 |
200 TEST(RPOEntryLoop) { | 200 TEST(RPOEntryLoop) { |
201 HandleAndZoneScope scope; | 201 HandleAndZoneScope scope; |
202 Schedule schedule(scope.main_zone()); | 202 Schedule schedule(scope.main_zone()); |
203 schedule.AddSuccessorForTesting(schedule.start(), schedule.end()); | 203 BasicBlock* body = schedule.NewBasicBlock(); |
204 schedule.AddSuccessorForTesting(schedule.end(), schedule.start()); | 204 schedule.AddSuccessorForTesting(schedule.start(), body); |
| 205 schedule.AddSuccessorForTesting(body, schedule.start()); |
205 ZonePool zone_pool(scope.main_isolate()); | 206 ZonePool zone_pool(scope.main_isolate()); |
206 BasicBlockVector* order = Scheduler::ComputeSpecialRPO(&zone_pool, &schedule); | 207 BasicBlockVector* order = Scheduler::ComputeSpecialRPO(&zone_pool, &schedule); |
207 CheckRPONumbers(order, 2, true); | 208 CheckRPONumbers(order, 2, true); |
208 BasicBlock* loop[] = {schedule.start(), schedule.end()}; | 209 BasicBlock* loop[] = {schedule.start(), body}; |
209 CheckLoop(order, loop, 2); | 210 CheckLoop(order, loop, 2); |
210 } | 211 } |
211 | 212 |
212 | 213 |
213 TEST(RPOEndLoop) { | 214 TEST(RPOEndLoop) { |
214 HandleAndZoneScope scope; | 215 HandleAndZoneScope scope; |
215 Schedule schedule(scope.main_zone()); | 216 Schedule schedule(scope.main_zone()); |
216 SmartPointer<TestLoop> loop1(CreateLoop(&schedule, 2)); | 217 SmartPointer<TestLoop> loop1(CreateLoop(&schedule, 2)); |
217 schedule.AddSuccessorForTesting(schedule.start(), loop1->header()); | 218 schedule.AddSuccessorForTesting(schedule.start(), loop1->header()); |
218 ZonePool zone_pool(scope.main_isolate()); | 219 ZonePool zone_pool(scope.main_isolate()); |
(...skipping 427 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
646 } | 647 } |
647 | 648 |
648 | 649 |
649 TEST(RPOLoopMultibackedge) { | 650 TEST(RPOLoopMultibackedge) { |
650 HandleAndZoneScope scope; | 651 HandleAndZoneScope scope; |
651 Schedule schedule(scope.main_zone()); | 652 Schedule schedule(scope.main_zone()); |
652 | 653 |
653 BasicBlock* A = schedule.start(); | 654 BasicBlock* A = schedule.start(); |
654 BasicBlock* B = schedule.NewBasicBlock(); | 655 BasicBlock* B = schedule.NewBasicBlock(); |
655 BasicBlock* C = schedule.NewBasicBlock(); | 656 BasicBlock* C = schedule.NewBasicBlock(); |
656 BasicBlock* D = schedule.end(); | 657 BasicBlock* D = schedule.NewBasicBlock(); |
657 BasicBlock* E = schedule.NewBasicBlock(); | 658 BasicBlock* E = schedule.NewBasicBlock(); |
658 | 659 |
659 schedule.AddSuccessorForTesting(A, B); | 660 schedule.AddSuccessorForTesting(A, B); |
660 schedule.AddSuccessorForTesting(B, C); | 661 schedule.AddSuccessorForTesting(B, C); |
661 schedule.AddSuccessorForTesting(B, D); | 662 schedule.AddSuccessorForTesting(B, D); |
662 schedule.AddSuccessorForTesting(B, E); | 663 schedule.AddSuccessorForTesting(B, E); |
663 schedule.AddSuccessorForTesting(C, B); | 664 schedule.AddSuccessorForTesting(C, B); |
664 schedule.AddSuccessorForTesting(D, B); | 665 schedule.AddSuccessorForTesting(D, B); |
665 schedule.AddSuccessorForTesting(E, B); | 666 schedule.AddSuccessorForTesting(E, B); |
666 | 667 |
(...skipping 1343 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2010 graph.SetEnd(end); | 2011 graph.SetEnd(end); |
2011 | 2012 |
2012 Schedule* schedule = ComputeAndVerifySchedule(6, &graph); | 2013 Schedule* schedule = ComputeAndVerifySchedule(6, &graph); |
2013 BasicBlock* block = schedule->block(loop); | 2014 BasicBlock* block = schedule->block(loop); |
2014 CHECK_NE(NULL, loop); | 2015 CHECK_NE(NULL, loop); |
2015 CHECK_EQ(block, schedule->block(effect)); | 2016 CHECK_EQ(block, schedule->block(effect)); |
2016 CHECK_GE(block->rpo_number(), 0); | 2017 CHECK_GE(block->rpo_number(), 0); |
2017 } | 2018 } |
2018 | 2019 |
2019 #endif | 2020 #endif |
OLD | NEW |