Chromium Code Reviews| Index: runtime/vm/intermediate_language_x64.cc |
| =================================================================== |
| --- runtime/vm/intermediate_language_x64.cc (revision 13385) |
| +++ runtime/vm/intermediate_language_x64.cc (working copy) |
| @@ -1975,6 +1975,44 @@ |
| } |
| +LocationSummary* DoubleToIntegerInstr::MakeLocationSummary() const { |
| + return MakeCallSummary(); // Slow case calls the method. |
| +} |
| + |
| + |
| +void DoubleToIntegerInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| + Register result = locs()->out().reg(); |
| + ASSERT(result == RAX); |
| + Register value_obj = RBX; |
| + XmmRegister value_double = XMM0; |
| + __ movq(value_obj, Address(RSP, 0)); |
| + __ movsd(value_double, FieldAddress(value_obj, Double::value_offset())); |
| + __ cvttsd2siq(result, value_double); |
|
Florian Schneider
2012/10/09 11:13:58
Please make sure that the tests cover the corner c
srdjan
2012/10/09 21:23:04
Yes, this is covered in arithmetic_test.dart (thro
|
| + // Overflow is signalled with minint. |
| + Label do_call, done; |
| + // Check for overflow and that it fits into Smi. |
| + __ cmpq(result, Immediate(0xC000000000000000)); |
|
cshapiro
2012/10/09 00:59:24
Why not use SH
SHL result, 1
JO <overflow>
The
srdjan
2012/10/09 21:23:04
Done, using a temporary register to preserve resul
|
| + __ j(NEGATIVE, &do_call, Assembler::kNearJump); |
| + __ SmiTag(result); |
| + __ Drop(1); |
| + __ jmp(&done); |
| + __ Bind(&do_call); |
| + ASSERT(instance_call()->HasICData()); |
| + const ICData& ic_data = *instance_call()->ic_data(); |
| + ASSERT((ic_data.NumberOfChecks() == 1)); |
| + const Function& target = Function::ZoneHandle(ic_data.GetTargetAt(0)); |
| + |
| + const intptr_t kNumberOfArguments = 1; |
| + compiler->GenerateStaticCall(instance_call()->deopt_id(), |
| + instance_call()->token_pos(), |
| + target, |
| + kNumberOfArguments, |
| + Array::Handle(), // No argument names., |
|
Florian Schneider
2012/10/09 11:13:58
Remove extra , at the end.
srdjan
2012/10/09 21:23:04
Done.
|
| + locs()); |
| + __ Bind(&done); |
| +} |
| + |
| + |
| LocationSummary* PolymorphicInstanceCallInstr::MakeLocationSummary() const { |
| return MakeCallSummary(); |
| } |