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 348 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
431 V(JS_MAP_TYPE) \ | 430 V(JS_MAP_TYPE) \ |
432 V(JS_SET_ITERATOR_TYPE) \ | 431 V(JS_SET_ITERATOR_TYPE) \ |
433 V(JS_MAP_ITERATOR_TYPE) \ | 432 V(JS_MAP_ITERATOR_TYPE) \ |
434 V(JS_ITERATOR_RESULT_TYPE) \ | 433 V(JS_ITERATOR_RESULT_TYPE) \ |
435 V(JS_WEAK_MAP_TYPE) \ | 434 V(JS_WEAK_MAP_TYPE) \ |
436 V(JS_WEAK_SET_TYPE) \ | 435 V(JS_WEAK_SET_TYPE) \ |
437 V(JS_PROMISE_TYPE) \ | 436 V(JS_PROMISE_TYPE) \ |
438 V(JS_REGEXP_TYPE) \ | 437 V(JS_REGEXP_TYPE) \ |
439 \ | 438 \ |
440 V(JS_FUNCTION_TYPE) \ | 439 V(JS_FUNCTION_TYPE) \ |
441 V(JS_FUNCTION_PROXY_TYPE) \ | |
442 V(DEBUG_INFO_TYPE) \ | 440 V(DEBUG_INFO_TYPE) \ |
443 V(BREAK_POINT_INFO_TYPE) | 441 V(BREAK_POINT_INFO_TYPE) |
444 | 442 |
445 | 443 |
446 // Since string types are not consecutive, this macro is used to | 444 // Since string types are not consecutive, this macro is used to |
447 // iterate over them. | 445 // iterate over them. |
448 #define STRING_TYPE_LIST(V) \ | 446 #define STRING_TYPE_LIST(V) \ |
449 V(STRING_TYPE, kVariableSizeSentinel, string, String) \ | 447 V(STRING_TYPE, kVariableSizeSentinel, string, String) \ |
450 V(ONE_BYTE_STRING_TYPE, kVariableSizeSentinel, one_byte_string, \ | 448 V(ONE_BYTE_STRING_TYPE, kVariableSizeSentinel, one_byte_string, \ |
451 OneByteString) \ | 449 OneByteString) \ |
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
702 CELL_TYPE, | 700 CELL_TYPE, |
703 WEAK_CELL_TYPE, | 701 WEAK_CELL_TYPE, |
704 PROPERTY_CELL_TYPE, | 702 PROPERTY_CELL_TYPE, |
705 PROTOTYPE_INFO_TYPE, | 703 PROTOTYPE_INFO_TYPE, |
706 SLOPPY_BLOCK_WITH_EVAL_CONTEXT_EXTENSION_TYPE, | 704 SLOPPY_BLOCK_WITH_EVAL_CONTEXT_EXTENSION_TYPE, |
707 | 705 |
708 // All the following types are subtypes of JSReceiver, which corresponds to | 706 // All the following types are subtypes of JSReceiver, which corresponds to |
709 // objects in the JS sense. The first and the last type in this range are | 707 // objects in the JS sense. The first and the last type in this range are |
710 // the two forms of function. This organization enables using the same | 708 // the two forms of function. This organization enables using the same |
711 // compares for checking the JS_RECEIVER and the NONCALLABLE_JS_OBJECT range. | 709 // compares for checking the JS_RECEIVER and the NONCALLABLE_JS_OBJECT range. |
712 JS_FUNCTION_PROXY_TYPE, // FIRST_JS_RECEIVER_TYPE, FIRST_JS_PROXY_TYPE | 710 JS_PROXY_TYPE, // FIRST_JS_RECEIVER_TYPE |
713 JS_PROXY_TYPE, // LAST_JS_PROXY_TYPE | 711 JS_VALUE_TYPE, // FIRST_JS_OBJECT_TYPE |
714 JS_VALUE_TYPE, // FIRST_JS_OBJECT_TYPE | |
715 JS_MESSAGE_OBJECT_TYPE, | 712 JS_MESSAGE_OBJECT_TYPE, |
716 JS_DATE_TYPE, | 713 JS_DATE_TYPE, |
717 JS_OBJECT_TYPE, | 714 JS_OBJECT_TYPE, |
718 JS_CONTEXT_EXTENSION_OBJECT_TYPE, | 715 JS_CONTEXT_EXTENSION_OBJECT_TYPE, |
719 JS_GENERATOR_OBJECT_TYPE, | 716 JS_GENERATOR_OBJECT_TYPE, |
720 JS_MODULE_TYPE, | 717 JS_MODULE_TYPE, |
721 JS_GLOBAL_OBJECT_TYPE, | 718 JS_GLOBAL_OBJECT_TYPE, |
722 JS_GLOBAL_PROXY_TYPE, | 719 JS_GLOBAL_PROXY_TYPE, |
723 JS_ARRAY_TYPE, | 720 JS_ARRAY_TYPE, |
724 JS_ARRAY_BUFFER_TYPE, | 721 JS_ARRAY_BUFFER_TYPE, |
(...skipping 23 matching lines...) Expand all Loading... |
748 // Boundaries for testing for a fixed typed array. | 745 // Boundaries for testing for a fixed typed array. |
749 FIRST_FIXED_TYPED_ARRAY_TYPE = FIXED_INT8_ARRAY_TYPE, | 746 FIRST_FIXED_TYPED_ARRAY_TYPE = FIXED_INT8_ARRAY_TYPE, |
750 LAST_FIXED_TYPED_ARRAY_TYPE = FIXED_UINT8_CLAMPED_ARRAY_TYPE, | 747 LAST_FIXED_TYPED_ARRAY_TYPE = FIXED_UINT8_CLAMPED_ARRAY_TYPE, |
751 // Boundary for promotion to old space. | 748 // Boundary for promotion to old space. |
752 LAST_DATA_TYPE = FILLER_TYPE, | 749 LAST_DATA_TYPE = FILLER_TYPE, |
753 // Boundary for objects represented as JSReceiver (i.e. JSObject or JSProxy). | 750 // Boundary for objects represented as JSReceiver (i.e. JSObject or JSProxy). |
754 // Note that there is no range for JSObject or JSProxy, since their subtypes | 751 // Note that there is no range for JSObject or JSProxy, since their subtypes |
755 // are not continuous in this enum! The enum ranges instead reflect the | 752 // are not continuous in this enum! The enum ranges instead reflect the |
756 // external class names, where proxies are treated as either ordinary objects, | 753 // external class names, where proxies are treated as either ordinary objects, |
757 // or functions. | 754 // or functions. |
758 FIRST_JS_RECEIVER_TYPE = JS_FUNCTION_PROXY_TYPE, | 755 FIRST_JS_RECEIVER_TYPE = JS_PROXY_TYPE, |
759 LAST_JS_RECEIVER_TYPE = LAST_TYPE, | 756 LAST_JS_RECEIVER_TYPE = LAST_TYPE, |
760 // Boundaries for testing the types represented as JSObject | 757 // Boundaries for testing the types represented as JSObject |
761 FIRST_JS_OBJECT_TYPE = JS_VALUE_TYPE, | 758 FIRST_JS_OBJECT_TYPE = JS_VALUE_TYPE, |
762 LAST_JS_OBJECT_TYPE = LAST_TYPE, | 759 LAST_JS_OBJECT_TYPE = LAST_TYPE, |
763 // Boundaries for testing the types represented as JSProxy | |
764 FIRST_JS_PROXY_TYPE = JS_FUNCTION_PROXY_TYPE, | |
765 LAST_JS_PROXY_TYPE = JS_PROXY_TYPE, | |
766 // | 760 // |
767 FIRST_NONCALLABLE_SPEC_OBJECT_TYPE = JS_PROXY_TYPE, | 761 FIRST_NONCALLABLE_SPEC_OBJECT_TYPE = JS_VALUE_TYPE, |
768 LAST_NONCALLABLE_SPEC_OBJECT_TYPE = JS_REGEXP_TYPE, | 762 LAST_NONCALLABLE_SPEC_OBJECT_TYPE = JS_REGEXP_TYPE, |
769 // Note that the types for which typeof is "function" are not continuous. | 763 // Note that the types for which typeof is "function" are not continuous. |
770 // Define this so that we can put assertions on discrete checks. | 764 // Define this so that we can put assertions on discrete checks. |
771 NUM_OF_CALLABLE_SPEC_OBJECT_TYPES = 2 | 765 NUM_OF_CALLABLE_SPEC_OBJECT_TYPES = 2 |
772 }; | 766 }; |
773 | 767 |
774 STATIC_ASSERT(JS_OBJECT_TYPE == Internals::kJSObjectType); | 768 STATIC_ASSERT(JS_OBJECT_TYPE == Internals::kJSObjectType); |
775 STATIC_ASSERT(FIRST_NONSTRING_TYPE == Internals::kFirstNonstringType); | 769 STATIC_ASSERT(FIRST_NONSTRING_TYPE == Internals::kFirstNonstringType); |
776 STATIC_ASSERT(ODDBALL_TYPE == Internals::kOddballType); | 770 STATIC_ASSERT(ODDBALL_TYPE == Internals::kOddballType); |
777 STATIC_ASSERT(FOREIGN_TYPE == Internals::kForeignType); | 771 STATIC_ASSERT(FOREIGN_TYPE == Internals::kForeignType); |
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
963 V(JSMessageObject) \ | 957 V(JSMessageObject) \ |
964 V(StringWrapper) \ | 958 V(StringWrapper) \ |
965 V(Foreign) \ | 959 V(Foreign) \ |
966 V(Boolean) \ | 960 V(Boolean) \ |
967 V(JSArray) \ | 961 V(JSArray) \ |
968 V(JSArrayBuffer) \ | 962 V(JSArrayBuffer) \ |
969 V(JSArrayBufferView) \ | 963 V(JSArrayBufferView) \ |
970 V(JSTypedArray) \ | 964 V(JSTypedArray) \ |
971 V(JSDataView) \ | 965 V(JSDataView) \ |
972 V(JSProxy) \ | 966 V(JSProxy) \ |
973 V(JSFunctionProxy) \ | |
974 V(JSSet) \ | 967 V(JSSet) \ |
975 V(JSMap) \ | 968 V(JSMap) \ |
976 V(JSSetIterator) \ | 969 V(JSSetIterator) \ |
977 V(JSMapIterator) \ | 970 V(JSMapIterator) \ |
978 V(JSIteratorResult) \ | 971 V(JSIteratorResult) \ |
979 V(JSWeakCollection) \ | 972 V(JSWeakCollection) \ |
980 V(JSWeakMap) \ | 973 V(JSWeakMap) \ |
981 V(JSWeakSet) \ | 974 V(JSWeakSet) \ |
982 V(JSRegExp) \ | 975 V(JSRegExp) \ |
983 V(HashTable) \ | 976 V(HashTable) \ |
(...skipping 8604 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9588 // Invoke a trap by name. If the trap does not exist on this's handler, | 9581 // Invoke a trap by name. If the trap does not exist on this's handler, |
9589 // but derived_trap is non-NULL, invoke that instead. May cause GC. | 9582 // but derived_trap is non-NULL, invoke that instead. May cause GC. |
9590 MUST_USE_RESULT static MaybeHandle<Object> CallTrap( | 9583 MUST_USE_RESULT static MaybeHandle<Object> CallTrap( |
9591 Handle<JSProxy> proxy, const char* name, Handle<Object> derived_trap, | 9584 Handle<JSProxy> proxy, const char* name, Handle<Object> derived_trap, |
9592 int argc, Handle<Object> args[]); | 9585 int argc, Handle<Object> args[]); |
9593 | 9586 |
9594 DISALLOW_IMPLICIT_CONSTRUCTORS(JSProxy); | 9587 DISALLOW_IMPLICIT_CONSTRUCTORS(JSProxy); |
9595 }; | 9588 }; |
9596 | 9589 |
9597 | 9590 |
9598 class JSFunctionProxy: public JSProxy { | |
9599 public: | |
9600 // [call_trap]: The call trap. | |
9601 DECL_ACCESSORS(call_trap, JSReceiver) | |
9602 | |
9603 // [construct_trap]: The construct trap. | |
9604 DECL_ACCESSORS(construct_trap, Object) | |
9605 | |
9606 DECLARE_CAST(JSFunctionProxy) | |
9607 | |
9608 // Dispatched behavior. | |
9609 DECLARE_PRINTER(JSFunctionProxy) | |
9610 DECLARE_VERIFIER(JSFunctionProxy) | |
9611 | |
9612 // Layout description. | |
9613 static const int kCallTrapOffset = JSProxy::kSize; | |
9614 static const int kConstructTrapOffset = kCallTrapOffset + kPointerSize; | |
9615 static const int kSize = kConstructTrapOffset + kPointerSize; | |
9616 | |
9617 typedef FixedBodyDescriptor<kTargetOffset, kSize, kSize> BodyDescriptor; | |
9618 | |
9619 private: | |
9620 DISALLOW_IMPLICIT_CONSTRUCTORS(JSFunctionProxy); | |
9621 }; | |
9622 | |
9623 | |
9624 class JSCollection : public JSObject { | 9591 class JSCollection : public JSObject { |
9625 public: | 9592 public: |
9626 // [table]: the backing hash table | 9593 // [table]: the backing hash table |
9627 DECL_ACCESSORS(table, Object) | 9594 DECL_ACCESSORS(table, Object) |
9628 | 9595 |
9629 static const int kTableOffset = JSObject::kHeaderSize; | 9596 static const int kTableOffset = JSObject::kHeaderSize; |
9630 static const int kSize = kTableOffset + kPointerSize; | 9597 static const int kSize = kTableOffset + kPointerSize; |
9631 | 9598 |
9632 private: | 9599 private: |
9633 DISALLOW_IMPLICIT_CONSTRUCTORS(JSCollection); | 9600 DISALLOW_IMPLICIT_CONSTRUCTORS(JSCollection); |
(...skipping 1082 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10716 } | 10683 } |
10717 return value; | 10684 return value; |
10718 } | 10685 } |
10719 }; | 10686 }; |
10720 | 10687 |
10721 | 10688 |
10722 } // NOLINT, false-positive due to second-order macros. | 10689 } // NOLINT, false-positive due to second-order macros. |
10723 } // NOLINT, false-positive due to second-order macros. | 10690 } // NOLINT, false-positive due to second-order macros. |
10724 | 10691 |
10725 #endif // V8_OBJECTS_H_ | 10692 #endif // V8_OBJECTS_H_ |
OLD | NEW |