| 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 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 116 return node_count; | 116 return node_count; |
| 117 } | 117 } |
| 118 | 118 |
| 119 | 119 |
| 120 static Schedule* ComputeAndVerifySchedule(int expected, Graph* graph) { | 120 static Schedule* ComputeAndVerifySchedule(int expected, Graph* graph) { |
| 121 if (FLAG_trace_turbo) { | 121 if (FLAG_trace_turbo) { |
| 122 OFStream os(stdout); | 122 OFStream os(stdout); |
| 123 os << AsDOT(*graph); | 123 os << AsDOT(*graph); |
| 124 } | 124 } |
| 125 | 125 |
| 126 ZonePool zone_pool(graph->zone()->isolate()); | 126 Schedule* schedule = Scheduler::ComputeSchedule(graph->zone(), graph); |
| 127 Schedule* schedule = Scheduler::ComputeSchedule(&zone_pool, graph); | |
| 128 | 127 |
| 129 if (FLAG_trace_turbo_scheduler) { | 128 if (FLAG_trace_turbo_scheduler) { |
| 130 OFStream os(stdout); | 129 OFStream os(stdout); |
| 131 os << *schedule << std::endl; | 130 os << *schedule << std::endl; |
| 132 } | 131 } |
| 133 ScheduleVerifier::Run(schedule); | 132 ScheduleVerifier::Run(schedule); |
| 134 CHECK_EQ(expected, GetScheduledNodeCount(schedule)); | 133 CHECK_EQ(expected, GetScheduledNodeCount(schedule)); |
| 135 return schedule; | 134 return schedule; |
| 136 } | 135 } |
| 137 | 136 |
| 138 | 137 |
| 139 TEST(RPODegenerate1) { | 138 TEST(RPODegenerate1) { |
| 140 HandleAndZoneScope scope; | 139 HandleAndZoneScope scope; |
| 141 Schedule schedule(scope.main_zone()); | 140 Schedule schedule(scope.main_zone()); |
| 142 | 141 |
| 143 ZonePool zone_pool(scope.main_isolate()); | 142 BasicBlockVector* order = |
| 144 BasicBlockVector* order = Scheduler::ComputeSpecialRPO(&zone_pool, &schedule); | 143 Scheduler::ComputeSpecialRPO(scope.main_zone(), &schedule); |
| 145 CheckRPONumbers(order, 1, false); | 144 CheckRPONumbers(order, 1, false); |
| 146 CHECK_EQ(schedule.start(), order->at(0)); | 145 CHECK_EQ(schedule.start(), order->at(0)); |
| 147 } | 146 } |
| 148 | 147 |
| 149 | 148 |
| 150 TEST(RPODegenerate2) { | 149 TEST(RPODegenerate2) { |
| 151 HandleAndZoneScope scope; | 150 HandleAndZoneScope scope; |
| 152 Schedule schedule(scope.main_zone()); | 151 Schedule schedule(scope.main_zone()); |
| 153 | 152 |
| 154 schedule.AddGoto(schedule.start(), schedule.end()); | 153 schedule.AddGoto(schedule.start(), schedule.end()); |
| 155 ZonePool zone_pool(scope.main_isolate()); | 154 BasicBlockVector* order = |
| 156 BasicBlockVector* order = Scheduler::ComputeSpecialRPO(&zone_pool, &schedule); | 155 Scheduler::ComputeSpecialRPO(scope.main_zone(), &schedule); |
| 157 CheckRPONumbers(order, 2, false); | 156 CheckRPONumbers(order, 2, false); |
| 158 CHECK_EQ(schedule.start(), order->at(0)); | 157 CHECK_EQ(schedule.start(), order->at(0)); |
| 159 CHECK_EQ(schedule.end(), order->at(1)); | 158 CHECK_EQ(schedule.end(), order->at(1)); |
| 160 } | 159 } |
| 161 | 160 |
| 162 | 161 |
| 163 TEST(RPOLine) { | 162 TEST(RPOLine) { |
| 164 HandleAndZoneScope scope; | 163 HandleAndZoneScope scope; |
| 165 | 164 |
| 166 for (int i = 0; i < 10; i++) { | 165 for (int i = 0; i < 10; i++) { |
| 167 Schedule schedule(scope.main_zone()); | 166 Schedule schedule(scope.main_zone()); |
| 168 | 167 |
| 169 BasicBlock* last = schedule.start(); | 168 BasicBlock* last = schedule.start(); |
| 170 for (int j = 0; j < i; j++) { | 169 for (int j = 0; j < i; j++) { |
| 171 BasicBlock* block = schedule.NewBasicBlock(); | 170 BasicBlock* block = schedule.NewBasicBlock(); |
| 172 block->set_deferred(i & 1); | 171 block->set_deferred(i & 1); |
| 173 schedule.AddGoto(last, block); | 172 schedule.AddGoto(last, block); |
| 174 last = block; | 173 last = block; |
| 175 } | 174 } |
| 176 ZonePool zone_pool(scope.main_isolate()); | |
| 177 BasicBlockVector* order = | 175 BasicBlockVector* order = |
| 178 Scheduler::ComputeSpecialRPO(&zone_pool, &schedule); | 176 Scheduler::ComputeSpecialRPO(scope.main_zone(), &schedule); |
| 179 CheckRPONumbers(order, 1 + i, false); | 177 CheckRPONumbers(order, 1 + i, false); |
| 180 | 178 |
| 181 for (size_t i = 0; i < schedule.BasicBlockCount(); i++) { | 179 for (size_t i = 0; i < schedule.BasicBlockCount(); i++) { |
| 182 BasicBlock* block = schedule.GetBlockById(BasicBlock::Id::FromSize(i)); | 180 BasicBlock* block = schedule.GetBlockById(BasicBlock::Id::FromSize(i)); |
| 183 if (block->rpo_number() >= 0 && block->SuccessorCount() == 1) { | 181 if (block->rpo_number() >= 0 && block->SuccessorCount() == 1) { |
| 184 CHECK(block->rpo_number() + 1 == block->SuccessorAt(0)->rpo_number()); | 182 CHECK(block->rpo_number() + 1 == block->SuccessorAt(0)->rpo_number()); |
| 185 } | 183 } |
| 186 } | 184 } |
| 187 } | 185 } |
| 188 } | 186 } |
| 189 | 187 |
| 190 | 188 |
| 191 TEST(RPOSelfLoop) { | 189 TEST(RPOSelfLoop) { |
| 192 HandleAndZoneScope scope; | 190 HandleAndZoneScope scope; |
| 193 Schedule schedule(scope.main_zone()); | 191 Schedule schedule(scope.main_zone()); |
| 194 schedule.AddSuccessorForTesting(schedule.start(), schedule.start()); | 192 schedule.AddSuccessorForTesting(schedule.start(), schedule.start()); |
| 195 ZonePool zone_pool(scope.main_isolate()); | 193 BasicBlockVector* order = |
| 196 BasicBlockVector* order = Scheduler::ComputeSpecialRPO(&zone_pool, &schedule); | 194 Scheduler::ComputeSpecialRPO(scope.main_zone(), &schedule); |
| 197 CheckRPONumbers(order, 1, true); | 195 CheckRPONumbers(order, 1, true); |
| 198 BasicBlock* loop[] = {schedule.start()}; | 196 BasicBlock* loop[] = {schedule.start()}; |
| 199 CheckLoop(order, loop, 1); | 197 CheckLoop(order, loop, 1); |
| 200 } | 198 } |
| 201 | 199 |
| 202 | 200 |
| 203 TEST(RPOEntryLoop) { | 201 TEST(RPOEntryLoop) { |
| 204 HandleAndZoneScope scope; | 202 HandleAndZoneScope scope; |
| 205 Schedule schedule(scope.main_zone()); | 203 Schedule schedule(scope.main_zone()); |
| 206 schedule.AddSuccessorForTesting(schedule.start(), schedule.end()); | 204 schedule.AddSuccessorForTesting(schedule.start(), schedule.end()); |
| 207 schedule.AddSuccessorForTesting(schedule.end(), schedule.start()); | 205 schedule.AddSuccessorForTesting(schedule.end(), schedule.start()); |
| 208 ZonePool zone_pool(scope.main_isolate()); | 206 BasicBlockVector* order = |
| 209 BasicBlockVector* order = Scheduler::ComputeSpecialRPO(&zone_pool, &schedule); | 207 Scheduler::ComputeSpecialRPO(scope.main_zone(), &schedule); |
| 210 CheckRPONumbers(order, 2, true); | 208 CheckRPONumbers(order, 2, true); |
| 211 BasicBlock* loop[] = {schedule.start(), schedule.end()}; | 209 BasicBlock* loop[] = {schedule.start(), schedule.end()}; |
| 212 CheckLoop(order, loop, 2); | 210 CheckLoop(order, loop, 2); |
| 213 } | 211 } |
| 214 | 212 |
| 215 | 213 |
| 216 TEST(RPOEndLoop) { | 214 TEST(RPOEndLoop) { |
| 217 HandleAndZoneScope scope; | 215 HandleAndZoneScope scope; |
| 218 Schedule schedule(scope.main_zone()); | 216 Schedule schedule(scope.main_zone()); |
| 219 SmartPointer<TestLoop> loop1(CreateLoop(&schedule, 2)); | 217 SmartPointer<TestLoop> loop1(CreateLoop(&schedule, 2)); |
| 220 schedule.AddSuccessorForTesting(schedule.start(), loop1->header()); | 218 schedule.AddSuccessorForTesting(schedule.start(), loop1->header()); |
| 221 ZonePool zone_pool(scope.main_isolate()); | 219 BasicBlockVector* order = |
| 222 BasicBlockVector* order = Scheduler::ComputeSpecialRPO(&zone_pool, &schedule); | 220 Scheduler::ComputeSpecialRPO(scope.main_zone(), &schedule); |
| 223 CheckRPONumbers(order, 3, true); | 221 CheckRPONumbers(order, 3, true); |
| 224 loop1->Check(order); | 222 loop1->Check(order); |
| 225 } | 223 } |
| 226 | 224 |
| 227 | 225 |
| 228 TEST(RPOEndLoopNested) { | 226 TEST(RPOEndLoopNested) { |
| 229 HandleAndZoneScope scope; | 227 HandleAndZoneScope scope; |
| 230 Schedule schedule(scope.main_zone()); | 228 Schedule schedule(scope.main_zone()); |
| 231 SmartPointer<TestLoop> loop1(CreateLoop(&schedule, 2)); | 229 SmartPointer<TestLoop> loop1(CreateLoop(&schedule, 2)); |
| 232 schedule.AddSuccessorForTesting(schedule.start(), loop1->header()); | 230 schedule.AddSuccessorForTesting(schedule.start(), loop1->header()); |
| 233 schedule.AddSuccessorForTesting(loop1->last(), schedule.start()); | 231 schedule.AddSuccessorForTesting(loop1->last(), schedule.start()); |
| 234 ZonePool zone_pool(scope.main_isolate()); | 232 BasicBlockVector* order = |
| 235 BasicBlockVector* order = Scheduler::ComputeSpecialRPO(&zone_pool, &schedule); | 233 Scheduler::ComputeSpecialRPO(scope.main_zone(), &schedule); |
| 236 CheckRPONumbers(order, 3, true); | 234 CheckRPONumbers(order, 3, true); |
| 237 loop1->Check(order); | 235 loop1->Check(order); |
| 238 } | 236 } |
| 239 | 237 |
| 240 | 238 |
| 241 TEST(RPODiamond) { | 239 TEST(RPODiamond) { |
| 242 HandleAndZoneScope scope; | 240 HandleAndZoneScope scope; |
| 243 Schedule schedule(scope.main_zone()); | 241 Schedule schedule(scope.main_zone()); |
| 244 | 242 |
| 245 BasicBlock* A = schedule.start(); | 243 BasicBlock* A = schedule.start(); |
| 246 BasicBlock* B = schedule.NewBasicBlock(); | 244 BasicBlock* B = schedule.NewBasicBlock(); |
| 247 BasicBlock* C = schedule.NewBasicBlock(); | 245 BasicBlock* C = schedule.NewBasicBlock(); |
| 248 BasicBlock* D = schedule.end(); | 246 BasicBlock* D = schedule.end(); |
| 249 | 247 |
| 250 schedule.AddSuccessorForTesting(A, B); | 248 schedule.AddSuccessorForTesting(A, B); |
| 251 schedule.AddSuccessorForTesting(A, C); | 249 schedule.AddSuccessorForTesting(A, C); |
| 252 schedule.AddSuccessorForTesting(B, D); | 250 schedule.AddSuccessorForTesting(B, D); |
| 253 schedule.AddSuccessorForTesting(C, D); | 251 schedule.AddSuccessorForTesting(C, D); |
| 254 | 252 |
| 255 ZonePool zone_pool(scope.main_isolate()); | 253 BasicBlockVector* order = |
| 256 BasicBlockVector* order = Scheduler::ComputeSpecialRPO(&zone_pool, &schedule); | 254 Scheduler::ComputeSpecialRPO(scope.main_zone(), &schedule); |
| 257 CheckRPONumbers(order, 4, false); | 255 CheckRPONumbers(order, 4, false); |
| 258 | 256 |
| 259 CHECK_EQ(0, A->rpo_number()); | 257 CHECK_EQ(0, A->rpo_number()); |
| 260 CHECK((B->rpo_number() == 1 && C->rpo_number() == 2) || | 258 CHECK((B->rpo_number() == 1 && C->rpo_number() == 2) || |
| 261 (B->rpo_number() == 2 && C->rpo_number() == 1)); | 259 (B->rpo_number() == 2 && C->rpo_number() == 1)); |
| 262 CHECK_EQ(3, D->rpo_number()); | 260 CHECK_EQ(3, D->rpo_number()); |
| 263 } | 261 } |
| 264 | 262 |
| 265 | 263 |
| 266 TEST(RPOLoop1) { | 264 TEST(RPOLoop1) { |
| 267 HandleAndZoneScope scope; | 265 HandleAndZoneScope scope; |
| 268 Schedule schedule(scope.main_zone()); | 266 Schedule schedule(scope.main_zone()); |
| 269 | 267 |
| 270 BasicBlock* A = schedule.start(); | 268 BasicBlock* A = schedule.start(); |
| 271 BasicBlock* B = schedule.NewBasicBlock(); | 269 BasicBlock* B = schedule.NewBasicBlock(); |
| 272 BasicBlock* C = schedule.NewBasicBlock(); | 270 BasicBlock* C = schedule.NewBasicBlock(); |
| 273 BasicBlock* D = schedule.end(); | 271 BasicBlock* D = schedule.end(); |
| 274 | 272 |
| 275 schedule.AddSuccessorForTesting(A, B); | 273 schedule.AddSuccessorForTesting(A, B); |
| 276 schedule.AddSuccessorForTesting(B, C); | 274 schedule.AddSuccessorForTesting(B, C); |
| 277 schedule.AddSuccessorForTesting(C, B); | 275 schedule.AddSuccessorForTesting(C, B); |
| 278 schedule.AddSuccessorForTesting(C, D); | 276 schedule.AddSuccessorForTesting(C, D); |
| 279 | 277 |
| 280 ZonePool zone_pool(scope.main_isolate()); | 278 BasicBlockVector* order = |
| 281 BasicBlockVector* order = Scheduler::ComputeSpecialRPO(&zone_pool, &schedule); | 279 Scheduler::ComputeSpecialRPO(scope.main_zone(), &schedule); |
| 282 CheckRPONumbers(order, 4, true); | 280 CheckRPONumbers(order, 4, true); |
| 283 BasicBlock* loop[] = {B, C}; | 281 BasicBlock* loop[] = {B, C}; |
| 284 CheckLoop(order, loop, 2); | 282 CheckLoop(order, loop, 2); |
| 285 } | 283 } |
| 286 | 284 |
| 287 | 285 |
| 288 TEST(RPOLoop2) { | 286 TEST(RPOLoop2) { |
| 289 HandleAndZoneScope scope; | 287 HandleAndZoneScope scope; |
| 290 Schedule schedule(scope.main_zone()); | 288 Schedule schedule(scope.main_zone()); |
| 291 | 289 |
| 292 BasicBlock* A = schedule.start(); | 290 BasicBlock* A = schedule.start(); |
| 293 BasicBlock* B = schedule.NewBasicBlock(); | 291 BasicBlock* B = schedule.NewBasicBlock(); |
| 294 BasicBlock* C = schedule.NewBasicBlock(); | 292 BasicBlock* C = schedule.NewBasicBlock(); |
| 295 BasicBlock* D = schedule.end(); | 293 BasicBlock* D = schedule.end(); |
| 296 | 294 |
| 297 schedule.AddSuccessorForTesting(A, B); | 295 schedule.AddSuccessorForTesting(A, B); |
| 298 schedule.AddSuccessorForTesting(B, C); | 296 schedule.AddSuccessorForTesting(B, C); |
| 299 schedule.AddSuccessorForTesting(C, B); | 297 schedule.AddSuccessorForTesting(C, B); |
| 300 schedule.AddSuccessorForTesting(B, D); | 298 schedule.AddSuccessorForTesting(B, D); |
| 301 | 299 |
| 302 ZonePool zone_pool(scope.main_isolate()); | 300 BasicBlockVector* order = |
| 303 BasicBlockVector* order = Scheduler::ComputeSpecialRPO(&zone_pool, &schedule); | 301 Scheduler::ComputeSpecialRPO(scope.main_zone(), &schedule); |
| 304 CheckRPONumbers(order, 4, true); | 302 CheckRPONumbers(order, 4, true); |
| 305 BasicBlock* loop[] = {B, C}; | 303 BasicBlock* loop[] = {B, C}; |
| 306 CheckLoop(order, loop, 2); | 304 CheckLoop(order, loop, 2); |
| 307 } | 305 } |
| 308 | 306 |
| 309 | 307 |
| 310 TEST(RPOLoopN) { | 308 TEST(RPOLoopN) { |
| 311 HandleAndZoneScope scope; | 309 HandleAndZoneScope scope; |
| 312 | 310 |
| 313 for (int i = 0; i < 11; i++) { | 311 for (int i = 0; i < 11; i++) { |
| (...skipping 21 matching lines...) Expand all Loading... |
| 335 if (i == 4) schedule.AddSuccessorForTesting(E, B); | 333 if (i == 4) schedule.AddSuccessorForTesting(E, B); |
| 336 if (i == 5) schedule.AddSuccessorForTesting(F, B); | 334 if (i == 5) schedule.AddSuccessorForTesting(F, B); |
| 337 | 335 |
| 338 // Throw in extra loop exits from time to time. | 336 // Throw in extra loop exits from time to time. |
| 339 if (i == 6) schedule.AddSuccessorForTesting(B, G); | 337 if (i == 6) schedule.AddSuccessorForTesting(B, G); |
| 340 if (i == 7) schedule.AddSuccessorForTesting(C, G); | 338 if (i == 7) schedule.AddSuccessorForTesting(C, G); |
| 341 if (i == 8) schedule.AddSuccessorForTesting(D, G); | 339 if (i == 8) schedule.AddSuccessorForTesting(D, G); |
| 342 if (i == 9) schedule.AddSuccessorForTesting(E, G); | 340 if (i == 9) schedule.AddSuccessorForTesting(E, G); |
| 343 if (i == 10) schedule.AddSuccessorForTesting(F, G); | 341 if (i == 10) schedule.AddSuccessorForTesting(F, G); |
| 344 | 342 |
| 345 ZonePool zone_pool(scope.main_isolate()); | |
| 346 BasicBlockVector* order = | 343 BasicBlockVector* order = |
| 347 Scheduler::ComputeSpecialRPO(&zone_pool, &schedule); | 344 Scheduler::ComputeSpecialRPO(scope.main_zone(), &schedule); |
| 348 CheckRPONumbers(order, 7, true); | 345 CheckRPONumbers(order, 7, true); |
| 349 BasicBlock* loop[] = {B, C, D, E, F}; | 346 BasicBlock* loop[] = {B, C, D, E, F}; |
| 350 CheckLoop(order, loop, 5); | 347 CheckLoop(order, loop, 5); |
| 351 } | 348 } |
| 352 } | 349 } |
| 353 | 350 |
| 354 | 351 |
| 355 TEST(RPOLoopNest1) { | 352 TEST(RPOLoopNest1) { |
| 356 HandleAndZoneScope scope; | 353 HandleAndZoneScope scope; |
| 357 Schedule schedule(scope.main_zone()); | 354 Schedule schedule(scope.main_zone()); |
| 358 | 355 |
| 359 BasicBlock* A = schedule.start(); | 356 BasicBlock* A = schedule.start(); |
| 360 BasicBlock* B = schedule.NewBasicBlock(); | 357 BasicBlock* B = schedule.NewBasicBlock(); |
| 361 BasicBlock* C = schedule.NewBasicBlock(); | 358 BasicBlock* C = schedule.NewBasicBlock(); |
| 362 BasicBlock* D = schedule.NewBasicBlock(); | 359 BasicBlock* D = schedule.NewBasicBlock(); |
| 363 BasicBlock* E = schedule.NewBasicBlock(); | 360 BasicBlock* E = schedule.NewBasicBlock(); |
| 364 BasicBlock* F = schedule.end(); | 361 BasicBlock* F = schedule.end(); |
| 365 | 362 |
| 366 schedule.AddSuccessorForTesting(A, B); | 363 schedule.AddSuccessorForTesting(A, B); |
| 367 schedule.AddSuccessorForTesting(B, C); | 364 schedule.AddSuccessorForTesting(B, C); |
| 368 schedule.AddSuccessorForTesting(C, D); | 365 schedule.AddSuccessorForTesting(C, D); |
| 369 schedule.AddSuccessorForTesting(D, C); | 366 schedule.AddSuccessorForTesting(D, C); |
| 370 schedule.AddSuccessorForTesting(D, E); | 367 schedule.AddSuccessorForTesting(D, E); |
| 371 schedule.AddSuccessorForTesting(E, B); | 368 schedule.AddSuccessorForTesting(E, B); |
| 372 schedule.AddSuccessorForTesting(E, F); | 369 schedule.AddSuccessorForTesting(E, F); |
| 373 | 370 |
| 374 ZonePool zone_pool(scope.main_isolate()); | 371 BasicBlockVector* order = |
| 375 BasicBlockVector* order = Scheduler::ComputeSpecialRPO(&zone_pool, &schedule); | 372 Scheduler::ComputeSpecialRPO(scope.main_zone(), &schedule); |
| 376 CheckRPONumbers(order, 6, true); | 373 CheckRPONumbers(order, 6, true); |
| 377 BasicBlock* loop1[] = {B, C, D, E}; | 374 BasicBlock* loop1[] = {B, C, D, E}; |
| 378 CheckLoop(order, loop1, 4); | 375 CheckLoop(order, loop1, 4); |
| 379 | 376 |
| 380 BasicBlock* loop2[] = {C, D}; | 377 BasicBlock* loop2[] = {C, D}; |
| 381 CheckLoop(order, loop2, 2); | 378 CheckLoop(order, loop2, 2); |
| 382 } | 379 } |
| 383 | 380 |
| 384 | 381 |
| 385 TEST(RPOLoopNest2) { | 382 TEST(RPOLoopNest2) { |
| (...skipping 14 matching lines...) Expand all Loading... |
| 400 schedule.AddSuccessorForTesting(C, D); | 397 schedule.AddSuccessorForTesting(C, D); |
| 401 schedule.AddSuccessorForTesting(D, E); | 398 schedule.AddSuccessorForTesting(D, E); |
| 402 schedule.AddSuccessorForTesting(E, F); | 399 schedule.AddSuccessorForTesting(E, F); |
| 403 schedule.AddSuccessorForTesting(F, G); | 400 schedule.AddSuccessorForTesting(F, G); |
| 404 schedule.AddSuccessorForTesting(G, H); | 401 schedule.AddSuccessorForTesting(G, H); |
| 405 | 402 |
| 406 schedule.AddSuccessorForTesting(E, D); | 403 schedule.AddSuccessorForTesting(E, D); |
| 407 schedule.AddSuccessorForTesting(F, C); | 404 schedule.AddSuccessorForTesting(F, C); |
| 408 schedule.AddSuccessorForTesting(G, B); | 405 schedule.AddSuccessorForTesting(G, B); |
| 409 | 406 |
| 410 ZonePool zone_pool(scope.main_isolate()); | 407 BasicBlockVector* order = |
| 411 BasicBlockVector* order = Scheduler::ComputeSpecialRPO(&zone_pool, &schedule); | 408 Scheduler::ComputeSpecialRPO(scope.main_zone(), &schedule); |
| 412 CheckRPONumbers(order, 8, true); | 409 CheckRPONumbers(order, 8, true); |
| 413 BasicBlock* loop1[] = {B, C, D, E, F, G}; | 410 BasicBlock* loop1[] = {B, C, D, E, F, G}; |
| 414 CheckLoop(order, loop1, 6); | 411 CheckLoop(order, loop1, 6); |
| 415 | 412 |
| 416 BasicBlock* loop2[] = {C, D, E, F}; | 413 BasicBlock* loop2[] = {C, D, E, F}; |
| 417 CheckLoop(order, loop2, 4); | 414 CheckLoop(order, loop2, 4); |
| 418 | 415 |
| 419 BasicBlock* loop3[] = {D, E}; | 416 BasicBlock* loop3[] = {D, E}; |
| 420 CheckLoop(order, loop3, 2); | 417 CheckLoop(order, loop3, 2); |
| 421 } | 418 } |
| 422 | 419 |
| 423 | 420 |
| 424 TEST(RPOLoopFollow1) { | 421 TEST(RPOLoopFollow1) { |
| 425 HandleAndZoneScope scope; | 422 HandleAndZoneScope scope; |
| 426 Schedule schedule(scope.main_zone()); | 423 Schedule schedule(scope.main_zone()); |
| 427 | 424 |
| 428 SmartPointer<TestLoop> loop1(CreateLoop(&schedule, 1)); | 425 SmartPointer<TestLoop> loop1(CreateLoop(&schedule, 1)); |
| 429 SmartPointer<TestLoop> loop2(CreateLoop(&schedule, 1)); | 426 SmartPointer<TestLoop> loop2(CreateLoop(&schedule, 1)); |
| 430 | 427 |
| 431 BasicBlock* A = schedule.start(); | 428 BasicBlock* A = schedule.start(); |
| 432 BasicBlock* E = schedule.end(); | 429 BasicBlock* E = schedule.end(); |
| 433 | 430 |
| 434 schedule.AddSuccessorForTesting(A, loop1->header()); | 431 schedule.AddSuccessorForTesting(A, loop1->header()); |
| 435 schedule.AddSuccessorForTesting(loop1->header(), loop2->header()); | 432 schedule.AddSuccessorForTesting(loop1->header(), loop2->header()); |
| 436 schedule.AddSuccessorForTesting(loop2->last(), E); | 433 schedule.AddSuccessorForTesting(loop2->last(), E); |
| 437 | 434 |
| 438 ZonePool zone_pool(scope.main_isolate()); | 435 BasicBlockVector* order = |
| 439 BasicBlockVector* order = Scheduler::ComputeSpecialRPO(&zone_pool, &schedule); | 436 Scheduler::ComputeSpecialRPO(scope.main_zone(), &schedule); |
| 440 | 437 |
| 441 CHECK_EQ(static_cast<int>(schedule.BasicBlockCount()), | 438 CHECK_EQ(static_cast<int>(schedule.BasicBlockCount()), |
| 442 static_cast<int>(order->size())); | 439 static_cast<int>(order->size())); |
| 443 | 440 |
| 444 loop1->Check(order); | 441 loop1->Check(order); |
| 445 loop2->Check(order); | 442 loop2->Check(order); |
| 446 } | 443 } |
| 447 | 444 |
| 448 | 445 |
| 449 TEST(RPOLoopFollow2) { | 446 TEST(RPOLoopFollow2) { |
| 450 HandleAndZoneScope scope; | 447 HandleAndZoneScope scope; |
| 451 Schedule schedule(scope.main_zone()); | 448 Schedule schedule(scope.main_zone()); |
| 452 | 449 |
| 453 SmartPointer<TestLoop> loop1(CreateLoop(&schedule, 1)); | 450 SmartPointer<TestLoop> loop1(CreateLoop(&schedule, 1)); |
| 454 SmartPointer<TestLoop> loop2(CreateLoop(&schedule, 1)); | 451 SmartPointer<TestLoop> loop2(CreateLoop(&schedule, 1)); |
| 455 | 452 |
| 456 BasicBlock* A = schedule.start(); | 453 BasicBlock* A = schedule.start(); |
| 457 BasicBlock* S = schedule.NewBasicBlock(); | 454 BasicBlock* S = schedule.NewBasicBlock(); |
| 458 BasicBlock* E = schedule.end(); | 455 BasicBlock* E = schedule.end(); |
| 459 | 456 |
| 460 schedule.AddSuccessorForTesting(A, loop1->header()); | 457 schedule.AddSuccessorForTesting(A, loop1->header()); |
| 461 schedule.AddSuccessorForTesting(loop1->header(), S); | 458 schedule.AddSuccessorForTesting(loop1->header(), S); |
| 462 schedule.AddSuccessorForTesting(S, loop2->header()); | 459 schedule.AddSuccessorForTesting(S, loop2->header()); |
| 463 schedule.AddSuccessorForTesting(loop2->last(), E); | 460 schedule.AddSuccessorForTesting(loop2->last(), E); |
| 464 | 461 |
| 465 ZonePool zone_pool(scope.main_isolate()); | 462 BasicBlockVector* order = |
| 466 BasicBlockVector* order = Scheduler::ComputeSpecialRPO(&zone_pool, &schedule); | 463 Scheduler::ComputeSpecialRPO(scope.main_zone(), &schedule); |
| 467 | 464 |
| 468 CHECK_EQ(static_cast<int>(schedule.BasicBlockCount()), | 465 CHECK_EQ(static_cast<int>(schedule.BasicBlockCount()), |
| 469 static_cast<int>(order->size())); | 466 static_cast<int>(order->size())); |
| 470 loop1->Check(order); | 467 loop1->Check(order); |
| 471 loop2->Check(order); | 468 loop2->Check(order); |
| 472 } | 469 } |
| 473 | 470 |
| 474 | 471 |
| 475 TEST(RPOLoopFollowN) { | 472 TEST(RPOLoopFollowN) { |
| 476 HandleAndZoneScope scope; | 473 HandleAndZoneScope scope; |
| 477 | 474 |
| 478 for (int size = 1; size < 5; size++) { | 475 for (int size = 1; size < 5; size++) { |
| 479 for (int exit = 0; exit < size; exit++) { | 476 for (int exit = 0; exit < size; exit++) { |
| 480 Schedule schedule(scope.main_zone()); | 477 Schedule schedule(scope.main_zone()); |
| 481 SmartPointer<TestLoop> loop1(CreateLoop(&schedule, size)); | 478 SmartPointer<TestLoop> loop1(CreateLoop(&schedule, size)); |
| 482 SmartPointer<TestLoop> loop2(CreateLoop(&schedule, size)); | 479 SmartPointer<TestLoop> loop2(CreateLoop(&schedule, size)); |
| 483 BasicBlock* A = schedule.start(); | 480 BasicBlock* A = schedule.start(); |
| 484 BasicBlock* E = schedule.end(); | 481 BasicBlock* E = schedule.end(); |
| 485 | 482 |
| 486 schedule.AddSuccessorForTesting(A, loop1->header()); | 483 schedule.AddSuccessorForTesting(A, loop1->header()); |
| 487 schedule.AddSuccessorForTesting(loop1->nodes[exit], loop2->header()); | 484 schedule.AddSuccessorForTesting(loop1->nodes[exit], loop2->header()); |
| 488 schedule.AddSuccessorForTesting(loop2->nodes[exit], E); | 485 schedule.AddSuccessorForTesting(loop2->nodes[exit], E); |
| 489 ZonePool zone_pool(scope.main_isolate()); | |
| 490 BasicBlockVector* order = | 486 BasicBlockVector* order = |
| 491 Scheduler::ComputeSpecialRPO(&zone_pool, &schedule); | 487 Scheduler::ComputeSpecialRPO(scope.main_zone(), &schedule); |
| 492 | 488 |
| 493 CHECK_EQ(static_cast<int>(schedule.BasicBlockCount()), | 489 CHECK_EQ(static_cast<int>(schedule.BasicBlockCount()), |
| 494 static_cast<int>(order->size())); | 490 static_cast<int>(order->size())); |
| 495 loop1->Check(order); | 491 loop1->Check(order); |
| 496 loop2->Check(order); | 492 loop2->Check(order); |
| 497 } | 493 } |
| 498 } | 494 } |
| 499 } | 495 } |
| 500 | 496 |
| 501 | 497 |
| 502 TEST(RPONestedLoopFollow1) { | 498 TEST(RPONestedLoopFollow1) { |
| 503 HandleAndZoneScope scope; | 499 HandleAndZoneScope scope; |
| 504 Schedule schedule(scope.main_zone()); | 500 Schedule schedule(scope.main_zone()); |
| 505 | 501 |
| 506 SmartPointer<TestLoop> loop1(CreateLoop(&schedule, 1)); | 502 SmartPointer<TestLoop> loop1(CreateLoop(&schedule, 1)); |
| 507 SmartPointer<TestLoop> loop2(CreateLoop(&schedule, 1)); | 503 SmartPointer<TestLoop> loop2(CreateLoop(&schedule, 1)); |
| 508 | 504 |
| 509 BasicBlock* A = schedule.start(); | 505 BasicBlock* A = schedule.start(); |
| 510 BasicBlock* B = schedule.NewBasicBlock(); | 506 BasicBlock* B = schedule.NewBasicBlock(); |
| 511 BasicBlock* C = schedule.NewBasicBlock(); | 507 BasicBlock* C = schedule.NewBasicBlock(); |
| 512 BasicBlock* E = schedule.end(); | 508 BasicBlock* E = schedule.end(); |
| 513 | 509 |
| 514 schedule.AddSuccessorForTesting(A, B); | 510 schedule.AddSuccessorForTesting(A, B); |
| 515 schedule.AddSuccessorForTesting(B, loop1->header()); | 511 schedule.AddSuccessorForTesting(B, loop1->header()); |
| 516 schedule.AddSuccessorForTesting(loop1->header(), loop2->header()); | 512 schedule.AddSuccessorForTesting(loop1->header(), loop2->header()); |
| 517 schedule.AddSuccessorForTesting(loop2->last(), C); | 513 schedule.AddSuccessorForTesting(loop2->last(), C); |
| 518 schedule.AddSuccessorForTesting(C, E); | 514 schedule.AddSuccessorForTesting(C, E); |
| 519 schedule.AddSuccessorForTesting(C, B); | 515 schedule.AddSuccessorForTesting(C, B); |
| 520 | 516 |
| 521 ZonePool zone_pool(scope.main_isolate()); | 517 BasicBlockVector* order = |
| 522 BasicBlockVector* order = Scheduler::ComputeSpecialRPO(&zone_pool, &schedule); | 518 Scheduler::ComputeSpecialRPO(scope.main_zone(), &schedule); |
| 523 | 519 |
| 524 CHECK_EQ(static_cast<int>(schedule.BasicBlockCount()), | 520 CHECK_EQ(static_cast<int>(schedule.BasicBlockCount()), |
| 525 static_cast<int>(order->size())); | 521 static_cast<int>(order->size())); |
| 526 loop1->Check(order); | 522 loop1->Check(order); |
| 527 loop2->Check(order); | 523 loop2->Check(order); |
| 528 | 524 |
| 529 BasicBlock* loop3[] = {B, loop1->nodes[0], loop2->nodes[0], C}; | 525 BasicBlock* loop3[] = {B, loop1->nodes[0], loop2->nodes[0], C}; |
| 530 CheckLoop(order, loop3, 4); | 526 CheckLoop(order, loop3, 4); |
| 531 } | 527 } |
| 532 | 528 |
| 533 | 529 |
| 534 TEST(RPOLoopBackedges1) { | 530 TEST(RPOLoopBackedges1) { |
| 535 HandleAndZoneScope scope; | 531 HandleAndZoneScope scope; |
| 536 | 532 |
| 537 int size = 8; | 533 int size = 8; |
| 538 for (int i = 0; i < size; i++) { | 534 for (int i = 0; i < size; i++) { |
| 539 for (int j = 0; j < size; j++) { | 535 for (int j = 0; j < size; j++) { |
| 540 Schedule schedule(scope.main_zone()); | 536 Schedule schedule(scope.main_zone()); |
| 541 BasicBlock* A = schedule.start(); | 537 BasicBlock* A = schedule.start(); |
| 542 BasicBlock* E = schedule.end(); | 538 BasicBlock* E = schedule.end(); |
| 543 | 539 |
| 544 SmartPointer<TestLoop> loop1(CreateLoop(&schedule, size)); | 540 SmartPointer<TestLoop> loop1(CreateLoop(&schedule, size)); |
| 545 schedule.AddSuccessorForTesting(A, loop1->header()); | 541 schedule.AddSuccessorForTesting(A, loop1->header()); |
| 546 schedule.AddSuccessorForTesting(loop1->last(), E); | 542 schedule.AddSuccessorForTesting(loop1->last(), E); |
| 547 | 543 |
| 548 schedule.AddSuccessorForTesting(loop1->nodes[i], loop1->header()); | 544 schedule.AddSuccessorForTesting(loop1->nodes[i], loop1->header()); |
| 549 schedule.AddSuccessorForTesting(loop1->nodes[j], E); | 545 schedule.AddSuccessorForTesting(loop1->nodes[j], E); |
| 550 | 546 |
| 551 ZonePool zone_pool(scope.main_isolate()); | |
| 552 BasicBlockVector* order = | 547 BasicBlockVector* order = |
| 553 Scheduler::ComputeSpecialRPO(&zone_pool, &schedule); | 548 Scheduler::ComputeSpecialRPO(scope.main_zone(), &schedule); |
| 554 CheckRPONumbers(order, schedule.BasicBlockCount(), true); | 549 CheckRPONumbers(order, schedule.BasicBlockCount(), true); |
| 555 loop1->Check(order); | 550 loop1->Check(order); |
| 556 } | 551 } |
| 557 } | 552 } |
| 558 } | 553 } |
| 559 | 554 |
| 560 | 555 |
| 561 TEST(RPOLoopOutedges1) { | 556 TEST(RPOLoopOutedges1) { |
| 562 HandleAndZoneScope scope; | 557 HandleAndZoneScope scope; |
| 563 | 558 |
| 564 int size = 8; | 559 int size = 8; |
| 565 for (int i = 0; i < size; i++) { | 560 for (int i = 0; i < size; i++) { |
| 566 for (int j = 0; j < size; j++) { | 561 for (int j = 0; j < size; j++) { |
| 567 Schedule schedule(scope.main_zone()); | 562 Schedule schedule(scope.main_zone()); |
| 568 BasicBlock* A = schedule.start(); | 563 BasicBlock* A = schedule.start(); |
| 569 BasicBlock* D = schedule.NewBasicBlock(); | 564 BasicBlock* D = schedule.NewBasicBlock(); |
| 570 BasicBlock* E = schedule.end(); | 565 BasicBlock* E = schedule.end(); |
| 571 | 566 |
| 572 SmartPointer<TestLoop> loop1(CreateLoop(&schedule, size)); | 567 SmartPointer<TestLoop> loop1(CreateLoop(&schedule, size)); |
| 573 schedule.AddSuccessorForTesting(A, loop1->header()); | 568 schedule.AddSuccessorForTesting(A, loop1->header()); |
| 574 schedule.AddSuccessorForTesting(loop1->last(), E); | 569 schedule.AddSuccessorForTesting(loop1->last(), E); |
| 575 | 570 |
| 576 schedule.AddSuccessorForTesting(loop1->nodes[i], loop1->header()); | 571 schedule.AddSuccessorForTesting(loop1->nodes[i], loop1->header()); |
| 577 schedule.AddSuccessorForTesting(loop1->nodes[j], D); | 572 schedule.AddSuccessorForTesting(loop1->nodes[j], D); |
| 578 schedule.AddSuccessorForTesting(D, E); | 573 schedule.AddSuccessorForTesting(D, E); |
| 579 | 574 |
| 580 ZonePool zone_pool(scope.main_isolate()); | |
| 581 BasicBlockVector* order = | 575 BasicBlockVector* order = |
| 582 Scheduler::ComputeSpecialRPO(&zone_pool, &schedule); | 576 Scheduler::ComputeSpecialRPO(scope.main_zone(), &schedule); |
| 583 CheckRPONumbers(order, schedule.BasicBlockCount(), true); | 577 CheckRPONumbers(order, schedule.BasicBlockCount(), true); |
| 584 loop1->Check(order); | 578 loop1->Check(order); |
| 585 } | 579 } |
| 586 } | 580 } |
| 587 } | 581 } |
| 588 | 582 |
| 589 | 583 |
| 590 TEST(RPOLoopOutedges2) { | 584 TEST(RPOLoopOutedges2) { |
| 591 HandleAndZoneScope scope; | 585 HandleAndZoneScope scope; |
| 592 | 586 |
| 593 int size = 8; | 587 int size = 8; |
| 594 for (int i = 0; i < size; i++) { | 588 for (int i = 0; i < size; i++) { |
| 595 Schedule schedule(scope.main_zone()); | 589 Schedule schedule(scope.main_zone()); |
| 596 BasicBlock* A = schedule.start(); | 590 BasicBlock* A = schedule.start(); |
| 597 BasicBlock* E = schedule.end(); | 591 BasicBlock* E = schedule.end(); |
| 598 | 592 |
| 599 SmartPointer<TestLoop> loop1(CreateLoop(&schedule, size)); | 593 SmartPointer<TestLoop> loop1(CreateLoop(&schedule, size)); |
| 600 schedule.AddSuccessorForTesting(A, loop1->header()); | 594 schedule.AddSuccessorForTesting(A, loop1->header()); |
| 601 schedule.AddSuccessorForTesting(loop1->last(), E); | 595 schedule.AddSuccessorForTesting(loop1->last(), E); |
| 602 | 596 |
| 603 for (int j = 0; j < size; j++) { | 597 for (int j = 0; j < size; j++) { |
| 604 BasicBlock* O = schedule.NewBasicBlock(); | 598 BasicBlock* O = schedule.NewBasicBlock(); |
| 605 schedule.AddSuccessorForTesting(loop1->nodes[j], O); | 599 schedule.AddSuccessorForTesting(loop1->nodes[j], O); |
| 606 schedule.AddSuccessorForTesting(O, E); | 600 schedule.AddSuccessorForTesting(O, E); |
| 607 } | 601 } |
| 608 | 602 |
| 609 ZonePool zone_pool(scope.main_isolate()); | |
| 610 BasicBlockVector* order = | 603 BasicBlockVector* order = |
| 611 Scheduler::ComputeSpecialRPO(&zone_pool, &schedule); | 604 Scheduler::ComputeSpecialRPO(scope.main_zone(), &schedule); |
| 612 CheckRPONumbers(order, schedule.BasicBlockCount(), true); | 605 CheckRPONumbers(order, schedule.BasicBlockCount(), true); |
| 613 loop1->Check(order); | 606 loop1->Check(order); |
| 614 } | 607 } |
| 615 } | 608 } |
| 616 | 609 |
| 617 | 610 |
| 618 TEST(RPOLoopOutloops1) { | 611 TEST(RPOLoopOutloops1) { |
| 619 HandleAndZoneScope scope; | 612 HandleAndZoneScope scope; |
| 620 | 613 |
| 621 int size = 8; | 614 int size = 8; |
| 622 for (int i = 0; i < size; i++) { | 615 for (int i = 0; i < size; i++) { |
| 623 Schedule schedule(scope.main_zone()); | 616 Schedule schedule(scope.main_zone()); |
| 624 BasicBlock* A = schedule.start(); | 617 BasicBlock* A = schedule.start(); |
| 625 BasicBlock* E = schedule.end(); | 618 BasicBlock* E = schedule.end(); |
| 626 SmartPointer<TestLoop> loop1(CreateLoop(&schedule, size)); | 619 SmartPointer<TestLoop> loop1(CreateLoop(&schedule, size)); |
| 627 schedule.AddSuccessorForTesting(A, loop1->header()); | 620 schedule.AddSuccessorForTesting(A, loop1->header()); |
| 628 schedule.AddSuccessorForTesting(loop1->last(), E); | 621 schedule.AddSuccessorForTesting(loop1->last(), E); |
| 629 | 622 |
| 630 TestLoop** loopN = new TestLoop* [size]; | 623 TestLoop** loopN = new TestLoop* [size]; |
| 631 for (int j = 0; j < size; j++) { | 624 for (int j = 0; j < size; j++) { |
| 632 loopN[j] = CreateLoop(&schedule, 2); | 625 loopN[j] = CreateLoop(&schedule, 2); |
| 633 schedule.AddSuccessorForTesting(loop1->nodes[j], loopN[j]->header()); | 626 schedule.AddSuccessorForTesting(loop1->nodes[j], loopN[j]->header()); |
| 634 schedule.AddSuccessorForTesting(loopN[j]->last(), E); | 627 schedule.AddSuccessorForTesting(loopN[j]->last(), E); |
| 635 } | 628 } |
| 636 | 629 |
| 637 ZonePool zone_pool(scope.main_isolate()); | |
| 638 BasicBlockVector* order = | 630 BasicBlockVector* order = |
| 639 Scheduler::ComputeSpecialRPO(&zone_pool, &schedule); | 631 Scheduler::ComputeSpecialRPO(scope.main_zone(), &schedule); |
| 640 CheckRPONumbers(order, schedule.BasicBlockCount(), true); | 632 CheckRPONumbers(order, schedule.BasicBlockCount(), true); |
| 641 loop1->Check(order); | 633 loop1->Check(order); |
| 642 | 634 |
| 643 for (int j = 0; j < size; j++) { | 635 for (int j = 0; j < size; j++) { |
| 644 loopN[j]->Check(order); | 636 loopN[j]->Check(order); |
| 645 delete loopN[j]; | 637 delete loopN[j]; |
| 646 } | 638 } |
| 647 delete[] loopN; | 639 delete[] loopN; |
| 648 } | 640 } |
| 649 } | 641 } |
| (...skipping 10 matching lines...) Expand all Loading... |
| 660 BasicBlock* E = schedule.NewBasicBlock(); | 652 BasicBlock* E = schedule.NewBasicBlock(); |
| 661 | 653 |
| 662 schedule.AddSuccessorForTesting(A, B); | 654 schedule.AddSuccessorForTesting(A, B); |
| 663 schedule.AddSuccessorForTesting(B, C); | 655 schedule.AddSuccessorForTesting(B, C); |
| 664 schedule.AddSuccessorForTesting(B, D); | 656 schedule.AddSuccessorForTesting(B, D); |
| 665 schedule.AddSuccessorForTesting(B, E); | 657 schedule.AddSuccessorForTesting(B, E); |
| 666 schedule.AddSuccessorForTesting(C, B); | 658 schedule.AddSuccessorForTesting(C, B); |
| 667 schedule.AddSuccessorForTesting(D, B); | 659 schedule.AddSuccessorForTesting(D, B); |
| 668 schedule.AddSuccessorForTesting(E, B); | 660 schedule.AddSuccessorForTesting(E, B); |
| 669 | 661 |
| 670 ZonePool zone_pool(scope.main_isolate()); | 662 BasicBlockVector* order = |
| 671 BasicBlockVector* order = Scheduler::ComputeSpecialRPO(&zone_pool, &schedule); | 663 Scheduler::ComputeSpecialRPO(scope.main_zone(), &schedule); |
| 672 CheckRPONumbers(order, 5, true); | 664 CheckRPONumbers(order, 5, true); |
| 673 | 665 |
| 674 BasicBlock* loop1[] = {B, C, D, E}; | 666 BasicBlock* loop1[] = {B, C, D, E}; |
| 675 CheckLoop(order, loop1, 4); | 667 CheckLoop(order, loop1, 4); |
| 676 } | 668 } |
| 677 | 669 |
| 678 | 670 |
| 679 TEST(BuildScheduleEmpty) { | 671 TEST(BuildScheduleEmpty) { |
| 680 HandleAndZoneScope scope; | 672 HandleAndZoneScope scope; |
| 681 Graph graph(scope.main_zone()); | 673 Graph graph(scope.main_zone()); |
| 682 CommonOperatorBuilder builder(scope.main_zone()); | 674 CommonOperatorBuilder builder(scope.main_zone()); |
| 683 graph.SetStart(graph.NewNode(builder.Start(0))); | 675 graph.SetStart(graph.NewNode(builder.Start(0))); |
| 684 graph.SetEnd(graph.NewNode(builder.End(), graph.start())); | 676 graph.SetEnd(graph.NewNode(builder.End(), graph.start())); |
| 685 | 677 |
| 686 ZonePool zone_pool(scope.main_isolate()); | 678 USE(Scheduler::ComputeSchedule(scope.main_zone(), &graph)); |
| 687 USE(Scheduler::ComputeSchedule(&zone_pool, &graph)); | |
| 688 } | 679 } |
| 689 | 680 |
| 690 | 681 |
| 691 TEST(BuildScheduleOneParameter) { | 682 TEST(BuildScheduleOneParameter) { |
| 692 HandleAndZoneScope scope; | 683 HandleAndZoneScope scope; |
| 693 Graph graph(scope.main_zone()); | 684 Graph graph(scope.main_zone()); |
| 694 CommonOperatorBuilder builder(scope.main_zone()); | 685 CommonOperatorBuilder builder(scope.main_zone()); |
| 695 graph.SetStart(graph.NewNode(builder.Start(0))); | 686 graph.SetStart(graph.NewNode(builder.Start(0))); |
| 696 | 687 |
| 697 Node* p1 = graph.NewNode(builder.Parameter(0), graph.start()); | 688 Node* p1 = graph.NewNode(builder.Parameter(0), graph.start()); |
| 698 Node* ret = graph.NewNode(builder.Return(), p1, graph.start(), graph.start()); | 689 Node* ret = graph.NewNode(builder.Return(), p1, graph.start(), graph.start()); |
| 699 | 690 |
| 700 graph.SetEnd(graph.NewNode(builder.End(), ret)); | 691 graph.SetEnd(graph.NewNode(builder.End(), ret)); |
| 701 | 692 |
| 702 ZonePool zone_pool(scope.main_isolate()); | 693 USE(Scheduler::ComputeSchedule(scope.main_zone(), &graph)); |
| 703 USE(Scheduler::ComputeSchedule(&zone_pool, &graph)); | |
| 704 } | 694 } |
| 705 | 695 |
| 706 | 696 |
| 707 TEST(BuildScheduleIfSplit) { | 697 TEST(BuildScheduleIfSplit) { |
| 708 HandleAndZoneScope scope; | 698 HandleAndZoneScope scope; |
| 709 Graph graph(scope.main_zone()); | 699 Graph graph(scope.main_zone()); |
| 710 CommonOperatorBuilder builder(scope.main_zone()); | 700 CommonOperatorBuilder builder(scope.main_zone()); |
| 711 JSOperatorBuilder js_builder(scope.main_zone()); | 701 JSOperatorBuilder js_builder(scope.main_zone()); |
| 712 graph.SetStart(graph.NewNode(builder.Start(3))); | 702 graph.SetStart(graph.NewNode(builder.Start(3))); |
| 713 | 703 |
| (...skipping 1333 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2047 graph.SetEnd(end); | 2037 graph.SetEnd(end); |
| 2048 | 2038 |
| 2049 Schedule* schedule = ComputeAndVerifySchedule(6, &graph); | 2039 Schedule* schedule = ComputeAndVerifySchedule(6, &graph); |
| 2050 BasicBlock* block = schedule->block(loop); | 2040 BasicBlock* block = schedule->block(loop); |
| 2051 CHECK_NE(NULL, loop); | 2041 CHECK_NE(NULL, loop); |
| 2052 CHECK_EQ(block, schedule->block(effect)); | 2042 CHECK_EQ(block, schedule->block(effect)); |
| 2053 CHECK_GE(block->rpo_number(), 0); | 2043 CHECK_GE(block->rpo_number(), 0); |
| 2054 } | 2044 } |
| 2055 | 2045 |
| 2056 #endif | 2046 #endif |
| OLD | NEW |