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

Unified Diff: runtime/vm/intermediate_language_x64.cc

Issue 11568044: Add DoubleToSmi optimistically, preventing boxing/unboxing of doubles and propagate smi-nessof the … (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years 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') | runtime/vm/intrinsifier_x64.cc » ('j') | 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 16259)
+++ runtime/vm/intermediate_language_x64.cc (working copy)
@@ -2204,6 +2204,35 @@
}
+LocationSummary* DoubleToSmiInstr::MakeLocationSummary() const {
+ const intptr_t kNumInputs = 1;
+ const intptr_t kNumTemps = 1;
+ LocationSummary* result = new LocationSummary(
+ kNumInputs, kNumTemps, LocationSummary::kNoCall);
+ result->set_in(0, Location::RequiresXmmRegister());
+ result->set_out(Location:: Location::RequiresRegister());
+ result->set_temp(0, Location::RequiresRegister());
+ return result;
+}
+
+
+void DoubleToSmiInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
+ Label* deopt = compiler->AddDeoptStub(deopt_id(), kDeoptDoubleToSmi);
+ Register result = locs()->out().reg();
+ XmmRegister value = locs()->in(0).xmm_reg();
+ Register temp = locs()->temp(0).reg();
+
+ __ cvttsd2siq(result, value);
+ // Overflow is signalled with minint.
+ Label do_call, done;
+ // Check for overflow and that it fits into Smi.
+ __ movq(temp, result);
+ __ shlq(temp, Immediate(1));
+ __ j(OVERFLOW, deopt);
+ __ SmiTag(result);
+}
+
+
LocationSummary* PolymorphicInstanceCallInstr::MakeLocationSummary() const {
return MakeCallSummary();
}
« no previous file with comments | « runtime/vm/intermediate_language_ia32.cc ('k') | runtime/vm/intrinsifier_x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698