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

Side by Side Diff: src/compiler/verifier.cc

Issue 602083003: Fix scheduler to correctly schedule nested diamonds. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Fix rebase bug Created 6 years, 2 months 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
« no previous file with comments | « src/compiler/scheduler.cc ('k') | test/cctest/compiler/test-scheduler.cc » ('j') | 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/compiler/verifier.h" 5 #include "src/compiler/verifier.h"
6 6
7 #include <deque> 7 #include <deque>
8 #include <queue> 8 #include <queue>
9 9
10 #include "src/compiler/generic-algorithm.h" 10 #include "src/compiler/generic-algorithm.h"
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after
264 } 264 }
265 block = block->dominator(); 265 block = block->dominator();
266 if (block == NULL) break; 266 if (block == NULL) break;
267 use_pos = static_cast<int>(block->NodeCount()) - 1; 267 use_pos = static_cast<int>(block->NodeCount()) - 1;
268 if (node == block->control_input()) return true; 268 if (node == block->control_input()) return true;
269 } 269 }
270 return false; 270 return false;
271 } 271 }
272 272
273 273
274 static bool Dominates(Schedule* schedule, Node* dominator, Node* dominatee) {
275 BasicBlock* dom = schedule->block(dominator);
276 BasicBlock* sub = schedule->block(dominatee);
277 while (sub != NULL) {
278 if (sub == dom) {
279 return true;
280 }
281 sub = sub->dominator();
282 }
283 return false;
284 }
285
286
274 static void CheckInputsDominate(Schedule* schedule, BasicBlock* block, 287 static void CheckInputsDominate(Schedule* schedule, BasicBlock* block,
275 Node* node, int use_pos) { 288 Node* node, int use_pos) {
276 for (int j = OperatorProperties::GetValueInputCount(node->op()) - 1; j >= 0; 289 for (int j = OperatorProperties::GetValueInputCount(node->op()) - 1; j >= 0;
277 j--) { 290 j--) {
278 BasicBlock* use_block = block; 291 BasicBlock* use_block = block;
279 if (node->opcode() == IrOpcode::kPhi) { 292 if (node->opcode() == IrOpcode::kPhi) {
280 use_block = use_block->PredecessorAt(j); 293 use_block = use_block->PredecessorAt(j);
281 use_pos = static_cast<int>(use_block->NodeCount()) - 1; 294 use_pos = static_cast<int>(use_block->NodeCount()) - 1;
282 } 295 }
283 Node* input = node->InputAt(j); 296 Node* input = node->InputAt(j);
284 if (!HasDominatingDef(schedule, node->InputAt(j), block, use_block, 297 if (!HasDominatingDef(schedule, node->InputAt(j), block, use_block,
285 use_pos)) { 298 use_pos)) {
286 V8_Fatal(__FILE__, __LINE__, 299 V8_Fatal(__FILE__, __LINE__,
287 "Node #%d:%s in B%d is not dominated by input@%d #%d:%s", 300 "Node #%d:%s in B%d is not dominated by input@%d #%d:%s",
288 node->id(), node->op()->mnemonic(), block->id().ToInt(), j, 301 node->id(), node->op()->mnemonic(), block->id().ToInt(), j,
289 input->id(), input->op()->mnemonic()); 302 input->id(), input->op()->mnemonic());
290 } 303 }
291 } 304 }
305 // Ensure that nodes are dominated by their control inputs;
306 // kEnd is an exception, as unreachable blocks resulting from kMerge
307 // are not in the RPO.
308 if (OperatorProperties::GetControlInputCount(node->op()) == 1 &&
309 node->opcode() != IrOpcode::kEnd) {
310 Node* ctl = NodeProperties::GetControlInput(node);
311 if (!Dominates(schedule, ctl, node)) {
312 V8_Fatal(__FILE__, __LINE__,
313 "Node #%d:%s in B%d is not dominated by control input #%d:%s",
314 node->id(), node->op()->mnemonic(), block->id(), ctl->id(),
315 ctl->op()->mnemonic());
316 }
317 }
292 } 318 }
293 319
294 320
295 void ScheduleVerifier::Run(Schedule* schedule) { 321 void ScheduleVerifier::Run(Schedule* schedule) {
296 const size_t count = schedule->BasicBlockCount(); 322 const size_t count = schedule->BasicBlockCount();
297 Zone tmp_zone(schedule->zone()->isolate()); 323 Zone tmp_zone(schedule->zone()->isolate());
298 Zone* zone = &tmp_zone; 324 Zone* zone = &tmp_zone;
299 BasicBlock* start = schedule->start(); 325 BasicBlock* start = schedule->start();
300 BasicBlockVector* rpo_order = schedule->rpo_order(); 326 BasicBlockVector* rpo_order = schedule->rpo_order();
301 327
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
448 // Check inputs for all nodes in the block. 474 // Check inputs for all nodes in the block.
449 for (size_t i = 0; i < block->NodeCount(); i++) { 475 for (size_t i = 0; i < block->NodeCount(); i++) {
450 Node* node = block->NodeAt(i); 476 Node* node = block->NodeAt(i);
451 CheckInputsDominate(schedule, block, node, static_cast<int>(i) - 1); 477 CheckInputsDominate(schedule, block, node, static_cast<int>(i) - 1);
452 } 478 }
453 } 479 }
454 } 480 }
455 } 481 }
456 } 482 }
457 } // namespace v8::internal::compiler 483 } // namespace v8::internal::compiler
OLDNEW
« no previous file with comments | « src/compiler/scheduler.cc ('k') | test/cctest/compiler/test-scheduler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698