Chromium Code Reviews| Index: src/heap.cc |
| diff --git a/src/heap.cc b/src/heap.cc |
| index e6dd2a9657c7f81a7d5c186ad618d7f957eac8bc..787bd4949923a2fe20e94dd2f9caadb77e68df6f 100644 |
| --- a/src/heap.cc |
| +++ b/src/heap.cc |
| @@ -3828,6 +3828,17 @@ 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>(&map)) return maybe_map; |
|
Sven Panne
2012/03/30 11:42:20
No need for the template parameter, I think.
rossberg
2012/04/10 14:01:15
Done.
|
| + // Allocate the object based on the map. |
| + MaybeObject* result = AllocateJSObjectFromMap(map, TENURED); |
|
Sven Panne
2012/03/30 11:42:20
No need to name the result.
rossberg
2012/04/10 14:01:15
Done.
|
| + return result; |
| +} |
| + |
| + |
| MaybeObject* Heap::AllocateJSArrayAndStorage( |
| ElementsKind elements_kind, |
| int length, |
| @@ -4702,6 +4713,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; |
|
Sven Panne
2012/03/30 11:42:20
Use templatized "To", removing the need for an exp
rossberg
2012/04/10 14:01:15
Unfortunately, that doesn't work here, because the
|
| + } |
| + 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; |