Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(108)

Side by Side Diff: src/objects.h

Issue 2405253006: [builtins] implement Array.prototype[@@iterator] in TFJ builtins (Closed)
Patch Set: latest round Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/js/array-iterator.js ('k') | src/objects-body-descriptors-inl.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 426 matching lines...) Expand 10 before | Expand all | Expand 10 after
437 V(JS_MAP_TYPE) \ 437 V(JS_MAP_TYPE) \
438 V(JS_SET_ITERATOR_TYPE) \ 438 V(JS_SET_ITERATOR_TYPE) \
439 V(JS_MAP_ITERATOR_TYPE) \ 439 V(JS_MAP_ITERATOR_TYPE) \
440 V(JS_WEAK_MAP_TYPE) \ 440 V(JS_WEAK_MAP_TYPE) \
441 V(JS_WEAK_SET_TYPE) \ 441 V(JS_WEAK_SET_TYPE) \
442 V(JS_PROMISE_TYPE) \ 442 V(JS_PROMISE_TYPE) \
443 V(JS_REGEXP_TYPE) \ 443 V(JS_REGEXP_TYPE) \
444 V(JS_ERROR_TYPE) \ 444 V(JS_ERROR_TYPE) \
445 V(JS_STRING_ITERATOR_TYPE) \ 445 V(JS_STRING_ITERATOR_TYPE) \
446 \ 446 \
447 V(JS_TYPED_ARRAY_KEY_ITERATOR_TYPE) \
448 V(JS_FAST_ARRAY_KEY_ITERATOR_TYPE) \
449 V(JS_GENERIC_ARRAY_KEY_ITERATOR_TYPE) \
450 \
451 V(JS_INT8_ARRAY_KEY_VALUE_ITERATOR_TYPE) \
452 V(JS_UINT8_ARRAY_KEY_VALUE_ITERATOR_TYPE) \
453 V(JS_INT16_ARRAY_KEY_VALUE_ITERATOR_TYPE) \
454 V(JS_UINT16_ARRAY_KEY_VALUE_ITERATOR_TYPE) \
455 V(JS_INT32_ARRAY_KEY_VALUE_ITERATOR_TYPE) \
456 V(JS_UINT32_ARRAY_KEY_VALUE_ITERATOR_TYPE) \
457 V(JS_FLOAT32_ARRAY_KEY_VALUE_ITERATOR_TYPE) \
458 V(JS_FLOAT64_ARRAY_KEY_VALUE_ITERATOR_TYPE) \
459 V(JS_UINT8_CLAMPED_ARRAY_KEY_VALUE_ITERATOR_TYPE) \
460 \
461 V(JS_FAST_SMI_ARRAY_KEY_VALUE_ITERATOR_TYPE) \
462 V(JS_FAST_HOLEY_SMI_ARRAY_KEY_VALUE_ITERATOR_TYPE) \
463 V(JS_FAST_ARRAY_KEY_VALUE_ITERATOR_TYPE) \
464 V(JS_FAST_HOLEY_ARRAY_KEY_VALUE_ITERATOR_TYPE) \
465 V(JS_FAST_DOUBLE_ARRAY_KEY_VALUE_ITERATOR_TYPE) \
466 V(JS_FAST_HOLEY_DOUBLE_ARRAY_KEY_VALUE_ITERATOR_TYPE) \
467 V(JS_GENERIC_ARRAY_KEY_VALUE_ITERATOR_TYPE) \
468 \
469 V(JS_INT8_ARRAY_VALUE_ITERATOR_TYPE) \
470 V(JS_UINT8_ARRAY_VALUE_ITERATOR_TYPE) \
471 V(JS_INT16_ARRAY_VALUE_ITERATOR_TYPE) \
472 V(JS_UINT16_ARRAY_VALUE_ITERATOR_TYPE) \
473 V(JS_INT32_ARRAY_VALUE_ITERATOR_TYPE) \
474 V(JS_UINT32_ARRAY_VALUE_ITERATOR_TYPE) \
475 V(JS_FLOAT32_ARRAY_VALUE_ITERATOR_TYPE) \
476 V(JS_FLOAT64_ARRAY_VALUE_ITERATOR_TYPE) \
477 V(JS_UINT8_CLAMPED_ARRAY_VALUE_ITERATOR_TYPE) \
478 \
479 V(JS_FAST_SMI_ARRAY_VALUE_ITERATOR_TYPE) \
480 V(JS_FAST_HOLEY_SMI_ARRAY_VALUE_ITERATOR_TYPE) \
481 V(JS_FAST_ARRAY_VALUE_ITERATOR_TYPE) \
482 V(JS_FAST_HOLEY_ARRAY_VALUE_ITERATOR_TYPE) \
483 V(JS_FAST_DOUBLE_ARRAY_VALUE_ITERATOR_TYPE) \
484 V(JS_FAST_HOLEY_DOUBLE_ARRAY_VALUE_ITERATOR_TYPE) \
485 V(JS_GENERIC_ARRAY_VALUE_ITERATOR_TYPE) \
486 \
447 V(JS_BOUND_FUNCTION_TYPE) \ 487 V(JS_BOUND_FUNCTION_TYPE) \
448 V(JS_FUNCTION_TYPE) \ 488 V(JS_FUNCTION_TYPE) \
449 V(DEBUG_INFO_TYPE) \ 489 V(DEBUG_INFO_TYPE) \
450 V(BREAK_POINT_INFO_TYPE) 490 V(BREAK_POINT_INFO_TYPE)
451 491
452 // Since string types are not consecutive, this macro is used to 492 // Since string types are not consecutive, this macro is used to
453 // iterate over them. 493 // iterate over them.
454 #define STRING_TYPE_LIST(V) \ 494 #define STRING_TYPE_LIST(V) \
455 V(STRING_TYPE, kVariableSizeSentinel, string, String) \ 495 V(STRING_TYPE, kVariableSizeSentinel, string, String) \
456 V(ONE_BYTE_STRING_TYPE, kVariableSizeSentinel, one_byte_string, \ 496 V(ONE_BYTE_STRING_TYPE, kVariableSizeSentinel, one_byte_string, \
(...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after
740 JS_SET_TYPE, 780 JS_SET_TYPE,
741 JS_MAP_TYPE, 781 JS_MAP_TYPE,
742 JS_SET_ITERATOR_TYPE, 782 JS_SET_ITERATOR_TYPE,
743 JS_MAP_ITERATOR_TYPE, 783 JS_MAP_ITERATOR_TYPE,
744 JS_WEAK_MAP_TYPE, 784 JS_WEAK_MAP_TYPE,
745 JS_WEAK_SET_TYPE, 785 JS_WEAK_SET_TYPE,
746 JS_PROMISE_TYPE, 786 JS_PROMISE_TYPE,
747 JS_REGEXP_TYPE, 787 JS_REGEXP_TYPE,
748 JS_ERROR_TYPE, 788 JS_ERROR_TYPE,
749 JS_STRING_ITERATOR_TYPE, 789 JS_STRING_ITERATOR_TYPE,
790
791 JS_TYPED_ARRAY_KEY_ITERATOR_TYPE,
792 JS_FAST_ARRAY_KEY_ITERATOR_TYPE,
793 JS_GENERIC_ARRAY_KEY_ITERATOR_TYPE,
794
795 JS_UINT8_ARRAY_KEY_VALUE_ITERATOR_TYPE,
796 JS_INT8_ARRAY_KEY_VALUE_ITERATOR_TYPE,
797 JS_UINT16_ARRAY_KEY_VALUE_ITERATOR_TYPE,
798 JS_INT16_ARRAY_KEY_VALUE_ITERATOR_TYPE,
799 JS_UINT32_ARRAY_KEY_VALUE_ITERATOR_TYPE,
800 JS_INT32_ARRAY_KEY_VALUE_ITERATOR_TYPE,
801 JS_FLOAT32_ARRAY_KEY_VALUE_ITERATOR_TYPE,
802 JS_FLOAT64_ARRAY_KEY_VALUE_ITERATOR_TYPE,
803 JS_UINT8_CLAMPED_ARRAY_KEY_VALUE_ITERATOR_TYPE,
804
805 JS_FAST_SMI_ARRAY_KEY_VALUE_ITERATOR_TYPE,
806 JS_FAST_HOLEY_SMI_ARRAY_KEY_VALUE_ITERATOR_TYPE,
807 JS_FAST_ARRAY_KEY_VALUE_ITERATOR_TYPE,
808 JS_FAST_HOLEY_ARRAY_KEY_VALUE_ITERATOR_TYPE,
809 JS_FAST_DOUBLE_ARRAY_KEY_VALUE_ITERATOR_TYPE,
810 JS_FAST_HOLEY_DOUBLE_ARRAY_KEY_VALUE_ITERATOR_TYPE,
811 JS_GENERIC_ARRAY_KEY_VALUE_ITERATOR_TYPE,
812
813 JS_UINT8_ARRAY_VALUE_ITERATOR_TYPE,
814 JS_INT8_ARRAY_VALUE_ITERATOR_TYPE,
815 JS_UINT16_ARRAY_VALUE_ITERATOR_TYPE,
816 JS_INT16_ARRAY_VALUE_ITERATOR_TYPE,
817 JS_UINT32_ARRAY_VALUE_ITERATOR_TYPE,
818 JS_INT32_ARRAY_VALUE_ITERATOR_TYPE,
819 JS_FLOAT32_ARRAY_VALUE_ITERATOR_TYPE,
820 JS_FLOAT64_ARRAY_VALUE_ITERATOR_TYPE,
821 JS_UINT8_CLAMPED_ARRAY_VALUE_ITERATOR_TYPE,
822
823 JS_FAST_SMI_ARRAY_VALUE_ITERATOR_TYPE,
824 JS_FAST_HOLEY_SMI_ARRAY_VALUE_ITERATOR_TYPE,
825 JS_FAST_ARRAY_VALUE_ITERATOR_TYPE,
826 JS_FAST_HOLEY_ARRAY_VALUE_ITERATOR_TYPE,
827 JS_FAST_DOUBLE_ARRAY_VALUE_ITERATOR_TYPE,
828 JS_FAST_HOLEY_DOUBLE_ARRAY_VALUE_ITERATOR_TYPE,
829 JS_GENERIC_ARRAY_VALUE_ITERATOR_TYPE,
830
750 JS_BOUND_FUNCTION_TYPE, 831 JS_BOUND_FUNCTION_TYPE,
751 JS_FUNCTION_TYPE, // LAST_JS_OBJECT_TYPE, LAST_JS_RECEIVER_TYPE 832 JS_FUNCTION_TYPE, // LAST_JS_OBJECT_TYPE, LAST_JS_RECEIVER_TYPE
752 833
753 // Pseudo-types 834 // Pseudo-types
754 FIRST_TYPE = 0x0, 835 FIRST_TYPE = 0x0,
755 LAST_TYPE = JS_FUNCTION_TYPE, 836 LAST_TYPE = JS_FUNCTION_TYPE,
756 FIRST_NAME_TYPE = FIRST_TYPE, 837 FIRST_NAME_TYPE = FIRST_TYPE,
757 LAST_NAME_TYPE = SYMBOL_TYPE, 838 LAST_NAME_TYPE = SYMBOL_TYPE,
758 FIRST_UNIQUE_NAME_TYPE = INTERNALIZED_STRING_TYPE, 839 FIRST_UNIQUE_NAME_TYPE = INTERNALIZED_STRING_TYPE,
759 LAST_UNIQUE_NAME_TYPE = SYMBOL_TYPE, 840 LAST_UNIQUE_NAME_TYPE = SYMBOL_TYPE,
(...skipping 16 matching lines...) Expand all
776 LAST_JS_RECEIVER_TYPE = LAST_TYPE, 857 LAST_JS_RECEIVER_TYPE = LAST_TYPE,
777 // Boundaries for testing the types represented as JSObject 858 // Boundaries for testing the types represented as JSObject
778 FIRST_JS_OBJECT_TYPE = JS_GLOBAL_OBJECT_TYPE, 859 FIRST_JS_OBJECT_TYPE = JS_GLOBAL_OBJECT_TYPE,
779 LAST_JS_OBJECT_TYPE = LAST_TYPE, 860 LAST_JS_OBJECT_TYPE = LAST_TYPE,
780 // Boundary for testing JSReceivers that need special property lookup handling 861 // Boundary for testing JSReceivers that need special property lookup handling
781 LAST_SPECIAL_RECEIVER_TYPE = JS_SPECIAL_API_OBJECT_TYPE, 862 LAST_SPECIAL_RECEIVER_TYPE = JS_SPECIAL_API_OBJECT_TYPE,
782 // Boundary case for testing JSReceivers that may have elements while having 863 // Boundary case for testing JSReceivers that may have elements while having
783 // an empty fixed array as elements backing store. This is true for string 864 // an empty fixed array as elements backing store. This is true for string
784 // wrappers. 865 // wrappers.
785 LAST_CUSTOM_ELEMENTS_RECEIVER = JS_VALUE_TYPE, 866 LAST_CUSTOM_ELEMENTS_RECEIVER = JS_VALUE_TYPE,
867
868 FIRST_ARRAY_KEY_ITERATOR_TYPE = JS_TYPED_ARRAY_KEY_ITERATOR_TYPE,
869 LAST_ARRAY_KEY_ITERATOR_TYPE = JS_GENERIC_ARRAY_KEY_ITERATOR_TYPE,
870
871 FIRST_ARRAY_KEY_VALUE_ITERATOR_TYPE = JS_UINT8_ARRAY_KEY_VALUE_ITERATOR_TYPE,
872 LAST_ARRAY_KEY_VALUE_ITERATOR_TYPE = JS_GENERIC_ARRAY_KEY_VALUE_ITERATOR_TYPE,
873
874 FIRST_ARRAY_VALUE_ITERATOR_TYPE = JS_UINT8_ARRAY_VALUE_ITERATOR_TYPE,
875 LAST_ARRAY_VALUE_ITERATOR_TYPE = JS_GENERIC_ARRAY_VALUE_ITERATOR_TYPE,
876
877 FIRST_ARRAY_ITERATOR_TYPE = FIRST_ARRAY_KEY_ITERATOR_TYPE,
878 LAST_ARRAY_ITERATOR_TYPE = LAST_ARRAY_VALUE_ITERATOR_TYPE,
786 }; 879 };
787 880
788 STATIC_ASSERT(JS_OBJECT_TYPE == Internals::kJSObjectType); 881 STATIC_ASSERT(JS_OBJECT_TYPE == Internals::kJSObjectType);
789 STATIC_ASSERT(JS_API_OBJECT_TYPE == Internals::kJSApiObjectType); 882 STATIC_ASSERT(JS_API_OBJECT_TYPE == Internals::kJSApiObjectType);
790 STATIC_ASSERT(FIRST_NONSTRING_TYPE == Internals::kFirstNonstringType); 883 STATIC_ASSERT(FIRST_NONSTRING_TYPE == Internals::kFirstNonstringType);
791 STATIC_ASSERT(ODDBALL_TYPE == Internals::kOddballType); 884 STATIC_ASSERT(ODDBALL_TYPE == Internals::kOddballType);
792 STATIC_ASSERT(FOREIGN_TYPE == Internals::kForeignType); 885 STATIC_ASSERT(FOREIGN_TYPE == Internals::kForeignType);
793 886
794 V8_EXPORT_PRIVATE std::ostream& operator<<(std::ostream& os, 887 V8_EXPORT_PRIVATE std::ostream& operator<<(std::ostream& os,
795 InstanceType instance_type); 888 InstanceType instance_type);
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after
1021 V(JSDate) \ 1114 V(JSDate) \
1022 V(JSMessageObject) \ 1115 V(JSMessageObject) \
1023 V(StringWrapper) \ 1116 V(StringWrapper) \
1024 V(Foreign) \ 1117 V(Foreign) \
1025 V(Boolean) \ 1118 V(Boolean) \
1026 V(JSArray) \ 1119 V(JSArray) \
1027 V(JSArrayBuffer) \ 1120 V(JSArrayBuffer) \
1028 V(JSArrayBufferView) \ 1121 V(JSArrayBufferView) \
1029 V(JSCollection) \ 1122 V(JSCollection) \
1030 V(JSTypedArray) \ 1123 V(JSTypedArray) \
1124 V(JSArrayIterator) \
1031 V(JSDataView) \ 1125 V(JSDataView) \
1032 V(JSProxy) \ 1126 V(JSProxy) \
1033 V(JSError) \ 1127 V(JSError) \
1034 V(JSPromise) \ 1128 V(JSPromise) \
1035 V(JSStringIterator) \ 1129 V(JSStringIterator) \
1036 V(JSSet) \ 1130 V(JSSet) \
1037 V(JSMap) \ 1131 V(JSMap) \
1038 V(JSSetIterator) \ 1132 V(JSSetIterator) \
1039 V(JSMapIterator) \ 1133 V(JSMapIterator) \
1040 V(JSWeakCollection) \ 1134 V(JSWeakCollection) \
(...skipping 9467 matching lines...) Expand 10 before | Expand all | Expand 10 after
10508 static void Clear(Handle<JSMap> map); 10602 static void Clear(Handle<JSMap> map);
10509 10603
10510 // Dispatched behavior. 10604 // Dispatched behavior.
10511 DECLARE_PRINTER(JSMap) 10605 DECLARE_PRINTER(JSMap)
10512 DECLARE_VERIFIER(JSMap) 10606 DECLARE_VERIFIER(JSMap)
10513 10607
10514 private: 10608 private:
10515 DISALLOW_IMPLICIT_CONSTRUCTORS(JSMap); 10609 DISALLOW_IMPLICIT_CONSTRUCTORS(JSMap);
10516 }; 10610 };
10517 10611
10612 class JSArrayIterator : public JSObject {
10613 public:
10614 DECLARE_PRINTER(JSArrayIterator)
10615 DECLARE_VERIFIER(JSArrayIterator)
10616
10617 DECLARE_CAST(JSArrayIterator)
10618
10619 // [object]: the [[IteratedObject]] internal field.
10620 DECL_ACCESSORS(object, Object)
10621
10622 // [index]: The [[ArrayIteratorNextIndex]] internal field.
10623 DECL_ACCESSORS(index, Object)
10624
10625 // [map]: The Map of the [[IteratedObject]] field at the time the iterator is
10626 // allocated.
10627 DECL_ACCESSORS(object_map, Object)
10628
10629 static const int kIteratedObjectOffset = JSObject::kHeaderSize;
10630 static const int kNextIndexOffset = kIteratedObjectOffset + kPointerSize;
10631 static const int kIteratedObjectMapOffset = kNextIndexOffset + kPointerSize;
10632 static const int kSize = kIteratedObjectMapOffset + kPointerSize;
10633
10634 private:
10635 DISALLOW_IMPLICIT_CONSTRUCTORS(JSArrayIterator);
10636 };
10637
10518 class JSStringIterator : public JSObject { 10638 class JSStringIterator : public JSObject {
10519 public: 10639 public:
10520 // Dispatched behavior. 10640 // Dispatched behavior.
10521 DECLARE_PRINTER(JSStringIterator) 10641 DECLARE_PRINTER(JSStringIterator)
10522 DECLARE_VERIFIER(JSStringIterator) 10642 DECLARE_VERIFIER(JSStringIterator)
10523 10643
10524 DECLARE_CAST(JSStringIterator) 10644 DECLARE_CAST(JSStringIterator)
10525 10645
10526 // [string]: the [[IteratedString]] internal field. 10646 // [string]: the [[IteratedString]] internal field.
10527 DECL_ACCESSORS(string, String) 10647 DECL_ACCESSORS(string, String)
(...skipping 1081 matching lines...) Expand 10 before | Expand all | Expand 10 after
11609 } 11729 }
11610 return value; 11730 return value;
11611 } 11731 }
11612 }; 11732 };
11613 11733
11614 11734
11615 } // NOLINT, false-positive due to second-order macros. 11735 } // NOLINT, false-positive due to second-order macros.
11616 } // NOLINT, false-positive due to second-order macros. 11736 } // NOLINT, false-positive due to second-order macros.
11617 11737
11618 #endif // V8_OBJECTS_H_ 11738 #endif // V8_OBJECTS_H_
OLDNEW
« no previous file with comments | « src/js/array-iterator.js ('k') | src/objects-body-descriptors-inl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698