Index: src/x64/stub-cache-x64.cc |
diff --git a/src/x64/stub-cache-x64.cc b/src/x64/stub-cache-x64.cc |
index f7836378e9b849d85c5c362ab5c885b38d9d82d0..c1129dc2a72a647a640c1a6807ee451a3203ba55 100644 |
--- a/src/x64/stub-cache-x64.cc |
+++ b/src/x64/stub-cache-x64.cc |
@@ -494,7 +494,12 @@ 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, field_type->AsClass(), miss_label, DO_SMI_CHECK); |
+ } else { |
+ __ JumpIfSmi(value_reg, miss_label); |
+ } |
} else if (representation.IsDouble()) { |
Label do_store, heap_number; |
__ AllocateHeapNumber(storage_reg, scratch1, slow); |
@@ -638,7 +643,12 @@ 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, field_type->AsClass(), miss_label, DO_SMI_CHECK); |
+ } else { |
+ __ JumpIfSmi(value_reg, miss_label); |
+ } |
} else if (representation.IsDouble()) { |
// Load the double storage. |
if (index < 0) { |