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

Unified Diff: runtime/vm/intermediate_language.cc

Issue 10698153: Change comparison-to-branch fusion to actually remove comparison from the graph. (Closed) Base URL: https://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
Index: runtime/vm/intermediate_language.cc
diff --git a/runtime/vm/intermediate_language.cc b/runtime/vm/intermediate_language.cc
index 2d281be8aa6fd37190bfb34bfde86ed5d8f95714..8cc93e3e980e69d44179ac9d65a0f14058d86dec 100644
--- a/runtime/vm/intermediate_language.cc
+++ b/runtime/vm/intermediate_language.cc
@@ -170,11 +170,14 @@ void CreateArrayComp::SetInputAt(intptr_t i, Value* value) {
intptr_t BranchInstr::InputCount() const {
- return 1;
+ return is_fused_with_comparison() ? fused_with_comparison_->InputCount() : 1;
}
Value* BranchInstr::InputAt(intptr_t i) const {
+ if (is_fused_with_comparison()) {
+ return fused_with_comparison_->InputAt(i);
+ }
if (i == 0) return value();
UNREACHABLE();
return NULL;
@@ -182,6 +185,7 @@ Value* BranchInstr::InputAt(intptr_t i) const {
void BranchInstr::SetInputAt(intptr_t i, Value* value) {
+ ASSERT(!is_fused_with_comparison());
if (i == 0) {
value_ = value;
return;
@@ -985,17 +989,13 @@ void ReThrowInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
LocationSummary* BranchInstr::MakeLocationSummary() const {
if (is_fused_with_comparison()) {
- return LocationSummary::Make(0,
- Location::NoLocation(),
- LocationSummary::kNoCall,
- LocationSummary::kBranch);
+ return fused_with_comparison_->locs();
} else {
const int kNumInputs = 1;
const int kNumTemps = 0;
LocationSummary* locs = new LocationSummary(kNumInputs,
kNumTemps,
- LocationSummary::kNoCall,
- LocationSummary::kBranch);
+ LocationSummary::kNoCall);
locs->set_in(0, Location::RequiresRegister());
return locs;
}
@@ -1003,8 +1003,9 @@ LocationSummary* BranchInstr::MakeLocationSummary() const {
void BranchInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
- // If branch was fused with a comparision then no code needs to be emitted.
- if (!is_fused_with_comparison()) {
+ 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);
@@ -1081,8 +1082,7 @@ LocationSummary* StrictCompareComp::MakeLocationSummary() const {
const intptr_t kNumTemps = 0;
LocationSummary* locs = new LocationSummary(kNumInputs,
kNumTemps,
- LocationSummary::kNoCall,
- LocationSummary::kBranch);
+ LocationSummary::kNoCall);
locs->set_in(0, Location::RequiresRegister());
locs->set_in(1, Location::RequiresRegister());
return locs;

Powered by Google App Engine
This is Rietveld 408576698