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

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: 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
Index: src/hydrogen.cc
diff --git a/src/hydrogen.cc b/src/hydrogen.cc
index 90f9c3496b2b4c6853419d218ae96fab4c637820..7235224df120faf9cecf18be59e7b0c3000fe4ab 100644
--- a/src/hydrogen.cc
+++ b/src/hydrogen.cc
@@ -113,6 +113,15 @@ void HBasicBlock::MarkUnreachable() {
}
+void HBasicBlock::MarkSuccEdgeUnreachable(int succ) {
+ ASSERT(IsFinished());
+ HBasicBlock* succ_block = end()->SuccessorAt(succ);
+
+ ASSERT(succ_block->predecessors()->length() == 1);
+ succ_block->MarkUnreachable();
+}
+
+
void HBasicBlock::AttachLoopInformation() {
ASSERT(!IsLoopHeader());
loop_information_ = new(zone()) HLoopInformation(this, zone());
@@ -313,6 +322,34 @@ int HBasicBlock::LoopNestingDepth() const {
}
+void HBasicBlock::ReplaceControlWithGotoSuccessor(int succ) {
+ ASSERT(IsFinished());
titzer 2014/01/13 17:26:56 I think you should go ahead and implement the gene
Igor Sheludko 2014/01/14 10:41:36 It seems that there are no instructions with more
+ ASSERT(end()->SuccessorCount() == 2); // Only this case is supported yet.
+ ASSERT(succ < end()->SuccessorCount());
+
+ // Replace control instruction with if(true) or if(false).
+ HConstant* value = (succ == 0)
+ ? graph()->GetConstantTrue()
+ : graph()->GetConstantFalse();
+
+ HBranch* new_branch = HBranch::New(
+ zone(),
+ NULL,
+ value,
+ ToBooleanStub::Types(ToBooleanStub::BOOLEAN),
+ end()->SuccessorAt(0),
+ end()->SuccessorAt(1));
+
+ int unreachable_succ = 1 - succ;
+
+ MarkSuccEdgeUnreachable(unreachable_succ);
titzer 2014/01/13 17:26:56 You should go through all the "other" successors,
Igor Sheludko 2014/01/14 10:41:36 Normally they
+
+ end()->DeleteAndReplaceWith(end()->ActualValue());
+ new_branch->InsertAfter(last());
+ end_ = new_branch;
+}
+
+
void HBasicBlock::PostProcessLoopHeader(IterationStatement* stmt) {
ASSERT(IsLoopHeader());

Powered by Google App Engine
This is Rietveld 408576698