Chromium Code Reviews| Index: src/heap.cc |
| diff --git a/src/heap.cc b/src/heap.cc |
| index 66f7055d3e85d20e5168bc2749b4d5dfd971189e..a4b75d6f20acffab6792bfd0eab92101d5e4a0a6 100644 |
| --- a/src/heap.cc |
| +++ b/src/heap.cc |
| @@ -2441,6 +2441,12 @@ bool Heap::CreateInitialMaps() { |
| AllocateMap(FIXED_ARRAY_TYPE, kVariableSizeSentinel); |
| if (!maybe_obj->ToObject(&obj)) return false; |
|
Sven Panne
2012/08/27 06:24:54
Consider templatized 'To'
rossberg
2012/08/27 09:07:16
Yeah, none of the other functions around here does
|
| } |
| + set_global_context_map(Map::cast(obj)); |
| + |
| + { MaybeObject* maybe_obj = |
| + AllocateMap(FIXED_ARRAY_TYPE, kVariableSizeSentinel); |
| + if (!maybe_obj->ToObject(&obj)) return false; |
| + } |
| Map* native_context_map = Map::cast(obj); |
| native_context_map->set_dictionary_map(true); |
| native_context_map->set_visitor_id(StaticVisitorBase::kVisitNativeContext); |
| @@ -4905,6 +4911,23 @@ MaybeObject* Heap::AllocateNativeContext() { |
| } |
| +MaybeObject* Heap::AllocateGlobalContext(JSFunction* function, |
| + ScopeInfo* scope_info) { |
| + Object* result; |
| + { MaybeObject* maybe_result = |
| + 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(global_context_map()); |
| + context->set_closure(function); |
| + context->set_extension(scope_info); |
| + ASSERT(context->IsGlobalContext()); |
| + ASSERT(result->IsContext()); |
| + return context; |
| +} |
| + |
| + |
| MaybeObject* Heap::AllocateModuleContext(ScopeInfo* scope_info) { |
| Object* result; |
| { MaybeObject* maybe_result = |