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

Side by Side Diff: src/ast/scopeinfo.cc

Issue 2353633002: [modules] Explicitly keep track of module requests. (Closed)
Patch Set: Address 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 unified diff | Download patch
« no previous file with comments | « src/ast/modules.cc ('k') | src/ast/scopes.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include <stdlib.h> 5 #include <stdlib.h>
6 6
7 #include "src/ast/context-slot-cache.h" 7 #include "src/ast/context-slot-cache.h"
8 #include "src/ast/scopes.h" 8 #include "src/ast/scopes.h"
9 #include "src/ast/variables.h" 9 #include "src/ast/variables.h"
10 #include "src/bootstrapper.h" 10 #include "src/bootstrapper.h"
(...skipping 835 matching lines...) Expand 10 before | Expand all | Expand 10 after
846 Handle<Object> module_request) { 846 Handle<Object> module_request) {
847 Handle<ModuleInfoEntry> result = isolate->factory()->NewModuleInfoEntry(); 847 Handle<ModuleInfoEntry> result = isolate->factory()->NewModuleInfoEntry();
848 result->set(kExportNameIndex, *export_name); 848 result->set(kExportNameIndex, *export_name);
849 result->set(kLocalNameIndex, *local_name); 849 result->set(kLocalNameIndex, *local_name);
850 result->set(kImportNameIndex, *import_name); 850 result->set(kImportNameIndex, *import_name);
851 result->set(kModuleRequestIndex, *module_request); 851 result->set(kModuleRequestIndex, *module_request);
852 return result; 852 return result;
853 } 853 }
854 854
855 Handle<ModuleInfo> ModuleInfo::New(Isolate* isolate, ModuleDescriptor* descr) { 855 Handle<ModuleInfo> ModuleInfo::New(Isolate* isolate, ModuleDescriptor* descr) {
856 // Serialize module requests.
857 Handle<FixedArray> module_requests = isolate->factory()->NewFixedArray(
858 static_cast<int>(descr->module_requests().size()));
859 for (const auto& elem : descr->module_requests()) {
860 module_requests->set(elem.second, *elem.first->string());
861 }
862
856 // Serialize special exports. 863 // Serialize special exports.
857 Handle<FixedArray> special_exports = 864 Handle<FixedArray> special_exports =
858 isolate->factory()->NewFixedArray(descr->special_exports().length()); 865 isolate->factory()->NewFixedArray(descr->special_exports().length());
859 { 866 {
860 int i = 0; 867 int i = 0;
861 for (auto entry : descr->special_exports()) { 868 for (auto entry : descr->special_exports()) {
862 special_exports->set(i++, *entry->Serialize(isolate)); 869 special_exports->set(i++, *entry->Serialize(isolate));
863 } 870 }
864 } 871 }
865 872
866 // Serialize regular exports. 873 // Serialize regular exports.
867 Handle<FixedArray> regular_exports = isolate->factory()->NewFixedArray( 874 Handle<FixedArray> regular_exports = isolate->factory()->NewFixedArray(
868 static_cast<int>(descr->regular_exports().size())); 875 static_cast<int>(descr->regular_exports().size()));
869 { 876 {
870 int i = 0; 877 int i = 0;
871 for (const auto& it : descr->regular_exports()) { 878 for (const auto& elem : descr->regular_exports()) {
872 regular_exports->set(i++, *it.second->Serialize(isolate)); 879 regular_exports->set(i++, *elem.second->Serialize(isolate));
873 } 880 }
874 } 881 }
875 882
876 Handle<ModuleInfo> result = isolate->factory()->NewModuleInfo(); 883 Handle<ModuleInfo> result = isolate->factory()->NewModuleInfo();
884 result->set(kModuleRequestsIndex, *module_requests);
877 result->set(kSpecialExportsIndex, *special_exports); 885 result->set(kSpecialExportsIndex, *special_exports);
878 result->set(kRegularExportsIndex, *regular_exports); 886 result->set(kRegularExportsIndex, *regular_exports);
879 return result; 887 return result;
880 } 888 }
881 889
882 } // namespace internal 890 } // namespace internal
883 } // namespace v8 891 } // namespace v8
OLDNEW
« no previous file with comments | « src/ast/modules.cc ('k') | src/ast/scopes.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698