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

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

Issue 499363002: Schedule floating control. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 3 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 241 matching lines...) Expand 10 before | Expand all | Expand 10 after
252 252
253 static bool HasDominatingDef(Schedule* schedule, Node* node, 253 static bool HasDominatingDef(Schedule* schedule, Node* node,
254 BasicBlock* container, BasicBlock* use_block, 254 BasicBlock* container, BasicBlock* use_block,
255 int use_pos) { 255 int use_pos) {
256 BasicBlock* block = use_block; 256 BasicBlock* block = use_block;
257 while (true) { 257 while (true) {
258 while (use_pos >= 0) { 258 while (use_pos >= 0) {
259 if (block->nodes_[use_pos] == node) return true; 259 if (block->nodes_[use_pos] == node) return true;
260 use_pos--; 260 use_pos--;
261 } 261 }
262 block = schedule->dominator(block); 262 block = block->dominator_;
263 if (block == NULL) break; 263 if (block == NULL) break;
264 use_pos = static_cast<int>(block->nodes_.size()) - 1; 264 use_pos = static_cast<int>(block->nodes_.size()) - 1;
265 if (node == block->control_input_) return true; 265 if (node == block->control_input_) return true;
266 } 266 }
267 return false; 267 return false;
268 } 268 }
269 269
270 270
271 static void CheckInputsDominate(Schedule* schedule, BasicBlock* block, 271 static void CheckInputsDominate(Schedule* schedule, BasicBlock* block,
272 Node* node, int use_pos) { 272 Node* node, int use_pos) {
(...skipping 28 matching lines...) Expand all
301 for (BasicBlockVector::iterator b = rpo_order->begin(); b != rpo_order->end(); 301 for (BasicBlockVector::iterator b = rpo_order->begin(); b != rpo_order->end();
302 ++b) { 302 ++b) {
303 CHECK_EQ((*b), schedule->GetBlockById((*b)->id())); 303 CHECK_EQ((*b), schedule->GetBlockById((*b)->id()));
304 } 304 }
305 305
306 // Verify RPO numbers of blocks. 306 // Verify RPO numbers of blocks.
307 CHECK_EQ(start, rpo_order->at(0)); // Start should be first. 307 CHECK_EQ(start, rpo_order->at(0)); // Start should be first.
308 for (size_t b = 0; b < rpo_order->size(); b++) { 308 for (size_t b = 0; b < rpo_order->size(); b++) {
309 BasicBlock* block = rpo_order->at(b); 309 BasicBlock* block = rpo_order->at(b);
310 CHECK_EQ(static_cast<int>(b), block->rpo_number_); 310 CHECK_EQ(static_cast<int>(b), block->rpo_number_);
311 BasicBlock* dom = schedule->dominator(block); 311 BasicBlock* dom = block->dominator_;
312 if (b == 0) { 312 if (b == 0) {
313 // All blocks except start should have a dominator. 313 // All blocks except start should have a dominator.
314 CHECK_EQ(NULL, dom); 314 CHECK_EQ(NULL, dom);
315 } else { 315 } else {
316 // Check that the immediate dominator appears somewhere before the block. 316 // Check that the immediate dominator appears somewhere before the block.
317 CHECK_NE(NULL, dom); 317 CHECK_NE(NULL, dom);
318 CHECK_LT(dom->rpo_number_, block->rpo_number_); 318 CHECK_LT(dom->rpo_number_, block->rpo_number_);
319 } 319 }
320 } 320 }
321 321
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
358 358
359 // Compute a set of all the nodes that dominate a given node by using 359 // Compute a set of all the nodes that dominate a given node by using
360 // a forward fixpoint. O(n^2). 360 // a forward fixpoint. O(n^2).
361 ZoneQueue<BasicBlock*> queue(zone); 361 ZoneQueue<BasicBlock*> queue(zone);
362 queue.push(start); 362 queue.push(start);
363 dominators[start->id()] = new (zone) BitVector(count, zone); 363 dominators[start->id()] = new (zone) BitVector(count, zone);
364 while (!queue.empty()) { 364 while (!queue.empty()) {
365 BasicBlock* block = queue.front(); 365 BasicBlock* block = queue.front();
366 queue.pop(); 366 queue.pop();
367 BitVector* block_doms = dominators[block->id()]; 367 BitVector* block_doms = dominators[block->id()];
368 BasicBlock* idom = schedule->dominator(block); 368 BasicBlock* idom = block->dominator_;
369 if (idom != NULL && !block_doms->Contains(idom->id())) { 369 if (idom != NULL && !block_doms->Contains(idom->id())) {
370 V8_Fatal(__FILE__, __LINE__, "Block B%d is not dominated by B%d", 370 V8_Fatal(__FILE__, __LINE__, "Block B%d is not dominated by B%d",
371 block->id(), idom->id()); 371 block->id(), idom->id());
372 } 372 }
373 for (int s = 0; s < block->SuccessorCount(); s++) { 373 for (int s = 0; s < block->SuccessorCount(); s++) {
374 BasicBlock* succ = block->SuccessorAt(s); 374 BasicBlock* succ = block->SuccessorAt(s);
375 BitVector* succ_doms = dominators[succ->id()]; 375 BitVector* succ_doms = dominators[succ->id()];
376 376
377 if (succ_doms == NULL) { 377 if (succ_doms == NULL) {
378 // First time visiting the node. S.vec = B U B.vec 378 // First time visiting the node. S.doms = B U B.doms
379 succ_doms = new (zone) BitVector(count, zone); 379 succ_doms = new (zone) BitVector(count, zone);
380 succ_doms->CopyFrom(*block_doms); 380 succ_doms->CopyFrom(*block_doms);
381 succ_doms->Add(block->id()); 381 succ_doms->Add(block->id());
382 dominators[succ->id()] = succ_doms; 382 dominators[succ->id()] = succ_doms;
383 queue.push(succ); 383 queue.push(succ);
384 } else { 384 } else {
385 // Nth time visiting the successor. S.vec = S.vec ^ (B U B.vec) 385 // Nth time visiting the successor. S.doms = S.doms ^ (B U B.doms)
386 bool had = succ_doms->Contains(block->id()); 386 bool had = succ_doms->Contains(block->id());
387 if (had) succ_doms->Remove(block->id()); 387 if (had) succ_doms->Remove(block->id());
388 if (succ_doms->IntersectIsChanged(*block_doms)) queue.push(succ); 388 if (succ_doms->IntersectIsChanged(*block_doms)) queue.push(succ);
389 if (had) succ_doms->Add(block->id()); 389 if (had) succ_doms->Add(block->id());
390 } 390 }
391 } 391 }
392 } 392 }
393 393
394 // Verify the immediateness of dominators. 394 // Verify the immediateness of dominators.
395 for (BasicBlockVector::iterator b = rpo_order->begin(); 395 for (BasicBlockVector::iterator b = rpo_order->begin();
396 b != rpo_order->end(); ++b) { 396 b != rpo_order->end(); ++b) {
397 BasicBlock* block = *b; 397 BasicBlock* block = *b;
398 BasicBlock* idom = schedule->dominator(block); 398 BasicBlock* idom = block->dominator_;
399 if (idom == NULL) continue; 399 if (idom == NULL) continue;
400 BitVector* block_doms = dominators[block->id()]; 400 BitVector* block_doms = dominators[block->id()];
401 401
402 for (BitVector::Iterator it(block_doms); !it.Done(); it.Advance()) { 402 for (BitVector::Iterator it(block_doms); !it.Done(); it.Advance()) {
403 BasicBlock* dom = schedule->GetBlockById(it.Current()); 403 BasicBlock* dom = schedule->GetBlockById(it.Current());
404 if (dom != idom && !dominators[idom->id()]->Contains(dom->id())) { 404 if (dom != idom && !dominators[idom->id()]->Contains(dom->id())) {
405 V8_Fatal(__FILE__, __LINE__, 405 V8_Fatal(__FILE__, __LINE__,
406 "Block B%d is not immediately dominated by B%d", block->id(), 406 "Block B%d is not immediately dominated by B%d", block->id(),
407 idom->id()); 407 idom->id());
408 } 408 }
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
443 // Check inputs for all nodes in the block. 443 // Check inputs for all nodes in the block.
444 for (size_t i = 0; i < block->nodes_.size(); i++) { 444 for (size_t i = 0; i < block->nodes_.size(); i++) {
445 Node* node = block->nodes_[i]; 445 Node* node = block->nodes_[i];
446 CheckInputsDominate(schedule, block, node, static_cast<int>(i) - 1); 446 CheckInputsDominate(schedule, block, node, static_cast<int>(i) - 1);
447 } 447 }
448 } 448 }
449 } 449 }
450 } 450 }
451 } 451 }
452 } // namespace v8::internal::compiler 452 } // 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