__ SmiTst(value, scratch);
DeoptimizeIf(eq, instr->environment(), scratch, Operand(zero_reg));
- // We know that value is a smi now, so we can omit the check below.
+ // 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()) {
} else if (representation.IsSmi()) {
__ JumpIfNotSmi(value_reg, miss_label);
} else if (representation.IsHeapObject()) {
- __ JumpIfSmi(value_reg, miss_label);
+ HeapType* field_type = descriptors->GetFieldType(descriptor);
+ if (field_type->IsClass()) {
+ __ CheckMap(value_reg, scratch1, field_type->AsClass(),
+ miss_label, DO_SMI_CHECK);
+ } else {
+ ASSERT(HeapType::Any()->Is(field_type));
+ __ JumpIfSmi(value_reg, miss_label);
+ }
} else if (representation.IsDouble()) {
Label do_store, heap_number;
__ LoadRoot(scratch3, Heap::kHeapNumberMapRootIndex);
if (representation.IsSmi()) {
__ JumpIfNotSmi(value_reg, miss_label);
} else if (representation.IsHeapObject()) {
- __ JumpIfSmi(value_reg, miss_label);
+ HeapType* field_type = lookup->GetFieldType();
+ if (field_type->IsClass()) {
+ __ CheckMap(value_reg, scratch1, field_type->AsClass(),
+ miss_label, DO_SMI_CHECK);
+ } else {
+ ASSERT(HeapType::Any()->Is(field_type));
+ __ JumpIfSmi(value_reg, miss_label);
+ }
} else if (representation.IsDouble()) {
// Load the double storage.
if (index < 0) {