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

Unified Diff: runtime/vm/intermediate_language_x64.cc

Issue 12298034: Copy propagated type info when inserting conversion. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 10 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
===================================================================
--- runtime/vm/intermediate_language_x64.cc (revision 18669)
+++ runtime/vm/intermediate_language_x64.cc (working copy)
@@ -2171,25 +2171,37 @@
LocationSummary* CheckEitherNonSmiInstr::MakeLocationSummary() const {
- ASSERT((left()->Type()->ToCid() != kDoubleCid) &&
- (right()->Type()->ToCid() != kDoubleCid));
+ intptr_t left_cid = left()->Type()->ToCid();
+ intptr_t right_cid = right()->Type()->ToCid();
+ ASSERT((left_cid != kDoubleCid) && (right_cid != kDoubleCid));
const intptr_t kNumInputs = 2;
- const intptr_t kNumTemps = 1;
+ const bool need_temp = (left_cid != kSmiCid) && (right_cid != kSmiCid);
+ const intptr_t kNumTemps = need_temp ? 1 : 0;
LocationSummary* summary =
new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall);
summary->set_in(0, Location::RequiresRegister());
summary->set_in(1, Location::RequiresRegister());
- summary->set_temp(0, Location::RequiresRegister());
+ if (need_temp) summary->set_temp(0, Location::RequiresRegister());
return summary;
}
void CheckEitherNonSmiInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
Label* deopt = compiler->AddDeoptStub(deopt_id(), kDeoptBinaryDoubleOp);
- Register temp = locs()->temp(0).reg();
- __ movq(temp, locs()->in(0).reg());
- __ orq(temp, locs()->in(1).reg());
- __ testl(temp, Immediate(kSmiTagMask));
+ intptr_t left_cid = left()->Type()->ToCid();
+ intptr_t right_cid = right()->Type()->ToCid();
+ Register left = locs()->in(0).reg();
+ Register right = locs()->in(1).reg();
+ if (left_cid == kSmiCid) {
+ __ testq(right, Immediate(kSmiTagMask));
+ } else if (right_cid == kSmiCid) {
+ __ testq(left, Immediate(kSmiTagMask));
+ } else {
+ Register temp = locs()->temp(0).reg();
+ __ movq(temp, left);
+ __ orq(temp, right);
+ __ testq(temp, Immediate(kSmiTagMask));
+ }
__ j(ZERO, deopt);
}
« runtime/vm/intermediate_language.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