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

Unified Diff: runtime/vm/intermediate_language.cc

Issue 10802025: Fuse compare with branch at graph building time. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 5 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 | « runtime/vm/intermediate_language.h ('k') | runtime/vm/intermediate_language_ia32.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/intermediate_language.cc
===================================================================
--- runtime/vm/intermediate_language.cc (revision 9761)
+++ runtime/vm/intermediate_language.cc (working copy)
@@ -170,27 +170,26 @@
intptr_t BranchInstr::InputCount() const {
- return is_fused_with_comparison() ? fused_with_comparison_->InputCount() : 1;
+ return 2;
}
Value* BranchInstr::InputAt(intptr_t i) const {
- if (is_fused_with_comparison()) {
- return fused_with_comparison_->InputAt(i);
- }
- if (i == 0) return value();
+ if (i == 0) return left();
+ if (i == 1) return right();
UNREACHABLE();
return NULL;
}
void BranchInstr::SetInputAt(intptr_t i, Value* value) {
- ASSERT(!is_fused_with_comparison());
if (i == 0) {
- value_ = value;
- return;
+ left_ = value;
+ } else if (i == 1) {
+ right_ = value;
+ } else {
+ UNREACHABLE();
}
- UNREACHABLE();
}
@@ -1037,32 +1036,6 @@
}
-LocationSummary* BranchInstr::MakeLocationSummary() const {
- if (is_fused_with_comparison()) {
- return fused_with_comparison_->locs();
- } else {
- const int kNumInputs = 1;
- const int kNumTemps = 0;
- LocationSummary* locs = new LocationSummary(kNumInputs,
- kNumTemps,
- LocationSummary::kNoCall);
- locs->set_in(0, Location::RequiresRegister());
- return locs;
- }
-}
-
-
-void BranchInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
- if (is_fused_with_comparison()) {
- fused_with_comparison_->EmitNativeCode(compiler);
- } else {
- Register value = locs()->in(0).reg();
- __ CompareObject(value, compiler->bool_true());
- EmitBranchOnCondition(compiler, EQUAL);
- }
-}
-
-
static Condition NegateCondition(Condition condition) {
switch (condition) {
case EQUAL: return NOT_EQUAL;
@@ -1085,9 +1058,6 @@
void BranchInstr::EmitBranchOnCondition(FlowGraphCompiler* compiler,
Condition true_condition) {
- if (is_negated()) {
- true_condition = NegateCondition(true_condition);
- }
if (compiler->IsNextBlock(false_successor())) {
// If the next block is the false successor we will fall through to it.
__ j(true_condition, compiler->GetBlockLabel(true_successor()));
@@ -1127,18 +1097,7 @@
LocationSummary* StrictCompareComp::MakeLocationSummary() const {
- if (is_fused_with_branch()) {
- const intptr_t kNumInputs = 2;
- const intptr_t kNumTemps = 0;
- LocationSummary* locs = new LocationSummary(kNumInputs,
- kNumTemps,
- LocationSummary::kNoCall);
- locs->set_in(0, Location::RequiresRegister());
- locs->set_in(1, Location::RequiresRegister());
- return locs;
- } else {
- return LocationSummary::Make(2, Location::SameAsFirstInput());
- }
+ return LocationSummary::Make(2, Location::SameAsFirstInput());
}
@@ -1150,18 +1109,14 @@
Condition true_condition = (kind() == Token::kEQ_STRICT) ? EQUAL : NOT_EQUAL;
__ CompareRegisters(left, right);
- if (is_fused_with_branch()) {
- fused_with_branch()->EmitBranchOnCondition(compiler, true_condition);
- } else {
- Register result = locs()->out().reg();
- Label load_true, done;
- __ j(true_condition, &load_true, Assembler::kNearJump);
- __ LoadObject(result, compiler->bool_false());
- __ jmp(&done, Assembler::kNearJump);
- __ Bind(&load_true);
- __ LoadObject(result, compiler->bool_true());
- __ Bind(&done);
- }
+ Register result = locs()->out().reg();
+ Label load_true, done;
+ __ j(true_condition, &load_true, Assembler::kNearJump);
+ __ LoadObject(result, compiler->bool_false());
+ __ jmp(&done, Assembler::kNearJump);
+ __ Bind(&load_true);
+ __ LoadObject(result, compiler->bool_true());
+ __ Bind(&done);
}
« no previous file with comments | « runtime/vm/intermediate_language.h ('k') | runtime/vm/intermediate_language_ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698