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

Unified Diff: runtime/vm/intermediate_language_x64.cc

Issue 10909272: Avoid using a temp register when unboxing a known smi. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 3 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_ia32.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/intermediate_language_x64.cc
===================================================================
--- runtime/vm/intermediate_language_x64.cc (revision 12439)
+++ runtime/vm/intermediate_language_x64.cc (working copy)
@@ -1910,32 +1910,34 @@
LocationSummary* UnboxDoubleInstr::MakeLocationSummary() const {
- const intptr_t v_cid = value()->ResultCid();
-
const intptr_t kNumInputs = 1;
- const intptr_t kNumTemps = (v_cid != kDoubleCid) ? 1 : 0;
+ const intptr_t kNumTemps = CanDeoptimize() ? 1 : 0;
LocationSummary* summary =
new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall);
summary->set_in(0, Location::RequiresRegister());
- if (v_cid != kDoubleCid) summary->set_temp(0, Location::RequiresRegister());
+ if (CanDeoptimize()) summary->set_temp(0, Location::RequiresRegister());
summary->set_out(Location::RequiresXmmRegister());
return summary;
}
void UnboxDoubleInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
- const intptr_t v_cid = value()->ResultCid();
-
+ const intptr_t value_cid = value()->ResultCid();
const Register value = locs()->in(0).reg();
const XmmRegister result = locs()->out().xmm_reg();
- if (v_cid != kDoubleCid) {
+
+ if (value_cid == kDoubleCid) {
+ __ movsd(result, FieldAddress(value, Double::value_offset()));
+ } else if (value_cid == kSmiCid) {
+ __ SmiUntag(value); // Untag input before conversion.
+ __ cvtsi2sd(result, value);
+ __ SmiTag(value); // Restore input register.
+ } else {
Label* deopt = compiler->AddDeoptStub(deopt_id_, kDeoptBinaryDoubleOp);
compiler->LoadDoubleOrSmiToXmm(result,
value,
locs()->temp(0).reg(),
deopt);
- } else {
- __ movsd(result, FieldAddress(value, Double::value_offset()));
}
}
« no previous file with comments | « runtime/vm/intermediate_language_ia32.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698