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

Side by Side Diff: src/objects.h

Issue 2302783002: [modules] Basic support of exports (Closed)
Patch Set: Disable module tests for deopt fuzzer. 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
« no previous file with comments | « src/interpreter/bytecode-generator.cc ('k') | src/objects.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 // - JSWeakMap 63 // - JSWeakMap
64 // - JSWeakSet 64 // - JSWeakSet
65 // - JSRegExp 65 // - JSRegExp
66 // - JSFunction 66 // - JSFunction
67 // - JSGeneratorObject 67 // - JSGeneratorObject
68 // - JSGlobalObject 68 // - JSGlobalObject
69 // - JSGlobalProxy 69 // - JSGlobalProxy
70 // - JSValue 70 // - JSValue
71 // - JSDate 71 // - JSDate
72 // - JSMessageObject 72 // - JSMessageObject
73 // - JSModule
73 // - JSProxy 74 // - JSProxy
74 // - FixedArrayBase 75 // - FixedArrayBase
75 // - ByteArray 76 // - ByteArray
76 // - BytecodeArray 77 // - BytecodeArray
77 // - FixedArray 78 // - FixedArray
78 // - DescriptorArray 79 // - DescriptorArray
79 // - FrameArray 80 // - FrameArray
80 // - LiteralsArray 81 // - LiteralsArray
81 // - HashTable 82 // - HashTable
82 // - Dictionary 83 // - Dictionary
83 // - StringTable 84 // - StringTable
84 // - StringSet 85 // - StringSet
85 // - CompilationCacheTable 86 // - CompilationCacheTable
86 // - CodeCacheHashTable 87 // - CodeCacheHashTable
87 // - MapCache 88 // - MapCache
88 // - OrderedHashTable 89 // - OrderedHashTable
89 // - OrderedHashSet 90 // - OrderedHashSet
90 // - OrderedHashMap 91 // - OrderedHashMap
91 // - Context 92 // - Context
92 // - TypeFeedbackMetadata 93 // - TypeFeedbackMetadata
93 // - TypeFeedbackVector 94 // - TypeFeedbackVector
94 // - TemplateList 95 // - TemplateList
95 // - TransitionArray 96 // - TransitionArray
96 // - ScopeInfo 97 // - ScopeInfo
98 // - ModuleInfoEntry
97 // - ModuleInfo 99 // - ModuleInfo
98 // - ScriptContextTable 100 // - ScriptContextTable
99 // - WeakFixedArray 101 // - WeakFixedArray
100 // - FixedDoubleArray 102 // - FixedDoubleArray
101 // - Name 103 // - Name
102 // - String 104 // - String
103 // - SeqString 105 // - SeqString
104 // - SeqOneByteString 106 // - SeqOneByteString
105 // - SeqTwoByteString 107 // - SeqTwoByteString
106 // - SlicedString 108 // - SlicedString
(...skipping 765 matching lines...) Expand 10 before | Expand all | Expand 10 after
872 class ElementsAccessor; 874 class ElementsAccessor;
873 class FixedArrayBase; 875 class FixedArrayBase;
874 class FunctionLiteral; 876 class FunctionLiteral;
875 class JSGlobalObject; 877 class JSGlobalObject;
876 class KeyAccumulator; 878 class KeyAccumulator;
877 class LayoutDescriptor; 879 class LayoutDescriptor;
878 class LiteralsArray; 880 class LiteralsArray;
879 class LookupIterator; 881 class LookupIterator;
880 class FieldType; 882 class FieldType;
881 class ModuleDescriptor; 883 class ModuleDescriptor;
884 class ModuleInfoEntry;
882 class ModuleInfo; 885 class ModuleInfo;
883 class ObjectHashTable; 886 class ObjectHashTable;
884 class ObjectVisitor; 887 class ObjectVisitor;
885 class PropertyCell; 888 class PropertyCell;
886 class PropertyDescriptor; 889 class PropertyDescriptor;
887 class SafepointEntry; 890 class SafepointEntry;
888 class SharedFunctionInfo; 891 class SharedFunctionInfo;
889 class StringStream; 892 class StringStream;
890 class TypeFeedbackInfo; 893 class TypeFeedbackInfo;
891 class TypeFeedbackMetadata; 894 class TypeFeedbackMetadata;
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
954 V(FixedFloat32Array) \ 957 V(FixedFloat32Array) \
955 V(FixedFloat64Array) \ 958 V(FixedFloat64Array) \
956 V(FixedUint8ClampedArray) \ 959 V(FixedUint8ClampedArray) \
957 V(ByteArray) \ 960 V(ByteArray) \
958 V(BytecodeArray) \ 961 V(BytecodeArray) \
959 V(FreeSpace) \ 962 V(FreeSpace) \
960 V(JSReceiver) \ 963 V(JSReceiver) \
961 V(JSObject) \ 964 V(JSObject) \
962 V(JSContextExtensionObject) \ 965 V(JSContextExtensionObject) \
963 V(JSGeneratorObject) \ 966 V(JSGeneratorObject) \
967 V(JSModule) \
964 V(Map) \ 968 V(Map) \
965 V(DescriptorArray) \ 969 V(DescriptorArray) \
966 V(FrameArray) \ 970 V(FrameArray) \
967 V(TransitionArray) \ 971 V(TransitionArray) \
968 V(LiteralsArray) \ 972 V(LiteralsArray) \
969 V(TypeFeedbackMetadata) \ 973 V(TypeFeedbackMetadata) \
970 V(TypeFeedbackVector) \ 974 V(TypeFeedbackVector) \
971 V(DeoptimizationInputData) \ 975 V(DeoptimizationInputData) \
972 V(DeoptimizationOutputData) \ 976 V(DeoptimizationOutputData) \
973 V(DependentCode) \ 977 V(DependentCode) \
974 V(HandlerTable) \ 978 V(HandlerTable) \
975 V(FixedArray) \ 979 V(FixedArray) \
976 V(FixedDoubleArray) \ 980 V(FixedDoubleArray) \
977 V(WeakFixedArray) \ 981 V(WeakFixedArray) \
978 V(ArrayList) \ 982 V(ArrayList) \
979 V(Context) \ 983 V(Context) \
980 V(ScriptContextTable) \ 984 V(ScriptContextTable) \
981 V(NativeContext) \ 985 V(NativeContext) \
982 V(ScopeInfo) \ 986 V(ScopeInfo) \
987 V(ModuleInfoEntry) \
983 V(ModuleInfo) \ 988 V(ModuleInfo) \
984 V(JSBoundFunction) \ 989 V(JSBoundFunction) \
985 V(JSFunction) \ 990 V(JSFunction) \
986 V(Code) \ 991 V(Code) \
987 V(AbstractCode) \ 992 V(AbstractCode) \
988 V(Oddball) \ 993 V(Oddball) \
989 V(SharedFunctionInfo) \ 994 V(SharedFunctionInfo) \
990 V(JSValue) \ 995 V(JSValue) \
991 V(JSDate) \ 996 V(JSDate) \
992 V(JSMessageObject) \ 997 V(JSMessageObject) \
(...skipping 3412 matching lines...) Expand 10 before | Expand all | Expand 10 after
4405 4410
4406 // Serializes empty scope info. 4411 // Serializes empty scope info.
4407 static ScopeInfo* Empty(Isolate* isolate); 4412 static ScopeInfo* Empty(Isolate* isolate);
4408 4413
4409 #ifdef DEBUG 4414 #ifdef DEBUG
4410 void Print(); 4415 void Print();
4411 #endif 4416 #endif
4412 4417
4413 // The layout of the static part of a ScopeInfo is as follows. Each entry is 4418 // The layout of the static part of a ScopeInfo is as follows. Each entry is
4414 // numeric and occupies one array slot. 4419 // numeric and occupies one array slot.
4415 // 1. A set of properties of the scope 4420 // 1. A set of properties of the scope.
4416 // 2. The number of parameters. For non-function scopes this is 0. 4421 // 2. The number of parameters. For non-function scopes this is 0.
4417 // 3. The number of non-parameter variables allocated on the stack. 4422 // 3. The number of non-parameter variables allocated on the stack.
4418 // 4. The number of non-parameter and parameter variables allocated in the 4423 // 4. The number of non-parameter and parameter variables allocated in the
4419 // context. 4424 // context.
4420 #define FOR_EACH_SCOPE_INFO_NUMERIC_FIELD(V) \ 4425 #define FOR_EACH_SCOPE_INFO_NUMERIC_FIELD(V) \
4421 V(Flags) \ 4426 V(Flags) \
4422 V(ParameterCount) \ 4427 V(ParameterCount) \
4423 V(StackLocalCount) \ 4428 V(StackLocalCount) \
4424 V(ContextLocalCount) 4429 V(ContextLocalCount)
4425 4430
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
4523 : public BitField<bool, FunctionKindField::kNext, 1> {}; 4528 : public BitField<bool, FunctionKindField::kNext, 1> {};
4524 4529
4525 // Properties of variables. 4530 // Properties of variables.
4526 class VariableModeField : public BitField<VariableMode, 0, 3> {}; 4531 class VariableModeField : public BitField<VariableMode, 0, 3> {};
4527 class InitFlagField : public BitField<InitializationFlag, 3, 1> {}; 4532 class InitFlagField : public BitField<InitializationFlag, 3, 1> {};
4528 class MaybeAssignedFlagField : public BitField<MaybeAssignedFlag, 4, 1> {}; 4533 class MaybeAssignedFlagField : public BitField<MaybeAssignedFlag, 4, 1> {};
4529 4534
4530 friend class ScopeIterator; 4535 friend class ScopeIterator;
4531 }; 4536 };
4532 4537
4538 class ModuleInfoEntry : public FixedArray {
4539 public:
4540 DECLARE_CAST(ModuleInfoEntry)
4541 static Handle<ModuleInfoEntry> New(Isolate* isolate,
4542 Handle<Object> export_name,
4543 Handle<Object> local_name,
4544 Handle<Object> import_name,
4545 Handle<Object> module_request);
4546 inline Object* export_name() const;
4547 inline Object* local_name() const;
4548 inline Object* import_name() const;
4549 inline Object* module_request() const;
4550
4551 private:
4552 friend class Factory;
4553 enum {
4554 kExportNameIndex,
4555 kLocalNameIndex,
4556 kImportNameIndex,
4557 kModuleRequestIndex,
4558 kLength
4559 };
4560 };
4561
4533 // ModuleInfo is to ModuleDescriptor what ScopeInfo is to Scope. 4562 // ModuleInfo is to ModuleDescriptor what ScopeInfo is to Scope.
4534 class ModuleInfo : public FixedArray { 4563 class ModuleInfo : public FixedArray {
4535 public: 4564 public:
4536 DECLARE_CAST(ModuleInfo) 4565 DECLARE_CAST(ModuleInfo)
4537 static Handle<ModuleInfo> New(Isolate* isolate, ModuleDescriptor* descr); 4566 static Handle<ModuleInfo> New(Isolate* isolate, ModuleDescriptor* descr);
4538 inline FixedArray* special_exports() const; 4567 inline FixedArray* special_exports() const;
4539 inline FixedArray* regular_exports() const; 4568 inline FixedArray* regular_exports() const;
4540 4569
4541 #ifdef DEBUG 4570 #ifdef DEBUG
4542 inline bool Equals(ModuleInfo* other) const; 4571 inline bool Equals(ModuleInfo* other) const;
(...skipping 1787 matching lines...) Expand 10 before | Expand all | Expand 10 after
6330 inline bool CanTransition(); 6359 inline bool CanTransition();
6331 6360
6332 inline bool IsBooleanMap(); 6361 inline bool IsBooleanMap();
6333 inline bool IsPrimitiveMap(); 6362 inline bool IsPrimitiveMap();
6334 inline bool IsJSReceiverMap(); 6363 inline bool IsJSReceiverMap();
6335 inline bool IsJSObjectMap(); 6364 inline bool IsJSObjectMap();
6336 inline bool IsJSArrayMap(); 6365 inline bool IsJSArrayMap();
6337 inline bool IsJSFunctionMap(); 6366 inline bool IsJSFunctionMap();
6338 inline bool IsStringMap(); 6367 inline bool IsStringMap();
6339 inline bool IsJSProxyMap(); 6368 inline bool IsJSProxyMap();
6369 inline bool IsJSModuleMap();
6340 inline bool IsJSGlobalProxyMap(); 6370 inline bool IsJSGlobalProxyMap();
6341 inline bool IsJSGlobalObjectMap(); 6371 inline bool IsJSGlobalObjectMap();
6342 inline bool IsJSTypedArrayMap(); 6372 inline bool IsJSTypedArrayMap();
6343 inline bool IsJSDataViewMap(); 6373 inline bool IsJSDataViewMap();
6344 6374
6345 inline bool CanOmitMapChecks(); 6375 inline bool CanOmitMapChecks();
6346 6376
6347 static void AddDependentCode(Handle<Map> map, 6377 static void AddDependentCode(Handle<Map> map,
6348 DependentCode::DependencyGroup group, 6378 DependentCode::DependencyGroup group,
6349 Handle<Code> code); 6379 Handle<Code> code);
(...skipping 1457 matching lines...) Expand 10 before | Expand all | Expand 10 after
7807 static const int kInputOrDebugPosOffset = kReceiverOffset + kPointerSize; 7837 static const int kInputOrDebugPosOffset = kReceiverOffset + kPointerSize;
7808 static const int kResumeModeOffset = kInputOrDebugPosOffset + kPointerSize; 7838 static const int kResumeModeOffset = kInputOrDebugPosOffset + kPointerSize;
7809 static const int kContinuationOffset = kResumeModeOffset + kPointerSize; 7839 static const int kContinuationOffset = kResumeModeOffset + kPointerSize;
7810 static const int kOperandStackOffset = kContinuationOffset + kPointerSize; 7840 static const int kOperandStackOffset = kContinuationOffset + kPointerSize;
7811 static const int kSize = kOperandStackOffset + kPointerSize; 7841 static const int kSize = kOperandStackOffset + kPointerSize;
7812 7842
7813 private: 7843 private:
7814 DISALLOW_IMPLICIT_CONSTRUCTORS(JSGeneratorObject); 7844 DISALLOW_IMPLICIT_CONSTRUCTORS(JSGeneratorObject);
7815 }; 7845 };
7816 7846
7847 // A JSModule object is a mapping from export names to cells
7848 // This is still very much in flux.
7849 class JSModule : public JSObject {
7850 public:
7851 DECLARE_CAST(JSModule)
7852 DECLARE_VERIFIER(JSModule)
7853
7854 static const int kSize = JSObject::kHeaderSize;
7855
7856 static void CreateExport(Handle<JSModule> module, Handle<String> name);
7857 static void StoreExport(Handle<JSModule> module, Handle<String> name,
7858 Handle<Object> value);
7859 static Handle<Object> LoadExport(Handle<JSModule> module,
7860 Handle<String> name);
7861 };
7817 7862
7818 // JSBoundFunction describes a bound function exotic object. 7863 // JSBoundFunction describes a bound function exotic object.
7819 class JSBoundFunction : public JSObject { 7864 class JSBoundFunction : public JSObject {
7820 public: 7865 public:
7821 // [bound_target_function]: The wrapped function object. 7866 // [bound_target_function]: The wrapped function object.
7822 DECL_ACCESSORS(bound_target_function, JSReceiver) 7867 DECL_ACCESSORS(bound_target_function, JSReceiver)
7823 7868
7824 // [bound_this]: The value that is always passed as the this value when 7869 // [bound_this]: The value that is always passed as the this value when
7825 // calling the wrapped function. 7870 // calling the wrapped function.
7826 DECL_ACCESSORS(bound_this, Object) 7871 DECL_ACCESSORS(bound_this, Object)
(...skipping 3399 matching lines...) Expand 10 before | Expand all | Expand 10 after
11226 } 11271 }
11227 return value; 11272 return value;
11228 } 11273 }
11229 }; 11274 };
11230 11275
11231 11276
11232 } // NOLINT, false-positive due to second-order macros. 11277 } // NOLINT, false-positive due to second-order macros.
11233 } // NOLINT, false-positive due to second-order macros. 11278 } // NOLINT, false-positive due to second-order macros.
11234 11279
11235 #endif // V8_OBJECTS_H_ 11280 #endif // V8_OBJECTS_H_
OLDNEW
« no previous file with comments | « src/interpreter/bytecode-generator.cc ('k') | src/objects.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698