Index: src/heap.cc |
diff --git a/src/heap.cc b/src/heap.cc |
index 6493524fcb51633e94294a3e83e85fa4f2b8be69..b740277f1642db61272e4474044c06d60742a2c5 100644 |
--- a/src/heap.cc |
+++ b/src/heap.cc |
@@ -4403,15 +4403,17 @@ MaybeObject* Heap::AllocateJSObjectWithAllocationSite(JSFunction* constructor, |
// Allocate the object based on the constructors initial map, or the payload |
// advice |
Map* initial_map = constructor->initial_map(); |
- |
- ElementsKind to_kind = allocation_site->GetElementsKind(); |
AllocationSiteMode mode = TRACK_ALLOCATION_SITE; |
- if (to_kind != initial_map->elements_kind()) { |
- MaybeObject* maybe_new_map = initial_map->AsElementsKind(to_kind); |
- if (!maybe_new_map->To(&initial_map)) return maybe_new_map; |
- // Possibly alter the mode, since we found an updated elements kind |
- // in the type info cell. |
- mode = AllocationSite::GetMode(to_kind); |
+ |
+ if (initial_map->instance_type() == JS_ARRAY_TYPE) { |
+ ElementsKind to_kind = allocation_site->GetElementsKind(); |
+ if (to_kind != initial_map->elements_kind()) { |
+ MaybeObject* maybe_new_map = initial_map->AsElementsKind(to_kind); |
+ if (!maybe_new_map->To(&initial_map)) return maybe_new_map; |
+ // Possibly alter the mode, since we found an updated elements kind |
+ // in the type info cell. |
+ mode = AllocationSite::GetMode(to_kind); |
+ } |
} |
MaybeObject* result; |