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 | 9 |
10 #include "src/assert-scope.h" | 10 #include "src/assert-scope.h" |
(...skipping 402 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
413 V(JS_MESSAGE_OBJECT_TYPE) \ | 413 V(JS_MESSAGE_OBJECT_TYPE) \ |
414 \ | 414 \ |
415 V(JS_VALUE_TYPE) \ | 415 V(JS_VALUE_TYPE) \ |
416 V(JS_DATE_TYPE) \ | 416 V(JS_DATE_TYPE) \ |
417 V(JS_OBJECT_TYPE) \ | 417 V(JS_OBJECT_TYPE) \ |
418 V(JS_CONTEXT_EXTENSION_OBJECT_TYPE) \ | 418 V(JS_CONTEXT_EXTENSION_OBJECT_TYPE) \ |
419 V(JS_GENERATOR_OBJECT_TYPE) \ | 419 V(JS_GENERATOR_OBJECT_TYPE) \ |
420 V(JS_MODULE_TYPE) \ | 420 V(JS_MODULE_TYPE) \ |
421 V(JS_GLOBAL_OBJECT_TYPE) \ | 421 V(JS_GLOBAL_OBJECT_TYPE) \ |
422 V(JS_GLOBAL_PROXY_TYPE) \ | 422 V(JS_GLOBAL_PROXY_TYPE) \ |
| 423 V(JS_API_OBJECT_TYPE) \ |
423 V(JS_SPECIAL_API_OBJECT_TYPE) \ | 424 V(JS_SPECIAL_API_OBJECT_TYPE) \ |
424 V(JS_ARRAY_TYPE) \ | 425 V(JS_ARRAY_TYPE) \ |
425 V(JS_ARRAY_BUFFER_TYPE) \ | 426 V(JS_ARRAY_BUFFER_TYPE) \ |
426 V(JS_TYPED_ARRAY_TYPE) \ | 427 V(JS_TYPED_ARRAY_TYPE) \ |
427 V(JS_DATA_VIEW_TYPE) \ | 428 V(JS_DATA_VIEW_TYPE) \ |
428 V(JS_PROXY_TYPE) \ | 429 V(JS_PROXY_TYPE) \ |
429 V(JS_SET_TYPE) \ | 430 V(JS_SET_TYPE) \ |
430 V(JS_MAP_TYPE) \ | 431 V(JS_MAP_TYPE) \ |
431 V(JS_SET_ITERATOR_TYPE) \ | 432 V(JS_SET_ITERATOR_TYPE) \ |
432 V(JS_MAP_ITERATOR_TYPE) \ | 433 V(JS_MAP_ITERATOR_TYPE) \ |
(...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
695 PROTOTYPE_INFO_TYPE, | 696 PROTOTYPE_INFO_TYPE, |
696 SLOPPY_BLOCK_WITH_EVAL_CONTEXT_EXTENSION_TYPE, | 697 SLOPPY_BLOCK_WITH_EVAL_CONTEXT_EXTENSION_TYPE, |
697 | 698 |
698 // All the following types are subtypes of JSReceiver, which corresponds to | 699 // All the following types are subtypes of JSReceiver, which corresponds to |
699 // objects in the JS sense. The first and the last type in this range are | 700 // objects in the JS sense. The first and the last type in this range are |
700 // the two forms of function. This organization enables using the same | 701 // the two forms of function. This organization enables using the same |
701 // compares for checking the JS_RECEIVER and the NONCALLABLE_JS_OBJECT range. | 702 // compares for checking the JS_RECEIVER and the NONCALLABLE_JS_OBJECT range. |
702 JS_PROXY_TYPE, // FIRST_JS_RECEIVER_TYPE | 703 JS_PROXY_TYPE, // FIRST_JS_RECEIVER_TYPE |
703 JS_GLOBAL_OBJECT_TYPE, // FIRST_JS_OBJECT_TYPE | 704 JS_GLOBAL_OBJECT_TYPE, // FIRST_JS_OBJECT_TYPE |
704 JS_GLOBAL_PROXY_TYPE, | 705 JS_GLOBAL_PROXY_TYPE, |
705 // Like JS_OBJECT_TYPE, but requires access checks and/or has interceptors. | 706 // Like JS_API_OBJECT_TYPE, but requires access checks and/or has |
| 707 // interceptors. |
706 JS_SPECIAL_API_OBJECT_TYPE, // LAST_SPECIAL_RECEIVER_TYPE | 708 JS_SPECIAL_API_OBJECT_TYPE, // LAST_SPECIAL_RECEIVER_TYPE |
707 JS_VALUE_TYPE, // LAST_CUSTOM_ELEMENTS_RECEIVER | 709 JS_VALUE_TYPE, // LAST_CUSTOM_ELEMENTS_RECEIVER |
708 JS_MESSAGE_OBJECT_TYPE, | 710 JS_MESSAGE_OBJECT_TYPE, |
709 JS_DATE_TYPE, | 711 JS_DATE_TYPE, |
| 712 // Like JS_OBJECT_TYPE, but created from API function. |
| 713 JS_API_OBJECT_TYPE, |
710 JS_OBJECT_TYPE, | 714 JS_OBJECT_TYPE, |
711 JS_CONTEXT_EXTENSION_OBJECT_TYPE, | 715 JS_CONTEXT_EXTENSION_OBJECT_TYPE, |
712 JS_GENERATOR_OBJECT_TYPE, | 716 JS_GENERATOR_OBJECT_TYPE, |
713 JS_MODULE_TYPE, | 717 JS_MODULE_TYPE, |
714 JS_ARRAY_TYPE, | 718 JS_ARRAY_TYPE, |
715 JS_ARRAY_BUFFER_TYPE, | 719 JS_ARRAY_BUFFER_TYPE, |
716 JS_TYPED_ARRAY_TYPE, | 720 JS_TYPED_ARRAY_TYPE, |
717 JS_DATA_VIEW_TYPE, | 721 JS_DATA_VIEW_TYPE, |
718 JS_SET_TYPE, | 722 JS_SET_TYPE, |
719 JS_MAP_TYPE, | 723 JS_MAP_TYPE, |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
755 LAST_JS_OBJECT_TYPE = LAST_TYPE, | 759 LAST_JS_OBJECT_TYPE = LAST_TYPE, |
756 // Boundary for testing JSReceivers that need special property lookup handling | 760 // Boundary for testing JSReceivers that need special property lookup handling |
757 LAST_SPECIAL_RECEIVER_TYPE = JS_SPECIAL_API_OBJECT_TYPE, | 761 LAST_SPECIAL_RECEIVER_TYPE = JS_SPECIAL_API_OBJECT_TYPE, |
758 // Boundary case for testing JSReceivers that may have elements while having | 762 // Boundary case for testing JSReceivers that may have elements while having |
759 // an empty fixed array as elements backing store. This is true for string | 763 // an empty fixed array as elements backing store. This is true for string |
760 // wrappers. | 764 // wrappers. |
761 LAST_CUSTOM_ELEMENTS_RECEIVER = JS_VALUE_TYPE, | 765 LAST_CUSTOM_ELEMENTS_RECEIVER = JS_VALUE_TYPE, |
762 }; | 766 }; |
763 | 767 |
764 STATIC_ASSERT(JS_OBJECT_TYPE == Internals::kJSObjectType); | 768 STATIC_ASSERT(JS_OBJECT_TYPE == Internals::kJSObjectType); |
| 769 STATIC_ASSERT(JS_API_OBJECT_TYPE == Internals::kJSApiObjectType); |
765 STATIC_ASSERT(FIRST_NONSTRING_TYPE == Internals::kFirstNonstringType); | 770 STATIC_ASSERT(FIRST_NONSTRING_TYPE == Internals::kFirstNonstringType); |
766 STATIC_ASSERT(ODDBALL_TYPE == Internals::kOddballType); | 771 STATIC_ASSERT(ODDBALL_TYPE == Internals::kOddballType); |
767 STATIC_ASSERT(FOREIGN_TYPE == Internals::kForeignType); | 772 STATIC_ASSERT(FOREIGN_TYPE == Internals::kForeignType); |
768 | 773 |
769 | 774 |
770 std::ostream& operator<<(std::ostream& os, InstanceType instance_type); | 775 std::ostream& operator<<(std::ostream& os, InstanceType instance_type); |
771 | 776 |
772 | 777 |
773 #define FIXED_ARRAY_SUB_INSTANCE_TYPE_LIST(V) \ | 778 #define FIXED_ARRAY_SUB_INSTANCE_TYPE_LIST(V) \ |
774 V(FAST_ELEMENTS_SUB_TYPE) \ | 779 V(FAST_ELEMENTS_SUB_TYPE) \ |
(...skipping 1502 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2277 // internal fields as well as the number of internal fields. | 2282 // internal fields as well as the number of internal fields. |
2278 static inline int GetHeaderSize(InstanceType instance_type); | 2283 static inline int GetHeaderSize(InstanceType instance_type); |
2279 inline int GetHeaderSize(); | 2284 inline int GetHeaderSize(); |
2280 | 2285 |
2281 static inline int GetInternalFieldCount(Map* map); | 2286 static inline int GetInternalFieldCount(Map* map); |
2282 inline int GetInternalFieldCount(); | 2287 inline int GetInternalFieldCount(); |
2283 inline int GetInternalFieldOffset(int index); | 2288 inline int GetInternalFieldOffset(int index); |
2284 inline Object* GetInternalField(int index); | 2289 inline Object* GetInternalField(int index); |
2285 inline void SetInternalField(int index, Object* value); | 2290 inline void SetInternalField(int index, Object* value); |
2286 inline void SetInternalField(int index, Smi* value); | 2291 inline void SetInternalField(int index, Smi* value); |
| 2292 bool WasConstructedFromApiFunction(); |
2287 | 2293 |
2288 void CollectOwnPropertyNames(KeyAccumulator* keys, | 2294 void CollectOwnPropertyNames(KeyAccumulator* keys, |
2289 PropertyFilter filter = ALL_PROPERTIES); | 2295 PropertyFilter filter = ALL_PROPERTIES); |
2290 | 2296 |
2291 // Returns the number of properties on this object filtering out properties | 2297 // Returns the number of properties on this object filtering out properties |
2292 // with the specified attributes (ignoring interceptors). | 2298 // with the specified attributes (ignoring interceptors). |
2293 // TODO(jkummerow): Deprecated, only used by Object.observe. | 2299 // TODO(jkummerow): Deprecated, only used by Object.observe. |
2294 int NumberOfOwnElements(PropertyFilter filter); | 2300 int NumberOfOwnElements(PropertyFilter filter); |
2295 // Returns the number of elements on this object filtering out elements | 2301 // Returns the number of elements on this object filtering out elements |
2296 // with the specified attributes (ignoring interceptors). | 2302 // with the specified attributes (ignoring interceptors). |
(...skipping 8465 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10762 } | 10768 } |
10763 return value; | 10769 return value; |
10764 } | 10770 } |
10765 }; | 10771 }; |
10766 | 10772 |
10767 | 10773 |
10768 } // NOLINT, false-positive due to second-order macros. | 10774 } // NOLINT, false-positive due to second-order macros. |
10769 } // NOLINT, false-positive due to second-order macros. | 10775 } // NOLINT, false-positive due to second-order macros. |
10770 | 10776 |
10771 #endif // V8_OBJECTS_H_ | 10777 #endif // V8_OBJECTS_H_ |
OLD | NEW |