Index: src/heap.cc |
diff --git a/src/heap.cc b/src/heap.cc |
index dbf3b95a941beca96cd1f77a35ea69de95a1a73c..e080cde3250b3d2780f4ab53b2538cca641878c5 100644 |
--- a/src/heap.cc |
+++ b/src/heap.cc |
@@ -1745,6 +1745,12 @@ bool Heap::CreateInitialMaps() { |
set_fixed_cow_array_map(Map::cast(obj)); |
ASSERT(fixed_array_map() != fixed_cow_array_map()); |
+ { MaybeObject* maybe_obj = |
+ AllocateMap(FIXED_ARRAY_TYPE, kVariableSizeSentinel); |
+ if (!maybe_obj->ToObject(&obj)) return false; |
+ } |
+ set_serialized_scope_info_map(Map::cast(obj)); |
+ |
{ MaybeObject* maybe_obj = AllocateMap(HEAP_NUMBER_TYPE, HeapNumber::kSize); |
if (!maybe_obj->ToObject(&obj)) return false; |
} |
@@ -1910,6 +1916,12 @@ bool Heap::CreateInitialMaps() { |
AllocateMap(FIXED_ARRAY_TYPE, kVariableSizeSentinel); |
if (!maybe_obj->ToObject(&obj)) return false; |
} |
+ set_block_context_map(Map::cast(obj)); |
+ |
+ { MaybeObject* maybe_obj = |
+ AllocateMap(FIXED_ARRAY_TYPE, kVariableSizeSentinel); |
+ if (!maybe_obj->ToObject(&obj)) return false; |
+ } |
Map* global_context_map = Map::cast(obj); |
global_context_map->set_visitor_id(StaticVisitorBase::kVisitGlobalContext); |
set_global_context_map(global_context_map); |
@@ -4017,6 +4029,37 @@ MaybeObject* Heap::AllocateWithContext(JSFunction* function, |
} |
+MaybeObject* Heap::AllocateBlockContext(JSFunction* function, |
+ Context* previous, |
+ SerializedScopeInfo* scope_info) { |
+ Object* result; |
+ { MaybeObject* maybe_result = |
+ AllocateFixedArray(scope_info->NumberOfContextSlots()); |
+ if (!maybe_result->ToObject(&result)) return maybe_result; |
+ } |
+ // TODO(keuchel): properly initialize context slots. |
+ Context* context = reinterpret_cast<Context*>(result); |
+ context->set_map(block_context_map()); |
+ context->set_closure(function); |
+ context->set_previous(previous); |
+ context->set_extension(scope_info); |
+ context->set_global(previous->global()); |
+ return context; |
+} |
+ |
+ |
+MaybeObject* Heap::AllocateSerializedScopeInfo(int length) { |
+ Object* result; |
+ { MaybeObject* maybe_result = AllocateFixedArray(length, TENURED); |
+ if (!maybe_result->ToObject(&result)) return maybe_result; |
+ } |
+ SerializedScopeInfo* scope_info = |
+ reinterpret_cast<SerializedScopeInfo*>(result); |
+ scope_info->set_map(serialized_scope_info_map()); |
+ return scope_info; |
+} |
+ |
+ |
MaybeObject* Heap::AllocateStruct(InstanceType type) { |
Map* map; |
switch (type) { |