Chromium Code Reviews| Index: src/heap.cc |
| diff --git a/src/heap.cc b/src/heap.cc |
| index 7d655b4c35a2f6de9987c5645d5c20de6d0dfff0..a02214118e52d687eb37fd38caebdae46204dfc4 100644 |
| --- a/src/heap.cc |
| +++ b/src/heap.cc |
| @@ -4006,13 +4006,18 @@ MaybeObject* Heap::AllocateJSObject(JSFunction* constructor, |
| } |
| -MaybeObject* Heap::AllocateJSModule() { |
| +MaybeObject* Heap::AllocateJSModule(Context* context, ScopeInfo* scope_info) { |
| // 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); |
| + JSModule* module; |
| + MaybeObject* maybe_module = AllocateJSObjectFromMap(map, TENURED); |
| + if (!maybe_module->To(&module)) return maybe_module; |
| + module->set_context(context); |
| + module->set_scope_info(scope_info); |
| + return module; |
| } |
| @@ -4911,18 +4916,18 @@ MaybeObject* Heap::AllocateGlobalContext() { |
| } |
| -MaybeObject* Heap::AllocateModuleContext(Context* previous, |
| - ScopeInfo* scope_info) { |
| +MaybeObject* Heap::AllocateModuleContext(ScopeInfo* scope_info) { |
| Object* result; |
| { MaybeObject* maybe_result = |
| - AllocateFixedArrayWithHoles(scope_info->ContextLength(), TENURED); |
| + AllocateFixedArray(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()); |
| + // Context links will be set later. |
| + context->set_previous(NULL); |
|
Michael Starzinger
2012/07/06 10:53:22
I would prefer Smi::FromInt(0) instead of NULL her
rossberg
2012/07/06 15:39:28
Done (also in old code below).
|
| + context->set_global(NULL); |
| + context->set_extension(NULL); |
| return context; |
| } |