Index: src/x64/stub-cache-x64.cc |
diff --git a/src/x64/stub-cache-x64.cc b/src/x64/stub-cache-x64.cc |
index 0981114ec404c100760795ba8ae82c403f33bba3..93121a05ca89e2d43b8f9ca218fc4756e954b626 100644 |
--- a/src/x64/stub-cache-x64.cc |
+++ b/src/x64/stub-cache-x64.cc |
@@ -494,13 +494,21 @@ 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()->Map(), |
- miss_label, DO_SMI_CHECK); |
- } else { |
- ASSERT(HeapType::Any()->Is(field_type)); |
- __ JumpIfSmi(value_reg, miss_label); |
+ HeapType::Iterator<Map> it = field_type->Classes(); |
+ if (!it.Done()) { |
+ Label do_store; |
+ while (true) { |
+ __ CompareMap(value_reg, it.Current()); |
+ it.Advance(); |
+ if (it.Done()) { |
+ __ j(not_equal, miss_label); |
+ break; |
+ } |
+ __ j(equal, &do_store, Label::kNear); |
+ } |
+ __ bind(&do_store); |
} |
} else if (representation.IsDouble()) { |
Label do_store, heap_number; |
@@ -645,13 +653,21 @@ 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()->Map(), |
- miss_label, DO_SMI_CHECK); |
- } else { |
- ASSERT(HeapType::Any()->Is(field_type)); |
- __ JumpIfSmi(value_reg, miss_label); |
+ HeapType::Iterator<Map> it = field_type->Classes(); |
+ if (!it.Done()) { |
+ Label do_store; |
+ while (true) { |
+ __ CompareMap(value_reg, it.Current()); |
+ it.Advance(); |
+ if (it.Done()) { |
+ __ j(not_equal, miss_label); |
+ break; |
+ } |
+ __ j(equal, &do_store, Label::kNear); |
+ } |
+ __ bind(&do_store); |
} |
} else if (representation.IsDouble()) { |
// Load the double storage. |