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

Side by Side Diff: src/objects.cc

Issue 2473993002: [modules] Make handling of module info's regular exports more robust. (Closed)
Patch Set: cast size_t Created 4 years, 1 month 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/objects.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 the V8 project authors. All rights reserved. 1 // Copyright 2015 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 "src/objects.h" 5 #include "src/objects.h"
6 6
7 #include <cmath> 7 #include <cmath>
8 #include <iomanip> 8 #include <iomanip>
9 #include <memory> 9 #include <memory>
10 #include <sstream> 10 #include <sstream>
(...skipping 19993 matching lines...) Expand 10 before | Expand all | Expand 10 after
20004 isolate->factory()->NewFunctionFromSharedFunctionInfo( 20004 isolate->factory()->NewFunctionFromSharedFunctionInfo(
20005 shared, 20005 shared,
20006 handle(Utils::OpenHandle(*context)->native_context(), isolate)); 20006 handle(Utils::OpenHandle(*context)->native_context(), isolate));
20007 module->set_code(*function); 20007 module->set_code(*function);
20008 DCHECK(module->instantiated()); 20008 DCHECK(module->instantiated());
20009 20009
20010 Handle<ModuleInfo> module_info(shared->scope_info()->ModuleDescriptorInfo(), 20010 Handle<ModuleInfo> module_info(shared->scope_info()->ModuleDescriptorInfo(),
20011 isolate); 20011 isolate);
20012 20012
20013 // Set up local exports. 20013 // Set up local exports.
20014 Handle<FixedArray> regular_exports(module_info->regular_exports(), isolate); 20014 for (int i = 0, n = module_info->RegularExportCount(); i < n; ++i) {
20015 for (int i = 0, n = regular_exports->length(); i < n; i += 3) { 20015 Handle<FixedArray> export_names(module_info->RegularExportExportNames(i),
20016 // TODO(neis): Make this more robust. 20016 isolate);
20017 Handle<FixedArray> export_names(
20018 FixedArray::cast(regular_exports->get(i + 2)), isolate);
20019 CreateExport(module, export_names); 20017 CreateExport(module, export_names);
20020 } 20018 }
20021 20019
20022 // Partially set up indirect exports. 20020 // Partially set up indirect exports.
20023 // For each indirect export, we create the appropriate slot in the export 20021 // For each indirect export, we create the appropriate slot in the export
20024 // table and store its ModuleInfoEntry there. When we later find the correct 20022 // table and store its ModuleInfoEntry there. When we later find the correct
20025 // Cell in the module that actually provides the value, we replace the 20023 // Cell in the module that actually provides the value, we replace the
20026 // ModuleInfoEntry by that Cell (see ResolveExport). 20024 // ModuleInfoEntry by that Cell (see ResolveExport).
20027 Handle<FixedArray> special_exports(module_info->special_exports(), isolate); 20025 Handle<FixedArray> special_exports(module_info->special_exports(), isolate);
20028 for (int i = 0, n = special_exports->length(); i < n; ++i) { 20026 for (int i = 0, n = special_exports->length(); i < n; ++i) {
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after
20255 ns, Accessors::ModuleNamespaceEntryInfo(isolate, name, attr)) 20253 ns, Accessors::ModuleNamespaceEntryInfo(isolate, name, attr))
20256 .Check(); 20254 .Check();
20257 } 20255 }
20258 JSObject::PreventExtensions(ns, THROW_ON_ERROR).ToChecked(); 20256 JSObject::PreventExtensions(ns, THROW_ON_ERROR).ToChecked();
20259 20257
20260 return ns; 20258 return ns;
20261 } 20259 }
20262 20260
20263 } // namespace internal 20261 } // namespace internal
20264 } // namespace v8 20262 } // namespace v8
OLDNEW
« no previous file with comments | « src/objects.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698