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

Unified Diff: runtime/vm/intermediate_language_ia32.cc

Issue 14031035: Cleanup implementation of SmiToDouble to use unboxed double result. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: emit SmiToDouble only at monomorphic sites Created 7 years, 8 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_x64.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/intermediate_language_ia32.cc
diff --git a/runtime/vm/intermediate_language_ia32.cc b/runtime/vm/intermediate_language_ia32.cc
index 00cd501db1599399e41b91a4dccaf4146888d6be..e330da535735e833f15822b1df294fccdf2a5bd0 100644
--- a/runtime/vm/intermediate_language_ia32.cc
+++ b/runtime/vm/intermediate_language_ia32.cc
@@ -2969,37 +2969,21 @@ void UnarySmiOpInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
LocationSummary* SmiToDoubleInstr::MakeLocationSummary() const {
- return MakeCallSummary(); // Calls a stub to allocate result.
+ const intptr_t kNumInputs = 1;
+ const intptr_t kNumTemps = 0;
+ LocationSummary* result =
+ new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall);
+ result->set_in(0, Location::WritableRegister());
+ result->set_out(Location::RequiresFpuRegister());
+ return result;
}
void SmiToDoubleInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
- Register result = locs()->out().reg();
-
- Label* deopt = compiler->AddDeoptStub(instance_call()->deopt_id(),
- kDeoptIntegerToDouble);
-
- const Class& double_class = compiler->double_class();
- const Code& stub =
- Code::Handle(StubCode::GetAllocationStubForClass(double_class));
- const ExternalLabel label(double_class.ToCString(), stub.EntryPoint());
-
- // TODO(vegorov): allocate box in the driver loop to avoid spilling.
- compiler->GenerateCall(instance_call()->token_pos(),
- &label,
- PcDescriptors::kOther,
- locs());
- ASSERT(result == EAX);
- Register value = EBX;
- // Preserve argument on the stack until after the deoptimization point.
- __ movl(value, Address(ESP, 0));
-
- __ testl(value, Immediate(kSmiTagMask));
- __ j(NOT_ZERO, deopt); // Deoptimize if not Smi.
+ Register value = locs()->in(0).reg();
+ FpuRegister result = locs()->out().fpu_reg();
__ SmiUntag(value);
- __ cvtsi2sd(XMM0, value);
- __ movsd(FieldAddress(result, Double::value_offset()), XMM0);
- __ Drop(1);
+ __ cvtsi2sd(result, value);
}
@@ -3063,8 +3047,6 @@ void DoubleToSmiInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
Register result = locs()->out().reg();
XmmRegister value = locs()->in(0).fpu_reg();
__ cvttsd2si(result, value);
- // Overflow is signalled with minint.
- Label do_call, done;
// Check for overflow and that it fits into Smi.
__ cmpl(result, Immediate(0xC0000000));
__ j(NEGATIVE, deopt);
« no previous file with comments | « runtime/vm/intermediate_language.h ('k') | runtime/vm/intermediate_language_x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698