Index: src/x64/lithium-codegen-x64.cc |
diff --git a/src/x64/lithium-codegen-x64.cc b/src/x64/lithium-codegen-x64.cc |
index 31fb562486294e4a26b8073ac2b1391a71355a13..5636a49d4405f75c9ce9915d0f66bdadd75c5179 100644 |
--- a/src/x64/lithium-codegen-x64.cc |
+++ b/src/x64/lithium-codegen-x64.cc |
@@ -4517,18 +4517,6 @@ void LCodeGen::DoInteger32ToDouble(LInteger32ToDouble* instr) { |
} |
-void LCodeGen::DoInteger32ToSmi(LInteger32ToSmi* instr) { |
- LOperand* input = instr->value(); |
- ASSERT(input->IsRegister()); |
- LOperand* output = instr->result(); |
- __ Integer32ToSmi(ToRegister(output), ToRegister(input)); |
- if (!instr->hydrogen()->value()->HasRange() || |
- !instr->hydrogen()->value()->range()->IsInSmiRange()) { |
- DeoptimizeIf(overflow, instr->environment()); |
- } |
-} |
- |
- |
void LCodeGen::DoUint32ToDouble(LUint32ToDouble* instr) { |
LOperand* input = instr->value(); |
LOperand* output = instr->result(); |
@@ -4540,22 +4528,6 @@ 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())); |
@@ -4690,10 +4662,19 @@ void LCodeGen::DoDeferredNumberTagD(LNumberTagD* instr) { |
void LCodeGen::DoSmiTag(LSmiTag* instr) { |
- ASSERT(instr->value()->Equals(instr->result())); |
+ HChange* hchange = instr->hydrogen(); |
Register input = ToRegister(instr->value()); |
- ASSERT(!instr->hydrogen_value()->CheckFlag(HValue::kCanOverflow)); |
- __ Integer32ToSmi(input, input); |
+ Register output = ToRegister(instr->result()); |
+ if (hchange->CheckFlag(HValue::kCanOverflow) && |
+ hchange->value()->CheckFlag(HValue::kUint32)) { |
+ __ testl(input, Immediate(0x80000000)); |
+ DeoptimizeIf(not_zero, instr->environment()); |
+ } |
+ __ Integer32ToSmi(output, input); |
+ if (hchange->CheckFlag(HValue::kCanOverflow) && |
+ !hchange->value()->CheckFlag(HValue::kUint32)) { |
+ DeoptimizeIf(overflow, instr->environment()); |
+ } |
} |