Index: src/heap.cc |
diff --git a/src/heap.cc b/src/heap.cc |
index 777661570aaf7d86736695d6a09f9c20d0877988..7b4e7f91c32af4cf35937f0e48d9a01a99928e54 100644 |
--- a/src/heap.cc |
+++ b/src/heap.cc |
@@ -4512,8 +4512,37 @@ MaybeObject* Heap::AllocateJSObjectFromMap(Map* map, PretenureFlag pretenure) { |
} |
-MaybeObject* Heap::AllocateJSObjectFromMapWithAllocationSite(Map* map, |
- Handle<AllocationSite> allocation_site) { |
+MaybeObject* Heap::AllocateJSObjectFromMapForDeoptimizer( |
+ Map* map, PretenureFlag pretenure) { |
+ // JSFunctions should be allocated using AllocateFunction to be |
+ // properly initialized. |
+ ASSERT(map->instance_type() != JS_FUNCTION_TYPE); |
+ |
+ // Both types of global objects should be allocated using |
+ // AllocateGlobalObject to be properly initialized. |
+ ASSERT(map->instance_type() != JS_GLOBAL_OBJECT_TYPE); |
+ ASSERT(map->instance_type() != JS_BUILTINS_OBJECT_TYPE); |
+ |
+ // Allocate the JSObject. |
+ AllocationSpace space = |
+ (pretenure == TENURED) ? OLD_POINTER_SPACE : NEW_SPACE; |
+ if (map->instance_size() > Page::kMaxNonCodeHeapObjectSize) space = LO_SPACE; |
+ Object* obj; |
+ MaybeObject* maybe_obj = Allocate(map, space); |
+ if (!maybe_obj->To(&obj)) return maybe_obj; |
+ |
+ // Initialize the JSObject. |
+ InitializeJSObjectFromMap(JSObject::cast(obj), |
+ empty_fixed_array(), |
+ map); |
+ ASSERT(JSObject::cast(obj)->HasFastElements() || |
+ JSObject::cast(obj)->HasExternalArrayElements()); |
+ return obj; |
+} |
+ |
+ |
+MaybeObject* Heap::AllocateJSObjectFromMapWithAllocationSite( |
+ Map* map, Handle<AllocationSite> allocation_site) { |
// JSFunctions should be allocated using AllocateFunction to be |
// properly initialized. |
ASSERT(map->instance_type() != JS_FUNCTION_TYPE); |