| 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 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 147 // - InterceptorInfo | 146 // - InterceptorInfo |
| 148 // - CallHandlerInfo | 147 // - CallHandlerInfo |
| 149 // - TemplateInfo | 148 // - TemplateInfo |
| 150 // - FunctionTemplateInfo | 149 // - FunctionTemplateInfo |
| 151 // - ObjectTemplateInfo | 150 // - ObjectTemplateInfo |
| 152 // - Script | 151 // - Script |
| 153 // - DebugInfo | 152 // - DebugInfo |
| 154 // - BreakPointInfo | 153 // - BreakPointInfo |
| 155 // - CodeCache | 154 // - CodeCache |
| 156 // - PrototypeInfo | 155 // - PrototypeInfo |
| 156 // - Module |
| 157 // - WeakCell | 157 // - WeakCell |
| 158 // | 158 // |
| 159 // Formats of Object*: | 159 // Formats of Object*: |
| 160 // Smi: [31 bit signed int] 0 | 160 // Smi: [31 bit signed int] 0 |
| 161 // HeapObject: [32 bit direct pointer] (4 byte aligned) | 01 | 161 // HeapObject: [32 bit direct pointer] (4 byte aligned) | 01 |
| 162 | 162 |
| 163 namespace v8 { | 163 namespace v8 { |
| 164 namespace internal { | 164 namespace internal { |
| 165 | 165 |
| 166 enum KeyedAccessStoreMode { | 166 enum KeyedAccessStoreMode { |
| (...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 391 V(SIGNATURE_INFO_TYPE) \ | 391 V(SIGNATURE_INFO_TYPE) \ |
| 392 V(TYPE_SWITCH_INFO_TYPE) \ | 392 V(TYPE_SWITCH_INFO_TYPE) \ |
| 393 V(ALLOCATION_MEMENTO_TYPE) \ | 393 V(ALLOCATION_MEMENTO_TYPE) \ |
| 394 V(ALLOCATION_SITE_TYPE) \ | 394 V(ALLOCATION_SITE_TYPE) \ |
| 395 V(SCRIPT_TYPE) \ | 395 V(SCRIPT_TYPE) \ |
| 396 V(TYPE_FEEDBACK_INFO_TYPE) \ | 396 V(TYPE_FEEDBACK_INFO_TYPE) \ |
| 397 V(ALIASED_ARGUMENTS_ENTRY_TYPE) \ | 397 V(ALIASED_ARGUMENTS_ENTRY_TYPE) \ |
| 398 V(BOX_TYPE) \ | 398 V(BOX_TYPE) \ |
| 399 V(PROTOTYPE_INFO_TYPE) \ | 399 V(PROTOTYPE_INFO_TYPE) \ |
| 400 V(CONTEXT_EXTENSION_TYPE) \ | 400 V(CONTEXT_EXTENSION_TYPE) \ |
| 401 V(MODULE_TYPE) \ |
| 401 \ | 402 \ |
| 402 V(FIXED_ARRAY_TYPE) \ | 403 V(FIXED_ARRAY_TYPE) \ |
| 403 V(FIXED_DOUBLE_ARRAY_TYPE) \ | 404 V(FIXED_DOUBLE_ARRAY_TYPE) \ |
| 404 V(SHARED_FUNCTION_INFO_TYPE) \ | 405 V(SHARED_FUNCTION_INFO_TYPE) \ |
| 405 V(WEAK_CELL_TYPE) \ | 406 V(WEAK_CELL_TYPE) \ |
| 406 V(TRANSITION_ARRAY_TYPE) \ | 407 V(TRANSITION_ARRAY_TYPE) \ |
| 407 \ | 408 \ |
| 408 V(JS_MESSAGE_OBJECT_TYPE) \ | 409 V(JS_MESSAGE_OBJECT_TYPE) \ |
| 409 \ | 410 \ |
| 410 V(JS_VALUE_TYPE) \ | 411 V(JS_VALUE_TYPE) \ |
| 411 V(JS_DATE_TYPE) \ | 412 V(JS_DATE_TYPE) \ |
| 412 V(JS_OBJECT_TYPE) \ | 413 V(JS_OBJECT_TYPE) \ |
| 413 V(JS_ARGUMENTS_TYPE) \ | 414 V(JS_ARGUMENTS_TYPE) \ |
| 414 V(JS_CONTEXT_EXTENSION_OBJECT_TYPE) \ | 415 V(JS_CONTEXT_EXTENSION_OBJECT_TYPE) \ |
| 415 V(JS_GENERATOR_OBJECT_TYPE) \ | 416 V(JS_GENERATOR_OBJECT_TYPE) \ |
| 416 V(JS_MODULE_TYPE) \ | |
| 417 V(JS_GLOBAL_OBJECT_TYPE) \ | 417 V(JS_GLOBAL_OBJECT_TYPE) \ |
| 418 V(JS_GLOBAL_PROXY_TYPE) \ | 418 V(JS_GLOBAL_PROXY_TYPE) \ |
| 419 V(JS_API_OBJECT_TYPE) \ | 419 V(JS_API_OBJECT_TYPE) \ |
| 420 V(JS_SPECIAL_API_OBJECT_TYPE) \ | 420 V(JS_SPECIAL_API_OBJECT_TYPE) \ |
| 421 V(JS_ARRAY_TYPE) \ | 421 V(JS_ARRAY_TYPE) \ |
| 422 V(JS_ARRAY_BUFFER_TYPE) \ | 422 V(JS_ARRAY_BUFFER_TYPE) \ |
| 423 V(JS_TYPED_ARRAY_TYPE) \ | 423 V(JS_TYPED_ARRAY_TYPE) \ |
| 424 V(JS_DATA_VIEW_TYPE) \ | 424 V(JS_DATA_VIEW_TYPE) \ |
| 425 V(JS_PROXY_TYPE) \ | 425 V(JS_PROXY_TYPE) \ |
| 426 V(JS_SET_TYPE) \ | 426 V(JS_SET_TYPE) \ |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 508 V(FUNCTION_TEMPLATE_INFO, FunctionTemplateInfo, function_template_info) \ | 508 V(FUNCTION_TEMPLATE_INFO, FunctionTemplateInfo, function_template_info) \ |
| 509 V(OBJECT_TEMPLATE_INFO, ObjectTemplateInfo, object_template_info) \ | 509 V(OBJECT_TEMPLATE_INFO, ObjectTemplateInfo, object_template_info) \ |
| 510 V(SCRIPT, Script, script) \ | 510 V(SCRIPT, Script, script) \ |
| 511 V(ALLOCATION_SITE, AllocationSite, allocation_site) \ | 511 V(ALLOCATION_SITE, AllocationSite, allocation_site) \ |
| 512 V(ALLOCATION_MEMENTO, AllocationMemento, allocation_memento) \ | 512 V(ALLOCATION_MEMENTO, AllocationMemento, allocation_memento) \ |
| 513 V(TYPE_FEEDBACK_INFO, TypeFeedbackInfo, type_feedback_info) \ | 513 V(TYPE_FEEDBACK_INFO, TypeFeedbackInfo, type_feedback_info) \ |
| 514 V(ALIASED_ARGUMENTS_ENTRY, AliasedArgumentsEntry, aliased_arguments_entry) \ | 514 V(ALIASED_ARGUMENTS_ENTRY, AliasedArgumentsEntry, aliased_arguments_entry) \ |
| 515 V(DEBUG_INFO, DebugInfo, debug_info) \ | 515 V(DEBUG_INFO, DebugInfo, debug_info) \ |
| 516 V(BREAK_POINT_INFO, BreakPointInfo, break_point_info) \ | 516 V(BREAK_POINT_INFO, BreakPointInfo, break_point_info) \ |
| 517 V(PROTOTYPE_INFO, PrototypeInfo, prototype_info) \ | 517 V(PROTOTYPE_INFO, PrototypeInfo, prototype_info) \ |
| 518 V(MODULE, Module, module) \ |
| 518 V(CONTEXT_EXTENSION, ContextExtension, context_extension) | 519 V(CONTEXT_EXTENSION, ContextExtension, context_extension) |
| 519 | 520 |
| 520 // We use the full 8 bits of the instance_type field to encode heap object | 521 // We use the full 8 bits of the instance_type field to encode heap object |
| 521 // instance types. The high-order bit (bit 7) is set if the object is not a | 522 // instance types. The high-order bit (bit 7) is set if the object is not a |
| 522 // string, and cleared if it is a string. | 523 // string, and cleared if it is a string. |
| 523 const uint32_t kIsNotStringMask = 0x80; | 524 const uint32_t kIsNotStringMask = 0x80; |
| 524 const uint32_t kStringTag = 0x0; | 525 const uint32_t kStringTag = 0x0; |
| 525 const uint32_t kNotStringTag = 0x80; | 526 const uint32_t kNotStringTag = 0x80; |
| 526 | 527 |
| 527 // Bit 6 indicates that the object is an internalized string (if set) or not. | 528 // Bit 6 indicates that the object is an internalized string (if set) or not. |
| (...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 683 DEBUG_INFO_TYPE, | 684 DEBUG_INFO_TYPE, |
| 684 BREAK_POINT_INFO_TYPE, | 685 BREAK_POINT_INFO_TYPE, |
| 685 FIXED_ARRAY_TYPE, | 686 FIXED_ARRAY_TYPE, |
| 686 SHARED_FUNCTION_INFO_TYPE, | 687 SHARED_FUNCTION_INFO_TYPE, |
| 687 CELL_TYPE, | 688 CELL_TYPE, |
| 688 WEAK_CELL_TYPE, | 689 WEAK_CELL_TYPE, |
| 689 TRANSITION_ARRAY_TYPE, | 690 TRANSITION_ARRAY_TYPE, |
| 690 PROPERTY_CELL_TYPE, | 691 PROPERTY_CELL_TYPE, |
| 691 PROTOTYPE_INFO_TYPE, | 692 PROTOTYPE_INFO_TYPE, |
| 692 CONTEXT_EXTENSION_TYPE, | 693 CONTEXT_EXTENSION_TYPE, |
| 694 MODULE_TYPE, |
| 693 | 695 |
| 694 // All the following types are subtypes of JSReceiver, which corresponds to | 696 // All the following types are subtypes of JSReceiver, which corresponds to |
| 695 // objects in the JS sense. The first and the last type in this range are | 697 // objects in the JS sense. The first and the last type in this range are |
| 696 // the two forms of function. This organization enables using the same | 698 // the two forms of function. This organization enables using the same |
| 697 // compares for checking the JS_RECEIVER and the NONCALLABLE_JS_OBJECT range. | 699 // compares for checking the JS_RECEIVER and the NONCALLABLE_JS_OBJECT range. |
| 698 JS_PROXY_TYPE, // FIRST_JS_RECEIVER_TYPE | 700 JS_PROXY_TYPE, // FIRST_JS_RECEIVER_TYPE |
| 699 JS_GLOBAL_OBJECT_TYPE, // FIRST_JS_OBJECT_TYPE | 701 JS_GLOBAL_OBJECT_TYPE, // FIRST_JS_OBJECT_TYPE |
| 700 JS_GLOBAL_PROXY_TYPE, | 702 JS_GLOBAL_PROXY_TYPE, |
| 701 // Like JS_API_OBJECT_TYPE, but requires access checks and/or has | 703 // Like JS_API_OBJECT_TYPE, but requires access checks and/or has |
| 702 // interceptors. | 704 // interceptors. |
| 703 JS_SPECIAL_API_OBJECT_TYPE, // LAST_SPECIAL_RECEIVER_TYPE | 705 JS_SPECIAL_API_OBJECT_TYPE, // LAST_SPECIAL_RECEIVER_TYPE |
| 704 JS_VALUE_TYPE, // LAST_CUSTOM_ELEMENTS_RECEIVER | 706 JS_VALUE_TYPE, // LAST_CUSTOM_ELEMENTS_RECEIVER |
| 705 JS_MESSAGE_OBJECT_TYPE, | 707 JS_MESSAGE_OBJECT_TYPE, |
| 706 JS_DATE_TYPE, | 708 JS_DATE_TYPE, |
| 707 // Like JS_OBJECT_TYPE, but created from API function. | 709 // Like JS_OBJECT_TYPE, but created from API function. |
| 708 JS_API_OBJECT_TYPE, | 710 JS_API_OBJECT_TYPE, |
| 709 JS_OBJECT_TYPE, | 711 JS_OBJECT_TYPE, |
| 710 JS_ARGUMENTS_TYPE, | 712 JS_ARGUMENTS_TYPE, |
| 711 JS_CONTEXT_EXTENSION_OBJECT_TYPE, | 713 JS_CONTEXT_EXTENSION_OBJECT_TYPE, |
| 712 JS_GENERATOR_OBJECT_TYPE, | 714 JS_GENERATOR_OBJECT_TYPE, |
| 713 JS_MODULE_TYPE, | |
| 714 JS_ARRAY_TYPE, | 715 JS_ARRAY_TYPE, |
| 715 JS_ARRAY_BUFFER_TYPE, | 716 JS_ARRAY_BUFFER_TYPE, |
| 716 JS_TYPED_ARRAY_TYPE, | 717 JS_TYPED_ARRAY_TYPE, |
| 717 JS_DATA_VIEW_TYPE, | 718 JS_DATA_VIEW_TYPE, |
| 718 JS_SET_TYPE, | 719 JS_SET_TYPE, |
| 719 JS_MAP_TYPE, | 720 JS_MAP_TYPE, |
| 720 JS_SET_ITERATOR_TYPE, | 721 JS_SET_ITERATOR_TYPE, |
| 721 JS_MAP_ITERATOR_TYPE, | 722 JS_MAP_ITERATOR_TYPE, |
| 722 JS_WEAK_MAP_TYPE, | 723 JS_WEAK_MAP_TYPE, |
| 723 JS_WEAK_SET_TYPE, | 724 JS_WEAK_SET_TYPE, |
| (...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 956 V(FixedFloat32Array) \ | 957 V(FixedFloat32Array) \ |
| 957 V(FixedFloat64Array) \ | 958 V(FixedFloat64Array) \ |
| 958 V(FixedUint8ClampedArray) \ | 959 V(FixedUint8ClampedArray) \ |
| 959 V(ByteArray) \ | 960 V(ByteArray) \ |
| 960 V(BytecodeArray) \ | 961 V(BytecodeArray) \ |
| 961 V(FreeSpace) \ | 962 V(FreeSpace) \ |
| 962 V(JSReceiver) \ | 963 V(JSReceiver) \ |
| 963 V(JSObject) \ | 964 V(JSObject) \ |
| 964 V(JSContextExtensionObject) \ | 965 V(JSContextExtensionObject) \ |
| 965 V(JSGeneratorObject) \ | 966 V(JSGeneratorObject) \ |
| 966 V(JSModule) \ | |
| 967 V(Map) \ | 967 V(Map) \ |
| 968 V(DescriptorArray) \ | 968 V(DescriptorArray) \ |
| 969 V(FrameArray) \ | 969 V(FrameArray) \ |
| 970 V(TransitionArray) \ | 970 V(TransitionArray) \ |
| 971 V(LiteralsArray) \ | 971 V(LiteralsArray) \ |
| 972 V(TypeFeedbackMetadata) \ | 972 V(TypeFeedbackMetadata) \ |
| 973 V(TypeFeedbackVector) \ | 973 V(TypeFeedbackVector) \ |
| 974 V(DeoptimizationInputData) \ | 974 V(DeoptimizationInputData) \ |
| 975 V(DeoptimizationOutputData) \ | 975 V(DeoptimizationOutputData) \ |
| 976 V(DependentCode) \ | 976 V(DependentCode) \ |
| (...skipping 5393 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6370 inline bool CanTransition(); | 6370 inline bool CanTransition(); |
| 6371 | 6371 |
| 6372 inline bool IsBooleanMap(); | 6372 inline bool IsBooleanMap(); |
| 6373 inline bool IsPrimitiveMap(); | 6373 inline bool IsPrimitiveMap(); |
| 6374 inline bool IsJSReceiverMap(); | 6374 inline bool IsJSReceiverMap(); |
| 6375 inline bool IsJSObjectMap(); | 6375 inline bool IsJSObjectMap(); |
| 6376 inline bool IsJSArrayMap(); | 6376 inline bool IsJSArrayMap(); |
| 6377 inline bool IsJSFunctionMap(); | 6377 inline bool IsJSFunctionMap(); |
| 6378 inline bool IsStringMap(); | 6378 inline bool IsStringMap(); |
| 6379 inline bool IsJSProxyMap(); | 6379 inline bool IsJSProxyMap(); |
| 6380 inline bool IsJSModuleMap(); | 6380 inline bool IsModuleMap(); |
| 6381 inline bool IsJSGlobalProxyMap(); | 6381 inline bool IsJSGlobalProxyMap(); |
| 6382 inline bool IsJSGlobalObjectMap(); | 6382 inline bool IsJSGlobalObjectMap(); |
| 6383 inline bool IsJSTypedArrayMap(); | 6383 inline bool IsJSTypedArrayMap(); |
| 6384 inline bool IsJSDataViewMap(); | 6384 inline bool IsJSDataViewMap(); |
| 6385 | 6385 |
| 6386 inline bool CanOmitMapChecks(); | 6386 inline bool CanOmitMapChecks(); |
| 6387 | 6387 |
| 6388 static void AddDependentCode(Handle<Map> map, | 6388 static void AddDependentCode(Handle<Map> map, |
| 6389 DependentCode::DependencyGroup group, | 6389 DependentCode::DependencyGroup group, |
| 6390 Handle<Code> code); | 6390 Handle<Code> code); |
| (...skipping 1457 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7848 static const int kInputOrDebugPosOffset = kReceiverOffset + kPointerSize; | 7848 static const int kInputOrDebugPosOffset = kReceiverOffset + kPointerSize; |
| 7849 static const int kResumeModeOffset = kInputOrDebugPosOffset + kPointerSize; | 7849 static const int kResumeModeOffset = kInputOrDebugPosOffset + kPointerSize; |
| 7850 static const int kContinuationOffset = kResumeModeOffset + kPointerSize; | 7850 static const int kContinuationOffset = kResumeModeOffset + kPointerSize; |
| 7851 static const int kOperandStackOffset = kContinuationOffset + kPointerSize; | 7851 static const int kOperandStackOffset = kContinuationOffset + kPointerSize; |
| 7852 static const int kSize = kOperandStackOffset + kPointerSize; | 7852 static const int kSize = kOperandStackOffset + kPointerSize; |
| 7853 | 7853 |
| 7854 private: | 7854 private: |
| 7855 DISALLOW_IMPLICIT_CONSTRUCTORS(JSGeneratorObject); | 7855 DISALLOW_IMPLICIT_CONSTRUCTORS(JSGeneratorObject); |
| 7856 }; | 7856 }; |
| 7857 | 7857 |
| 7858 // A JSModule object is a mapping from export names to cells | 7858 // A Module object is a mapping from export names to cells |
| 7859 // This is still very much in flux. | 7859 // This is still very much in flux. |
| 7860 class JSModule : public JSObject { | 7860 class Module : public Struct { |
| 7861 public: | 7861 public: |
| 7862 DECLARE_CAST(JSModule) | 7862 DECLARE_CAST(Module) |
| 7863 DECLARE_VERIFIER(JSModule) | 7863 DECLARE_VERIFIER(Module) |
| 7864 DECLARE_PRINTER(Module) |
| 7864 | 7865 |
| 7865 static const int kSize = JSObject::kHeaderSize; | 7866 DECL_ACCESSORS(exports, ObjectHashTable) |
| 7866 | 7867 |
| 7867 static void CreateExport(Handle<JSModule> module, Handle<String> name); | 7868 static void CreateExport(Handle<Module> module, Handle<String> name); |
| 7868 static void StoreExport(Handle<JSModule> module, Handle<String> name, | 7869 static void StoreExport(Handle<Module> module, Handle<String> name, |
| 7869 Handle<Object> value); | 7870 Handle<Object> value); |
| 7870 static Handle<Object> LoadExport(Handle<JSModule> module, | 7871 static Handle<Object> LoadExport(Handle<Module> module, Handle<String> name); |
| 7871 Handle<String> name); | 7872 |
| 7873 static const int kExportsOffset = HeapObject::kHeaderSize; |
| 7874 static const int kSize = kExportsOffset + kPointerSize; |
| 7875 |
| 7876 private: |
| 7877 DISALLOW_IMPLICIT_CONSTRUCTORS(Module); |
| 7872 }; | 7878 }; |
| 7873 | 7879 |
| 7874 // JSBoundFunction describes a bound function exotic object. | 7880 // JSBoundFunction describes a bound function exotic object. |
| 7875 class JSBoundFunction : public JSObject { | 7881 class JSBoundFunction : public JSObject { |
| 7876 public: | 7882 public: |
| 7877 // [bound_target_function]: The wrapped function object. | 7883 // [bound_target_function]: The wrapped function object. |
| 7878 DECL_ACCESSORS(bound_target_function, JSReceiver) | 7884 DECL_ACCESSORS(bound_target_function, JSReceiver) |
| 7879 | 7885 |
| 7880 // [bound_this]: The value that is always passed as the this value when | 7886 // [bound_this]: The value that is always passed as the this value when |
| 7881 // calling the wrapped function. | 7887 // calling the wrapped function. |
| (...skipping 3400 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 11282 } | 11288 } |
| 11283 return value; | 11289 return value; |
| 11284 } | 11290 } |
| 11285 }; | 11291 }; |
| 11286 | 11292 |
| 11287 | 11293 |
| 11288 } // NOLINT, false-positive due to second-order macros. | 11294 } // NOLINT, false-positive due to second-order macros. |
| 11289 } // NOLINT, false-positive due to second-order macros. | 11295 } // NOLINT, false-positive due to second-order macros. |
| 11290 | 11296 |
| 11291 #endif // V8_OBJECTS_H_ | 11297 #endif // V8_OBJECTS_H_ |
| OLD | NEW |