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

Unified Diff: src/heap.cc

Issue 9844002: Implement rudimentary module linking. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 8 years, 9 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
« src/full-codegen.cc ('K') | « src/heap.h ('k') | src/hydrogen.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
« src/full-codegen.cc ('K') | « src/heap.h ('k') | src/hydrogen.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698