Index: runtime/vm/intrinsifier_x64.cc |
diff --git a/runtime/vm/intrinsifier_x64.cc b/runtime/vm/intrinsifier_x64.cc |
index 5fd3ad77999a4aca7f45751b15ae97ba0aa70a8e..80b7395b9ff338b58d8904b746bd8d1bbf9e4d17 100644 |
--- a/runtime/vm/intrinsifier_x64.cc |
+++ b/runtime/vm/intrinsifier_x64.cc |
@@ -1295,10 +1295,11 @@ void Intrinsifier::Double_lessEqualThan(Assembler* assembler) { |
// Expects left argument to be double (receiver). Right argument is unknown. |
// Both arguments are on stack. |
static void DoubleArithmeticOperations(Assembler* assembler, Token::Kind kind) { |
- Label fall_through; |
- TestLastArgumentIsDouble(assembler, &fall_through, &fall_through); |
+ Label fall_through, is_smi, double_op; |
+ TestLastArgumentIsDouble(assembler, &is_smi, &fall_through); |
// Both arguments are double, right operand is in RAX. |
__ movsd(XMM1, FieldAddress(RAX, Double::value_offset())); |
+ __ Bind(&double_op); |
__ movq(RAX, Address(RSP, + 2 * kWordSize)); // Left argument. |
__ movsd(XMM0, FieldAddress(RAX, Double::value_offset())); |
switch (kind) { |
@@ -1317,6 +1318,10 @@ static void DoubleArithmeticOperations(Assembler* assembler, Token::Kind kind) { |
R13); |
__ movsd(FieldAddress(RAX, Double::value_offset()), XMM0); |
__ ret(); |
+ __ Bind(&is_smi); |
+ __ SmiUntag(RAX); |
+ __ cvtsi2sdq(XMM1, RAX); |
+ __ jmp(&double_op); |
__ Bind(&fall_through); |
} |