Index: src/x64/lithium-codegen-x64.cc |
diff --git a/src/x64/lithium-codegen-x64.cc b/src/x64/lithium-codegen-x64.cc |
index 85895b39039d2eb460e4f9bd828c781c1cbd9830..7c70094fbf03cda94da80d04a01e604d2b42d75e 100644 |
--- a/src/x64/lithium-codegen-x64.cc |
+++ b/src/x64/lithium-codegen-x64.cc |
@@ -4421,6 +4421,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())); |