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

Side by Side Diff: src/lithium.cc

Issue 22876009: Improve and simplify removal of unreachable code (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Fix ia32 Created 7 years, 4 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
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 474 matching lines...) Expand 10 before | Expand all | Expand 10 after
485 spill_slot_count_ += 2; 485 spill_slot_count_ += 2;
486 } else { 486 } else {
487 spill_slot_count_++; 487 spill_slot_count_++;
488 } 488 }
489 } 489 }
490 iterator.Advance(); 490 iterator.Advance();
491 } 491 }
492 } 492 }
493 493
494 494
495 LInstruction* LChunkBuilder::ElideControlInstruction(
496 HControlInstruction* instr,
497 bool condition) {
498 HBasicBlock* successor = condition
499 ? instr->FirstSuccessor()
500 : instr->SecondSuccessor();
501 HBasicBlock* unreachable = condition
502 ? instr->SecondSuccessor()
503 : instr->FirstSuccessor();
504 unreachable->MarkUnreachable();
505 return new(zone()) LGoto(successor->block_id());
506 }
507
508
509 void LChunkBuilder::PropagateUnreachableBlockMarks() {
Michael Starzinger 2013/08/16 15:02:20 As discussed offline: This looks like it should be
Jakob Kummerow 2013/08/30 11:52:43 Am I missing something, or is this method never ca
510 // If there is unreachable code in the graph, propagate the unreachable marks
511 // using a fixed-point iteration.
512 if (graph()->HasUnreachableCode()) {
Jakob Kummerow 2013/08/20 08:46:56 You can avoid a level of indentation by turning th
513 bool changed = true;
514 const ZoneList<HBasicBlock*>* blocks = graph()->blocks();
515 while (changed) {
516 changed = false;
517 for (int i = 0; i < blocks->length(); i++) {
518 HBasicBlock* block = blocks->at(i);
519 if (block->IsReachable()) {
520 bool is_reachable = blocks->at(0) == block;
521 for (HPredecessorIterator it(block); !it.Done(); it.Advance()) {
522 HBasicBlock* predecessor = it.Current();
523 if (predecessor->IsReachable() &&
524 !predecessor->IsDeoptimizing()) {
525 is_reachable = true;
526 break;
527 }
528 }
529 if (!is_reachable) {
530 block->MarkUnreachable();
531 changed = true;
532 }
533 }
534 }
535 }
536 }
537 }
538
539
495 LPhase::~LPhase() { 540 LPhase::~LPhase() {
496 if (ShouldProduceTraceOutput()) { 541 if (ShouldProduceTraceOutput()) {
497 isolate()->GetHTracer()->TraceLithium(name(), chunk_); 542 isolate()->GetHTracer()->TraceLithium(name(), chunk_);
498 } 543 }
499 } 544 }
500 545
501 546
502 } } // namespace v8::internal 547 } } // namespace v8::internal
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698