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

Side by Side 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 unified diff | Download patch
OLDNEW
1 // Copyright 2015 the V8 project authors. All rights reserved. 1 // Copyright 2015 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_OBJECTS_H_ 5 #ifndef V8_OBJECTS_H_
6 #define V8_OBJECTS_H_ 6 #define V8_OBJECTS_H_
7 7
8 #include <iosfwd> 8 #include <iosfwd>
9 #include <memory> 9 #include <memory>
10 10
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 // - MapCache 87 // - MapCache
88 // - OrderedHashTable 88 // - OrderedHashTable
89 // - OrderedHashSet 89 // - OrderedHashSet
90 // - OrderedHashMap 90 // - OrderedHashMap
91 // - Context 91 // - Context
92 // - TypeFeedbackMetadata 92 // - TypeFeedbackMetadata
93 // - TypeFeedbackVector 93 // - TypeFeedbackVector
94 // - TemplateList 94 // - TemplateList
95 // - TransitionArray 95 // - TransitionArray
96 // - ScopeInfo 96 // - ScopeInfo
97 // - ModuleInfoEntry
97 // - ModuleInfo 98 // - ModuleInfo
98 // - ScriptContextTable 99 // - ScriptContextTable
99 // - WeakFixedArray 100 // - WeakFixedArray
100 // - FixedDoubleArray 101 // - FixedDoubleArray
101 // - Name 102 // - Name
102 // - String 103 // - String
103 // - SeqString 104 // - SeqString
104 // - SeqOneByteString 105 // - SeqOneByteString
105 // - SeqTwoByteString 106 // - SeqTwoByteString
106 // - SlicedString 107 // - SlicedString
(...skipping 767 matching lines...) Expand 10 before | Expand all | Expand 10 after
874 class ElementsAccessor; 875 class ElementsAccessor;
875 class FixedArrayBase; 876 class FixedArrayBase;
876 class FunctionLiteral; 877 class FunctionLiteral;
877 class JSGlobalObject; 878 class JSGlobalObject;
878 class KeyAccumulator; 879 class KeyAccumulator;
879 class LayoutDescriptor; 880 class LayoutDescriptor;
880 class LiteralsArray; 881 class LiteralsArray;
881 class LookupIterator; 882 class LookupIterator;
882 class FieldType; 883 class FieldType;
883 class ModuleDescriptor; 884 class ModuleDescriptor;
885 class ModuleInfoEntry;
884 class ModuleInfo; 886 class ModuleInfo;
885 class ObjectHashTable; 887 class ObjectHashTable;
886 class ObjectVisitor; 888 class ObjectVisitor;
887 class PropertyCell; 889 class PropertyCell;
888 class PropertyDescriptor; 890 class PropertyDescriptor;
889 class SafepointEntry; 891 class SafepointEntry;
890 class SharedFunctionInfo; 892 class SharedFunctionInfo;
891 class StringStream; 893 class StringStream;
892 class TypeFeedbackInfo; 894 class TypeFeedbackInfo;
893 class TypeFeedbackMetadata; 895 class TypeFeedbackMetadata;
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
956 V(FixedFloat32Array) \ 958 V(FixedFloat32Array) \
957 V(FixedFloat64Array) \ 959 V(FixedFloat64Array) \
958 V(FixedUint8ClampedArray) \ 960 V(FixedUint8ClampedArray) \
959 V(ByteArray) \ 961 V(ByteArray) \
960 V(BytecodeArray) \ 962 V(BytecodeArray) \
961 V(FreeSpace) \ 963 V(FreeSpace) \
962 V(JSReceiver) \ 964 V(JSReceiver) \
963 V(JSObject) \ 965 V(JSObject) \
964 V(JSContextExtensionObject) \ 966 V(JSContextExtensionObject) \
965 V(JSGeneratorObject) \ 967 V(JSGeneratorObject) \
968 V(JSModule) \
966 V(Map) \ 969 V(Map) \
967 V(DescriptorArray) \ 970 V(DescriptorArray) \
968 V(FrameArray) \ 971 V(FrameArray) \
969 V(TransitionArray) \ 972 V(TransitionArray) \
970 V(LiteralsArray) \ 973 V(LiteralsArray) \
971 V(TypeFeedbackMetadata) \ 974 V(TypeFeedbackMetadata) \
972 V(TypeFeedbackVector) \ 975 V(TypeFeedbackVector) \
973 V(DeoptimizationInputData) \ 976 V(DeoptimizationInputData) \
974 V(DeoptimizationOutputData) \ 977 V(DeoptimizationOutputData) \
975 V(DependentCode) \ 978 V(DependentCode) \
976 V(HandlerTable) \ 979 V(HandlerTable) \
977 V(FixedArray) \ 980 V(FixedArray) \
978 V(FixedDoubleArray) \ 981 V(FixedDoubleArray) \
979 V(WeakFixedArray) \ 982 V(WeakFixedArray) \
980 V(ArrayList) \ 983 V(ArrayList) \
981 V(Context) \ 984 V(Context) \
982 V(ScriptContextTable) \ 985 V(ScriptContextTable) \
983 V(NativeContext) \ 986 V(NativeContext) \
984 V(ScopeInfo) \ 987 V(ScopeInfo) \
988 V(ModuleInfoEntry) \
985 V(ModuleInfo) \ 989 V(ModuleInfo) \
986 V(JSBoundFunction) \ 990 V(JSBoundFunction) \
987 V(JSFunction) \ 991 V(JSFunction) \
988 V(Code) \ 992 V(Code) \
989 V(AbstractCode) \ 993 V(AbstractCode) \
990 V(Oddball) \ 994 V(Oddball) \
991 V(SharedFunctionInfo) \ 995 V(SharedFunctionInfo) \
992 V(JSValue) \ 996 V(JSValue) \
993 V(JSDate) \ 997 V(JSDate) \
994 V(JSMessageObject) \ 998 V(JSMessageObject) \
(...skipping 3403 matching lines...) Expand 10 before | Expand all | Expand 10 after
4398 4402
4399 // Serializes empty scope info. 4403 // Serializes empty scope info.
4400 static ScopeInfo* Empty(Isolate* isolate); 4404 static ScopeInfo* Empty(Isolate* isolate);
4401 4405
4402 #ifdef DEBUG 4406 #ifdef DEBUG
4403 void Print(); 4407 void Print();
4404 #endif 4408 #endif
4405 4409
4406 // The layout of the static part of a ScopeInfo is as follows. Each entry is 4410 // The layout of the static part of a ScopeInfo is as follows. Each entry is
4407 // numeric and occupies one array slot. 4411 // numeric and occupies one array slot.
4408 // 1. A set of properties of the scope 4412 // 1. A set of properties of the scope.
4409 // 2. The number of parameters. For non-function scopes this is 0. 4413 // 2. The number of parameters. For non-function scopes this is 0.
4410 // 3. The number of non-parameter variables allocated on the stack. 4414 // 3. The number of non-parameter variables allocated on the stack.
4411 // 4. The number of non-parameter and parameter variables allocated in the 4415 // 4. The number of non-parameter and parameter variables allocated in the
4412 // context. 4416 // context.
4413 #define FOR_EACH_SCOPE_INFO_NUMERIC_FIELD(V) \ 4417 #define FOR_EACH_SCOPE_INFO_NUMERIC_FIELD(V) \
4414 V(Flags) \ 4418 V(Flags) \
4415 V(ParameterCount) \ 4419 V(ParameterCount) \
4416 V(StackLocalCount) \ 4420 V(StackLocalCount) \
4417 V(ContextLocalCount) 4421 V(ContextLocalCount)
4418 4422
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
4511 : public BitField<FunctionKind, HasSimpleParametersField::kNext, 9> {}; 4515 : public BitField<FunctionKind, HasSimpleParametersField::kNext, 9> {};
4512 4516
4513 // Properties of variables. 4517 // Properties of variables.
4514 class VariableModeField : public BitField<VariableMode, 0, 3> {}; 4518 class VariableModeField : public BitField<VariableMode, 0, 3> {};
4515 class InitFlagField : public BitField<InitializationFlag, 3, 1> {}; 4519 class InitFlagField : public BitField<InitializationFlag, 3, 1> {};
4516 class MaybeAssignedFlagField : public BitField<MaybeAssignedFlag, 4, 1> {}; 4520 class MaybeAssignedFlagField : public BitField<MaybeAssignedFlag, 4, 1> {};
4517 4521
4518 friend class ScopeIterator; 4522 friend class ScopeIterator;
4519 }; 4523 };
4520 4524
4525 // XXX Name clash
4526 class ModuleInfoEntry : public FixedArray {
4527 public:
4528 DECLARE_CAST(ModuleInfoEntry)
4529 static Handle<ModuleInfoEntry> New(Isolate* isolate,
4530 Handle<Object> export_name,
4531 Handle<Object> local_name,
4532 Handle<Object> import_name,
4533 Handle<Object> module_request);
4534 inline Object* export_name() const;
4535 inline Object* local_name() const;
4536 inline Object* import_name() const;
4537 inline Object* module_request() const;
4538
4539 private:
4540 friend class Factory;
4541 enum {
4542 kExportNameIndex,
4543 kLocalNameIndex,
4544 kImportNameIndex,
4545 kModuleRequestIndex,
4546 kLength
4547 };
4548 };
4549
4550 // XXX Should I be using Struct rather than FixedArray?
4521 // ModuleInfo is to ModuleDescriptor what ScopeInfo is to Scope. 4551 // ModuleInfo is to ModuleDescriptor what ScopeInfo is to Scope.
4522 class ModuleInfo : public FixedArray { 4552 class ModuleInfo : public FixedArray {
4523 public: 4553 public:
4524 DECLARE_CAST(ModuleInfo) 4554 DECLARE_CAST(ModuleInfo)
4525 static Handle<ModuleInfo> New(Isolate* isolate, ModuleDescriptor* descr); 4555 static Handle<ModuleInfo> New(Isolate* isolate, ModuleDescriptor* descr);
4526 inline FixedArray* special_exports() const; 4556 inline FixedArray* special_exports() const;
4527 inline FixedArray* regular_exports() const; 4557 inline FixedArray* regular_exports() const;
4528 4558
4529 private: 4559 private:
4530 friend class Factory; 4560 friend class Factory;
(...skipping 3252 matching lines...) Expand 10 before | Expand all | Expand 10 after
7783 static const int kInputOrDebugPosOffset = kReceiverOffset + kPointerSize; 7813 static const int kInputOrDebugPosOffset = kReceiverOffset + kPointerSize;
7784 static const int kResumeModeOffset = kInputOrDebugPosOffset + kPointerSize; 7814 static const int kResumeModeOffset = kInputOrDebugPosOffset + kPointerSize;
7785 static const int kContinuationOffset = kResumeModeOffset + kPointerSize; 7815 static const int kContinuationOffset = kResumeModeOffset + kPointerSize;
7786 static const int kOperandStackOffset = kContinuationOffset + kPointerSize; 7816 static const int kOperandStackOffset = kContinuationOffset + kPointerSize;
7787 static const int kSize = kOperandStackOffset + kPointerSize; 7817 static const int kSize = kOperandStackOffset + kPointerSize;
7788 7818
7789 private: 7819 private:
7790 DISALLOW_IMPLICIT_CONSTRUCTORS(JSGeneratorObject); 7820 DISALLOW_IMPLICIT_CONSTRUCTORS(JSGeneratorObject);
7791 }; 7821 };
7792 7822
7823 class JSModule : public JSObject {
7824 public:
7825 DECLARE_CAST(JSModule)
7826 DECLARE_VERIFIER(JSModule)
7827
7828 static const int kSize = JSObject::kHeaderSize;
7829
7830 static void CreateExport(Handle<JSModule> module,
7831 Handle<String> name);
7832 static void StoreExport(Handle<JSModule> module,
7833 Handle<String> name, Handle<Object> value);
7834 static Handle<Object> LoadExport(Handle<JSModule> module,
7835 Handle<String> name);
7836 };
7793 7837
7794 // JSBoundFunction describes a bound function exotic object. 7838 // JSBoundFunction describes a bound function exotic object.
7795 class JSBoundFunction : public JSObject { 7839 class JSBoundFunction : public JSObject {
7796 public: 7840 public:
7797 // [bound_target_function]: The wrapped function object. 7841 // [bound_target_function]: The wrapped function object.
7798 DECL_ACCESSORS(bound_target_function, JSReceiver) 7842 DECL_ACCESSORS(bound_target_function, JSReceiver)
7799 7843
7800 // [bound_this]: The value that is always passed as the this value when 7844 // [bound_this]: The value that is always passed as the this value when
7801 // calling the wrapped function. 7845 // calling the wrapped function.
7802 DECL_ACCESSORS(bound_this, Object) 7846 DECL_ACCESSORS(bound_this, Object)
(...skipping 3398 matching lines...) Expand 10 before | Expand all | Expand 10 after
11201 } 11245 }
11202 return value; 11246 return value;
11203 } 11247 }
11204 }; 11248 };
11205 11249
11206 11250
11207 } // NOLINT, false-positive due to second-order macros. 11251 } // NOLINT, false-positive due to second-order macros.
11208 } // NOLINT, false-positive due to second-order macros. 11252 } // NOLINT, false-positive due to second-order macros.
11209 11253
11210 #endif // V8_OBJECTS_H_ 11254 #endif // V8_OBJECTS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698