Index: src/mips/stub-cache-mips.cc |
diff --git a/src/mips/stub-cache-mips.cc b/src/mips/stub-cache-mips.cc |
index 153a8168207121389892de1ec307edc1a6211e65..45aadc85a30b2ac470a95e23892af0f63d894bba 100644 |
--- a/src/mips/stub-cache-mips.cc |
+++ b/src/mips/stub-cache-mips.cc |
@@ -415,7 +415,14 @@ void StoreStubCompiler::GenerateStoreTransition(MacroAssembler* masm, |
} 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); |
@@ -578,7 +585,14 @@ void StoreStubCompiler::GenerateStoreField(MacroAssembler* masm, |
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) { |