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

Unified Diff: src/factory.cc

Issue 2355033002: [modules] Add a requested_modules field to Module (Closed)
Patch Set: Handle review comments 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/objects.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 1c31840a55c1077b583c67a4db3d62d3a438c7cd..4317b97c991b734b3ab95ce949e4c0014be9e422 100644
--- a/src/factory.cc
+++ b/src/factory.cc
@@ -1705,12 +1705,20 @@ Handle<JSGeneratorObject> Factory::NewJSGeneratorObject(
JSGeneratorObject);
}
-Handle<Module> Factory::NewModule(Handle<SharedFunctionInfo> code,
- int min_size) {
- Handle<ObjectHashTable> exports = ObjectHashTable::New(isolate(), min_size);
+Handle<Module> Factory::NewModule(Handle<SharedFunctionInfo> code) {
+ Handle<ModuleInfo> module_info(code->scope_info()->ModuleDescriptorInfo(),
+ isolate());
+ Handle<ObjectHashTable> exports =
+ ObjectHashTable::New(isolate(), module_info->regular_exports()->length());
+ int requested_modules_length = module_info->module_requests()->length();
+ Handle<FixedArray> requested_modules =
+ requested_modules_length > 0 ? NewFixedArray(requested_modules_length)
+ : empty_fixed_array();
+
Handle<Module> module = Handle<Module>::cast(NewStruct(MODULE_TYPE));
module->set_code(*code);
module->set_exports(*exports);
+ module->set_requested_modules(*requested_modules);
return module;
}
« no previous file with comments | « src/factory.h ('k') | src/objects.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698