OLD | NEW |
(Empty) | |
| 1 // Copyright 2017 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef V8_OBJECTS_MODULE_INFO_H_ |
| 6 #define V8_OBJECTS_MODULE_INFO_H_ |
| 7 |
| 8 #include "src/objects.h" |
| 9 |
| 10 // Has to be the last include (doesn't have include guards): |
| 11 #include "src/objects/object-macros.h" |
| 12 |
| 13 namespace v8 { |
| 14 namespace internal { |
| 15 |
| 16 template <typename T> |
| 17 class Handle; |
| 18 class Isolate; |
| 19 class ModuleDescriptor; |
| 20 class ModuleInfoEntry; |
| 21 class String; |
| 22 class Zone; |
| 23 |
| 24 // ModuleInfo is to ModuleDescriptor what ScopeInfo is to Scope. |
| 25 class ModuleInfo : public FixedArray { |
| 26 public: |
| 27 DECLARE_CAST(ModuleInfo) |
| 28 |
| 29 static Handle<ModuleInfo> New(Isolate* isolate, Zone* zone, |
| 30 ModuleDescriptor* descr); |
| 31 |
| 32 inline FixedArray* module_requests() const { |
| 33 return FixedArray::cast(get(kModuleRequestsIndex)); |
| 34 } |
| 35 |
| 36 inline FixedArray* special_exports() const { |
| 37 return FixedArray::cast(get(kSpecialExportsIndex)); |
| 38 } |
| 39 |
| 40 inline FixedArray* regular_exports() const { |
| 41 return FixedArray::cast(get(kRegularExportsIndex)); |
| 42 } |
| 43 |
| 44 inline FixedArray* regular_imports() const { |
| 45 return FixedArray::cast(get(kRegularImportsIndex)); |
| 46 } |
| 47 |
| 48 inline FixedArray* namespace_imports() const { |
| 49 return FixedArray::cast(get(kNamespaceImportsIndex)); |
| 50 } |
| 51 |
| 52 // Accessors for [regular_exports]. |
| 53 int RegularExportCount() const; |
| 54 String* RegularExportLocalName(int i) const; |
| 55 int RegularExportCellIndex(int i) const; |
| 56 FixedArray* RegularExportExportNames(int i) const; |
| 57 |
| 58 static Handle<ModuleInfoEntry> LookupRegularImport(Handle<ModuleInfo> info, |
| 59 Handle<String> local_name); |
| 60 |
| 61 #ifdef DEBUG |
| 62 inline bool Equals(ModuleInfo* other) const { |
| 63 return regular_exports() == other->regular_exports() && |
| 64 regular_imports() == other->regular_imports() && |
| 65 special_exports() == other->special_exports() && |
| 66 namespace_imports() == other->namespace_imports(); |
| 67 } |
| 68 #endif |
| 69 |
| 70 private: |
| 71 friend class Factory; |
| 72 friend class ModuleDescriptor; |
| 73 enum { |
| 74 kModuleRequestsIndex, |
| 75 kSpecialExportsIndex, |
| 76 kRegularExportsIndex, |
| 77 kNamespaceImportsIndex, |
| 78 kRegularImportsIndex, |
| 79 kLength |
| 80 }; |
| 81 enum { |
| 82 kRegularExportLocalNameOffset, |
| 83 kRegularExportCellIndexOffset, |
| 84 kRegularExportExportNamesOffset, |
| 85 kRegularExportLength |
| 86 }; |
| 87 DISALLOW_IMPLICIT_CONSTRUCTORS(ModuleInfo); |
| 88 }; |
| 89 |
| 90 } // namespace internal |
| 91 } // namespace v8 |
| 92 |
| 93 #include "src/objects/object-macros-undef.h" |
| 94 |
| 95 #endif // V8_OBJECTS_MODULE_INFO_H_ |
OLD | NEW |