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

Unified Diff: src/objects.h

Issue 2302783002: [modules] Basic support of exports (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 side-by-side diff with in-line comments
Download patch
Index: src/objects.h
diff --git a/src/objects.h b/src/objects.h
index 7e49bf8cb00918d014adb2670236fa29a7b91df1..a5914ad57b39f38ef9b74306c5b0a6ad8356aa85 100644
--- a/src/objects.h
+++ b/src/objects.h
@@ -94,6 +94,7 @@
// - TemplateList
// - TransitionArray
// - ScopeInfo
+// - ModuleInfoEntry
// - ModuleInfo
// - ScriptContextTable
// - WeakFixedArray
@@ -881,6 +882,7 @@ class LiteralsArray;
class LookupIterator;
class FieldType;
class ModuleDescriptor;
+class ModuleInfoEntry;
class ModuleInfo;
class ObjectHashTable;
class ObjectVisitor;
@@ -963,6 +965,7 @@ template <class C> inline bool Is(Object* obj);
V(JSObject) \
V(JSContextExtensionObject) \
V(JSGeneratorObject) \
+ V(JSModule) \
V(Map) \
V(DescriptorArray) \
V(FrameArray) \
@@ -982,6 +985,7 @@ template <class C> inline bool Is(Object* obj);
V(ScriptContextTable) \
V(NativeContext) \
V(ScopeInfo) \
+ V(ModuleInfoEntry) \
V(ModuleInfo) \
V(JSBoundFunction) \
V(JSFunction) \
@@ -4405,7 +4409,7 @@ class ScopeInfo : public FixedArray {
// The layout of the static part of a ScopeInfo is as follows. Each entry is
// numeric and occupies one array slot.
- // 1. A set of properties of the scope
+// 1. A set of properties of the scope.
// 2. The number of parameters. For non-function scopes this is 0.
// 3. The number of non-parameter variables allocated on the stack.
// 4. The number of non-parameter and parameter variables allocated in the
@@ -4518,6 +4522,32 @@ class ScopeInfo : public FixedArray {
friend class ScopeIterator;
};
+// XXX Name clash
+class ModuleInfoEntry : public FixedArray {
+ public:
+ DECLARE_CAST(ModuleInfoEntry)
+ static Handle<ModuleInfoEntry> New(Isolate* isolate,
+ Handle<Object> export_name,
+ Handle<Object> local_name,
+ Handle<Object> import_name,
+ Handle<Object> module_request);
+ inline Object* export_name() const;
+ inline Object* local_name() const;
+ inline Object* import_name() const;
+ inline Object* module_request() const;
+
+ private:
+ friend class Factory;
+ enum {
+ kExportNameIndex,
+ kLocalNameIndex,
+ kImportNameIndex,
+ kModuleRequestIndex,
+ kLength
+ };
+};
+
+// XXX Should I be using Struct rather than FixedArray?
// ModuleInfo is to ModuleDescriptor what ScopeInfo is to Scope.
class ModuleInfo : public FixedArray {
public:
@@ -7790,6 +7820,20 @@ class JSGeneratorObject: public JSObject {
DISALLOW_IMPLICIT_CONSTRUCTORS(JSGeneratorObject);
};
+class JSModule : public JSObject {
+ public:
+ DECLARE_CAST(JSModule)
+ DECLARE_VERIFIER(JSModule)
+
+ static const int kSize = JSObject::kHeaderSize;
+
+ static void CreateExport(Handle<JSModule> module,
+ Handle<String> name);
+ static void StoreExport(Handle<JSModule> module,
+ Handle<String> name, Handle<Object> value);
+ static Handle<Object> LoadExport(Handle<JSModule> module,
+ Handle<String> name);
+};
// JSBoundFunction describes a bound function exotic object.
class JSBoundFunction : public JSObject {

Powered by Google App Engine
This is Rietveld 408576698