Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(762)

Unified Diff: src/heap.cc

Issue 132963012: Pretenure call new support. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Comment response. Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: src/heap.cc
diff --git a/src/heap.cc b/src/heap.cc
index 535c99e4dcd993ff20470e013dca75423d7fcf1e..088bcdf5d5d54ef59885d1b4265cff1dc3f8b183 100644
--- a/src/heap.cc
+++ b/src/heap.cc
@@ -4396,7 +4396,8 @@ MaybeObject* Heap::AllocateJSObjectFromMapWithAllocationSite(
// Initialize the JSObject.
InitializeJSObjectFromMap(JSObject::cast(obj), properties, map);
- ASSERT(JSObject::cast(obj)->HasFastElements());
+ ASSERT(JSObject::cast(obj)->HasFastElements() ||
+ JSObject::cast(obj)->HasExternalArrayElements());
return obj;
}
@@ -4422,15 +4423,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;

Powered by Google App Engine
This is Rietveld 408576698