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

Side by Side Diff: src/objects.h

Issue 145133013: External Array renaming and boilerplate scrapping (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 11 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 | Annotate | Revision Log
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 // - StringTable 89 // - StringTable
90 // - CompilationCacheTable 90 // - CompilationCacheTable
91 // - CodeCacheHashTable 91 // - CodeCacheHashTable
92 // - MapCache 92 // - MapCache
93 // - Context 93 // - Context
94 // - JSFunctionResultCache 94 // - JSFunctionResultCache
95 // - ScopeInfo 95 // - ScopeInfo
96 // - TransitionArray 96 // - TransitionArray
97 // - FixedDoubleArray 97 // - FixedDoubleArray
98 // - ExternalArray 98 // - ExternalArray
99 // - ExternalPixelArray 99 // - ExternalUint8ClampedArray
100 // - ExternalByteArray 100 // - ExternalInt8Array
101 // - ExternalUnsignedByteArray 101 // - ExternalUint8Array
102 // - ExternalShortArray 102 // - ExternalInt16Array
103 // - ExternalUnsignedShortArray 103 // - ExternalUint16Array
104 // - ExternalIntArray 104 // - ExternalInt32Array
105 // - ExternalUnsignedIntArray 105 // - ExternalUint32Array
106 // - ExternalFloatArray 106 // - ExternalFloat32Array
107 // - Name 107 // - Name
108 // - String 108 // - String
109 // - SeqString 109 // - SeqString
110 // - SeqOneByteString 110 // - SeqOneByteString
111 // - SeqTwoByteString 111 // - SeqTwoByteString
112 // - SlicedString 112 // - SlicedString
113 // - ConsString 113 // - ConsString
114 // - ExternalString 114 // - ExternalString
115 // - ExternalAsciiString 115 // - ExternalAsciiString
116 // - ExternalTwoByteString 116 // - ExternalTwoByteString
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after
370 V(CELL_TYPE) \ 370 V(CELL_TYPE) \
371 V(PROPERTY_CELL_TYPE) \ 371 V(PROPERTY_CELL_TYPE) \
372 \ 372 \
373 V(HEAP_NUMBER_TYPE) \ 373 V(HEAP_NUMBER_TYPE) \
374 V(FOREIGN_TYPE) \ 374 V(FOREIGN_TYPE) \
375 V(BYTE_ARRAY_TYPE) \ 375 V(BYTE_ARRAY_TYPE) \
376 V(FREE_SPACE_TYPE) \ 376 V(FREE_SPACE_TYPE) \
377 /* Note: the order of these external array */ \ 377 /* Note: the order of these external array */ \
378 /* types is relied upon in */ \ 378 /* types is relied upon in */ \
379 /* Object::IsExternalArray(). */ \ 379 /* Object::IsExternalArray(). */ \
380 V(EXTERNAL_BYTE_ARRAY_TYPE) \ 380 V(EXTERNAL_INT8_ARRAY_TYPE) \
381 V(EXTERNAL_UNSIGNED_BYTE_ARRAY_TYPE) \ 381 V(EXTERNAL_UINT8_ARRAY_TYPE) \
382 V(EXTERNAL_SHORT_ARRAY_TYPE) \ 382 V(EXTERNAL_INT16_ARRAY_TYPE) \
383 V(EXTERNAL_UNSIGNED_SHORT_ARRAY_TYPE) \ 383 V(EXTERNAL_UINT16_ARRAY_TYPE) \
384 V(EXTERNAL_INT_ARRAY_TYPE) \ 384 V(EXTERNAL_INT32_ARRAY_TYPE) \
385 V(EXTERNAL_UNSIGNED_INT_ARRAY_TYPE) \ 385 V(EXTERNAL_UINT32_ARRAY_TYPE) \
386 V(EXTERNAL_FLOAT_ARRAY_TYPE) \ 386 V(EXTERNAL_FLOAT32_ARRAY_TYPE) \
387 V(EXTERNAL_DOUBLE_ARRAY_TYPE) \ 387 V(EXTERNAL_FLOAT64_ARRAY_TYPE) \
388 V(EXTERNAL_PIXEL_ARRAY_TYPE) \ 388 V(EXTERNAL_UINT8_CLAMPED_ARRAY_TYPE) \
389 \ 389 \
390 V(FIXED_INT8_ARRAY_TYPE) \ 390 V(FIXED_INT8_ARRAY_TYPE) \
391 V(FIXED_UINT8_ARRAY_TYPE) \ 391 V(FIXED_UINT8_ARRAY_TYPE) \
392 V(FIXED_INT16_ARRAY_TYPE) \ 392 V(FIXED_INT16_ARRAY_TYPE) \
393 V(FIXED_UINT16_ARRAY_TYPE) \ 393 V(FIXED_UINT16_ARRAY_TYPE) \
394 V(FIXED_INT32_ARRAY_TYPE) \ 394 V(FIXED_INT32_ARRAY_TYPE) \
395 V(FIXED_UINT32_ARRAY_TYPE) \ 395 V(FIXED_UINT32_ARRAY_TYPE) \
396 V(FIXED_FLOAT32_ARRAY_TYPE) \ 396 V(FIXED_FLOAT32_ARRAY_TYPE) \
397 V(FIXED_FLOAT64_ARRAY_TYPE) \ 397 V(FIXED_FLOAT64_ARRAY_TYPE) \
398 V(FIXED_UINT8_CLAMPED_ARRAY_TYPE) \ 398 V(FIXED_UINT8_CLAMPED_ARRAY_TYPE) \
(...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after
715 ODDBALL_TYPE, 715 ODDBALL_TYPE,
716 CELL_TYPE, 716 CELL_TYPE,
717 PROPERTY_CELL_TYPE, 717 PROPERTY_CELL_TYPE,
718 718
719 // "Data", objects that cannot contain non-map-word pointers to heap 719 // "Data", objects that cannot contain non-map-word pointers to heap
720 // objects. 720 // objects.
721 HEAP_NUMBER_TYPE, 721 HEAP_NUMBER_TYPE,
722 FOREIGN_TYPE, 722 FOREIGN_TYPE,
723 BYTE_ARRAY_TYPE, 723 BYTE_ARRAY_TYPE,
724 FREE_SPACE_TYPE, 724 FREE_SPACE_TYPE,
725 EXTERNAL_BYTE_ARRAY_TYPE, // FIRST_EXTERNAL_ARRAY_TYPE 725
726 EXTERNAL_UNSIGNED_BYTE_ARRAY_TYPE, 726 EXTERNAL_INT8_ARRAY_TYPE, // FIRST_EXTERNAL_ARRAY_TYPE
727 EXTERNAL_SHORT_ARRAY_TYPE, 727 EXTERNAL_UINT8_ARRAY_TYPE,
728 EXTERNAL_UNSIGNED_SHORT_ARRAY_TYPE, 728 EXTERNAL_INT16_ARRAY_TYPE,
729 EXTERNAL_INT_ARRAY_TYPE, 729 EXTERNAL_UINT16_ARRAY_TYPE,
730 EXTERNAL_UNSIGNED_INT_ARRAY_TYPE, 730 EXTERNAL_INT32_ARRAY_TYPE,
731 EXTERNAL_FLOAT_ARRAY_TYPE, 731 EXTERNAL_UINT32_ARRAY_TYPE,
732 EXTERNAL_DOUBLE_ARRAY_TYPE, 732 EXTERNAL_FLOAT32_ARRAY_TYPE,
733 EXTERNAL_PIXEL_ARRAY_TYPE, // LAST_EXTERNAL_ARRAY_TYPE 733 EXTERNAL_FLOAT64_ARRAY_TYPE,
734 EXTERNAL_UINT8_CLAMPED_ARRAY_TYPE, // LAST_EXTERNAL_ARRAY_TYPE
734 735
735 FIXED_INT8_ARRAY_TYPE, // FIRST_FIXED_TYPED_ARRAY_TYPE 736 FIXED_INT8_ARRAY_TYPE, // FIRST_FIXED_TYPED_ARRAY_TYPE
736 FIXED_UINT8_ARRAY_TYPE, 737 FIXED_UINT8_ARRAY_TYPE,
737 FIXED_INT16_ARRAY_TYPE, 738 FIXED_INT16_ARRAY_TYPE,
738 FIXED_UINT16_ARRAY_TYPE, 739 FIXED_UINT16_ARRAY_TYPE,
739 FIXED_INT32_ARRAY_TYPE, 740 FIXED_INT32_ARRAY_TYPE,
740 FIXED_UINT32_ARRAY_TYPE, 741 FIXED_UINT32_ARRAY_TYPE,
741 FIXED_FLOAT32_ARRAY_TYPE, 742 FIXED_FLOAT32_ARRAY_TYPE,
742 FIXED_FLOAT64_ARRAY_TYPE, 743 FIXED_FLOAT64_ARRAY_TYPE,
743 FIXED_UINT8_CLAMPED_ARRAY_TYPE, // LAST_FIXED_TYPED_ARRAY_TYPE 744 FIXED_UINT8_CLAMPED_ARRAY_TYPE, // LAST_FIXED_TYPED_ARRAY_TYPE
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
810 811
811 // Pseudo-types 812 // Pseudo-types
812 FIRST_TYPE = 0x0, 813 FIRST_TYPE = 0x0,
813 LAST_TYPE = JS_FUNCTION_TYPE, 814 LAST_TYPE = JS_FUNCTION_TYPE,
814 FIRST_NAME_TYPE = FIRST_TYPE, 815 FIRST_NAME_TYPE = FIRST_TYPE,
815 LAST_NAME_TYPE = SYMBOL_TYPE, 816 LAST_NAME_TYPE = SYMBOL_TYPE,
816 FIRST_UNIQUE_NAME_TYPE = INTERNALIZED_STRING_TYPE, 817 FIRST_UNIQUE_NAME_TYPE = INTERNALIZED_STRING_TYPE,
817 LAST_UNIQUE_NAME_TYPE = SYMBOL_TYPE, 818 LAST_UNIQUE_NAME_TYPE = SYMBOL_TYPE,
818 FIRST_NONSTRING_TYPE = SYMBOL_TYPE, 819 FIRST_NONSTRING_TYPE = SYMBOL_TYPE,
819 // Boundaries for testing for an external array. 820 // Boundaries for testing for an external array.
820 FIRST_EXTERNAL_ARRAY_TYPE = EXTERNAL_BYTE_ARRAY_TYPE, 821 FIRST_EXTERNAL_ARRAY_TYPE = EXTERNAL_INT8_ARRAY_TYPE,
821 LAST_EXTERNAL_ARRAY_TYPE = EXTERNAL_PIXEL_ARRAY_TYPE, 822 LAST_EXTERNAL_ARRAY_TYPE = EXTERNAL_UINT8_CLAMPED_ARRAY_TYPE,
822 // Boundaries for testing for a fixed typed array. 823 // Boundaries for testing for a fixed typed array.
823 FIRST_FIXED_TYPED_ARRAY_TYPE = FIXED_INT8_ARRAY_TYPE, 824 FIRST_FIXED_TYPED_ARRAY_TYPE = FIXED_INT8_ARRAY_TYPE,
824 LAST_FIXED_TYPED_ARRAY_TYPE = FIXED_UINT8_CLAMPED_ARRAY_TYPE, 825 LAST_FIXED_TYPED_ARRAY_TYPE = FIXED_UINT8_CLAMPED_ARRAY_TYPE,
825 // Boundary for promotion to old data space/old pointer space. 826 // Boundary for promotion to old data space/old pointer space.
826 LAST_DATA_TYPE = FILLER_TYPE, 827 LAST_DATA_TYPE = FILLER_TYPE,
827 // Boundary for objects represented as JSReceiver (i.e. JSObject or JSProxy). 828 // Boundary for objects represented as JSReceiver (i.e. JSObject or JSProxy).
828 // Note that there is no range for JSObject or JSProxy, since their subtypes 829 // Note that there is no range for JSObject or JSProxy, since their subtypes
829 // are not continuous in this enum! The enum ranges instead reflect the 830 // are not continuous in this enum! The enum ranges instead reflect the
830 // external class names, where proxies are treated as either ordinary objects, 831 // external class names, where proxies are treated as either ordinary objects,
831 // or functions. 832 // or functions.
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
998 V(ConsString) \ 999 V(ConsString) \
999 V(SlicedString) \ 1000 V(SlicedString) \
1000 V(ExternalTwoByteString) \ 1001 V(ExternalTwoByteString) \
1001 V(ExternalAsciiString) \ 1002 V(ExternalAsciiString) \
1002 V(SeqTwoByteString) \ 1003 V(SeqTwoByteString) \
1003 V(SeqOneByteString) \ 1004 V(SeqOneByteString) \
1004 V(InternalizedString) \ 1005 V(InternalizedString) \
1005 V(Symbol) \ 1006 V(Symbol) \
1006 \ 1007 \
1007 V(ExternalArray) \ 1008 V(ExternalArray) \
1008 V(ExternalByteArray) \ 1009 V(ExternalInt8Array) \
1009 V(ExternalUnsignedByteArray) \ 1010 V(ExternalUint8Array) \
1010 V(ExternalShortArray) \ 1011 V(ExternalInt16Array) \
1011 V(ExternalUnsignedShortArray) \ 1012 V(ExternalUint16Array) \
1012 V(ExternalIntArray) \ 1013 V(ExternalInt32Array) \
1013 V(ExternalUnsignedIntArray) \ 1014 V(ExternalUint32Array) \
1014 V(ExternalFloatArray) \ 1015 V(ExternalFloat32Array) \
1015 V(ExternalDoubleArray) \ 1016 V(ExternalFloat64Array) \
1016 V(ExternalPixelArray) \ 1017 V(ExternalUint8ClampedArray) \
1017 V(FixedTypedArrayBase) \ 1018 V(FixedTypedArrayBase) \
1018 V(FixedUint8Array) \ 1019 V(FixedUint8Array) \
1019 V(FixedInt8Array) \ 1020 V(FixedInt8Array) \
1020 V(FixedUint16Array) \ 1021 V(FixedUint16Array) \
1021 V(FixedInt16Array) \ 1022 V(FixedInt16Array) \
1022 V(FixedUint32Array) \ 1023 V(FixedUint32Array) \
1023 V(FixedInt32Array) \ 1024 V(FixedInt32Array) \
1024 V(FixedFloat32Array) \ 1025 V(FixedFloat32Array) \
1025 V(FixedFloat64Array) \ 1026 V(FixedFloat64Array) \
1026 V(FixedUint8ClampedArray) \ 1027 V(FixedUint8ClampedArray) \
(...skipping 1109 matching lines...) Expand 10 before | Expand all | Expand 10 after
2136 inline bool HasFastElements(); 2137 inline bool HasFastElements();
2137 // Returns true if an object has elements of FAST_DOUBLE_ELEMENTS 2138 // Returns true if an object has elements of FAST_DOUBLE_ELEMENTS
2138 // ElementsKind. 2139 // ElementsKind.
2139 inline bool HasFastDoubleElements(); 2140 inline bool HasFastDoubleElements();
2140 // Returns true if an object has elements of FAST_HOLEY_*_ELEMENTS 2141 // Returns true if an object has elements of FAST_HOLEY_*_ELEMENTS
2141 // ElementsKind. 2142 // ElementsKind.
2142 inline bool HasFastHoleyElements(); 2143 inline bool HasFastHoleyElements();
2143 inline bool HasNonStrictArgumentsElements(); 2144 inline bool HasNonStrictArgumentsElements();
2144 inline bool HasDictionaryElements(); 2145 inline bool HasDictionaryElements();
2145 2146
2146 inline bool HasExternalPixelElements(); 2147 inline bool HasExternalUint8ClampedElements();
2147 inline bool HasExternalArrayElements(); 2148 inline bool HasExternalArrayElements();
2148 inline bool HasExternalByteElements(); 2149 inline bool HasExternalInt8Elements();
2149 inline bool HasExternalUnsignedByteElements(); 2150 inline bool HasExternalUint8Elements();
2150 inline bool HasExternalShortElements(); 2151 inline bool HasExternalInt16Elements();
2151 inline bool HasExternalUnsignedShortElements(); 2152 inline bool HasExternalUint16Elements();
2152 inline bool HasExternalIntElements(); 2153 inline bool HasExternalInt32Elements();
2153 inline bool HasExternalUnsignedIntElements(); 2154 inline bool HasExternalUint32Elements();
2154 inline bool HasExternalFloatElements(); 2155 inline bool HasExternalFloat32Elements();
2155 inline bool HasExternalDoubleElements(); 2156 inline bool HasExternalFloat64Elements();
2156 2157
2157 inline bool HasFixedTypedArrayElements(); 2158 inline bool HasFixedTypedArrayElements();
2158 2159
2159 bool HasFastArgumentsElements(); 2160 bool HasFastArgumentsElements();
2160 bool HasDictionaryArgumentsElements(); 2161 bool HasDictionaryArgumentsElements();
2161 inline SeededNumberDictionary* element_dictionary(); // Gets slow elements. 2162 inline SeededNumberDictionary* element_dictionary(); // Gets slow elements.
2162 2163
2163 inline void set_map_and_elements( 2164 inline void set_map_and_elements(
2164 Map* map, 2165 Map* map,
2165 FixedArrayBase* value, 2166 FixedArrayBase* value,
(...skipping 2395 matching lines...) Expand 10 before | Expand all | Expand 10 after
4561 static const int kSizeOffset = HeapObject::kHeaderSize; 4562 static const int kSizeOffset = HeapObject::kHeaderSize;
4562 static const int kHeaderSize = kSizeOffset + kPointerSize; 4563 static const int kHeaderSize = kSizeOffset + kPointerSize;
4563 4564
4564 static const int kAlignedSize = OBJECT_POINTER_ALIGN(kHeaderSize); 4565 static const int kAlignedSize = OBJECT_POINTER_ALIGN(kHeaderSize);
4565 4566
4566 private: 4567 private:
4567 DISALLOW_IMPLICIT_CONSTRUCTORS(FreeSpace); 4568 DISALLOW_IMPLICIT_CONSTRUCTORS(FreeSpace);
4568 }; 4569 };
4569 4570
4570 4571
4572 // V has parameters (Type, type, TYPE, C type, element_size)
4573 #define TYPED_ARRAYS(V) \
4574 V(Uint8, uint8, UINT8, uint8_t, 1) \
4575 V(Int8, int8, INT8, int8_t, 1) \
4576 V(Uint16, uint16, UINT16, uint16_t, 2) \
4577 V(Int16, int16, INT16, int16_t, 2) \
4578 V(Uint32, uint32, UINT32, uint32_t, 4) \
4579 V(Int32, int32, INT32, int32_t, 4) \
4580 V(Float32, float32, FLOAT32, float, 4) \
4581 V(Float64, float64, FLOAT64, double, 8) \
4582 V(Uint8Clamped, uint8_clamped, UINT8_CLAMPED, uint8_t, 1)
4583
4584
4585
4571 // An ExternalArray represents a fixed-size array of primitive values 4586 // An ExternalArray represents a fixed-size array of primitive values
4572 // which live outside the JavaScript heap. Its subclasses are used to 4587 // which live outside the JavaScript heap. Its subclasses are used to
4573 // implement the CanvasArray types being defined in the WebGL 4588 // implement the CanvasArray types being defined in the WebGL
4574 // specification. As of this writing the first public draft is not yet 4589 // specification. As of this writing the first public draft is not yet
4575 // available, but Khronos members can access the draft at: 4590 // available, but Khronos members can access the draft at:
4576 // https://cvs.khronos.org/svn/repos/3dweb/trunk/doc/spec/WebGL-spec.html 4591 // https://cvs.khronos.org/svn/repos/3dweb/trunk/doc/spec/WebGL-spec.html
4577 // 4592 //
4578 // The semantics of these arrays differ from CanvasPixelArray. 4593 // The semantics of these arrays differ from CanvasPixelArray.
4579 // Out-of-range values passed to the setter are converted via a C 4594 // Out-of-range values passed to the setter are converted via a C
4580 // cast, not clamping. Out-of-range indices cause exceptions to be 4595 // cast, not clamping. Out-of-range indices cause exceptions to be
(...skipping 16 matching lines...) Expand all
4597 static const int kExternalPointerOffset = 4612 static const int kExternalPointerOffset =
4598 POINTER_SIZE_ALIGN(FixedArrayBase::kLengthOffset + kPointerSize); 4613 POINTER_SIZE_ALIGN(FixedArrayBase::kLengthOffset + kPointerSize);
4599 static const int kHeaderSize = kExternalPointerOffset + kPointerSize; 4614 static const int kHeaderSize = kExternalPointerOffset + kPointerSize;
4600 static const int kAlignedSize = OBJECT_POINTER_ALIGN(kHeaderSize); 4615 static const int kAlignedSize = OBJECT_POINTER_ALIGN(kHeaderSize);
4601 4616
4602 private: 4617 private:
4603 DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalArray); 4618 DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalArray);
4604 }; 4619 };
4605 4620
4606 4621
4607 // A ExternalPixelArray represents a fixed-size byte array with special 4622 // A ExternalUint8ClampedArray represents a fixed-size byte array with special
4608 // semantics used for implementing the CanvasPixelArray object. Please see the 4623 // semantics used for implementing the CanvasPixelArray object. Please see the
4609 // specification at: 4624 // specification at:
4610 4625
4611 // http://www.whatwg.org/specs/web-apps/current-work/ 4626 // http://www.whatwg.org/specs/web-apps/current-work/
4612 // multipage/the-canvas-element.html#canvaspixelarray 4627 // multipage/the-canvas-element.html#canvaspixelarray
4613 // In particular, write access clamps the value written to 0 or 255 if the 4628 // In particular, write access clamps the value written to 0 or 255 if the
4614 // value written is outside this range. 4629 // value written is outside this range.
4615 class ExternalPixelArray: public ExternalArray { 4630 class ExternalUint8ClampedArray: public ExternalArray {
4616 public: 4631 public:
4617 inline uint8_t* external_pixel_pointer(); 4632 inline uint8_t* external_uint8_clamped_pointer();
4618 4633
4619 // Setter and getter. 4634 // Setter and getter.
4620 inline uint8_t get_scalar(int index); 4635 inline uint8_t get_scalar(int index);
4621 MUST_USE_RESULT inline MaybeObject* get(int index); 4636 MUST_USE_RESULT inline MaybeObject* get(int index);
4622 inline void set(int index, uint8_t value); 4637 inline void set(int index, uint8_t value);
4623 4638
4624 // This accessor applies the correct conversion from Smi, HeapNumber and 4639 // This accessor applies the correct conversion from Smi, HeapNumber and
4625 // undefined and clamps the converted value between 0 and 255. 4640 // undefined and clamps the converted value between 0 and 255.
4626 Object* SetValue(uint32_t index, Object* value); 4641 Object* SetValue(uint32_t index, Object* value);
4627 4642
4643 static Handle<Object> SetValue(Handle<ExternalUint8ClampedArray> array,
4644 uint32_t index,
4645 Handle<Object> value);
4646
4628 // Casting. 4647 // Casting.
4629 static inline ExternalPixelArray* cast(Object* obj); 4648 static inline ExternalUint8ClampedArray* cast(Object* obj);
4630 4649
4631 // Dispatched behavior. 4650 // Dispatched behavior.
4632 DECLARE_PRINTER(ExternalPixelArray) 4651 DECLARE_PRINTER(ExternalUint8ClampedArray)
4633 DECLARE_VERIFIER(ExternalPixelArray) 4652 DECLARE_VERIFIER(ExternalUint8ClampedArray)
4634 4653
4635 private: 4654 private:
4636 DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalPixelArray); 4655 DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalUint8ClampedArray);
4637 }; 4656 };
4638 4657
4639 4658
4640 class ExternalByteArray: public ExternalArray { 4659 class ExternalInt8Array: public ExternalArray {
4641 public: 4660 public:
4642 // Setter and getter. 4661 // Setter and getter.
4643 inline int8_t get_scalar(int index); 4662 inline int8_t get_scalar(int index);
4644 MUST_USE_RESULT inline MaybeObject* get(int index); 4663 MUST_USE_RESULT inline MaybeObject* get(int index);
4645 inline void set(int index, int8_t value); 4664 inline void set(int index, int8_t value);
4646 4665
4647 static Handle<Object> SetValue(Handle<ExternalByteArray> array, 4666 static Handle<Object> SetValue(Handle<ExternalInt8Array> array,
4648 uint32_t index, 4667 uint32_t index,
4649 Handle<Object> value); 4668 Handle<Object> value);
4650 4669
4651 // This accessor applies the correct conversion from Smi, HeapNumber 4670 // This accessor applies the correct conversion from Smi, HeapNumber
4652 // and undefined. 4671 // and undefined.
4653 MUST_USE_RESULT MaybeObject* SetValue(uint32_t index, Object* value); 4672 MUST_USE_RESULT MaybeObject* SetValue(uint32_t index, Object* value);
4654 4673
4655 // Casting. 4674 // Casting.
4656 static inline ExternalByteArray* cast(Object* obj); 4675 static inline ExternalInt8Array* cast(Object* obj);
4657 4676
4658 // Dispatched behavior. 4677 // Dispatched behavior.
4659 DECLARE_PRINTER(ExternalByteArray) 4678 DECLARE_PRINTER(ExternalInt8Array)
4660 DECLARE_VERIFIER(ExternalByteArray) 4679 DECLARE_VERIFIER(ExternalInt8Array)
4661 4680
4662 private: 4681 private:
4663 DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalByteArray); 4682 DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalInt8Array);
4664 }; 4683 };
4665 4684
4666 4685
4667 class ExternalUnsignedByteArray: public ExternalArray { 4686 class ExternalUint8Array: public ExternalArray {
4668 public: 4687 public:
4669 // Setter and getter. 4688 // Setter and getter.
4670 inline uint8_t get_scalar(int index); 4689 inline uint8_t get_scalar(int index);
4671 MUST_USE_RESULT inline MaybeObject* get(int index); 4690 MUST_USE_RESULT inline MaybeObject* get(int index);
4672 inline void set(int index, uint8_t value); 4691 inline void set(int index, uint8_t value);
4673 4692
4674 static Handle<Object> SetValue(Handle<ExternalUnsignedByteArray> array, 4693 static Handle<Object> SetValue(Handle<ExternalUint8Array> array,
4675 uint32_t index, 4694 uint32_t index,
4676 Handle<Object> value); 4695 Handle<Object> value);
4677 4696
4678 // This accessor applies the correct conversion from Smi, HeapNumber 4697 // This accessor applies the correct conversion from Smi, HeapNumber
4679 // and undefined. 4698 // and undefined.
4680 MUST_USE_RESULT MaybeObject* SetValue(uint32_t index, Object* value); 4699 MUST_USE_RESULT MaybeObject* SetValue(uint32_t index, Object* value);
4681 4700
4682 // Casting. 4701 // Casting.
4683 static inline ExternalUnsignedByteArray* cast(Object* obj); 4702 static inline ExternalUint8Array* cast(Object* obj);
4684 4703
4685 // Dispatched behavior. 4704 // Dispatched behavior.
4686 DECLARE_PRINTER(ExternalUnsignedByteArray) 4705 DECLARE_PRINTER(ExternalUint8Array)
4687 DECLARE_VERIFIER(ExternalUnsignedByteArray) 4706 DECLARE_VERIFIER(ExternalUint8Array)
4688 4707
4689 private: 4708 private:
4690 DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalUnsignedByteArray); 4709 DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalUint8Array);
4691 }; 4710 };
4692 4711
4693 4712
4694 class ExternalShortArray: public ExternalArray { 4713 class ExternalInt16Array: public ExternalArray {
4695 public: 4714 public:
4696 // Setter and getter. 4715 // Setter and getter.
4697 inline int16_t get_scalar(int index); 4716 inline int16_t get_scalar(int index);
4698 MUST_USE_RESULT inline MaybeObject* get(int index); 4717 MUST_USE_RESULT inline MaybeObject* get(int index);
4699 inline void set(int index, int16_t value); 4718 inline void set(int index, int16_t value);
4700 4719
4701 static Handle<Object> SetValue(Handle<ExternalShortArray> array, 4720 static Handle<Object> SetValue(Handle<ExternalInt16Array> array,
4702 uint32_t index, 4721 uint32_t index,
4703 Handle<Object> value); 4722 Handle<Object> value);
4704 4723
4705 // This accessor applies the correct conversion from Smi, HeapNumber 4724 // This accessor applies the correct conversion from Smi, HeapNumber
4706 // and undefined. 4725 // and undefined.
4707 MUST_USE_RESULT MaybeObject* SetValue(uint32_t index, Object* value); 4726 MUST_USE_RESULT MaybeObject* SetValue(uint32_t index, Object* value);
4708 4727
4709 // Casting. 4728 // Casting.
4710 static inline ExternalShortArray* cast(Object* obj); 4729 static inline ExternalInt16Array* cast(Object* obj);
4711 4730
4712 // Dispatched behavior. 4731 // Dispatched behavior.
4713 DECLARE_PRINTER(ExternalShortArray) 4732 DECLARE_PRINTER(ExternalInt16Array)
4714 DECLARE_VERIFIER(ExternalShortArray) 4733 DECLARE_VERIFIER(ExternalInt16Array)
4715 4734
4716 private: 4735 private:
4717 DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalShortArray); 4736 DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalInt16Array);
4718 }; 4737 };
4719 4738
4720 4739
4721 class ExternalUnsignedShortArray: public ExternalArray { 4740 class ExternalUint16Array: public ExternalArray {
4722 public: 4741 public:
4723 // Setter and getter. 4742 // Setter and getter.
4724 inline uint16_t get_scalar(int index); 4743 inline uint16_t get_scalar(int index);
4725 MUST_USE_RESULT inline MaybeObject* get(int index); 4744 MUST_USE_RESULT inline MaybeObject* get(int index);
4726 inline void set(int index, uint16_t value); 4745 inline void set(int index, uint16_t value);
4727 4746
4728 static Handle<Object> SetValue(Handle<ExternalUnsignedShortArray> array, 4747 static Handle<Object> SetValue(Handle<ExternalUint16Array> array,
4729 uint32_t index, 4748 uint32_t index,
4730 Handle<Object> value); 4749 Handle<Object> value);
4731 4750
4732 // This accessor applies the correct conversion from Smi, HeapNumber 4751 // This accessor applies the correct conversion from Smi, HeapNumber
4733 // and undefined. 4752 // and undefined.
4734 MUST_USE_RESULT MaybeObject* SetValue(uint32_t index, Object* value); 4753 MUST_USE_RESULT MaybeObject* SetValue(uint32_t index, Object* value);
4735 4754
4736 // Casting. 4755 // Casting.
4737 static inline ExternalUnsignedShortArray* cast(Object* obj); 4756 static inline ExternalUint16Array* cast(Object* obj);
4738 4757
4739 // Dispatched behavior. 4758 // Dispatched behavior.
4740 DECLARE_PRINTER(ExternalUnsignedShortArray) 4759 DECLARE_PRINTER(ExternalUint16Array)
4741 DECLARE_VERIFIER(ExternalUnsignedShortArray) 4760 DECLARE_VERIFIER(ExternalUint16Array)
4742 4761
4743 private: 4762 private:
4744 DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalUnsignedShortArray); 4763 DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalUint16Array);
4745 }; 4764 };
4746 4765
4747 4766
4748 class ExternalIntArray: public ExternalArray { 4767 class ExternalInt32Array: public ExternalArray {
4749 public: 4768 public:
4750 // Setter and getter. 4769 // Setter and getter.
4751 inline int32_t get_scalar(int index); 4770 inline int32_t get_scalar(int index);
4752 MUST_USE_RESULT inline MaybeObject* get(int index); 4771 MUST_USE_RESULT inline MaybeObject* get(int index);
4753 inline void set(int index, int32_t value); 4772 inline void set(int index, int32_t value);
4754 4773
4755 static Handle<Object> SetValue(Handle<ExternalIntArray> array, 4774 static Handle<Object> SetValue(Handle<ExternalInt32Array> array,
4756 uint32_t index, 4775 uint32_t index,
4757 Handle<Object> value); 4776 Handle<Object> value);
4758 4777
4759 // This accessor applies the correct conversion from Smi, HeapNumber 4778 // This accessor applies the correct conversion from Smi, HeapNumber
4760 // and undefined. 4779 // and undefined.
4761 MUST_USE_RESULT MaybeObject* SetValue(uint32_t index, Object* value); 4780 MUST_USE_RESULT MaybeObject* SetValue(uint32_t index, Object* value);
4762 4781
4763 // Casting. 4782 // Casting.
4764 static inline ExternalIntArray* cast(Object* obj); 4783 static inline ExternalInt32Array* cast(Object* obj);
4765 4784
4766 // Dispatched behavior. 4785 // Dispatched behavior.
4767 DECLARE_PRINTER(ExternalIntArray) 4786 DECLARE_PRINTER(ExternalInt32Array)
4768 DECLARE_VERIFIER(ExternalIntArray) 4787 DECLARE_VERIFIER(ExternalInt32Array)
4769 4788
4770 private: 4789 private:
4771 DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalIntArray); 4790 DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalInt32Array);
4772 }; 4791 };
4773 4792
4774 4793
4775 class ExternalUnsignedIntArray: public ExternalArray { 4794 class ExternalUint32Array: public ExternalArray {
4776 public: 4795 public:
4777 // Setter and getter. 4796 // Setter and getter.
4778 inline uint32_t get_scalar(int index); 4797 inline uint32_t get_scalar(int index);
4779 MUST_USE_RESULT inline MaybeObject* get(int index); 4798 MUST_USE_RESULT inline MaybeObject* get(int index);
4780 inline void set(int index, uint32_t value); 4799 inline void set(int index, uint32_t value);
4781 4800
4782 static Handle<Object> SetValue(Handle<ExternalUnsignedIntArray> array, 4801 static Handle<Object> SetValue(Handle<ExternalUint32Array> array,
4783 uint32_t index, 4802 uint32_t index,
4784 Handle<Object> value); 4803 Handle<Object> value);
4785 4804
4786 // This accessor applies the correct conversion from Smi, HeapNumber 4805 // This accessor applies the correct conversion from Smi, HeapNumber
4787 // and undefined. 4806 // and undefined.
4788 MUST_USE_RESULT MaybeObject* SetValue(uint32_t index, Object* value); 4807 MUST_USE_RESULT MaybeObject* SetValue(uint32_t index, Object* value);
4789 4808
4790 // Casting. 4809 // Casting.
4791 static inline ExternalUnsignedIntArray* cast(Object* obj); 4810 static inline ExternalUint32Array* cast(Object* obj);
4792 4811
4793 // Dispatched behavior. 4812 // Dispatched behavior.
4794 DECLARE_PRINTER(ExternalUnsignedIntArray) 4813 DECLARE_PRINTER(ExternalUint32Array)
4795 DECLARE_VERIFIER(ExternalUnsignedIntArray) 4814 DECLARE_VERIFIER(ExternalUint32Array)
4796 4815
4797 private: 4816 private:
4798 DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalUnsignedIntArray); 4817 DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalUint32Array);
4799 }; 4818 };
4800 4819
4801 4820
4802 class ExternalFloatArray: public ExternalArray { 4821 class ExternalFloat32Array: public ExternalArray {
4803 public: 4822 public:
4804 // Setter and getter. 4823 // Setter and getter.
4805 inline float get_scalar(int index); 4824 inline float get_scalar(int index);
4806 MUST_USE_RESULT inline MaybeObject* get(int index); 4825 MUST_USE_RESULT inline MaybeObject* get(int index);
4807 inline void set(int index, float value); 4826 inline void set(int index, float value);
4808 4827
4809 static Handle<Object> SetValue(Handle<ExternalFloatArray> array, 4828 static Handle<Object> SetValue(Handle<ExternalFloat32Array> array,
4810 uint32_t index, 4829 uint32_t index,
4811 Handle<Object> value); 4830 Handle<Object> value);
4812 4831
4813 // This accessor applies the correct conversion from Smi, HeapNumber 4832 // This accessor applies the correct conversion from Smi, HeapNumber
4814 // and undefined. 4833 // and undefined.
4815 MUST_USE_RESULT MaybeObject* SetValue(uint32_t index, Object* value); 4834 MUST_USE_RESULT MaybeObject* SetValue(uint32_t index, Object* value);
4816 4835
4817 // Casting. 4836 // Casting.
4818 static inline ExternalFloatArray* cast(Object* obj); 4837 static inline ExternalFloat32Array* cast(Object* obj);
4819 4838
4820 // Dispatched behavior. 4839 // Dispatched behavior.
4821 DECLARE_PRINTER(ExternalFloatArray) 4840 DECLARE_PRINTER(ExternalFloat32Array)
4822 DECLARE_VERIFIER(ExternalFloatArray) 4841 DECLARE_VERIFIER(ExternalFloat32Array)
4823 4842
4824 private: 4843 private:
4825 DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalFloatArray); 4844 DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalFloat32Array);
4826 }; 4845 };
4827 4846
4828 4847
4829 class ExternalDoubleArray: public ExternalArray { 4848 class ExternalFloat64Array: public ExternalArray {
4830 public: 4849 public:
4831 // Setter and getter. 4850 // Setter and getter.
4832 inline double get_scalar(int index); 4851 inline double get_scalar(int index);
4833 MUST_USE_RESULT inline MaybeObject* get(int index); 4852 MUST_USE_RESULT inline MaybeObject* get(int index);
4834 inline void set(int index, double value); 4853 inline void set(int index, double value);
4835 4854
4836 static Handle<Object> SetValue(Handle<ExternalDoubleArray> array, 4855 static Handle<Object> SetValue(Handle<ExternalFloat64Array> array,
4837 uint32_t index, 4856 uint32_t index,
4838 Handle<Object> value); 4857 Handle<Object> value);
4839 4858
4840 // This accessor applies the correct conversion from Smi, HeapNumber 4859 // This accessor applies the correct conversion from Smi, HeapNumber
4841 // and undefined. 4860 // and undefined.
4842 MUST_USE_RESULT MaybeObject* SetValue(uint32_t index, Object* value); 4861 MUST_USE_RESULT MaybeObject* SetValue(uint32_t index, Object* value);
4843 4862
4844 // Casting. 4863 // Casting.
4845 static inline ExternalDoubleArray* cast(Object* obj); 4864 static inline ExternalFloat64Array* cast(Object* obj);
4846 4865
4847 // Dispatched behavior. 4866 // Dispatched behavior.
4848 DECLARE_PRINTER(ExternalDoubleArray) 4867 DECLARE_PRINTER(ExternalFloat64Array)
4849 DECLARE_VERIFIER(ExternalDoubleArray) 4868 DECLARE_VERIFIER(ExternalFloat64Array)
4850 4869
4851 private: 4870 private:
4852 DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalDoubleArray); 4871 DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalFloat64Array);
4853 }; 4872 };
4854 4873
4855 4874
4856 class FixedTypedArrayBase: public FixedArrayBase { 4875 class FixedTypedArrayBase: public FixedArrayBase {
4857 public: 4876 public:
4858 // Casting: 4877 // Casting:
4859 static inline FixedTypedArrayBase* cast(Object* obj); 4878 static inline FixedTypedArrayBase* cast(Object* obj);
4860 4879
4861 static const int kDataOffset = kHeaderSize; 4880 static const int kDataOffset = kHeaderSize;
4862 4881
(...skipping 29 matching lines...) Expand all
4892 uint32_t index, 4911 uint32_t index,
4893 Handle<Object> value); 4912 Handle<Object> value);
4894 4913
4895 DECLARE_PRINTER(FixedTypedArray) 4914 DECLARE_PRINTER(FixedTypedArray)
4896 DECLARE_VERIFIER(FixedTypedArray) 4915 DECLARE_VERIFIER(FixedTypedArray)
4897 4916
4898 private: 4917 private:
4899 DISALLOW_IMPLICIT_CONSTRUCTORS(FixedTypedArray); 4918 DISALLOW_IMPLICIT_CONSTRUCTORS(FixedTypedArray);
4900 }; 4919 };
4901 4920
4902 #define FIXED_TYPED_ARRAY_TRAITS(Type, type, TYPE, elementType) \ 4921 #define FIXED_TYPED_ARRAY_TRAITS(Type, type, TYPE, elementType, size) \
4903 class Type##ArrayTraits { \ 4922 class Type##ArrayTraits { \
4904 public: \ 4923 public: \
4905 typedef elementType ElementType; \ 4924 typedef elementType ElementType; \
4906 static const InstanceType kInstanceType = FIXED_##TYPE##_ARRAY_TYPE; \ 4925 static const InstanceType kInstanceType = FIXED_##TYPE##_ARRAY_TYPE; \
4907 static const char* Designator() { return #type " array"; } \ 4926 static const char* Designator() { return #type " array"; } \
4908 static inline MaybeObject* ToObject(Heap* heap, elementType scalar); \ 4927 static inline MaybeObject* ToObject(Heap* heap, elementType scalar); \
4909 static elementType defaultValue() { return 0; } \ 4928 static elementType defaultValue() { return 0; } \
4910 }; \ 4929 }; \
4911 \ 4930 \
4912 typedef FixedTypedArray<Type##ArrayTraits> Fixed##Type##Array; 4931 typedef FixedTypedArray<Type##ArrayTraits> Fixed##Type##Array;
4913 4932
4914 FIXED_TYPED_ARRAY_TRAITS(Uint8, uint8, UINT8, uint8_t) 4933 TYPED_ARRAYS(FIXED_TYPED_ARRAY_TRAITS)
4915 FIXED_TYPED_ARRAY_TRAITS(Int8, int8, INT8, int8_t)
4916 FIXED_TYPED_ARRAY_TRAITS(Uint16, uint16, UINT16, uint16_t)
4917 FIXED_TYPED_ARRAY_TRAITS(Int16, int16, INT16, int16_t)
4918 FIXED_TYPED_ARRAY_TRAITS(Uint32, uint32, UINT32, uint32_t)
4919 FIXED_TYPED_ARRAY_TRAITS(Int32, int32, INT32, int32_t)
4920 FIXED_TYPED_ARRAY_TRAITS(Float32, float32, FLOAT32, float)
4921 FIXED_TYPED_ARRAY_TRAITS(Float64, float64, FLOAT64, double)
4922 FIXED_TYPED_ARRAY_TRAITS(Uint8Clamped, uint8_clamped, UINT8_CLAMPED, uint8_t)
4923 4934
4924 #undef FIXED_TYPED_ARRAY_TRAITS 4935 #undef FIXED_TYPED_ARRAY_TRAITS
4925 4936
4926 // DeoptimizationInputData is a fixed array used to hold the deoptimization 4937 // DeoptimizationInputData is a fixed array used to hold the deoptimization
4927 // data for code generated by the Hydrogen/Lithium compiler. It also 4938 // data for code generated by the Hydrogen/Lithium compiler. It also
4928 // contains information about functions that were inlined. If N different 4939 // contains information about functions that were inlined. If N different
4929 // functions were inlined then first N elements of the literal array will 4940 // functions were inlined then first N elements of the literal array will
4930 // contain these functions. 4941 // contain these functions.
4931 // 4942 //
4932 // It can be empty. 4943 // It can be empty.
(...skipping 5823 matching lines...) Expand 10 before | Expand all | Expand 10 after
10756 } else { 10767 } else {
10757 value &= ~(1 << bit_position); 10768 value &= ~(1 << bit_position);
10758 } 10769 }
10759 return value; 10770 return value;
10760 } 10771 }
10761 }; 10772 };
10762 10773
10763 } } // namespace v8::internal 10774 } } // namespace v8::internal
10764 10775
10765 #endif // V8_OBJECTS_H_ 10776 #endif // V8_OBJECTS_H_
OLDNEW
« src/api.cc ('K') | « src/mips/lithium-mips.cc ('k') | src/objects.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698