| OLD | NEW |
| 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 #ifndef V8_AST_MODULES_H_ | 5 #ifndef V8_AST_MODULES_H_ |
| 6 #define V8_AST_MODULES_H_ | 6 #define V8_AST_MODULES_H_ |
| 7 | 7 |
| 8 #include "src/parsing/scanner.h" // Only for Scanner::Location. | 8 #include "src/parsing/scanner.h" // Only for Scanner::Location. |
| 9 #include "src/pending-compilation-error-handler.h" | 9 #include "src/pending-compilation-error-handler.h" |
| 10 #include "src/zone/zone-containers.h" | 10 #include "src/zone/zone-containers.h" |
| 11 | 11 |
| 12 namespace v8 { | 12 namespace v8 { |
| 13 namespace internal { | 13 namespace internal { |
| 14 | 14 |
| 15 | 15 |
| 16 class AstRawString; | 16 class AstRawString; |
| 17 class ModuleInfo; |
| 17 class ModuleInfoEntry; | 18 class ModuleInfoEntry; |
| 18 | 19 |
| 19 class ModuleDescriptor : public ZoneObject { | 20 class ModuleDescriptor : public ZoneObject { |
| 20 public: | 21 public: |
| 21 explicit ModuleDescriptor(Zone* zone) | 22 explicit ModuleDescriptor(Zone* zone) |
| 22 : module_requests_(zone), | 23 : module_requests_(zone), |
| 23 special_exports_(1, zone), | 24 special_exports_(1, zone), |
| 24 namespace_imports_(1, zone), | 25 namespace_imports_(1, zone), |
| 25 regular_exports_(zone), | 26 regular_exports_(zone), |
| 26 regular_imports_(zone) {} | 27 regular_imports_(zone) {} |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 162 DCHECK_NULL(entry->import_name); | 163 DCHECK_NULL(entry->import_name); |
| 163 DCHECK_NULL(entry->export_name); | 164 DCHECK_NULL(entry->export_name); |
| 164 DCHECK_NOT_NULL(entry->local_name); | 165 DCHECK_NOT_NULL(entry->local_name); |
| 165 DCHECK_LE(0, entry->module_request); | 166 DCHECK_LE(0, entry->module_request); |
| 166 namespace_imports_.Add(entry, zone); | 167 namespace_imports_.Add(entry, zone); |
| 167 } | 168 } |
| 168 | 169 |
| 169 Handle<FixedArray> SerializeRegularExports(Isolate* isolate, | 170 Handle<FixedArray> SerializeRegularExports(Isolate* isolate, |
| 170 Zone* zone) const; | 171 Zone* zone) const; |
| 171 void DeserializeRegularExports(Isolate* isolate, AstValueFactory* avfactory, | 172 void DeserializeRegularExports(Isolate* isolate, AstValueFactory* avfactory, |
| 172 Handle<FixedArray> data); | 173 Handle<ModuleInfo> module_info); |
| 173 | 174 |
| 174 private: | 175 private: |
| 175 // TODO(neis): Use STL datastructure instead of ZoneList? | 176 // TODO(neis): Use STL datastructure instead of ZoneList? |
| 176 ZoneMap<const AstRawString*, int> module_requests_; | 177 ZoneMap<const AstRawString*, int> module_requests_; |
| 177 ZoneList<const Entry*> special_exports_; | 178 ZoneList<const Entry*> special_exports_; |
| 178 ZoneList<const Entry*> namespace_imports_; | 179 ZoneList<const Entry*> namespace_imports_; |
| 179 ZoneMultimap<const AstRawString*, Entry*> regular_exports_; | 180 ZoneMultimap<const AstRawString*, Entry*> regular_exports_; |
| 180 ZoneMap<const AstRawString*, Entry*> regular_imports_; | 181 ZoneMap<const AstRawString*, Entry*> regular_imports_; |
| 181 | 182 |
| 182 // If there are multiple export entries with the same export name, return the | 183 // If there are multiple export entries with the same export name, return the |
| (...skipping 29 matching lines...) Expand all Loading... |
| 212 .insert(std::make_pair(specifier, module_requests_.size())) | 213 .insert(std::make_pair(specifier, module_requests_.size())) |
| 213 .first; | 214 .first; |
| 214 return it->second; | 215 return it->second; |
| 215 } | 216 } |
| 216 }; | 217 }; |
| 217 | 218 |
| 218 } // namespace internal | 219 } // namespace internal |
| 219 } // namespace v8 | 220 } // namespace v8 |
| 220 | 221 |
| 221 #endif // V8_AST_MODULES_H_ | 222 #endif // V8_AST_MODULES_H_ |
| OLD | NEW |