Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(61)

Side by Side Diff: test/cctest/compiler/test-scheduler.cc

Issue 686273005: [turbofan] Propagate "deferredness" to dominated basic blocks. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« src/compiler/scheduler.cc ('K') | « src/compiler/scheduler.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 16 matching lines...) Expand all
27 static void CheckRPONumbers(BasicBlockVector* order, size_t expected, 27 static void CheckRPONumbers(BasicBlockVector* order, size_t expected,
28 bool loops_allowed) { 28 bool loops_allowed) {
29 CHECK(expected == order->size()); 29 CHECK(expected == order->size());
30 for (int i = 0; i < static_cast<int>(order->size()); i++) { 30 for (int i = 0; i < static_cast<int>(order->size()); i++) {
31 CHECK(order->at(i)->rpo_number() == i); 31 CHECK(order->at(i)->rpo_number() == i);
32 if (!loops_allowed) { 32 if (!loops_allowed) {
33 CHECK_LT(order->at(i)->loop_end(), 0); 33 CHECK_LT(order->at(i)->loop_end(), 0);
34 CHECK_EQ(NULL, order->at(i)->loop_header()); 34 CHECK_EQ(NULL, order->at(i)->loop_header());
35 } 35 }
36 } 36 }
37 int number = 0;
38 for (auto const block : *order) {
39 if (block->deferred()) continue;
40 CHECK_EQ(number, block->ao_number());
41 ++number;
42 }
43 for (auto const block : *order) {
44 if (!block->deferred()) continue;
45 CHECK_EQ(number, block->ao_number());
46 ++number;
47 }
37 } 48 }
38 49
39 50
40 static void CheckLoop(BasicBlockVector* order, BasicBlock** blocks, 51 static void CheckLoop(BasicBlockVector* order, BasicBlock** blocks,
41 int body_size) { 52 int body_size) {
42 BasicBlock* header = blocks[0]; 53 BasicBlock* header = blocks[0];
43 CHECK_GT(header->loop_end(), 0); 54 CHECK_GT(header->loop_end(), 0);
44 CHECK_EQ(body_size, (header->loop_end() - header->rpo_number())); 55 CHECK_EQ(body_size, (header->loop_end() - header->rpo_number()));
45 for (int i = 0; i < body_size; i++) { 56 for (int i = 0; i < body_size; i++) {
46 int num = blocks[i]->rpo_number(); 57 int num = blocks[i]->rpo_number();
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 157
147 TEST(RPOLine) { 158 TEST(RPOLine) {
148 HandleAndZoneScope scope; 159 HandleAndZoneScope scope;
149 160
150 for (int i = 0; i < 10; i++) { 161 for (int i = 0; i < 10; i++) {
151 Schedule schedule(scope.main_zone()); 162 Schedule schedule(scope.main_zone());
152 163
153 BasicBlock* last = schedule.start(); 164 BasicBlock* last = schedule.start();
154 for (int j = 0; j < i; j++) { 165 for (int j = 0; j < i; j++) {
155 BasicBlock* block = schedule.NewBasicBlock(); 166 BasicBlock* block = schedule.NewBasicBlock();
167 block->set_deferred(i & 1);
156 schedule.AddGoto(last, block); 168 schedule.AddGoto(last, block);
157 last = block; 169 last = block;
158 } 170 }
159 ZonePool zone_pool(scope.main_isolate()); 171 ZonePool zone_pool(scope.main_isolate());
160 BasicBlockVector* order = 172 BasicBlockVector* order =
161 Scheduler::ComputeSpecialRPO(&zone_pool, &schedule); 173 Scheduler::ComputeSpecialRPO(&zone_pool, &schedule);
162 CheckRPONumbers(order, 1 + i, false); 174 CheckRPONumbers(order, 1 + i, false);
163 175
164 for (size_t i = 0; i < schedule.BasicBlockCount(); i++) { 176 for (size_t i = 0; i < schedule.BasicBlockCount(); i++) {
165 BasicBlock* block = schedule.GetBlockById(BasicBlock::Id::FromSize(i)); 177 BasicBlock* block = schedule.GetBlockById(BasicBlock::Id::FromSize(i));
(...skipping 1790 matching lines...) Expand 10 before | Expand all | Expand 10 after
1956 graph.SetEnd(end); 1968 graph.SetEnd(end);
1957 1969
1958 Schedule* schedule = ComputeAndVerifySchedule(6, &graph); 1970 Schedule* schedule = ComputeAndVerifySchedule(6, &graph);
1959 BasicBlock* block = schedule->block(loop); 1971 BasicBlock* block = schedule->block(loop);
1960 CHECK_NE(NULL, loop); 1972 CHECK_NE(NULL, loop);
1961 CHECK_EQ(block, schedule->block(effect)); 1973 CHECK_EQ(block, schedule->block(effect));
1962 CHECK_GE(block->rpo_number(), 0); 1974 CHECK_GE(block->rpo_number(), 0);
1963 } 1975 }
1964 1976
1965 #endif 1977 #endif
OLDNEW
« src/compiler/scheduler.cc ('K') | « src/compiler/scheduler.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698