Index: src/x64/lithium-codegen-x64.cc |
diff --git a/src/x64/lithium-codegen-x64.cc b/src/x64/lithium-codegen-x64.cc |
index a1cc01ec8c6ff1283454a648a6d7f2d3c7f7ae9c..c49fa930f88f6620bfc0fe96939380a7bbd9a639 100644 |
--- a/src/x64/lithium-codegen-x64.cc |
+++ b/src/x64/lithium-codegen-x64.cc |
@@ -3990,12 +3990,29 @@ void LCodeGen::DoStoreNamedField(LStoreNamedField* instr) { |
} |
Register object = ToRegister(instr->object()); |
- __ AssertNotSmi(object); |
+ SmiCheck check_needed = hinstr->value()->IsHeapObject() |
+ ? OMIT_SMI_CHECK : INLINE_SMI_CHECK; |
+ |
+ ASSERT(!(representation.IsSmi() && |
+ instr->value()->IsConstantOperand() && |
+ !IsInteger32Constant(LConstantOperand::cast(instr->value())))); |
+ if (representation.IsHeapObject()) { |
+ if (instr->value()->IsConstantOperand()) { |
+ LConstantOperand* operand_value = LConstantOperand::cast(instr->value()); |
+ if (chunk_->LookupConstant(operand_value)->HasSmiValue()) { |
+ DeoptimizeIf(no_condition, instr->environment()); |
+ } |
+ } else { |
+ if (!hinstr->value()->type().IsHeapObject()) { |
+ Register value = ToRegister(instr->value()); |
+ Condition cc = masm()->CheckSmi(value); |
+ DeoptimizeIf(cc, instr->environment()); |
- ASSERT(!representation.IsSmi() || |
- !instr->value()->IsConstantOperand() || |
- IsInteger32Constant(LConstantOperand::cast(instr->value()))); |
- if (representation.IsDouble()) { |
+ // We know now that value is not a smi, so we can omit the check below. |
+ check_needed = OMIT_SMI_CHECK; |
+ } |
+ } |
+ } else if (representation.IsDouble()) { |
ASSERT(access.IsInobject()); |
ASSERT(!hinstr->has_transition()); |
ASSERT(!hinstr->NeedsWriteBarrier()); |
@@ -4080,7 +4097,7 @@ void LCodeGen::DoStoreNamedField(LStoreNamedField* instr) { |
temp, |
kSaveFPRegs, |
EMIT_REMEMBERED_SET, |
- hinstr->SmiCheckForWriteBarrier()); |
+ check_needed); |
} |
} |