Index: src/ia32/lithium-codegen-ia32.cc |
diff --git a/src/ia32/lithium-codegen-ia32.cc b/src/ia32/lithium-codegen-ia32.cc |
index eb59f4ec9f3de07734882d5b1d6eb9f1e5f3474b..ba43e4230fd9667577d5fa7457443da20f178e59 100644 |
--- a/src/ia32/lithium-codegen-ia32.cc |
+++ b/src/ia32/lithium-codegen-ia32.cc |
@@ -4359,12 +4359,30 @@ void LCodeGen::DoStoreNamedField(LStoreNamedField* instr) { |
} |
Register object = ToRegister(instr->object()); |
- __ AssertNotSmi(object); |
+ SmiCheck check_needed = |
+ instr->hydrogen()->value()->IsHeapObject() |
+ ? OMIT_SMI_CHECK : INLINE_SMI_CHECK; |
+ |
+ ASSERT(!(representation.IsSmi() && |
+ instr->value()->IsConstantOperand() && |
+ !IsSmi(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 (!instr->hydrogen()->value()->type().IsHeapObject()) { |
+ Register value = ToRegister(instr->value()); |
+ __ test(value, Immediate(kSmiTagMask)); |
+ DeoptimizeIf(zero, instr->environment()); |
- ASSERT(!representation.IsSmi() || |
- !instr->value()->IsConstantOperand() || |
- IsSmi(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(!instr->hydrogen()->has_transition()); |
ASSERT(!instr->hydrogen()->NeedsWriteBarrier()); |
@@ -4437,7 +4455,7 @@ void LCodeGen::DoStoreNamedField(LStoreNamedField* instr) { |
temp, |
GetSaveFPRegsMode(isolate()), |
EMIT_REMEMBERED_SET, |
- instr->hydrogen()->SmiCheckForWriteBarrier()); |
+ check_needed); |
} |
} |