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

Unified Diff: src/hydrogen.cc

Issue 130613003: Eliminatable CheckMaps replaced with if(true) or if(false). (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Review notes applied, rev.2 Created 6 years, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/hydrogen.h ('k') | src/hydrogen-check-elimination.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/hydrogen.cc
diff --git a/src/hydrogen.cc b/src/hydrogen.cc
index 4377b420705755d36223b319fc2119ab40bfcd42..f924307993a2835b3aadf6f2da06fe9b0b4e5c8e 100644
--- a/src/hydrogen.cc
+++ b/src/hydrogen.cc
@@ -313,6 +313,30 @@ int HBasicBlock::LoopNestingDepth() const {
}
+void HBasicBlock::ReplaceControlWithGotoSuccessor(int succ) {
+ ASSERT(IsFinished());
+ ASSERT(end()->SuccessorCount() == 2); // Only this case is supported yet.
+ ASSERT(succ < end()->SuccessorCount());
+
+ int unreachable_succ = 1 - succ;
+
+ // Replace control instruction with if (true) {succ} else {unreachable_succ}.
+ HBranch* new_branch = HBranch::New(
+ zone(),
+ NULL,
+ graph()->GetConstantTrue(),
+ ToBooleanStub::Types(ToBooleanStub::BOOLEAN),
+ end()->SuccessorAt(succ),
+ end()->SuccessorAt(unreachable_succ));
+
+ MarkSuccEdgeUnreachable(unreachable_succ);
+
+ end()->DeleteAndReplaceWith(end()->ActualValue());
Jakob Kummerow 2014/01/15 10:30:19 As discussed offline, this is a bug. Some instruc
+ new_branch->InsertAfter(last());
+ end_ = new_branch;
+}
+
+
void HBasicBlock::PostProcessLoopHeader(IterationStatement* stmt) {
ASSERT(IsLoopHeader());
@@ -331,6 +355,15 @@ void HBasicBlock::PostProcessLoopHeader(IterationStatement* stmt) {
}
+void HBasicBlock::MarkSuccEdgeUnreachable(int succ) {
+ ASSERT(IsFinished());
+ HBasicBlock* succ_block = end()->SuccessorAt(succ);
+
+ ASSERT(succ_block->predecessors()->length() == 1);
+ succ_block->MarkUnreachable();
+}
+
+
void HBasicBlock::RegisterPredecessor(HBasicBlock* pred) {
if (HasPredecessor()) {
// Only loop header blocks can have a predecessor added after
« no previous file with comments | « src/hydrogen.h ('k') | src/hydrogen-check-elimination.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698