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

Side by Side Diff: src/objects.h

Issue 1262583002: Reland of "Remove ExternalArray, derived types, and element kinds" (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: updates Created 5 years, 4 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/mips64/lithium-mips64.cc ('k') | src/objects.cc » ('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 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 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 // - OrderedHashSet 86 // - OrderedHashSet
87 // - OrderedHashMap 87 // - OrderedHashMap
88 // - Context 88 // - Context
89 // - TypeFeedbackVector 89 // - TypeFeedbackVector
90 // - JSFunctionResultCache 90 // - JSFunctionResultCache
91 // - ScopeInfo 91 // - ScopeInfo
92 // - TransitionArray 92 // - TransitionArray
93 // - ScriptContextTable 93 // - ScriptContextTable
94 // - WeakFixedArray 94 // - WeakFixedArray
95 // - FixedDoubleArray 95 // - FixedDoubleArray
96 // - ExternalArray
97 // - ExternalUint8ClampedArray
98 // - ExternalInt8Array
99 // - ExternalUint8Array
100 // - ExternalInt16Array
101 // - ExternalUint16Array
102 // - ExternalInt32Array
103 // - ExternalUint32Array
104 // - ExternalFloat32Array
105 // - Name 96 // - Name
106 // - String 97 // - String
107 // - SeqString 98 // - SeqString
108 // - SeqOneByteString 99 // - SeqOneByteString
109 // - SeqTwoByteString 100 // - SeqTwoByteString
110 // - SlicedString 101 // - SlicedString
111 // - ConsString 102 // - ConsString
112 // - ExternalString 103 // - ExternalString
113 // - ExternalOneByteString 104 // - ExternalOneByteString
114 // - ExternalTwoByteString 105 // - ExternalTwoByteString
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after
385 V(ODDBALL_TYPE) \ 376 V(ODDBALL_TYPE) \
386 V(CELL_TYPE) \ 377 V(CELL_TYPE) \
387 V(PROPERTY_CELL_TYPE) \ 378 V(PROPERTY_CELL_TYPE) \
388 \ 379 \
389 V(HEAP_NUMBER_TYPE) \ 380 V(HEAP_NUMBER_TYPE) \
390 V(MUTABLE_HEAP_NUMBER_TYPE) \ 381 V(MUTABLE_HEAP_NUMBER_TYPE) \
391 V(FOREIGN_TYPE) \ 382 V(FOREIGN_TYPE) \
392 V(BYTE_ARRAY_TYPE) \ 383 V(BYTE_ARRAY_TYPE) \
393 V(BYTECODE_ARRAY_TYPE) \ 384 V(BYTECODE_ARRAY_TYPE) \
394 V(FREE_SPACE_TYPE) \ 385 V(FREE_SPACE_TYPE) \
395 /* Note: the order of these external array */ \
396 /* types is relied upon in */ \
397 /* Object::IsExternalArray(). */ \
398 V(EXTERNAL_INT8_ARRAY_TYPE) \
399 V(EXTERNAL_UINT8_ARRAY_TYPE) \
400 V(EXTERNAL_INT16_ARRAY_TYPE) \
401 V(EXTERNAL_UINT16_ARRAY_TYPE) \
402 V(EXTERNAL_INT32_ARRAY_TYPE) \
403 V(EXTERNAL_UINT32_ARRAY_TYPE) \
404 V(EXTERNAL_FLOAT32_ARRAY_TYPE) \
405 V(EXTERNAL_FLOAT64_ARRAY_TYPE) \
406 V(EXTERNAL_UINT8_CLAMPED_ARRAY_TYPE) \
407 \ 386 \
408 V(FIXED_INT8_ARRAY_TYPE) \ 387 V(FIXED_INT8_ARRAY_TYPE) \
409 V(FIXED_UINT8_ARRAY_TYPE) \ 388 V(FIXED_UINT8_ARRAY_TYPE) \
410 V(FIXED_INT16_ARRAY_TYPE) \ 389 V(FIXED_INT16_ARRAY_TYPE) \
411 V(FIXED_UINT16_ARRAY_TYPE) \ 390 V(FIXED_UINT16_ARRAY_TYPE) \
412 V(FIXED_INT32_ARRAY_TYPE) \ 391 V(FIXED_INT32_ARRAY_TYPE) \
413 V(FIXED_UINT32_ARRAY_TYPE) \ 392 V(FIXED_UINT32_ARRAY_TYPE) \
414 V(FIXED_FLOAT32_ARRAY_TYPE) \ 393 V(FIXED_FLOAT32_ARRAY_TYPE) \
415 V(FIXED_FLOAT64_ARRAY_TYPE) \ 394 V(FIXED_FLOAT64_ARRAY_TYPE) \
416 V(FIXED_UINT8_CLAMPED_ARRAY_TYPE) \ 395 V(FIXED_UINT8_CLAMPED_ARRAY_TYPE) \
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after
682 661
683 // "Data", objects that cannot contain non-map-word pointers to heap 662 // "Data", objects that cannot contain non-map-word pointers to heap
684 // objects. 663 // objects.
685 HEAP_NUMBER_TYPE, 664 HEAP_NUMBER_TYPE,
686 MUTABLE_HEAP_NUMBER_TYPE, 665 MUTABLE_HEAP_NUMBER_TYPE,
687 FLOAT32X4_TYPE, // FIRST_SIMD_TYPE, LAST_SIMD_TYPE 666 FLOAT32X4_TYPE, // FIRST_SIMD_TYPE, LAST_SIMD_TYPE
688 FOREIGN_TYPE, 667 FOREIGN_TYPE,
689 BYTE_ARRAY_TYPE, 668 BYTE_ARRAY_TYPE,
690 BYTECODE_ARRAY_TYPE, 669 BYTECODE_ARRAY_TYPE,
691 FREE_SPACE_TYPE, 670 FREE_SPACE_TYPE,
692 EXTERNAL_INT8_ARRAY_TYPE, // FIRST_EXTERNAL_ARRAY_TYPE
693 EXTERNAL_UINT8_ARRAY_TYPE,
694 EXTERNAL_INT16_ARRAY_TYPE,
695 EXTERNAL_UINT16_ARRAY_TYPE,
696 EXTERNAL_INT32_ARRAY_TYPE,
697 EXTERNAL_UINT32_ARRAY_TYPE,
698 EXTERNAL_FLOAT32_ARRAY_TYPE,
699 EXTERNAL_FLOAT64_ARRAY_TYPE,
700 EXTERNAL_UINT8_CLAMPED_ARRAY_TYPE, // LAST_EXTERNAL_ARRAY_TYPE
701 FIXED_INT8_ARRAY_TYPE, // FIRST_FIXED_TYPED_ARRAY_TYPE 671 FIXED_INT8_ARRAY_TYPE, // FIRST_FIXED_TYPED_ARRAY_TYPE
702 FIXED_UINT8_ARRAY_TYPE, 672 FIXED_UINT8_ARRAY_TYPE,
703 FIXED_INT16_ARRAY_TYPE, 673 FIXED_INT16_ARRAY_TYPE,
704 FIXED_UINT16_ARRAY_TYPE, 674 FIXED_UINT16_ARRAY_TYPE,
705 FIXED_INT32_ARRAY_TYPE, 675 FIXED_INT32_ARRAY_TYPE,
706 FIXED_UINT32_ARRAY_TYPE, 676 FIXED_UINT32_ARRAY_TYPE,
707 FIXED_FLOAT32_ARRAY_TYPE, 677 FIXED_FLOAT32_ARRAY_TYPE,
708 FIXED_FLOAT64_ARRAY_TYPE, 678 FIXED_FLOAT64_ARRAY_TYPE,
709 FIXED_UINT8_CLAMPED_ARRAY_TYPE, // LAST_FIXED_TYPED_ARRAY_TYPE 679 FIXED_UINT8_CLAMPED_ARRAY_TYPE, // LAST_FIXED_TYPED_ARRAY_TYPE
710 FIXED_DOUBLE_ARRAY_TYPE, 680 FIXED_DOUBLE_ARRAY_TYPE,
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
773 FIRST_TYPE = 0x0, 743 FIRST_TYPE = 0x0,
774 LAST_TYPE = JS_FUNCTION_TYPE, 744 LAST_TYPE = JS_FUNCTION_TYPE,
775 FIRST_NAME_TYPE = FIRST_TYPE, 745 FIRST_NAME_TYPE = FIRST_TYPE,
776 LAST_NAME_TYPE = SYMBOL_TYPE, 746 LAST_NAME_TYPE = SYMBOL_TYPE,
777 FIRST_UNIQUE_NAME_TYPE = INTERNALIZED_STRING_TYPE, 747 FIRST_UNIQUE_NAME_TYPE = INTERNALIZED_STRING_TYPE,
778 LAST_UNIQUE_NAME_TYPE = SYMBOL_TYPE, 748 LAST_UNIQUE_NAME_TYPE = SYMBOL_TYPE,
779 FIRST_NONSTRING_TYPE = SYMBOL_TYPE, 749 FIRST_NONSTRING_TYPE = SYMBOL_TYPE,
780 // Boundaries for testing for a SIMD type. 750 // Boundaries for testing for a SIMD type.
781 FIRST_SIMD_TYPE = FLOAT32X4_TYPE, 751 FIRST_SIMD_TYPE = FLOAT32X4_TYPE,
782 LAST_SIMD_TYPE = FLOAT32X4_TYPE, 752 LAST_SIMD_TYPE = FLOAT32X4_TYPE,
783 // Boundaries for testing for an external array.
784 FIRST_EXTERNAL_ARRAY_TYPE = EXTERNAL_INT8_ARRAY_TYPE,
785 LAST_EXTERNAL_ARRAY_TYPE = EXTERNAL_UINT8_CLAMPED_ARRAY_TYPE,
786 // Boundaries for testing for a fixed typed array. 753 // Boundaries for testing for a fixed typed array.
787 FIRST_FIXED_TYPED_ARRAY_TYPE = FIXED_INT8_ARRAY_TYPE, 754 FIRST_FIXED_TYPED_ARRAY_TYPE = FIXED_INT8_ARRAY_TYPE,
788 LAST_FIXED_TYPED_ARRAY_TYPE = FIXED_UINT8_CLAMPED_ARRAY_TYPE, 755 LAST_FIXED_TYPED_ARRAY_TYPE = FIXED_UINT8_CLAMPED_ARRAY_TYPE,
789 // Boundary for promotion to old space. 756 // Boundary for promotion to old space.
790 LAST_DATA_TYPE = FILLER_TYPE, 757 LAST_DATA_TYPE = FILLER_TYPE,
791 // Boundary for objects represented as JSReceiver (i.e. JSObject or JSProxy). 758 // Boundary for objects represented as JSReceiver (i.e. JSObject or JSProxy).
792 // Note that there is no range for JSObject or JSProxy, since their subtypes 759 // Note that there is no range for JSObject or JSProxy, since their subtypes
793 // are not continuous in this enum! The enum ranges instead reflect the 760 // are not continuous in this enum! The enum ranges instead reflect the
794 // external class names, where proxies are treated as either ordinary objects, 761 // external class names, where proxies are treated as either ordinary objects,
795 // or functions. 762 // or functions.
796 FIRST_JS_RECEIVER_TYPE = JS_FUNCTION_PROXY_TYPE, 763 FIRST_JS_RECEIVER_TYPE = JS_FUNCTION_PROXY_TYPE,
797 LAST_JS_RECEIVER_TYPE = LAST_TYPE, 764 LAST_JS_RECEIVER_TYPE = LAST_TYPE,
798 // Boundaries for testing the types represented as JSObject 765 // Boundaries for testing the types represented as JSObject
799 FIRST_JS_OBJECT_TYPE = JS_VALUE_TYPE, 766 FIRST_JS_OBJECT_TYPE = JS_VALUE_TYPE,
800 LAST_JS_OBJECT_TYPE = LAST_TYPE, 767 LAST_JS_OBJECT_TYPE = LAST_TYPE,
801 // Boundaries for testing the types represented as JSProxy 768 // Boundaries for testing the types represented as JSProxy
802 FIRST_JS_PROXY_TYPE = JS_FUNCTION_PROXY_TYPE, 769 FIRST_JS_PROXY_TYPE = JS_FUNCTION_PROXY_TYPE,
803 LAST_JS_PROXY_TYPE = JS_PROXY_TYPE, 770 LAST_JS_PROXY_TYPE = JS_PROXY_TYPE,
804 // Boundaries for testing whether the type is a JavaScript object. 771 // Boundaries for testing whether the type is a JavaScript object.
805 FIRST_SPEC_OBJECT_TYPE = FIRST_JS_RECEIVER_TYPE, 772 FIRST_SPEC_OBJECT_TYPE = FIRST_JS_RECEIVER_TYPE,
806 LAST_SPEC_OBJECT_TYPE = LAST_JS_RECEIVER_TYPE, 773 LAST_SPEC_OBJECT_TYPE = LAST_JS_RECEIVER_TYPE,
807 // Boundaries for testing the types for which typeof is "object". 774 // Boundaries for testing the types for which typeof is "object".
808 FIRST_NONCALLABLE_SPEC_OBJECT_TYPE = JS_PROXY_TYPE, 775 FIRST_NONCALLABLE_SPEC_OBJECT_TYPE = JS_PROXY_TYPE,
809 LAST_NONCALLABLE_SPEC_OBJECT_TYPE = JS_REGEXP_TYPE, 776 LAST_NONCALLABLE_SPEC_OBJECT_TYPE = JS_REGEXP_TYPE,
810 // Note that the types for which typeof is "function" are not continuous. 777 // Note that the types for which typeof is "function" are not continuous.
811 // Define this so that we can put assertions on discrete checks. 778 // Define this so that we can put assertions on discrete checks.
812 NUM_OF_CALLABLE_SPEC_OBJECT_TYPES = 2 779 NUM_OF_CALLABLE_SPEC_OBJECT_TYPES = 2
813 }; 780 };
814 781
815 const int kExternalArrayTypeCount =
816 LAST_EXTERNAL_ARRAY_TYPE - FIRST_EXTERNAL_ARRAY_TYPE + 1;
817
818 STATIC_ASSERT(JS_OBJECT_TYPE == Internals::kJSObjectType); 782 STATIC_ASSERT(JS_OBJECT_TYPE == Internals::kJSObjectType);
819 STATIC_ASSERT(FIRST_NONSTRING_TYPE == Internals::kFirstNonstringType); 783 STATIC_ASSERT(FIRST_NONSTRING_TYPE == Internals::kFirstNonstringType);
820 STATIC_ASSERT(ODDBALL_TYPE == Internals::kOddballType); 784 STATIC_ASSERT(ODDBALL_TYPE == Internals::kOddballType);
821 STATIC_ASSERT(FOREIGN_TYPE == Internals::kForeignType); 785 STATIC_ASSERT(FOREIGN_TYPE == Internals::kForeignType);
822 786
823 787
824 #define FIXED_ARRAY_SUB_INSTANCE_TYPE_LIST(V) \ 788 #define FIXED_ARRAY_SUB_INSTANCE_TYPE_LIST(V) \
825 V(FAST_ELEMENTS_SUB_TYPE) \ 789 V(FAST_ELEMENTS_SUB_TYPE) \
826 V(DICTIONARY_ELEMENTS_SUB_TYPE) \ 790 V(DICTIONARY_ELEMENTS_SUB_TYPE) \
827 V(FAST_PROPERTIES_SUB_TYPE) \ 791 V(FAST_PROPERTIES_SUB_TYPE) \
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
926 V(ExternalString) \ 890 V(ExternalString) \
927 V(ConsString) \ 891 V(ConsString) \
928 V(SlicedString) \ 892 V(SlicedString) \
929 V(ExternalTwoByteString) \ 893 V(ExternalTwoByteString) \
930 V(ExternalOneByteString) \ 894 V(ExternalOneByteString) \
931 V(SeqTwoByteString) \ 895 V(SeqTwoByteString) \
932 V(SeqOneByteString) \ 896 V(SeqOneByteString) \
933 V(InternalizedString) \ 897 V(InternalizedString) \
934 V(Symbol) \ 898 V(Symbol) \
935 \ 899 \
936 V(ExternalArray) \
937 V(ExternalInt8Array) \
938 V(ExternalUint8Array) \
939 V(ExternalInt16Array) \
940 V(ExternalUint16Array) \
941 V(ExternalInt32Array) \
942 V(ExternalUint32Array) \
943 V(ExternalFloat32Array) \
944 V(ExternalFloat64Array) \
945 V(ExternalUint8ClampedArray) \
946 V(FixedTypedArrayBase) \ 900 V(FixedTypedArrayBase) \
947 V(FixedUint8Array) \ 901 V(FixedUint8Array) \
948 V(FixedInt8Array) \ 902 V(FixedInt8Array) \
949 V(FixedUint16Array) \ 903 V(FixedUint16Array) \
950 V(FixedInt16Array) \ 904 V(FixedInt16Array) \
951 V(FixedUint32Array) \ 905 V(FixedUint32Array) \
952 V(FixedInt32Array) \ 906 V(FixedInt32Array) \
953 V(FixedFloat32Array) \ 907 V(FixedFloat32Array) \
954 V(FixedFloat64Array) \ 908 V(FixedFloat64Array) \
955 V(FixedUint8ClampedArray) \ 909 V(FixedUint8ClampedArray) \
(...skipping 809 matching lines...) Expand 10 before | Expand all | Expand 10 after
1765 // 1719 //
1766 // In the fast mode elements is a FixedArray and so each element can 1720 // In the fast mode elements is a FixedArray and so each element can
1767 // be quickly accessed. This fact is used in the generated code. The 1721 // be quickly accessed. This fact is used in the generated code. The
1768 // elements array can have one of three maps in this mode: 1722 // elements array can have one of three maps in this mode:
1769 // fixed_array_map, sloppy_arguments_elements_map or 1723 // fixed_array_map, sloppy_arguments_elements_map or
1770 // fixed_cow_array_map (for copy-on-write arrays). In the latter case 1724 // fixed_cow_array_map (for copy-on-write arrays). In the latter case
1771 // the elements array may be shared by a few objects and so before 1725 // the elements array may be shared by a few objects and so before
1772 // writing to any element the array must be copied. Use 1726 // writing to any element the array must be copied. Use
1773 // EnsureWritableFastElements in this case. 1727 // EnsureWritableFastElements in this case.
1774 // 1728 //
1775 // In the slow mode the elements is either a NumberDictionary, an 1729 // In the slow mode the elements is either a NumberDictionary, a
1776 // ExternalArray, or a FixedArray parameter map for a (sloppy) 1730 // FixedArray parameter map for a (sloppy) arguments object.
1777 // arguments object.
1778 DECL_ACCESSORS(elements, FixedArrayBase) 1731 DECL_ACCESSORS(elements, FixedArrayBase)
1779 inline void initialize_elements(); 1732 inline void initialize_elements();
1780 static void ResetElements(Handle<JSObject> object); 1733 static void ResetElements(Handle<JSObject> object);
1781 static inline void SetMapAndElements(Handle<JSObject> object, 1734 static inline void SetMapAndElements(Handle<JSObject> object,
1782 Handle<Map> map, 1735 Handle<Map> map,
1783 Handle<FixedArrayBase> elements); 1736 Handle<FixedArrayBase> elements);
1784 inline ElementsKind GetElementsKind(); 1737 inline ElementsKind GetElementsKind();
1785 ElementsAccessor* GetElementsAccessor(); 1738 ElementsAccessor* GetElementsAccessor();
1786 // Returns true if an object has elements of FAST_SMI_ELEMENTS ElementsKind. 1739 // Returns true if an object has elements of FAST_SMI_ELEMENTS ElementsKind.
1787 inline bool HasFastSmiElements(); 1740 inline bool HasFastSmiElements();
1788 // Returns true if an object has elements of FAST_ELEMENTS ElementsKind. 1741 // Returns true if an object has elements of FAST_ELEMENTS ElementsKind.
1789 inline bool HasFastObjectElements(); 1742 inline bool HasFastObjectElements();
1790 // Returns true if an object has elements of FAST_ELEMENTS or 1743 // Returns true if an object has elements of FAST_ELEMENTS or
1791 // FAST_SMI_ONLY_ELEMENTS. 1744 // FAST_SMI_ONLY_ELEMENTS.
1792 inline bool HasFastSmiOrObjectElements(); 1745 inline bool HasFastSmiOrObjectElements();
1793 // Returns true if an object has any of the fast elements kinds. 1746 // Returns true if an object has any of the fast elements kinds.
1794 inline bool HasFastElements(); 1747 inline bool HasFastElements();
1795 // Returns true if an object has elements of FAST_DOUBLE_ELEMENTS 1748 // Returns true if an object has elements of FAST_DOUBLE_ELEMENTS
1796 // ElementsKind. 1749 // ElementsKind.
1797 inline bool HasFastDoubleElements(); 1750 inline bool HasFastDoubleElements();
1798 // Returns true if an object has elements of FAST_HOLEY_*_ELEMENTS 1751 // Returns true if an object has elements of FAST_HOLEY_*_ELEMENTS
1799 // ElementsKind. 1752 // ElementsKind.
1800 inline bool HasFastHoleyElements(); 1753 inline bool HasFastHoleyElements();
1801 inline bool HasSloppyArgumentsElements(); 1754 inline bool HasSloppyArgumentsElements();
1802 inline bool HasDictionaryElements(); 1755 inline bool HasDictionaryElements();
1803 1756
1804 inline bool HasExternalUint8ClampedElements();
1805 inline bool HasExternalArrayElements();
1806 inline bool HasExternalInt8Elements();
1807 inline bool HasExternalUint8Elements();
1808 inline bool HasExternalInt16Elements();
1809 inline bool HasExternalUint16Elements();
1810 inline bool HasExternalInt32Elements();
1811 inline bool HasExternalUint32Elements();
1812 inline bool HasExternalFloat32Elements();
1813 inline bool HasExternalFloat64Elements();
1814
1815 inline bool HasFixedTypedArrayElements(); 1757 inline bool HasFixedTypedArrayElements();
1816 1758
1817 inline bool HasFixedUint8ClampedElements(); 1759 inline bool HasFixedUint8ClampedElements();
1818 inline bool HasFixedArrayElements(); 1760 inline bool HasFixedArrayElements();
1819 inline bool HasFixedInt8Elements(); 1761 inline bool HasFixedInt8Elements();
1820 inline bool HasFixedUint8Elements(); 1762 inline bool HasFixedUint8Elements();
1821 inline bool HasFixedInt16Elements(); 1763 inline bool HasFixedInt16Elements();
1822 inline bool HasFixedUint16Elements(); 1764 inline bool HasFixedUint16Elements();
1823 inline bool HasFixedInt32Elements(); 1765 inline bool HasFixedInt32Elements();
1824 inline bool HasFixedUint32Elements(); 1766 inline bool HasFixedUint32Elements();
(...skipping 2502 matching lines...) Expand 10 before | Expand all | Expand 10 after
4327 V(Int8, int8, INT8, int8_t, 1) \ 4269 V(Int8, int8, INT8, int8_t, 1) \
4328 V(Uint16, uint16, UINT16, uint16_t, 2) \ 4270 V(Uint16, uint16, UINT16, uint16_t, 2) \
4329 V(Int16, int16, INT16, int16_t, 2) \ 4271 V(Int16, int16, INT16, int16_t, 2) \
4330 V(Uint32, uint32, UINT32, uint32_t, 4) \ 4272 V(Uint32, uint32, UINT32, uint32_t, 4) \
4331 V(Int32, int32, INT32, int32_t, 4) \ 4273 V(Int32, int32, INT32, int32_t, 4) \
4332 V(Float32, float32, FLOAT32, float, 4) \ 4274 V(Float32, float32, FLOAT32, float, 4) \
4333 V(Float64, float64, FLOAT64, double, 8) \ 4275 V(Float64, float64, FLOAT64, double, 8) \
4334 V(Uint8Clamped, uint8_clamped, UINT8_CLAMPED, uint8_t, 1) 4276 V(Uint8Clamped, uint8_clamped, UINT8_CLAMPED, uint8_t, 1)
4335 4277
4336 4278
4337
4338 // An ExternalArray represents a fixed-size array of primitive values
4339 // which live outside the JavaScript heap. Its subclasses are used to
4340 // implement the CanvasArray types being defined in the WebGL
4341 // specification. As of this writing the first public draft is not yet
4342 // available, but Khronos members can access the draft at:
4343 // https://cvs.khronos.org/svn/repos/3dweb/trunk/doc/spec/WebGL-spec.html
4344 //
4345 // The semantics of these arrays differ from CanvasPixelArray.
4346 // Out-of-range values passed to the setter are converted via a C
4347 // cast, not clamping. Out-of-range indices cause exceptions to be
4348 // raised rather than being silently ignored.
4349 class ExternalArray: public FixedArrayBase {
4350 public:
4351 inline bool is_the_hole(int index) { return false; }
4352
4353 // [external_pointer]: The pointer to the external memory area backing this
4354 // external array.
4355 DECL_ACCESSORS(external_pointer, void) // Pointer to the data store.
4356
4357 DECLARE_CAST(ExternalArray)
4358
4359 // Maximal acceptable length for an external array.
4360 static const int kMaxLength = 0x3fffffff;
4361
4362 // ExternalArray headers are not quadword aligned.
4363 static const int kExternalPointerOffset =
4364 POINTER_SIZE_ALIGN(FixedArrayBase::kLengthOffset + kPointerSize);
4365 static const int kSize = kExternalPointerOffset + kPointerSize;
4366
4367 private:
4368 DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalArray);
4369 };
4370
4371
4372 // A ExternalUint8ClampedArray represents a fixed-size byte array with special
4373 // semantics used for implementing the CanvasPixelArray object. Please see the
4374 // specification at:
4375
4376 // http://www.whatwg.org/specs/web-apps/current-work/
4377 // multipage/the-canvas-element.html#canvaspixelarray
4378 // In particular, write access clamps the value written to 0 or 255 if the
4379 // value written is outside this range.
4380 class ExternalUint8ClampedArray: public ExternalArray {
4381 public:
4382 inline uint8_t* external_uint8_clamped_pointer();
4383
4384 // Setter and getter.
4385 inline uint8_t get_scalar(int index);
4386 static inline Handle<Object> get(Handle<ExternalUint8ClampedArray> array,
4387 int index);
4388 inline void set(int index, uint8_t value);
4389
4390 // This accessor applies the correct conversion from Smi, HeapNumber
4391 // and undefined and clamps the converted value between 0 and 255.
4392 void SetValue(uint32_t index, Object* value);
4393
4394 DECLARE_CAST(ExternalUint8ClampedArray)
4395
4396 // Dispatched behavior.
4397 DECLARE_PRINTER(ExternalUint8ClampedArray)
4398 DECLARE_VERIFIER(ExternalUint8ClampedArray)
4399
4400 private:
4401 DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalUint8ClampedArray);
4402 };
4403
4404
4405 class ExternalInt8Array: public ExternalArray {
4406 public:
4407 // Setter and getter.
4408 inline int8_t get_scalar(int index);
4409 static inline Handle<Object> get(Handle<ExternalInt8Array> array, int index);
4410 inline void set(int index, int8_t value);
4411
4412 // This accessor applies the correct conversion from Smi, HeapNumber
4413 // and undefined.
4414 void SetValue(uint32_t index, Object* value);
4415
4416 DECLARE_CAST(ExternalInt8Array)
4417
4418 // Dispatched behavior.
4419 DECLARE_PRINTER(ExternalInt8Array)
4420 DECLARE_VERIFIER(ExternalInt8Array)
4421
4422 private:
4423 DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalInt8Array);
4424 };
4425
4426
4427 class ExternalUint8Array: public ExternalArray {
4428 public:
4429 // Setter and getter.
4430 inline uint8_t get_scalar(int index);
4431 static inline Handle<Object> get(Handle<ExternalUint8Array> array, int index);
4432 inline void set(int index, uint8_t value);
4433
4434 // This accessor applies the correct conversion from Smi, HeapNumber
4435 // and undefined.
4436 void SetValue(uint32_t index, Object* value);
4437
4438 DECLARE_CAST(ExternalUint8Array)
4439
4440 // Dispatched behavior.
4441 DECLARE_PRINTER(ExternalUint8Array)
4442 DECLARE_VERIFIER(ExternalUint8Array)
4443
4444 private:
4445 DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalUint8Array);
4446 };
4447
4448
4449 class ExternalInt16Array: public ExternalArray {
4450 public:
4451 // Setter and getter.
4452 inline int16_t get_scalar(int index);
4453 static inline Handle<Object> get(Handle<ExternalInt16Array> array, int index);
4454 inline void set(int index, int16_t value);
4455
4456 // This accessor applies the correct conversion from Smi, HeapNumber
4457 // and undefined.
4458 void SetValue(uint32_t index, Object* value);
4459
4460 DECLARE_CAST(ExternalInt16Array)
4461
4462 // Dispatched behavior.
4463 DECLARE_PRINTER(ExternalInt16Array)
4464 DECLARE_VERIFIER(ExternalInt16Array)
4465
4466 private:
4467 DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalInt16Array);
4468 };
4469
4470
4471 class ExternalUint16Array: public ExternalArray {
4472 public:
4473 // Setter and getter.
4474 inline uint16_t get_scalar(int index);
4475 static inline Handle<Object> get(Handle<ExternalUint16Array> array,
4476 int index);
4477 inline void set(int index, uint16_t value);
4478
4479 // This accessor applies the correct conversion from Smi, HeapNumber
4480 // and undefined.
4481 void SetValue(uint32_t index, Object* value);
4482
4483 DECLARE_CAST(ExternalUint16Array)
4484
4485 // Dispatched behavior.
4486 DECLARE_PRINTER(ExternalUint16Array)
4487 DECLARE_VERIFIER(ExternalUint16Array)
4488
4489 private:
4490 DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalUint16Array);
4491 };
4492
4493
4494 class ExternalInt32Array: public ExternalArray {
4495 public:
4496 // Setter and getter.
4497 inline int32_t get_scalar(int index);
4498 static inline Handle<Object> get(Handle<ExternalInt32Array> array, int index);
4499 inline void set(int index, int32_t value);
4500
4501 // This accessor applies the correct conversion from Smi, HeapNumber
4502 // and undefined.
4503 void SetValue(uint32_t index, Object* value);
4504
4505 DECLARE_CAST(ExternalInt32Array)
4506
4507 // Dispatched behavior.
4508 DECLARE_PRINTER(ExternalInt32Array)
4509 DECLARE_VERIFIER(ExternalInt32Array)
4510
4511 private:
4512 DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalInt32Array);
4513 };
4514
4515
4516 class ExternalUint32Array: public ExternalArray {
4517 public:
4518 // Setter and getter.
4519 inline uint32_t get_scalar(int index);
4520 static inline Handle<Object> get(Handle<ExternalUint32Array> array,
4521 int index);
4522 inline void set(int index, uint32_t value);
4523
4524 // This accessor applies the correct conversion from Smi, HeapNumber
4525 // and undefined.
4526 void SetValue(uint32_t index, Object* value);
4527
4528 DECLARE_CAST(ExternalUint32Array)
4529
4530 // Dispatched behavior.
4531 DECLARE_PRINTER(ExternalUint32Array)
4532 DECLARE_VERIFIER(ExternalUint32Array)
4533
4534 private:
4535 DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalUint32Array);
4536 };
4537
4538
4539 class ExternalFloat32Array: public ExternalArray {
4540 public:
4541 // Setter and getter.
4542 inline float get_scalar(int index);
4543 static inline Handle<Object> get(Handle<ExternalFloat32Array> array,
4544 int index);
4545 inline void set(int index, float value);
4546
4547 // This accessor applies the correct conversion from Smi, HeapNumber
4548 // and undefined.
4549 void SetValue(uint32_t index, Object* value);
4550
4551 DECLARE_CAST(ExternalFloat32Array)
4552
4553 // Dispatched behavior.
4554 DECLARE_PRINTER(ExternalFloat32Array)
4555 DECLARE_VERIFIER(ExternalFloat32Array)
4556
4557 private:
4558 DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalFloat32Array);
4559 };
4560
4561
4562 class ExternalFloat64Array: public ExternalArray {
4563 public:
4564 // Setter and getter.
4565 inline double get_scalar(int index);
4566 static inline Handle<Object> get(Handle<ExternalFloat64Array> array,
4567 int index);
4568 inline void set(int index, double value);
4569
4570 // This accessor applies the correct conversion from Smi, HeapNumber
4571 // and undefined.
4572 void SetValue(uint32_t index, Object* value);
4573
4574 DECLARE_CAST(ExternalFloat64Array)
4575
4576 // Dispatched behavior.
4577 DECLARE_PRINTER(ExternalFloat64Array)
4578 DECLARE_VERIFIER(ExternalFloat64Array)
4579
4580 private:
4581 DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalFloat64Array);
4582 };
4583
4584
4585 class FixedTypedArrayBase: public FixedArrayBase { 4279 class FixedTypedArrayBase: public FixedArrayBase {
4586 public: 4280 public:
4587 // [base_pointer]: For now, points to the FixedTypedArrayBase itself. 4281 // [base_pointer]: Either points to the FixedTypedArrayBase itself or nullptr.
4588 DECL_ACCESSORS(base_pointer, Object) 4282 DECL_ACCESSORS(base_pointer, Object)
4589 4283
4590 // [external_pointer]: For now, contains the offset between base_pointer and 4284 // [external_pointer]: Contains the offset between base_pointer and the start
4591 // the start of the data. 4285 // of the data. If the base_pointer is a nullptr, the external_pointer
4286 // therefore points to the actual backing store.
4592 DECL_ACCESSORS(external_pointer, void) 4287 DECL_ACCESSORS(external_pointer, void)
4593 4288
4594 // Dispatched behavior. 4289 // Dispatched behavior.
4595 inline void FixedTypedArrayBaseIterateBody(ObjectVisitor* v); 4290 inline void FixedTypedArrayBaseIterateBody(ObjectVisitor* v);
4596 4291
4597 template <typename StaticVisitor> 4292 template <typename StaticVisitor>
4598 inline void FixedTypedArrayBaseIterateBody(); 4293 inline void FixedTypedArrayBaseIterateBody();
4599 4294
4600 DECLARE_CAST(FixedTypedArrayBase) 4295 DECLARE_CAST(FixedTypedArrayBase)
4601 4296
(...skipping 1130 matching lines...) Expand 10 before | Expand all | Expand 10 after
5732 } 5427 }
5733 5428
5734 inline bool has_fast_elements() { 5429 inline bool has_fast_elements() {
5735 return IsFastElementsKind(elements_kind()); 5430 return IsFastElementsKind(elements_kind());
5736 } 5431 }
5737 5432
5738 inline bool has_sloppy_arguments_elements() { 5433 inline bool has_sloppy_arguments_elements() {
5739 return IsSloppyArgumentsElements(elements_kind()); 5434 return IsSloppyArgumentsElements(elements_kind());
5740 } 5435 }
5741 5436
5742 inline bool has_external_array_elements() {
5743 return IsExternalArrayElementsKind(elements_kind());
5744 }
5745
5746 inline bool has_fixed_typed_array_elements() { 5437 inline bool has_fixed_typed_array_elements() {
5747 return IsFixedTypedArrayElementsKind(elements_kind()); 5438 return IsFixedTypedArrayElementsKind(elements_kind());
5748 } 5439 }
5749 5440
5750 inline bool has_dictionary_elements() { 5441 inline bool has_dictionary_elements() {
5751 return IsDictionaryElementsKind(elements_kind()); 5442 return IsDictionaryElementsKind(elements_kind());
5752 } 5443 }
5753 5444
5754 static bool IsValidElementsTransition(ElementsKind from_kind, 5445 static bool IsValidElementsTransition(ElementsKind from_kind,
5755 ElementsKind to_kind); 5446 ElementsKind to_kind);
(...skipping 5094 matching lines...) Expand 10 before | Expand all | Expand 10 after
10850 } else { 10541 } else {
10851 value &= ~(1 << bit_position); 10542 value &= ~(1 << bit_position);
10852 } 10543 }
10853 return value; 10544 return value;
10854 } 10545 }
10855 }; 10546 };
10856 10547
10857 } } // namespace v8::internal 10548 } } // namespace v8::internal
10858 10549
10859 #endif // V8_OBJECTS_H_ 10550 #endif // V8_OBJECTS_H_
OLDNEW
« no previous file with comments | « src/mips64/lithium-mips64.cc ('k') | src/objects.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698