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

Side by Side Diff: src/objects.h

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