| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 | 9 |
| 10 #include "src/allocation.h" | 10 #include "src/allocation.h" |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 62 // - JSRegExp | 62 // - JSRegExp |
| 63 // - JSFunction | 63 // - JSFunction |
| 64 // - JSGeneratorObject | 64 // - JSGeneratorObject |
| 65 // - JSModule | 65 // - JSModule |
| 66 // - JSGlobalObject | 66 // - JSGlobalObject |
| 67 // - JSGlobalProxy | 67 // - JSGlobalProxy |
| 68 // - JSValue | 68 // - JSValue |
| 69 // - JSDate | 69 // - JSDate |
| 70 // - JSMessageObject | 70 // - JSMessageObject |
| 71 // - JSProxy | 71 // - JSProxy |
| 72 // - JSFunctionProxy | |
| 73 // - FixedArrayBase | 72 // - FixedArrayBase |
| 74 // - ByteArray | 73 // - ByteArray |
| 75 // - BytecodeArray | 74 // - BytecodeArray |
| 76 // - FixedArray | 75 // - FixedArray |
| 77 // - DescriptorArray | 76 // - DescriptorArray |
| 78 // - LiteralsArray | 77 // - LiteralsArray |
| 79 // - BindingsArray | 78 // - BindingsArray |
| 80 // - HashTable | 79 // - HashTable |
| 81 // - Dictionary | 80 // - Dictionary |
| 82 // - StringTable | 81 // - StringTable |
| (...skipping 349 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 432 V(JS_MAP_TYPE) \ | 431 V(JS_MAP_TYPE) \ |
| 433 V(JS_SET_ITERATOR_TYPE) \ | 432 V(JS_SET_ITERATOR_TYPE) \ |
| 434 V(JS_MAP_ITERATOR_TYPE) \ | 433 V(JS_MAP_ITERATOR_TYPE) \ |
| 435 V(JS_ITERATOR_RESULT_TYPE) \ | 434 V(JS_ITERATOR_RESULT_TYPE) \ |
| 436 V(JS_WEAK_MAP_TYPE) \ | 435 V(JS_WEAK_MAP_TYPE) \ |
| 437 V(JS_WEAK_SET_TYPE) \ | 436 V(JS_WEAK_SET_TYPE) \ |
| 438 V(JS_PROMISE_TYPE) \ | 437 V(JS_PROMISE_TYPE) \ |
| 439 V(JS_REGEXP_TYPE) \ | 438 V(JS_REGEXP_TYPE) \ |
| 440 \ | 439 \ |
| 441 V(JS_FUNCTION_TYPE) \ | 440 V(JS_FUNCTION_TYPE) \ |
| 442 V(JS_FUNCTION_PROXY_TYPE) \ | |
| 443 V(DEBUG_INFO_TYPE) \ | 441 V(DEBUG_INFO_TYPE) \ |
| 444 V(BREAK_POINT_INFO_TYPE) | 442 V(BREAK_POINT_INFO_TYPE) |
| 445 | 443 |
| 446 | 444 |
| 447 // Since string types are not consecutive, this macro is used to | 445 // Since string types are not consecutive, this macro is used to |
| 448 // iterate over them. | 446 // iterate over them. |
| 449 #define STRING_TYPE_LIST(V) \ | 447 #define STRING_TYPE_LIST(V) \ |
| 450 V(STRING_TYPE, kVariableSizeSentinel, string, String) \ | 448 V(STRING_TYPE, kVariableSizeSentinel, string, String) \ |
| 451 V(ONE_BYTE_STRING_TYPE, kVariableSizeSentinel, one_byte_string, \ | 449 V(ONE_BYTE_STRING_TYPE, kVariableSizeSentinel, one_byte_string, \ |
| 452 OneByteString) \ | 450 OneByteString) \ |
| (...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 704 WEAK_CELL_TYPE, | 702 WEAK_CELL_TYPE, |
| 705 TRANSITION_ARRAY_TYPE, | 703 TRANSITION_ARRAY_TYPE, |
| 706 PROPERTY_CELL_TYPE, | 704 PROPERTY_CELL_TYPE, |
| 707 PROTOTYPE_INFO_TYPE, | 705 PROTOTYPE_INFO_TYPE, |
| 708 SLOPPY_BLOCK_WITH_EVAL_CONTEXT_EXTENSION_TYPE, | 706 SLOPPY_BLOCK_WITH_EVAL_CONTEXT_EXTENSION_TYPE, |
| 709 | 707 |
| 710 // All the following types are subtypes of JSReceiver, which corresponds to | 708 // All the following types are subtypes of JSReceiver, which corresponds to |
| 711 // objects in the JS sense. The first and the last type in this range are | 709 // objects in the JS sense. The first and the last type in this range are |
| 712 // the two forms of function. This organization enables using the same | 710 // the two forms of function. This organization enables using the same |
| 713 // compares for checking the JS_RECEIVER and the NONCALLABLE_JS_OBJECT range. | 711 // compares for checking the JS_RECEIVER and the NONCALLABLE_JS_OBJECT range. |
| 714 JS_FUNCTION_PROXY_TYPE, // FIRST_JS_RECEIVER_TYPE, FIRST_JS_PROXY_TYPE | 712 JS_PROXY_TYPE, // FIRST_JS_RECEIVER_TYPE |
| 715 JS_PROXY_TYPE, // LAST_JS_PROXY_TYPE | 713 JS_VALUE_TYPE, // FIRST_JS_OBJECT_TYPE |
| 716 JS_VALUE_TYPE, // FIRST_JS_OBJECT_TYPE | |
| 717 JS_MESSAGE_OBJECT_TYPE, | 714 JS_MESSAGE_OBJECT_TYPE, |
| 718 JS_DATE_TYPE, | 715 JS_DATE_TYPE, |
| 719 JS_OBJECT_TYPE, | 716 JS_OBJECT_TYPE, |
| 720 JS_CONTEXT_EXTENSION_OBJECT_TYPE, | 717 JS_CONTEXT_EXTENSION_OBJECT_TYPE, |
| 721 JS_GENERATOR_OBJECT_TYPE, | 718 JS_GENERATOR_OBJECT_TYPE, |
| 722 JS_MODULE_TYPE, | 719 JS_MODULE_TYPE, |
| 723 JS_GLOBAL_OBJECT_TYPE, | 720 JS_GLOBAL_OBJECT_TYPE, |
| 724 JS_GLOBAL_PROXY_TYPE, | 721 JS_GLOBAL_PROXY_TYPE, |
| 725 JS_ARRAY_TYPE, | 722 JS_ARRAY_TYPE, |
| 726 JS_ARRAY_BUFFER_TYPE, | 723 JS_ARRAY_BUFFER_TYPE, |
| (...skipping 23 matching lines...) Expand all Loading... |
| 750 // Boundaries for testing for a fixed typed array. | 747 // Boundaries for testing for a fixed typed array. |
| 751 FIRST_FIXED_TYPED_ARRAY_TYPE = FIXED_INT8_ARRAY_TYPE, | 748 FIRST_FIXED_TYPED_ARRAY_TYPE = FIXED_INT8_ARRAY_TYPE, |
| 752 LAST_FIXED_TYPED_ARRAY_TYPE = FIXED_UINT8_CLAMPED_ARRAY_TYPE, | 749 LAST_FIXED_TYPED_ARRAY_TYPE = FIXED_UINT8_CLAMPED_ARRAY_TYPE, |
| 753 // Boundary for promotion to old space. | 750 // Boundary for promotion to old space. |
| 754 LAST_DATA_TYPE = FILLER_TYPE, | 751 LAST_DATA_TYPE = FILLER_TYPE, |
| 755 // Boundary for objects represented as JSReceiver (i.e. JSObject or JSProxy). | 752 // Boundary for objects represented as JSReceiver (i.e. JSObject or JSProxy). |
| 756 // Note that there is no range for JSObject or JSProxy, since their subtypes | 753 // Note that there is no range for JSObject or JSProxy, since their subtypes |
| 757 // are not continuous in this enum! The enum ranges instead reflect the | 754 // are not continuous in this enum! The enum ranges instead reflect the |
| 758 // external class names, where proxies are treated as either ordinary objects, | 755 // external class names, where proxies are treated as either ordinary objects, |
| 759 // or functions. | 756 // or functions. |
| 760 FIRST_JS_RECEIVER_TYPE = JS_FUNCTION_PROXY_TYPE, | 757 FIRST_JS_RECEIVER_TYPE = JS_PROXY_TYPE, |
| 761 LAST_JS_RECEIVER_TYPE = LAST_TYPE, | 758 LAST_JS_RECEIVER_TYPE = LAST_TYPE, |
| 762 // Boundaries for testing the types represented as JSObject | 759 // Boundaries for testing the types represented as JSObject |
| 763 FIRST_JS_OBJECT_TYPE = JS_VALUE_TYPE, | 760 FIRST_JS_OBJECT_TYPE = JS_VALUE_TYPE, |
| 764 LAST_JS_OBJECT_TYPE = LAST_TYPE, | 761 LAST_JS_OBJECT_TYPE = LAST_TYPE, |
| 765 // Boundaries for testing the types represented as JSProxy | |
| 766 FIRST_JS_PROXY_TYPE = JS_FUNCTION_PROXY_TYPE, | |
| 767 LAST_JS_PROXY_TYPE = JS_PROXY_TYPE, | |
| 768 // | 762 // |
| 769 FIRST_NONCALLABLE_SPEC_OBJECT_TYPE = JS_PROXY_TYPE, | 763 FIRST_NONCALLABLE_SPEC_OBJECT_TYPE = JS_VALUE_TYPE, |
| 770 LAST_NONCALLABLE_SPEC_OBJECT_TYPE = JS_REGEXP_TYPE, | 764 LAST_NONCALLABLE_SPEC_OBJECT_TYPE = JS_REGEXP_TYPE, |
| 771 // Note that the types for which typeof is "function" are not continuous. | 765 // Note that the types for which typeof is "function" are not continuous. |
| 772 // Define this so that we can put assertions on discrete checks. | 766 // Define this so that we can put assertions on discrete checks. |
| 773 NUM_OF_CALLABLE_SPEC_OBJECT_TYPES = 2 | 767 NUM_OF_CALLABLE_SPEC_OBJECT_TYPES = 2 |
| 774 }; | 768 }; |
| 775 | 769 |
| 776 STATIC_ASSERT(JS_OBJECT_TYPE == Internals::kJSObjectType); | 770 STATIC_ASSERT(JS_OBJECT_TYPE == Internals::kJSObjectType); |
| 777 STATIC_ASSERT(FIRST_NONSTRING_TYPE == Internals::kFirstNonstringType); | 771 STATIC_ASSERT(FIRST_NONSTRING_TYPE == Internals::kFirstNonstringType); |
| 778 STATIC_ASSERT(ODDBALL_TYPE == Internals::kOddballType); | 772 STATIC_ASSERT(ODDBALL_TYPE == Internals::kOddballType); |
| 779 STATIC_ASSERT(FOREIGN_TYPE == Internals::kForeignType); | 773 STATIC_ASSERT(FOREIGN_TYPE == Internals::kForeignType); |
| (...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 968 V(JSMessageObject) \ | 962 V(JSMessageObject) \ |
| 969 V(StringWrapper) \ | 963 V(StringWrapper) \ |
| 970 V(Foreign) \ | 964 V(Foreign) \ |
| 971 V(Boolean) \ | 965 V(Boolean) \ |
| 972 V(JSArray) \ | 966 V(JSArray) \ |
| 973 V(JSArrayBuffer) \ | 967 V(JSArrayBuffer) \ |
| 974 V(JSArrayBufferView) \ | 968 V(JSArrayBufferView) \ |
| 975 V(JSTypedArray) \ | 969 V(JSTypedArray) \ |
| 976 V(JSDataView) \ | 970 V(JSDataView) \ |
| 977 V(JSProxy) \ | 971 V(JSProxy) \ |
| 978 V(JSFunctionProxy) \ | |
| 979 V(JSSet) \ | 972 V(JSSet) \ |
| 980 V(JSMap) \ | 973 V(JSMap) \ |
| 981 V(JSSetIterator) \ | 974 V(JSSetIterator) \ |
| 982 V(JSMapIterator) \ | 975 V(JSMapIterator) \ |
| 983 V(JSIteratorResult) \ | 976 V(JSIteratorResult) \ |
| 984 V(JSWeakCollection) \ | 977 V(JSWeakCollection) \ |
| 985 V(JSWeakMap) \ | 978 V(JSWeakMap) \ |
| 986 V(JSWeakSet) \ | 979 V(JSWeakSet) \ |
| 987 V(JSRegExp) \ | 980 V(JSRegExp) \ |
| 988 V(HashTable) \ | 981 V(HashTable) \ |
| (...skipping 8601 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9590 private: | 9583 private: |
| 9591 friend class JSReceiver; | 9584 friend class JSReceiver; |
| 9592 | 9585 |
| 9593 MUST_USE_RESULT static MaybeHandle<Object> GetTrap(Handle<JSProxy> proxy, | 9586 MUST_USE_RESULT static MaybeHandle<Object> GetTrap(Handle<JSProxy> proxy, |
| 9594 Handle<String> trap); | 9587 Handle<String> trap); |
| 9595 | 9588 |
| 9596 DISALLOW_IMPLICIT_CONSTRUCTORS(JSProxy); | 9589 DISALLOW_IMPLICIT_CONSTRUCTORS(JSProxy); |
| 9597 }; | 9590 }; |
| 9598 | 9591 |
| 9599 | 9592 |
| 9600 class JSFunctionProxy: public JSProxy { | |
| 9601 public: | |
| 9602 // [call_trap]: The call trap. | |
| 9603 DECL_ACCESSORS(call_trap, JSReceiver) | |
| 9604 | |
| 9605 // [construct_trap]: The construct trap. | |
| 9606 DECL_ACCESSORS(construct_trap, Object) | |
| 9607 | |
| 9608 DECLARE_CAST(JSFunctionProxy) | |
| 9609 | |
| 9610 // Dispatched behavior. | |
| 9611 DECLARE_PRINTER(JSFunctionProxy) | |
| 9612 DECLARE_VERIFIER(JSFunctionProxy) | |
| 9613 | |
| 9614 // Layout description. | |
| 9615 static const int kCallTrapOffset = JSProxy::kSize; | |
| 9616 static const int kConstructTrapOffset = kCallTrapOffset + kPointerSize; | |
| 9617 static const int kSize = kConstructTrapOffset + kPointerSize; | |
| 9618 | |
| 9619 typedef FixedBodyDescriptor<kTargetOffset, kSize, kSize> BodyDescriptor; | |
| 9620 | |
| 9621 private: | |
| 9622 DISALLOW_IMPLICIT_CONSTRUCTORS(JSFunctionProxy); | |
| 9623 }; | |
| 9624 | |
| 9625 | |
| 9626 class JSCollection : public JSObject { | 9593 class JSCollection : public JSObject { |
| 9627 public: | 9594 public: |
| 9628 // [table]: the backing hash table | 9595 // [table]: the backing hash table |
| 9629 DECL_ACCESSORS(table, Object) | 9596 DECL_ACCESSORS(table, Object) |
| 9630 | 9597 |
| 9631 static const int kTableOffset = JSObject::kHeaderSize; | 9598 static const int kTableOffset = JSObject::kHeaderSize; |
| 9632 static const int kSize = kTableOffset + kPointerSize; | 9599 static const int kSize = kTableOffset + kPointerSize; |
| 9633 | 9600 |
| 9634 private: | 9601 private: |
| 9635 DISALLOW_IMPLICIT_CONSTRUCTORS(JSCollection); | 9602 DISALLOW_IMPLICIT_CONSTRUCTORS(JSCollection); |
| (...skipping 1082 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10718 } | 10685 } |
| 10719 return value; | 10686 return value; |
| 10720 } | 10687 } |
| 10721 }; | 10688 }; |
| 10722 | 10689 |
| 10723 | 10690 |
| 10724 } // NOLINT, false-positive due to second-order macros. | 10691 } // NOLINT, false-positive due to second-order macros. |
| 10725 } // NOLINT, false-positive due to second-order macros. | 10692 } // NOLINT, false-positive due to second-order macros. |
| 10726 | 10693 |
| 10727 #endif // V8_OBJECTS_H_ | 10694 #endif // V8_OBJECTS_H_ |
| OLD | NEW |