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

Unified Diff: runtime/vm/intermediate_language_x64.cc

Issue 12412013: Add pass to remove empty blocks and recompute fall-through targets. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 9 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: runtime/vm/intermediate_language_x64.cc
diff --git a/runtime/vm/intermediate_language_x64.cc b/runtime/vm/intermediate_language_x64.cc
index 12dbf3b937f6931899b43bd1fceff90f92b588d9..b9752079205cecab3a8e552293ada3d530524f41 100644
--- a/runtime/vm/intermediate_language_x64.cc
+++ b/runtime/vm/intermediate_language_x64.cc
@@ -2897,8 +2897,8 @@ void GotoInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
// We can fall through if the successor is the next block in the list.
// Otherwise, we need a jump.
- if (!compiler->IsNextBlock(successor())) {
- __ jmp(compiler->GetBlockLabel(successor()));
+ if (!compiler->CanFallThroughTo(successor())) {
+ __ jmp(compiler->GetJumpLabel(successor()));
}
}
@@ -2925,25 +2925,29 @@ static Condition NegateCondition(Condition condition) {
void ControlInstruction::EmitBranchOnValue(FlowGraphCompiler* compiler,
bool value) {
- if (value && compiler->IsNextBlock(false_successor())) {
- __ jmp(compiler->GetBlockLabel(true_successor()));
- } else if (!value && compiler->IsNextBlock(true_successor())) {
- __ jmp(compiler->GetBlockLabel(false_successor()));
+ if (value && !compiler->CanFallThroughTo(true_successor())) {
+ __ jmp(compiler->GetJumpLabel(true_successor()));
+ } else if (!value && !compiler->CanFallThroughTo(false_successor())) {
+ __ jmp(compiler->GetJumpLabel(false_successor()));
}
}
void ControlInstruction::EmitBranchOnCondition(FlowGraphCompiler* compiler,
Condition true_condition) {
- if (compiler->IsNextBlock(false_successor())) {
+ if (compiler->CanFallThroughTo(false_successor())) {
// If the next block is the false successor we will fall through to it.
- __ j(true_condition, compiler->GetBlockLabel(true_successor()));
+ __ j(true_condition, compiler->GetJumpLabel(true_successor()));
} else {
// If the next block is the true successor we negate comparison and fall
// through to it.
- ASSERT(compiler->IsNextBlock(true_successor()));
Condition false_condition = NegateCondition(true_condition);
- __ j(false_condition, compiler->GetBlockLabel(false_successor()));
+ __ j(false_condition, compiler->GetJumpLabel(false_successor()));
+
+ // Fall through or jump to the true successor.
+ if (!compiler->CanFallThroughTo(true_successor())) {
+ __ jmp(compiler->GetJumpLabel(true_successor()));
+ }
}
}
« runtime/vm/flow_graph_compiler.h ('K') | « runtime/vm/intermediate_language_ia32.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698