Index: src/heap.cc |
diff --git a/src/heap.cc b/src/heap.cc |
index 22dbbebe887ad64404ce0948795c07b104130b09..ac9e029e4a1acc6a38fea6caea313ef995f5750e 100644 |
--- a/src/heap.cc |
+++ b/src/heap.cc |
@@ -3827,6 +3827,16 @@ MaybeObject* Heap::AllocateJSObject(JSFunction* constructor, |
} |
+MaybeObject* Heap::AllocateJSModule() { |
+ // Allocate a fresh map. Modules do not have a prototype. |
+ Map* map; |
+ MaybeObject* maybe_map = AllocateMap(JS_MODULE_TYPE, JSModule::kSize); |
+ if (!maybe_map->To(&map)) return maybe_map; |
+ // Allocate the object based on the map. |
+ return AllocateJSObjectFromMap(map, TENURED); |
+} |
+ |
+ |
MaybeObject* Heap::AllocateJSArrayAndStorage( |
ElementsKind elements_kind, |
int length, |
@@ -4701,6 +4711,22 @@ MaybeObject* Heap::AllocateGlobalContext() { |
} |
+MaybeObject* Heap::AllocateModuleContext(Context* previous, |
+ ScopeInfo* scope_info) { |
+ Object* result; |
+ { MaybeObject* maybe_result = |
+ AllocateFixedArrayWithHoles(scope_info->ContextLength(), TENURED); |
+ if (!maybe_result->ToObject(&result)) return maybe_result; |
+ } |
+ Context* context = reinterpret_cast<Context*>(result); |
+ context->set_map_no_write_barrier(module_context_map()); |
+ context->set_previous(previous); |
+ context->set_extension(scope_info); |
+ context->set_global(previous->global()); |
+ return context; |
+} |
+ |
+ |
MaybeObject* Heap::AllocateFunctionContext(int length, JSFunction* function) { |
ASSERT(length >= Context::MIN_CONTEXT_SLOTS); |
Object* result; |