OLD | NEW |
---|---|
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 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
64 // - JSWeakMap | 64 // - JSWeakMap |
65 // - JSWeakSet | 65 // - JSWeakSet |
66 // - JSRegExp | 66 // - JSRegExp |
67 // - JSFunction | 67 // - JSFunction |
68 // - JSGeneratorObject | 68 // - JSGeneratorObject |
69 // - JSGlobalObject | 69 // - JSGlobalObject |
70 // - JSGlobalProxy | 70 // - JSGlobalProxy |
71 // - JSValue | 71 // - JSValue |
72 // - JSDate | 72 // - JSDate |
73 // - JSMessageObject | 73 // - JSMessageObject |
74 // - JSModuleNamespace | |
74 // - JSProxy | 75 // - JSProxy |
75 // - FixedArrayBase | 76 // - FixedArrayBase |
76 // - ByteArray | 77 // - ByteArray |
77 // - BytecodeArray | 78 // - BytecodeArray |
78 // - FixedArray | 79 // - FixedArray |
79 // - DescriptorArray | 80 // - DescriptorArray |
80 // - FrameArray | 81 // - FrameArray |
81 // - LiteralsArray | 82 // - LiteralsArray |
82 // - HashTable | 83 // - HashTable |
83 // - Dictionary | 84 // - Dictionary |
(...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
409 V(TRANSITION_ARRAY_TYPE) \ | 410 V(TRANSITION_ARRAY_TYPE) \ |
410 \ | 411 \ |
411 V(JS_MESSAGE_OBJECT_TYPE) \ | 412 V(JS_MESSAGE_OBJECT_TYPE) \ |
412 \ | 413 \ |
413 V(JS_VALUE_TYPE) \ | 414 V(JS_VALUE_TYPE) \ |
414 V(JS_DATE_TYPE) \ | 415 V(JS_DATE_TYPE) \ |
415 V(JS_OBJECT_TYPE) \ | 416 V(JS_OBJECT_TYPE) \ |
416 V(JS_ARGUMENTS_TYPE) \ | 417 V(JS_ARGUMENTS_TYPE) \ |
417 V(JS_CONTEXT_EXTENSION_OBJECT_TYPE) \ | 418 V(JS_CONTEXT_EXTENSION_OBJECT_TYPE) \ |
418 V(JS_GENERATOR_OBJECT_TYPE) \ | 419 V(JS_GENERATOR_OBJECT_TYPE) \ |
420 V(JS_MODULE_NAMESPACE_TYPE) \ | |
419 V(JS_GLOBAL_OBJECT_TYPE) \ | 421 V(JS_GLOBAL_OBJECT_TYPE) \ |
420 V(JS_GLOBAL_PROXY_TYPE) \ | 422 V(JS_GLOBAL_PROXY_TYPE) \ |
421 V(JS_API_OBJECT_TYPE) \ | 423 V(JS_API_OBJECT_TYPE) \ |
422 V(JS_SPECIAL_API_OBJECT_TYPE) \ | 424 V(JS_SPECIAL_API_OBJECT_TYPE) \ |
423 V(JS_ARRAY_TYPE) \ | 425 V(JS_ARRAY_TYPE) \ |
424 V(JS_ARRAY_BUFFER_TYPE) \ | 426 V(JS_ARRAY_BUFFER_TYPE) \ |
425 V(JS_TYPED_ARRAY_TYPE) \ | 427 V(JS_TYPED_ARRAY_TYPE) \ |
426 V(JS_DATA_VIEW_TYPE) \ | 428 V(JS_DATA_VIEW_TYPE) \ |
427 V(JS_PROXY_TYPE) \ | 429 V(JS_PROXY_TYPE) \ |
428 V(JS_SET_TYPE) \ | 430 V(JS_SET_TYPE) \ |
(...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
710 JS_SPECIAL_API_OBJECT_TYPE, // LAST_SPECIAL_RECEIVER_TYPE | 712 JS_SPECIAL_API_OBJECT_TYPE, // LAST_SPECIAL_RECEIVER_TYPE |
711 JS_VALUE_TYPE, // LAST_CUSTOM_ELEMENTS_RECEIVER | 713 JS_VALUE_TYPE, // LAST_CUSTOM_ELEMENTS_RECEIVER |
712 JS_MESSAGE_OBJECT_TYPE, | 714 JS_MESSAGE_OBJECT_TYPE, |
713 JS_DATE_TYPE, | 715 JS_DATE_TYPE, |
714 // Like JS_OBJECT_TYPE, but created from API function. | 716 // Like JS_OBJECT_TYPE, but created from API function. |
715 JS_API_OBJECT_TYPE, | 717 JS_API_OBJECT_TYPE, |
716 JS_OBJECT_TYPE, | 718 JS_OBJECT_TYPE, |
717 JS_ARGUMENTS_TYPE, | 719 JS_ARGUMENTS_TYPE, |
718 JS_CONTEXT_EXTENSION_OBJECT_TYPE, | 720 JS_CONTEXT_EXTENSION_OBJECT_TYPE, |
719 JS_GENERATOR_OBJECT_TYPE, | 721 JS_GENERATOR_OBJECT_TYPE, |
722 JS_MODULE_NAMESPACE_TYPE, | |
720 JS_ARRAY_TYPE, | 723 JS_ARRAY_TYPE, |
721 JS_ARRAY_BUFFER_TYPE, | 724 JS_ARRAY_BUFFER_TYPE, |
722 JS_TYPED_ARRAY_TYPE, | 725 JS_TYPED_ARRAY_TYPE, |
723 JS_DATA_VIEW_TYPE, | 726 JS_DATA_VIEW_TYPE, |
724 JS_SET_TYPE, | 727 JS_SET_TYPE, |
725 JS_MAP_TYPE, | 728 JS_MAP_TYPE, |
726 JS_SET_ITERATOR_TYPE, | 729 JS_SET_ITERATOR_TYPE, |
727 JS_MAP_ITERATOR_TYPE, | 730 JS_MAP_ITERATOR_TYPE, |
728 JS_WEAK_MAP_TYPE, | 731 JS_WEAK_MAP_TYPE, |
729 JS_WEAK_SET_TYPE, | 732 JS_WEAK_SET_TYPE, |
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
879 class ConsString; | 882 class ConsString; |
880 class ElementsAccessor; | 883 class ElementsAccessor; |
881 class FixedArrayBase; | 884 class FixedArrayBase; |
882 class FunctionLiteral; | 885 class FunctionLiteral; |
883 class JSGlobalObject; | 886 class JSGlobalObject; |
884 class KeyAccumulator; | 887 class KeyAccumulator; |
885 class LayoutDescriptor; | 888 class LayoutDescriptor; |
886 class LiteralsArray; | 889 class LiteralsArray; |
887 class LookupIterator; | 890 class LookupIterator; |
888 class FieldType; | 891 class FieldType; |
892 class Module; | |
889 class ModuleDescriptor; | 893 class ModuleDescriptor; |
890 class ModuleInfoEntry; | 894 class ModuleInfoEntry; |
891 class ModuleInfo; | 895 class ModuleInfo; |
892 class ObjectHashTable; | 896 class ObjectHashTable; |
893 class ObjectVisitor; | 897 class ObjectVisitor; |
894 class PropertyCell; | 898 class PropertyCell; |
895 class PropertyDescriptor; | 899 class PropertyDescriptor; |
896 class SafepointEntry; | 900 class SafepointEntry; |
897 class SharedFunctionInfo; | 901 class SharedFunctionInfo; |
898 class StringStream; | 902 class StringStream; |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
963 V(FixedFloat32Array) \ | 967 V(FixedFloat32Array) \ |
964 V(FixedFloat64Array) \ | 968 V(FixedFloat64Array) \ |
965 V(FixedUint8ClampedArray) \ | 969 V(FixedUint8ClampedArray) \ |
966 V(ByteArray) \ | 970 V(ByteArray) \ |
967 V(BytecodeArray) \ | 971 V(BytecodeArray) \ |
968 V(FreeSpace) \ | 972 V(FreeSpace) \ |
969 V(JSReceiver) \ | 973 V(JSReceiver) \ |
970 V(JSObject) \ | 974 V(JSObject) \ |
971 V(JSContextExtensionObject) \ | 975 V(JSContextExtensionObject) \ |
972 V(JSGeneratorObject) \ | 976 V(JSGeneratorObject) \ |
977 V(JSModuleNamespace) \ | |
973 V(Map) \ | 978 V(Map) \ |
974 V(DescriptorArray) \ | 979 V(DescriptorArray) \ |
975 V(FrameArray) \ | 980 V(FrameArray) \ |
976 V(TransitionArray) \ | 981 V(TransitionArray) \ |
977 V(LiteralsArray) \ | 982 V(LiteralsArray) \ |
978 V(TypeFeedbackMetadata) \ | 983 V(TypeFeedbackMetadata) \ |
979 V(TypeFeedbackVector) \ | 984 V(TypeFeedbackVector) \ |
980 V(DeoptimizationInputData) \ | 985 V(DeoptimizationInputData) \ |
981 V(DeoptimizationOutputData) \ | 986 V(DeoptimizationOutputData) \ |
982 V(DependentCode) \ | 987 V(DependentCode) \ |
(...skipping 2960 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3943 MUST_USE_RESULT static inline Handle<ObjectHashTable> Shrink( | 3948 MUST_USE_RESULT static inline Handle<ObjectHashTable> Shrink( |
3944 Handle<ObjectHashTable> table, | 3949 Handle<ObjectHashTable> table, |
3945 Handle<Object> key); | 3950 Handle<Object> key); |
3946 | 3951 |
3947 // Looks up the value associated with the given key. The hole value is | 3952 // Looks up the value associated with the given key. The hole value is |
3948 // returned in case the key is not present. | 3953 // returned in case the key is not present. |
3949 Object* Lookup(Handle<Object> key); | 3954 Object* Lookup(Handle<Object> key); |
3950 Object* Lookup(Handle<Object> key, int32_t hash); | 3955 Object* Lookup(Handle<Object> key, int32_t hash); |
3951 Object* Lookup(Isolate* isolate, Handle<Object> key, int32_t hash); | 3956 Object* Lookup(Isolate* isolate, Handle<Object> key, int32_t hash); |
3952 | 3957 |
3958 // Returns the value at entry. | |
3959 Object* ValueAt(int entry); | |
3960 | |
3953 // Adds (or overwrites) the value associated with the given key. | 3961 // Adds (or overwrites) the value associated with the given key. |
3954 static Handle<ObjectHashTable> Put(Handle<ObjectHashTable> table, | 3962 static Handle<ObjectHashTable> Put(Handle<ObjectHashTable> table, |
3955 Handle<Object> key, | 3963 Handle<Object> key, |
3956 Handle<Object> value); | 3964 Handle<Object> value); |
3957 static Handle<ObjectHashTable> Put(Handle<ObjectHashTable> table, | 3965 static Handle<ObjectHashTable> Put(Handle<ObjectHashTable> table, |
3958 Handle<Object> key, Handle<Object> value, | 3966 Handle<Object> key, Handle<Object> value, |
3959 int32_t hash); | 3967 int32_t hash); |
3960 | 3968 |
3961 // Returns an ObjectHashTable (possibly |table|) where |key| has been removed. | 3969 // Returns an ObjectHashTable (possibly |table|) where |key| has been removed. |
3962 static Handle<ObjectHashTable> Remove(Handle<ObjectHashTable> table, | 3970 static Handle<ObjectHashTable> Remove(Handle<ObjectHashTable> table, |
(...skipping 3928 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
7891 static const int kInputOrDebugPosOffset = kReceiverOffset + kPointerSize; | 7899 static const int kInputOrDebugPosOffset = kReceiverOffset + kPointerSize; |
7892 static const int kResumeModeOffset = kInputOrDebugPosOffset + kPointerSize; | 7900 static const int kResumeModeOffset = kInputOrDebugPosOffset + kPointerSize; |
7893 static const int kContinuationOffset = kResumeModeOffset + kPointerSize; | 7901 static const int kContinuationOffset = kResumeModeOffset + kPointerSize; |
7894 static const int kOperandStackOffset = kContinuationOffset + kPointerSize; | 7902 static const int kOperandStackOffset = kContinuationOffset + kPointerSize; |
7895 static const int kSize = kOperandStackOffset + kPointerSize; | 7903 static const int kSize = kOperandStackOffset + kPointerSize; |
7896 | 7904 |
7897 private: | 7905 private: |
7898 DISALLOW_IMPLICIT_CONSTRUCTORS(JSGeneratorObject); | 7906 DISALLOW_IMPLICIT_CONSTRUCTORS(JSGeneratorObject); |
7899 }; | 7907 }; |
7900 | 7908 |
7909 class JSModuleNamespace : public JSObject { | |
adamk
2016/10/04 18:26:53
Please add a comment for those not as well-versed
neis
2016/10/05 08:18:41
Done.
| |
7910 public: | |
7911 DECLARE_CAST(JSModuleNamespace) | |
7912 DECLARE_VERIFIER(JSModuleNamespace) | |
7913 | |
7914 DECL_ACCESSORS(module, Module) | |
adamk
2016/10/04 18:26:53
Comment please.
neis
2016/10/05 08:18:41
Done.
| |
7915 | |
7916 Object* Get(Handle<String> name); | |
adamk
2016/10/04 18:26:53
Please add a comment. Get what? Possible return va
neis
2016/10/05 08:18:41
Done.
adamk
2016/10/05 17:21:54
Ah, I didn't realize ObjectHashTable had this API
| |
7917 | |
7918 static const int kModuleOffset = JSObject::kHeaderSize; | |
7919 static const int kSize = kModuleOffset + kPointerSize; | |
7920 | |
7921 private: | |
7922 DISALLOW_IMPLICIT_CONSTRUCTORS(JSModuleNamespace); | |
7923 }; | |
7924 | |
7901 // A Module object is a mapping from export names to cells | 7925 // A Module object is a mapping from export names to cells |
7902 // This is still very much in flux. | 7926 // This is still very much in flux. |
7903 class Module : public Struct { | 7927 class Module : public Struct { |
7904 public: | 7928 public: |
7905 DECLARE_CAST(Module) | 7929 DECLARE_CAST(Module) |
7906 DECLARE_VERIFIER(Module) | 7930 DECLARE_VERIFIER(Module) |
7907 DECLARE_PRINTER(Module) | 7931 DECLARE_PRINTER(Module) |
7908 | 7932 |
7909 // The code representing this Module, either a | 7933 // The code representing this Module, either a SharedFunctionInfo or a |
7910 // SharedFunctionInfo or a JSFunction depending | 7934 // JSFunction depending on whether it's been instantiated. |
7911 // on whether it's been instantiated. | |
7912 DECL_ACCESSORS(code, Object) | 7935 DECL_ACCESSORS(code, Object) |
7913 | 7936 |
7914 DECL_ACCESSORS(exports, ObjectHashTable) | 7937 DECL_ACCESSORS(exports, ObjectHashTable) |
7915 | 7938 |
7939 // The namespace object (or undefined). | |
7940 DECL_ACCESSORS(module_namespace, HeapObject) | |
7941 | |
7916 // [[RequestedModules]]: Modules imported or re-exported by this module. | 7942 // [[RequestedModules]]: Modules imported or re-exported by this module. |
7917 // Corresponds 1-to-1 to the module specifier strings in | 7943 // Corresponds 1-to-1 to the module specifier strings in |
7918 // ModuleInfo::module_requests. | 7944 // ModuleInfo::module_requests. |
7919 DECL_ACCESSORS(requested_modules, FixedArray) | 7945 DECL_ACCESSORS(requested_modules, FixedArray) |
7920 | 7946 |
7921 // [[Evaluated]]: Whether this module has been evaluated. Modules | 7947 // [[Evaluated]]: Whether this module has been evaluated. Modules |
7922 // are only evaluated a single time. | 7948 // are only evaluated a single time. |
7923 DECL_BOOLEAN_ACCESSORS(evaluated) | 7949 DECL_BOOLEAN_ACCESSORS(evaluated) |
7924 | 7950 |
7925 // Storage for [[Evaluated]] | 7951 // Storage for [[Evaluated]]. |
7926 DECL_INT_ACCESSORS(flags) | 7952 DECL_INT_ACCESSORS(flags) |
7927 | 7953 |
7928 // Embedder-specified data | 7954 // Embedder-specified data |
7929 DECL_ACCESSORS(embedder_data, Object) | 7955 DECL_ACCESSORS(embedder_data, Object) |
7930 | 7956 |
7931 // Get the SharedFunctionInfo associated with the code. | 7957 // Get the SharedFunctionInfo associated with the code. |
7932 inline SharedFunctionInfo* shared() const; | 7958 inline SharedFunctionInfo* shared() const; |
7933 | 7959 |
7934 // Get the ModuleInfo associated with the code. | 7960 // Get the ModuleInfo associated with the code. |
7935 inline ModuleInfo* info() const; | 7961 inline ModuleInfo* info() const; |
(...skipping 12 matching lines...) Expand all Loading... | |
7948 // Implementation of spec operation ModuleEvaluation. | 7974 // Implementation of spec operation ModuleEvaluation. |
7949 static MUST_USE_RESULT MaybeHandle<Object> Evaluate(Handle<Module> module); | 7975 static MUST_USE_RESULT MaybeHandle<Object> Evaluate(Handle<Module> module); |
7950 | 7976 |
7951 static Handle<Object> LoadExport(Handle<Module> module, Handle<String> name); | 7977 static Handle<Object> LoadExport(Handle<Module> module, Handle<String> name); |
7952 static void StoreExport(Handle<Module> module, Handle<String> name, | 7978 static void StoreExport(Handle<Module> module, Handle<String> name, |
7953 Handle<Object> value); | 7979 Handle<Object> value); |
7954 | 7980 |
7955 static Handle<Object> LoadImport(Handle<Module> module, Handle<String> name, | 7981 static Handle<Object> LoadImport(Handle<Module> module, Handle<String> name, |
7956 int module_request); | 7982 int module_request); |
7957 | 7983 |
7984 static void FetchStarExports(Handle<Module> module, Zone* zone); | |
7985 static Handle<JSModuleNamespace> GetModuleNamespace(Handle<Module> module); | |
adamk
2016/10/04 18:26:53
Should this function be private? It looks like the
neis
2016/10/05 08:18:41
Done.
| |
7986 static Handle<JSModuleNamespace> GetModuleNamespace(Handle<Module> module, | |
adamk
2016/10/04 18:26:53
Please add a comment (specifically, the second arg
neis
2016/10/05 08:18:41
Done.
| |
7987 int module_request); | |
7988 | |
7958 static const int kCodeOffset = HeapObject::kHeaderSize; | 7989 static const int kCodeOffset = HeapObject::kHeaderSize; |
7959 static const int kExportsOffset = kCodeOffset + kPointerSize; | 7990 static const int kExportsOffset = kCodeOffset + kPointerSize; |
7960 static const int kRequestedModulesOffset = kExportsOffset + kPointerSize; | 7991 static const int kRequestedModulesOffset = kExportsOffset + kPointerSize; |
7961 static const int kFlagsOffset = kRequestedModulesOffset + kPointerSize; | 7992 static const int kFlagsOffset = kRequestedModulesOffset + kPointerSize; |
7962 static const int kEmbedderDataOffset = kFlagsOffset + kPointerSize; | 7993 static const int kEmbedderDataOffset = kFlagsOffset + kPointerSize; |
7963 static const int kSize = kEmbedderDataOffset + kPointerSize; | 7994 static const int kModuleNamespaceOffset = kEmbedderDataOffset + kPointerSize; |
7995 static const int kSize = kModuleNamespaceOffset + kPointerSize; | |
7964 | 7996 |
7965 private: | 7997 private: |
7966 enum { kEvaluatedBit }; | 7998 enum { kEvaluatedBit }; |
7967 | 7999 |
7968 static void CreateExport(Handle<Module> module, Handle<FixedArray> names); | 8000 static void CreateExport(Handle<Module> module, Handle<FixedArray> names); |
7969 static void CreateIndirectExport(Handle<Module> module, Handle<String> name, | 8001 static void CreateIndirectExport(Handle<Module> module, Handle<String> name, |
7970 Handle<ModuleInfoEntry> entry); | 8002 Handle<ModuleInfoEntry> entry); |
7971 | 8003 |
7972 // The [must_resolve] argument indicates whether or not an exception should be | 8004 // The [must_resolve] argument indicates whether or not an exception should be |
7973 // thrown in case the module does not provide an export named [name] | 8005 // thrown in case the module does not provide an export named [name] |
(...skipping 3455 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
11429 } | 11461 } |
11430 return value; | 11462 return value; |
11431 } | 11463 } |
11432 }; | 11464 }; |
11433 | 11465 |
11434 | 11466 |
11435 } // NOLINT, false-positive due to second-order macros. | 11467 } // NOLINT, false-positive due to second-order macros. |
11436 } // NOLINT, false-positive due to second-order macros. | 11468 } // NOLINT, false-positive due to second-order macros. |
11437 | 11469 |
11438 #endif // V8_OBJECTS_H_ | 11470 #endif // V8_OBJECTS_H_ |
OLD | NEW |