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

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

Issue 2357003002: [modules] Also (de-)serialize imports. (Closed)
Patch Set: 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/scopeinfo.cc ('k') | src/objects.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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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/ast/scopes.h" 5 #include "src/ast/scopes.h"
6 6
7 #include <set> 7 #include <set>
8 8
9 #include "src/accessors.h" 9 #include "src/accessors.h"
10 #include "src/ast/ast.h" 10 #include "src/ast/ast.h"
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after
178 } 178 }
179 179
180 // Deserialize regular exports. 180 // Deserialize regular exports.
181 Handle<FixedArray> regular_exports = handle(module_info->regular_exports()); 181 Handle<FixedArray> regular_exports = handle(module_info->regular_exports());
182 for (int i = 0, n = regular_exports->length(); i < n; ++i) { 182 for (int i = 0, n = regular_exports->length(); i < n; ++i) {
183 Handle<ModuleInfoEntry> serialized_entry( 183 Handle<ModuleInfoEntry> serialized_entry(
184 ModuleInfoEntry::cast(regular_exports->get(i)), isolate); 184 ModuleInfoEntry::cast(regular_exports->get(i)), isolate);
185 module_descriptor_->AddRegularExport(ModuleDescriptor::Entry::Deserialize( 185 module_descriptor_->AddRegularExport(ModuleDescriptor::Entry::Deserialize(
186 isolate, avfactory, serialized_entry)); 186 isolate, avfactory, serialized_entry));
187 } 187 }
188
189 // Deserialize special imports.
190 Handle<FixedArray> special_imports = handle(module_info->special_imports());
191 for (int i = 0, n = special_imports->length(); i < n; ++i) {
192 Handle<ModuleInfoEntry> serialized_entry(
193 ModuleInfoEntry::cast(special_imports->get(i)), isolate);
194 module_descriptor_->AddSpecialImport(
195 ModuleDescriptor::Entry::Deserialize(isolate, avfactory,
196 serialized_entry),
197 avfactory->zone());
198 }
199
200 // Deserialize regular imports.
201 Handle<FixedArray> regular_imports = handle(module_info->regular_imports());
202 for (int i = 0, n = regular_imports->length(); i < n; ++i) {
203 Handle<ModuleInfoEntry> serialized_entry(
204 ModuleInfoEntry::cast(regular_imports->get(i)), isolate);
205 module_descriptor_->AddRegularImport(ModuleDescriptor::Entry::Deserialize(
206 isolate, avfactory, serialized_entry));
207 }
188 } 208 }
189 209
190 Scope::Scope(Zone* zone, ScopeType scope_type, Handle<ScopeInfo> scope_info) 210 Scope::Scope(Zone* zone, ScopeType scope_type, Handle<ScopeInfo> scope_info)
191 : zone_(zone), 211 : zone_(zone),
192 outer_scope_(nullptr), 212 outer_scope_(nullptr),
193 variables_(zone), 213 variables_(zone),
194 locals_(0, zone), 214 locals_(0, zone),
195 decls_(0, zone), 215 decls_(0, zone),
196 scope_info_(scope_info), 216 scope_info_(scope_info),
197 scope_type_(scope_type) { 217 scope_type_(scope_type) {
(...skipping 1627 matching lines...) Expand 10 before | Expand all | Expand 10 after
1825 Variable* function = 1845 Variable* function =
1826 is_function_scope() ? AsDeclarationScope()->function_var() : nullptr; 1846 is_function_scope() ? AsDeclarationScope()->function_var() : nullptr;
1827 bool is_function_var_in_context = 1847 bool is_function_var_in_context =
1828 function != nullptr && function->IsContextSlot(); 1848 function != nullptr && function->IsContextSlot();
1829 return num_heap_slots() - Context::MIN_CONTEXT_SLOTS - 1849 return num_heap_slots() - Context::MIN_CONTEXT_SLOTS -
1830 (is_function_var_in_context ? 1 : 0); 1850 (is_function_var_in_context ? 1 : 0);
1831 } 1851 }
1832 1852
1833 } // namespace internal 1853 } // namespace internal
1834 } // namespace v8 1854 } // namespace v8
OLDNEW
« no previous file with comments | « src/ast/scopeinfo.cc ('k') | src/objects.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698