Index: src/arm/lithium-codegen-arm.cc |
diff --git a/src/arm/lithium-codegen-arm.cc b/src/arm/lithium-codegen-arm.cc |
index 96adb2f7b4bf2180d4963dc1ba88f9d24dea7d0e..c749e4a15d6b334f8cbe1fdfc6495755e0175a2a 100644 |
--- a/src/arm/lithium-codegen-arm.cc |
+++ b/src/arm/lithium-codegen-arm.cc |
@@ -518,7 +518,7 @@ DwVfpRegister LCodeGen::EmitLoadDoubleRegister(LOperand* op, |
Handle<Object> LCodeGen::ToHandle(LConstantOperand* op) const { |
HConstant* constant = chunk_->LookupConstant(op); |
- ASSERT(chunk_->LookupLiteralRepresentation(op).IsTagged()); |
+ ASSERT(chunk_->LookupLiteralRepresentation(op).IsSmiOrTagged()); |
return constant->handle(); |
} |
@@ -528,6 +528,11 @@ bool LCodeGen::IsInteger32(LConstantOperand* op) const { |
} |
+bool LCodeGen::IsSmi(LConstantOperand* op) const { |
+ return chunk_->LookupLiteralRepresentation(op).IsSmi(); |
+} |
+ |
+ |
int LCodeGen::ToInteger32(LConstantOperand* op) const { |
HConstant* constant = chunk_->LookupConstant(op); |
return constant->Integer32Value(); |
@@ -2208,7 +2213,7 @@ void LCodeGen::DoBranch(LBranch* instr) { |
int false_block = chunk_->LookupDestination(instr->false_block_id()); |
Representation r = instr->hydrogen()->value()->representation(); |
- if (r.IsInteger32()) { |
+ if (r.IsInteger32() || r.IsSmi()) { |
Register reg = ToRegister(instr->value()); |
__ cmp(reg, Operand::Zero()); |
EmitBranch(true_block, false_block, ne); |
@@ -4212,13 +4217,7 @@ void LCodeGen::DoStoreNamedField(LStoreNamedField* instr) { |
Handle<Map> transition = instr->transition(); |
- if (FLAG_track_fields && representation.IsSmi()) { |
- Register value = ToRegister(instr->value()); |
- __ SmiTag(value, value, SetCC); |
- if (!instr->hydrogen()->value()->range()->IsInSmiRange()) { |
- DeoptimizeIf(vs, instr->environment()); |
- } |
- } else if (FLAG_track_heap_object_fields && representation.IsHeapObject()) { |
+ if (FLAG_track_heap_object_fields && representation.IsHeapObject()) { |
Register value = ToRegister(instr->value()); |
if (!instr->hydrogen()->value()->type().IsHeapObject()) { |
__ tst(value, Operand(kSmiTagMask)); |
@@ -4705,6 +4704,19 @@ void LCodeGen::DoInteger32ToDouble(LInteger32ToDouble* instr) { |
} |
+void LCodeGen::DoInteger32ToSmi(LInteger32ToSmi* instr) { |
+ LOperand* input = instr->value(); |
+ ASSERT(input->IsRegister()); |
+ LOperand* output = instr->result(); |
+ ASSERT(output->IsRegister()); |
+ __ SmiTag(ToRegister(output), ToRegister(input)); |
Rodolph Perfetta
2013/05/18 17:54:53
SetCC
danno
2013/05/18 19:16:16
Done.
danno
2013/05/18 19:16:16
Done.
|
+ if (!instr->hydrogen()->value()->HasRange() || |
+ !instr->hydrogen()->value()->range()->IsInSmiRange()) { |
+ DeoptimizeIf(vs, instr->environment()); |
+ } |
+} |
+ |
+ |
void LCodeGen::DoUint32ToDouble(LUint32ToDouble* instr) { |
LOperand* input = instr->value(); |
LOperand* output = instr->result(); |
@@ -5142,6 +5154,30 @@ void LCodeGen::DoDoubleToI(LDoubleToI* instr) { |
} |
+void LCodeGen::DoDoubleToSmi(LDoubleToSmi* instr) { |
+ Register result_reg = ToRegister(instr->result()); |
+ Register scratch1 = scratch0(); |
+ Register scratch2 = ToRegister(instr->temp()); |
+ DwVfpRegister double_input = ToDoubleRegister(instr->value()); |
+ DwVfpRegister double_scratch = double_scratch0(); |
+ |
+ Label done; |
+ |
+ if (instr->truncating()) { |
+ Register scratch3 = ToRegister(instr->temp2()); |
+ __ ECMAToInt32(result_reg, double_input, |
+ scratch1, scratch2, scratch3, double_scratch); |
+ } else { |
+ __ TryDoubleToInt32Exact(result_reg, double_input, double_scratch); |
+ // Deoptimize if the input wasn't a int32 (inside a double). |
+ DeoptimizeIf(ne, instr->environment()); |
Rodolph Perfetta
2013/05/18 17:54:53
This code doesn't handle -0.
danno
2013/05/18 19:16:16
Done.
|
+ } |
+ __ bind(&done); |
Rodolph Perfetta
2013/05/18 17:54:53
Nothing branch to this label.
danno
2013/05/18 19:16:16
Done.
|
+ __ SmiTag(result_reg, SetCC); |
+ DeoptimizeIf(vs, instr->environment()); |
+} |
+ |
+ |
void LCodeGen::DoCheckSmi(LCheckSmi* instr) { |
LOperand* input = instr->value(); |
__ tst(ToRegister(input), Operand(kSmiTagMask)); |