Index: src/x64/lithium-codegen-x64.cc |
diff --git a/src/x64/lithium-codegen-x64.cc b/src/x64/lithium-codegen-x64.cc |
index 7c9949a1fad8da5b441e7ecd79d96ab41dbea073..902cea1669e29e0527f14d6a5f95eeb270fe0948 100644 |
--- a/src/x64/lithium-codegen-x64.cc |
+++ b/src/x64/lithium-codegen-x64.cc |
@@ -3946,7 +3946,8 @@ void LCodeGen::DoStoreNamedField(LStoreNamedField* instr) { |
if (FLAG_track_fields && representation.IsSmi()) { |
if (instr->value()->IsConstantOperand()) { |
LConstantOperand* operand_value = LConstantOperand::cast(instr->value()); |
- if (!IsSmiConstant(operand_value)) { |
+ if (!IsInteger32Constant(operand_value) && |
+ !IsSmiConstant(operand_value)) { |
DeoptimizeIf(no_condition, instr->environment()); |
} |
} |
@@ -4001,6 +4002,19 @@ void LCodeGen::DoStoreNamedField(LStoreNamedField* instr) { |
__ movq(write_register, FieldOperand(object, JSObject::kPropertiesOffset)); |
} |
+ bool kScratchRegisterContainsZero = false; |
+ if (representation.IsSmi()) { |
+ if (!instr->hydrogen()->can_omit_smi_tag_store()) { |
+ // Clear the smi tag as we are not sure that it contains the right value. |
+ __ xorl(kScratchRegister, kScratchRegister); |
+ kScratchRegisterContainsZero = true; |
+ __ movl(FieldOperand(write_register, offset), kScratchRegister); |
Toon Verwaest
2013/12/09 15:51:10
What about just shifting up the value and storing
Igor Sheludko
2013/12/10 09:13:08
Done.
|
+ } |
+ // Deal with the upper part of the smi containing the value. |
+ offset += kPointerSize / 2; |
+ representation = Representation::Integer32(); |
+ } |
+ |
if (instr->value()->IsConstantOperand()) { |
LConstantOperand* operand_value = LConstantOperand::cast(instr->value()); |
if (operand_value->IsRegister()) { |
@@ -4009,7 +4023,11 @@ void LCodeGen::DoStoreNamedField(LStoreNamedField* instr) { |
} else if (representation.IsInteger32()) { |
int32_t value = ToInteger32(operand_value); |
ASSERT(!instr->hydrogen()->NeedsWriteBarrier()); |
- __ movl(FieldOperand(write_register, offset), Immediate(value)); |
+ if ((value == 0) && kScratchRegisterContainsZero) { |
+ __ movl(FieldOperand(write_register, offset), kScratchRegister); |
+ } else { |
+ __ movl(FieldOperand(write_register, offset), Immediate(value)); |
+ } |
} else { |
Handle<Object> handle_value = ToHandle(operand_value); |
ASSERT(!instr->hydrogen()->NeedsWriteBarrier()); |