Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(472)

Unified Diff: src/heap.cc

Issue 10690043: Implement proper module linking. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 8 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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;
}

Powered by Google App Engine
This is Rietveld 408576698