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

Unified Diff: src/objects.h

Issue 2277253003: [modules] Partial scope info support of modules (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@modules-refactor
Patch Set: Undo 'git cl format' screwup and fix order of writes. Created 4 years, 4 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
« src/factory.cc ('K') | « src/heap/heap.cc ('k') | src/objects-inl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/objects.h
diff --git a/src/objects.h b/src/objects.h
index 7ad59a1050b297ef76860197bb11d53d3c1b4ba7..4bc1017c23bbaa1374b5193dab03359e03d1736f 100644
--- a/src/objects.h
+++ b/src/objects.h
@@ -94,6 +94,7 @@
// - TemplateList
// - TransitionArray
// - ScopeInfo
+// - ModuleInfo
// - ScriptContextTable
// - WeakFixedArray
// - FixedDoubleArray
@@ -879,6 +880,8 @@ class LayoutDescriptor;
class LiteralsArray;
class LookupIterator;
class FieldType;
+class ModuleDescriptor;
+class ModuleInfo;
class ObjectHashTable;
class ObjectVisitor;
class PropertyCell;
@@ -979,6 +982,7 @@ template <class C> inline bool Is(Object* obj);
V(ScriptContextTable) \
V(NativeContext) \
V(ScopeInfo) \
+ V(ModuleInfo) \
V(JSBoundFunction) \
V(JSFunction) \
V(Code) \
@@ -4313,6 +4317,8 @@ class ScopeInfo : public FixedArray {
// Return the function_name if present.
String* FunctionName();
+ ModuleInfo* ModuleDescriptorInfo();
+
// Return the name of the given parameter.
String* ParameterName(int var);
@@ -4366,6 +4372,12 @@ class ScopeInfo : public FixedArray {
InitializationFlag* init_flag,
MaybeAssignedFlag* maybe_assigned_flag);
+ // Lookup metadata of a MODULE-allocated variable. Return a negative value if
+ // there is no module variable with the given name.
+ static int ModuleIndex(Handle<ScopeInfo> scope_info, Handle<String> name,
+ VariableMode* mode, InitializationFlag* init_flag,
+ MaybeAssignedFlag* maybe_assigned_flag);
+
// Lookup the name of a certain context slot by its index.
String* ContextSlotName(int slot_index);
@@ -4400,8 +4412,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
- // 2. The number of parameters. This only applies to function scopes. For
- // non-function scopes this is 0.
+ // 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
// context.
@@ -4460,6 +4471,12 @@ class ScopeInfo : public FixedArray {
// information about the function variable. It always occupies two array
// slots: a. The name of the function variable.
// b. The context or stack slot index for the variable.
+ // 8. ModuleInfoEntryIndex:
+ // For a module scope, this part contains module-specific information (for
+ // non-module scopes it is empty):
+ // The first slot contains the ModuleInfo. The second slot contains the
+ // number n of MODULE-allocated variables. The remaining 3*n slots contain
+ // the metadata of those variables.
int ParameterEntriesIndex();
int StackLocalFirstSlotIndex();
int StackLocalEntriesIndex();
@@ -4469,6 +4486,7 @@ class ScopeInfo : public FixedArray {
int ContextGlobalInfoEntriesIndex();
int ReceiverEntryIndex();
int FunctionNameEntryIndex();
+ int ModuleInfoEntryIndex();
int Lookup(Handle<String> name, int start, int end, VariableMode* mode,
VariableLocation* location, InitializationFlag* init_flag,
@@ -4511,6 +4529,13 @@ class ScopeInfo : public FixedArray {
friend class ScopeIterator;
};
+class ModuleInfo : public FixedArray {
+ public:
+ DECLARE_CAST(ModuleInfo)
+ static Handle<ModuleInfo> New(Isolate* isolate, ModuleDescriptor* descr);
+ inline FixedArray* special_exports() const;
+ inline FixedArray* regular_exports() const;
+};
// The cache for maps used by normalized (dictionary mode) objects.
// Such maps do not have property descriptors, so a typical program
« src/factory.cc ('K') | « src/heap/heap.cc ('k') | src/objects-inl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698