Index: src/x64/lithium-codegen-x64.cc |
diff --git a/src/x64/lithium-codegen-x64.cc b/src/x64/lithium-codegen-x64.cc |
index 4fbcbcdfc962964f01c0df20f65d7b7a049fa29c..9c8446cdb9051056d38427fe7c89f830c9fdd673 100644 |
--- a/src/x64/lithium-codegen-x64.cc |
+++ b/src/x64/lithium-codegen-x64.cc |
@@ -4459,6 +4459,22 @@ void LCodeGen::DoUint32ToDouble(LUint32ToDouble* instr) { |
} |
+void LCodeGen::DoUint32ToSmi(LUint32ToSmi* instr) { |
+ LOperand* input = instr->value(); |
+ ASSERT(input->IsRegister()); |
+ LOperand* output = instr->result(); |
+ if (!instr->hydrogen()->value()->HasRange() || |
+ !instr->hydrogen()->value()->range()->IsInSmiRange() || |
+ instr->hydrogen()->value()->range()->upper() == kMaxInt) { |
+ // The Range class can't express upper bounds in the (kMaxInt, kMaxUint32] |
+ // interval, so we treat kMaxInt as a sentinel for this entire interval. |
+ __ testl(ToRegister(input), Immediate(0x80000000)); |
+ DeoptimizeIf(not_zero, instr->environment()); |
+ } |
+ __ Integer32ToSmi(ToRegister(output), ToRegister(input)); |
+} |
+ |
+ |
void LCodeGen::DoNumberTagI(LNumberTagI* instr) { |
LOperand* input = instr->value(); |
ASSERT(input->IsRegister() && input->Equals(instr->result())); |