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

Unified Diff: src/factory.cc

Issue 2302783002: [modules] Basic support of exports (Closed)
Patch Set: Disable module tests for deopt fuzzer. Created 4 years, 3 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
« no previous file with comments | « src/factory.h ('k') | src/heap/heap.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/factory.cc
diff --git a/src/factory.cc b/src/factory.cc
index 3c4a3774cb630c8af434ab9f0f49bc2d26adab3e..2548c4dc3432fef32a6c31e2a5c058812a072f98 100644
--- a/src/factory.cc
+++ b/src/factory.cc
@@ -789,15 +789,19 @@ Handle<ScriptContextTable> Factory::NewScriptContextTable() {
return context_table;
}
-
-Handle<Context> Factory::NewModuleContext(Handle<ScopeInfo> scope_info) {
+Handle<Context> Factory::NewModuleContext(Handle<JSModule> module,
+ Handle<JSFunction> function,
+ Handle<ScopeInfo> scope_info) {
DCHECK_EQ(scope_info->scope_type(), MODULE_SCOPE);
Handle<FixedArray> array =
NewFixedArray(scope_info->ContextLength(), TENURED);
array->set_map_no_write_barrier(*module_context_map());
- // Instance link will be set later.
Handle<Context> context = Handle<Context>::cast(array);
- context->set_extension(*the_hole_value());
+ context->set_closure(*function);
+ context->set_previous(function->context());
+ context->set_extension(*module);
+ context->set_native_context(function->native_context());
+ DCHECK(context->IsModuleContext());
return context;
}
@@ -1398,11 +1402,16 @@ Handle<ScopeInfo> Factory::NewScopeInfo(int length) {
return scope_info;
}
+Handle<ModuleInfoEntry> Factory::NewModuleInfoEntry() {
+ Handle<FixedArray> array = NewFixedArray(ModuleInfoEntry::kLength, TENURED);
+ array->set_map_no_write_barrier(*module_info_entry_map());
+ return Handle<ModuleInfoEntry>::cast(array);
+}
+
Handle<ModuleInfo> Factory::NewModuleInfo() {
Handle<FixedArray> array = NewFixedArray(ModuleInfo::kLength, TENURED);
array->set_map_no_write_barrier(*module_info_map());
- Handle<ModuleInfo> module_info = Handle<ModuleInfo>::cast(array);
- return module_info;
+ return Handle<ModuleInfo>::cast(array);
}
Handle<JSObject> Factory::NewExternal(void* value) {
@@ -1695,6 +1704,11 @@ Handle<JSGeneratorObject> Factory::NewJSGeneratorObject(
JSGeneratorObject);
}
+Handle<JSModule> Factory::NewJSModule() {
+ Handle<JSModule> module =
+ Handle<JSModule>::cast(NewJSObjectFromMap(js_module_map(), TENURED));
+ return module;
+}
Handle<JSArrayBuffer> Factory::NewJSArrayBuffer(SharedFlag shared,
PretenureFlag pretenure) {
« no previous file with comments | « src/factory.h ('k') | src/heap/heap.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698