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

Side by Side Diff: src/objects.h

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