OLD | NEW |
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 4632 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4643 inline uint8_t* external_uint8_clamped_pointer(); | 4643 inline uint8_t* external_uint8_clamped_pointer(); |
4644 | 4644 |
4645 // Setter and getter. | 4645 // Setter and getter. |
4646 inline uint8_t get_scalar(int index); | 4646 inline uint8_t get_scalar(int index); |
4647 static inline Handle<Object> get(Handle<ExternalUint8ClampedArray> array, | 4647 static inline Handle<Object> get(Handle<ExternalUint8ClampedArray> array, |
4648 int index); | 4648 int index); |
4649 inline void set(int index, uint8_t value); | 4649 inline void set(int index, uint8_t value); |
4650 | 4650 |
4651 // This accessor applies the correct conversion from Smi, HeapNumber | 4651 // This accessor applies the correct conversion from Smi, HeapNumber |
4652 // and undefined and clamps the converted value between 0 and 255. | 4652 // and undefined and clamps the converted value between 0 and 255. |
4653 static Handle<Object> SetValue(Handle<ExternalUint8ClampedArray> array, | 4653 static Handle<Object> SetValue(Handle<JSObject> holder, |
4654 uint32_t index, | 4654 Handle<ExternalUint8ClampedArray> array, |
4655 Handle<Object> value); | 4655 uint32_t index, Handle<Object> value); |
4656 | 4656 |
4657 DECLARE_CAST(ExternalUint8ClampedArray) | 4657 DECLARE_CAST(ExternalUint8ClampedArray) |
4658 | 4658 |
4659 // Dispatched behavior. | 4659 // Dispatched behavior. |
4660 DECLARE_PRINTER(ExternalUint8ClampedArray) | 4660 DECLARE_PRINTER(ExternalUint8ClampedArray) |
4661 DECLARE_VERIFIER(ExternalUint8ClampedArray) | 4661 DECLARE_VERIFIER(ExternalUint8ClampedArray) |
4662 | 4662 |
4663 private: | 4663 private: |
4664 DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalUint8ClampedArray); | 4664 DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalUint8ClampedArray); |
4665 }; | 4665 }; |
4666 | 4666 |
4667 | 4667 |
4668 class ExternalInt8Array: public ExternalArray { | 4668 class ExternalInt8Array: public ExternalArray { |
4669 public: | 4669 public: |
4670 // Setter and getter. | 4670 // Setter and getter. |
4671 inline int8_t get_scalar(int index); | 4671 inline int8_t get_scalar(int index); |
4672 static inline Handle<Object> get(Handle<ExternalInt8Array> array, int index); | 4672 static inline Handle<Object> get(Handle<ExternalInt8Array> array, int index); |
4673 inline void set(int index, int8_t value); | 4673 inline void set(int index, int8_t value); |
4674 | 4674 |
4675 // This accessor applies the correct conversion from Smi, HeapNumber | 4675 // This accessor applies the correct conversion from Smi, HeapNumber |
4676 // and undefined. | 4676 // and undefined. |
4677 static Handle<Object> SetValue(Handle<ExternalInt8Array> array, | 4677 static Handle<Object> SetValue(Handle<JSObject> holder, |
4678 uint32_t index, | 4678 Handle<ExternalInt8Array> array, |
4679 Handle<Object> value); | 4679 uint32_t index, Handle<Object> value); |
4680 | 4680 |
4681 DECLARE_CAST(ExternalInt8Array) | 4681 DECLARE_CAST(ExternalInt8Array) |
4682 | 4682 |
4683 // Dispatched behavior. | 4683 // Dispatched behavior. |
4684 DECLARE_PRINTER(ExternalInt8Array) | 4684 DECLARE_PRINTER(ExternalInt8Array) |
4685 DECLARE_VERIFIER(ExternalInt8Array) | 4685 DECLARE_VERIFIER(ExternalInt8Array) |
4686 | 4686 |
4687 private: | 4687 private: |
4688 DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalInt8Array); | 4688 DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalInt8Array); |
4689 }; | 4689 }; |
4690 | 4690 |
4691 | 4691 |
4692 class ExternalUint8Array: public ExternalArray { | 4692 class ExternalUint8Array: public ExternalArray { |
4693 public: | 4693 public: |
4694 // Setter and getter. | 4694 // Setter and getter. |
4695 inline uint8_t get_scalar(int index); | 4695 inline uint8_t get_scalar(int index); |
4696 static inline Handle<Object> get(Handle<ExternalUint8Array> array, int index); | 4696 static inline Handle<Object> get(Handle<ExternalUint8Array> array, int index); |
4697 inline void set(int index, uint8_t value); | 4697 inline void set(int index, uint8_t value); |
4698 | 4698 |
4699 // This accessor applies the correct conversion from Smi, HeapNumber | 4699 // This accessor applies the correct conversion from Smi, HeapNumber |
4700 // and undefined. | 4700 // and undefined. |
4701 static Handle<Object> SetValue(Handle<ExternalUint8Array> array, | 4701 static Handle<Object> SetValue(Handle<JSObject> holder, |
4702 uint32_t index, | 4702 Handle<ExternalUint8Array> array, |
4703 Handle<Object> value); | 4703 uint32_t index, Handle<Object> value); |
4704 | 4704 |
4705 DECLARE_CAST(ExternalUint8Array) | 4705 DECLARE_CAST(ExternalUint8Array) |
4706 | 4706 |
4707 // Dispatched behavior. | 4707 // Dispatched behavior. |
4708 DECLARE_PRINTER(ExternalUint8Array) | 4708 DECLARE_PRINTER(ExternalUint8Array) |
4709 DECLARE_VERIFIER(ExternalUint8Array) | 4709 DECLARE_VERIFIER(ExternalUint8Array) |
4710 | 4710 |
4711 private: | 4711 private: |
4712 DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalUint8Array); | 4712 DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalUint8Array); |
4713 }; | 4713 }; |
4714 | 4714 |
4715 | 4715 |
4716 class ExternalInt16Array: public ExternalArray { | 4716 class ExternalInt16Array: public ExternalArray { |
4717 public: | 4717 public: |
4718 // Setter and getter. | 4718 // Setter and getter. |
4719 inline int16_t get_scalar(int index); | 4719 inline int16_t get_scalar(int index); |
4720 static inline Handle<Object> get(Handle<ExternalInt16Array> array, int index); | 4720 static inline Handle<Object> get(Handle<ExternalInt16Array> array, int index); |
4721 inline void set(int index, int16_t value); | 4721 inline void set(int index, int16_t value); |
4722 | 4722 |
4723 // This accessor applies the correct conversion from Smi, HeapNumber | 4723 // This accessor applies the correct conversion from Smi, HeapNumber |
4724 // and undefined. | 4724 // and undefined. |
4725 static Handle<Object> SetValue(Handle<ExternalInt16Array> array, | 4725 static Handle<Object> SetValue(Handle<JSObject> holder, |
4726 uint32_t index, | 4726 Handle<ExternalInt16Array> array, |
4727 Handle<Object> value); | 4727 uint32_t index, Handle<Object> value); |
4728 | 4728 |
4729 DECLARE_CAST(ExternalInt16Array) | 4729 DECLARE_CAST(ExternalInt16Array) |
4730 | 4730 |
4731 // Dispatched behavior. | 4731 // Dispatched behavior. |
4732 DECLARE_PRINTER(ExternalInt16Array) | 4732 DECLARE_PRINTER(ExternalInt16Array) |
4733 DECLARE_VERIFIER(ExternalInt16Array) | 4733 DECLARE_VERIFIER(ExternalInt16Array) |
4734 | 4734 |
4735 private: | 4735 private: |
4736 DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalInt16Array); | 4736 DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalInt16Array); |
4737 }; | 4737 }; |
4738 | 4738 |
4739 | 4739 |
4740 class ExternalUint16Array: public ExternalArray { | 4740 class ExternalUint16Array: public ExternalArray { |
4741 public: | 4741 public: |
4742 // Setter and getter. | 4742 // Setter and getter. |
4743 inline uint16_t get_scalar(int index); | 4743 inline uint16_t get_scalar(int index); |
4744 static inline Handle<Object> get(Handle<ExternalUint16Array> array, | 4744 static inline Handle<Object> get(Handle<ExternalUint16Array> array, |
4745 int index); | 4745 int index); |
4746 inline void set(int index, uint16_t value); | 4746 inline void set(int index, uint16_t value); |
4747 | 4747 |
4748 // This accessor applies the correct conversion from Smi, HeapNumber | 4748 // This accessor applies the correct conversion from Smi, HeapNumber |
4749 // and undefined. | 4749 // and undefined. |
4750 static Handle<Object> SetValue(Handle<ExternalUint16Array> array, | 4750 static Handle<Object> SetValue(Handle<JSObject> holder, |
4751 uint32_t index, | 4751 Handle<ExternalUint16Array> array, |
4752 Handle<Object> value); | 4752 uint32_t index, Handle<Object> value); |
4753 | 4753 |
4754 DECLARE_CAST(ExternalUint16Array) | 4754 DECLARE_CAST(ExternalUint16Array) |
4755 | 4755 |
4756 // Dispatched behavior. | 4756 // Dispatched behavior. |
4757 DECLARE_PRINTER(ExternalUint16Array) | 4757 DECLARE_PRINTER(ExternalUint16Array) |
4758 DECLARE_VERIFIER(ExternalUint16Array) | 4758 DECLARE_VERIFIER(ExternalUint16Array) |
4759 | 4759 |
4760 private: | 4760 private: |
4761 DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalUint16Array); | 4761 DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalUint16Array); |
4762 }; | 4762 }; |
4763 | 4763 |
4764 | 4764 |
4765 class ExternalInt32Array: public ExternalArray { | 4765 class ExternalInt32Array: public ExternalArray { |
4766 public: | 4766 public: |
4767 // Setter and getter. | 4767 // Setter and getter. |
4768 inline int32_t get_scalar(int index); | 4768 inline int32_t get_scalar(int index); |
4769 static inline Handle<Object> get(Handle<ExternalInt32Array> array, int index); | 4769 static inline Handle<Object> get(Handle<ExternalInt32Array> array, int index); |
4770 inline void set(int index, int32_t value); | 4770 inline void set(int index, int32_t value); |
4771 | 4771 |
4772 // This accessor applies the correct conversion from Smi, HeapNumber | 4772 // This accessor applies the correct conversion from Smi, HeapNumber |
4773 // and undefined. | 4773 // and undefined. |
4774 static Handle<Object> SetValue(Handle<ExternalInt32Array> array, | 4774 static Handle<Object> SetValue(Handle<JSObject> holder, |
4775 uint32_t index, | 4775 Handle<ExternalInt32Array> array, |
4776 Handle<Object> value); | 4776 uint32_t index, Handle<Object> value); |
4777 | 4777 |
4778 DECLARE_CAST(ExternalInt32Array) | 4778 DECLARE_CAST(ExternalInt32Array) |
4779 | 4779 |
4780 // Dispatched behavior. | 4780 // Dispatched behavior. |
4781 DECLARE_PRINTER(ExternalInt32Array) | 4781 DECLARE_PRINTER(ExternalInt32Array) |
4782 DECLARE_VERIFIER(ExternalInt32Array) | 4782 DECLARE_VERIFIER(ExternalInt32Array) |
4783 | 4783 |
4784 private: | 4784 private: |
4785 DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalInt32Array); | 4785 DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalInt32Array); |
4786 }; | 4786 }; |
4787 | 4787 |
4788 | 4788 |
4789 class ExternalUint32Array: public ExternalArray { | 4789 class ExternalUint32Array: public ExternalArray { |
4790 public: | 4790 public: |
4791 // Setter and getter. | 4791 // Setter and getter. |
4792 inline uint32_t get_scalar(int index); | 4792 inline uint32_t get_scalar(int index); |
4793 static inline Handle<Object> get(Handle<ExternalUint32Array> array, | 4793 static inline Handle<Object> get(Handle<ExternalUint32Array> array, |
4794 int index); | 4794 int index); |
4795 inline void set(int index, uint32_t value); | 4795 inline void set(int index, uint32_t value); |
4796 | 4796 |
4797 // This accessor applies the correct conversion from Smi, HeapNumber | 4797 // This accessor applies the correct conversion from Smi, HeapNumber |
4798 // and undefined. | 4798 // and undefined. |
4799 static Handle<Object> SetValue(Handle<ExternalUint32Array> array, | 4799 static Handle<Object> SetValue(Handle<JSObject> holder, |
4800 uint32_t index, | 4800 Handle<ExternalUint32Array> array, |
4801 Handle<Object> value); | 4801 uint32_t index, Handle<Object> value); |
4802 | 4802 |
4803 DECLARE_CAST(ExternalUint32Array) | 4803 DECLARE_CAST(ExternalUint32Array) |
4804 | 4804 |
4805 // Dispatched behavior. | 4805 // Dispatched behavior. |
4806 DECLARE_PRINTER(ExternalUint32Array) | 4806 DECLARE_PRINTER(ExternalUint32Array) |
4807 DECLARE_VERIFIER(ExternalUint32Array) | 4807 DECLARE_VERIFIER(ExternalUint32Array) |
4808 | 4808 |
4809 private: | 4809 private: |
4810 DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalUint32Array); | 4810 DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalUint32Array); |
4811 }; | 4811 }; |
4812 | 4812 |
4813 | 4813 |
4814 class ExternalFloat32Array: public ExternalArray { | 4814 class ExternalFloat32Array: public ExternalArray { |
4815 public: | 4815 public: |
4816 // Setter and getter. | 4816 // Setter and getter. |
4817 inline float get_scalar(int index); | 4817 inline float get_scalar(int index); |
4818 static inline Handle<Object> get(Handle<ExternalFloat32Array> array, | 4818 static inline Handle<Object> get(Handle<ExternalFloat32Array> array, |
4819 int index); | 4819 int index); |
4820 inline void set(int index, float value); | 4820 inline void set(int index, float value); |
4821 | 4821 |
4822 // This accessor applies the correct conversion from Smi, HeapNumber | 4822 // This accessor applies the correct conversion from Smi, HeapNumber |
4823 // and undefined. | 4823 // and undefined. |
4824 static Handle<Object> SetValue(Handle<ExternalFloat32Array> array, | 4824 static Handle<Object> SetValue(Handle<JSObject> holder, |
4825 uint32_t index, | 4825 Handle<ExternalFloat32Array> array, |
4826 Handle<Object> value); | 4826 uint32_t index, Handle<Object> value); |
4827 | 4827 |
4828 DECLARE_CAST(ExternalFloat32Array) | 4828 DECLARE_CAST(ExternalFloat32Array) |
4829 | 4829 |
4830 // Dispatched behavior. | 4830 // Dispatched behavior. |
4831 DECLARE_PRINTER(ExternalFloat32Array) | 4831 DECLARE_PRINTER(ExternalFloat32Array) |
4832 DECLARE_VERIFIER(ExternalFloat32Array) | 4832 DECLARE_VERIFIER(ExternalFloat32Array) |
4833 | 4833 |
4834 private: | 4834 private: |
4835 DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalFloat32Array); | 4835 DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalFloat32Array); |
4836 }; | 4836 }; |
4837 | 4837 |
4838 | 4838 |
4839 class ExternalFloat64Array: public ExternalArray { | 4839 class ExternalFloat64Array: public ExternalArray { |
4840 public: | 4840 public: |
4841 // Setter and getter. | 4841 // Setter and getter. |
4842 inline double get_scalar(int index); | 4842 inline double get_scalar(int index); |
4843 static inline Handle<Object> get(Handle<ExternalFloat64Array> array, | 4843 static inline Handle<Object> get(Handle<ExternalFloat64Array> array, |
4844 int index); | 4844 int index); |
4845 inline void set(int index, double value); | 4845 inline void set(int index, double value); |
4846 | 4846 |
4847 // This accessor applies the correct conversion from Smi, HeapNumber | 4847 // This accessor applies the correct conversion from Smi, HeapNumber |
4848 // and undefined. | 4848 // and undefined. |
4849 static Handle<Object> SetValue(Handle<ExternalFloat64Array> array, | 4849 static Handle<Object> SetValue(Handle<JSObject> holder, |
4850 uint32_t index, | 4850 Handle<ExternalFloat64Array> array, |
4851 Handle<Object> value); | 4851 uint32_t index, Handle<Object> value); |
4852 | 4852 |
4853 DECLARE_CAST(ExternalFloat64Array) | 4853 DECLARE_CAST(ExternalFloat64Array) |
4854 | 4854 |
4855 // Dispatched behavior. | 4855 // Dispatched behavior. |
4856 DECLARE_PRINTER(ExternalFloat64Array) | 4856 DECLARE_PRINTER(ExternalFloat64Array) |
4857 DECLARE_VERIFIER(ExternalFloat64Array) | 4857 DECLARE_VERIFIER(ExternalFloat64Array) |
4858 | 4858 |
4859 private: | 4859 private: |
4860 DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalFloat64Array); | 4860 DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalFloat64Array); |
4861 }; | 4861 }; |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4904 | 4904 |
4905 inline ElementType get_scalar(int index); | 4905 inline ElementType get_scalar(int index); |
4906 static inline Handle<Object> get(Handle<FixedTypedArray> array, int index); | 4906 static inline Handle<Object> get(Handle<FixedTypedArray> array, int index); |
4907 inline void set(int index, ElementType value); | 4907 inline void set(int index, ElementType value); |
4908 | 4908 |
4909 static inline ElementType from_int(int value); | 4909 static inline ElementType from_int(int value); |
4910 static inline ElementType from_double(double value); | 4910 static inline ElementType from_double(double value); |
4911 | 4911 |
4912 // This accessor applies the correct conversion from Smi, HeapNumber | 4912 // This accessor applies the correct conversion from Smi, HeapNumber |
4913 // and undefined. | 4913 // and undefined. |
4914 static Handle<Object> SetValue(Handle<FixedTypedArray<Traits> > array, | 4914 static Handle<Object> SetValue(Handle<JSObject> holder, |
4915 uint32_t index, | 4915 Handle<FixedTypedArray<Traits> > array, |
4916 Handle<Object> value); | 4916 uint32_t index, Handle<Object> value); |
4917 | 4917 |
4918 DECLARE_PRINTER(FixedTypedArray) | 4918 DECLARE_PRINTER(FixedTypedArray) |
4919 DECLARE_VERIFIER(FixedTypedArray) | 4919 DECLARE_VERIFIER(FixedTypedArray) |
4920 | 4920 |
4921 private: | 4921 private: |
4922 DISALLOW_IMPLICIT_CONSTRUCTORS(FixedTypedArray); | 4922 DISALLOW_IMPLICIT_CONSTRUCTORS(FixedTypedArray); |
4923 }; | 4923 }; |
4924 | 4924 |
4925 #define FIXED_TYPED_ARRAY_TRAITS(Type, type, TYPE, elementType, size) \ | 4925 #define FIXED_TYPED_ARRAY_TRAITS(Type, type, TYPE, elementType, size) \ |
4926 class Type##ArrayTraits { \ | 4926 class Type##ArrayTraits { \ |
(...skipping 5300 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10227 | 10227 |
10228 inline bool is_external(); | 10228 inline bool is_external(); |
10229 inline void set_is_external(bool value); | 10229 inline void set_is_external(bool value); |
10230 | 10230 |
10231 inline bool should_be_freed(); | 10231 inline bool should_be_freed(); |
10232 inline void set_should_be_freed(bool value); | 10232 inline void set_should_be_freed(bool value); |
10233 | 10233 |
10234 inline bool is_neuterable(); | 10234 inline bool is_neuterable(); |
10235 inline void set_is_neuterable(bool value); | 10235 inline void set_is_neuterable(bool value); |
10236 | 10236 |
| 10237 inline bool was_neutered(); |
| 10238 inline void set_was_neutered(bool value); |
| 10239 |
10237 // [weak_next]: linked list of array buffers. | 10240 // [weak_next]: linked list of array buffers. |
10238 DECL_ACCESSORS(weak_next, Object) | 10241 DECL_ACCESSORS(weak_next, Object) |
10239 | 10242 |
10240 // [weak_first_array]: weak linked list of views. | |
10241 DECL_ACCESSORS(weak_first_view, Object) | |
10242 | |
10243 DECLARE_CAST(JSArrayBuffer) | 10243 DECLARE_CAST(JSArrayBuffer) |
10244 | 10244 |
10245 // Neutering. Only neuters the buffer, not associated typed arrays. | |
10246 void Neuter(); | 10245 void Neuter(); |
10247 | 10246 |
10248 // Dispatched behavior. | 10247 // Dispatched behavior. |
10249 DECLARE_PRINTER(JSArrayBuffer) | 10248 DECLARE_PRINTER(JSArrayBuffer) |
10250 DECLARE_VERIFIER(JSArrayBuffer) | 10249 DECLARE_VERIFIER(JSArrayBuffer) |
10251 | 10250 |
10252 static const int kBackingStoreOffset = JSObject::kHeaderSize; | 10251 static const int kBackingStoreOffset = JSObject::kHeaderSize; |
10253 static const int kByteLengthOffset = kBackingStoreOffset + kPointerSize; | 10252 static const int kByteLengthOffset = kBackingStoreOffset + kPointerSize; |
10254 static const int kFlagOffset = kByteLengthOffset + kPointerSize; | 10253 static const int kFlagOffset = kByteLengthOffset + kPointerSize; |
10255 static const int kWeakNextOffset = kFlagOffset + kPointerSize; | 10254 static const int kWeakNextOffset = kFlagOffset + kPointerSize; |
10256 static const int kWeakFirstViewOffset = kWeakNextOffset + kPointerSize; | 10255 static const int kSize = kWeakNextOffset + kPointerSize; |
10257 static const int kSize = kWeakFirstViewOffset + kPointerSize; | |
10258 | 10256 |
10259 static const int kSizeWithInternalFields = | 10257 static const int kSizeWithInternalFields = |
10260 kSize + v8::ArrayBuffer::kInternalFieldCount * kPointerSize; | 10258 kSize + v8::ArrayBuffer::kInternalFieldCount * kPointerSize; |
10261 | 10259 |
10262 private: | |
10263 // Bit position in a flag | 10260 // Bit position in a flag |
10264 static const int kIsExternalBit = 0; | 10261 static const int kIsExternalBit = 0; |
10265 static const int kShouldBeFreed = 1; | 10262 static const int kShouldBeFreed = 1; |
10266 static const int kIsNeuterableBit = 2; | 10263 static const int kIsNeuterableBit = 2; |
| 10264 static const int kWasNeuteredBit = 3; |
10267 | 10265 |
| 10266 private: |
10268 DISALLOW_IMPLICIT_CONSTRUCTORS(JSArrayBuffer); | 10267 DISALLOW_IMPLICIT_CONSTRUCTORS(JSArrayBuffer); |
10269 }; | 10268 }; |
10270 | 10269 |
10271 | 10270 |
10272 class JSArrayBufferView: public JSObject { | 10271 class JSArrayBufferView: public JSObject { |
10273 public: | 10272 public: |
10274 // [buffer]: ArrayBuffer that this typed array views. | 10273 // [buffer]: ArrayBuffer that this typed array views. |
10275 DECL_ACCESSORS(buffer, Object) | 10274 DECL_ACCESSORS(buffer, Object) |
10276 | 10275 |
10277 // [byte_length]: offset of typed array in bytes. | 10276 // [byte_length]: offset of typed array in bytes. |
10278 DECL_ACCESSORS(byte_offset, Object) | 10277 DECL_ACCESSORS(byte_offset, Object) |
10279 | 10278 |
10280 // [byte_length]: length of typed array in bytes. | 10279 // [byte_length]: length of typed array in bytes. |
10281 DECL_ACCESSORS(byte_length, Object) | 10280 DECL_ACCESSORS(byte_length, Object) |
10282 | 10281 |
10283 // [weak_next]: linked list of typed arrays over the same array buffer. | |
10284 DECL_ACCESSORS(weak_next, Object) | |
10285 | |
10286 DECLARE_CAST(JSArrayBufferView) | 10282 DECLARE_CAST(JSArrayBufferView) |
10287 | 10283 |
10288 DECLARE_VERIFIER(JSArrayBufferView) | 10284 DECLARE_VERIFIER(JSArrayBufferView) |
10289 | 10285 |
| 10286 inline bool WasNeutered() const; |
| 10287 |
10290 static const int kBufferOffset = JSObject::kHeaderSize; | 10288 static const int kBufferOffset = JSObject::kHeaderSize; |
10291 static const int kByteOffsetOffset = kBufferOffset + kPointerSize; | 10289 static const int kByteOffsetOffset = kBufferOffset + kPointerSize; |
10292 static const int kByteLengthOffset = kByteOffsetOffset + kPointerSize; | 10290 static const int kByteLengthOffset = kByteOffsetOffset + kPointerSize; |
10293 static const int kWeakNextOffset = kByteLengthOffset + kPointerSize; | 10291 static const int kViewSize = kByteLengthOffset + kPointerSize; |
10294 static const int kViewSize = kWeakNextOffset + kPointerSize; | |
10295 | |
10296 protected: | |
10297 void NeuterView(); | |
10298 | 10292 |
10299 private: | 10293 private: |
| 10294 #ifdef VERIFY_HEAP |
| 10295 DECL_ACCESSORS(raw_byte_offset, Object) |
| 10296 DECL_ACCESSORS(raw_byte_length, Object) |
| 10297 #endif |
| 10298 |
10300 DISALLOW_IMPLICIT_CONSTRUCTORS(JSArrayBufferView); | 10299 DISALLOW_IMPLICIT_CONSTRUCTORS(JSArrayBufferView); |
10301 }; | 10300 }; |
10302 | 10301 |
10303 | 10302 |
10304 class JSTypedArray: public JSArrayBufferView { | 10303 class JSTypedArray: public JSArrayBufferView { |
10305 public: | 10304 public: |
10306 // [length]: length of typed array in elements. | 10305 // [length]: length of typed array in elements. |
10307 DECL_ACCESSORS(length, Object) | 10306 DECL_ACCESSORS(length, Object) |
10308 | 10307 |
10309 // Neutering. Only neuters this typed array. | |
10310 void Neuter(); | |
10311 | |
10312 DECLARE_CAST(JSTypedArray) | 10308 DECLARE_CAST(JSTypedArray) |
10313 | 10309 |
10314 ExternalArrayType type(); | 10310 ExternalArrayType type(); |
10315 size_t element_size(); | 10311 size_t element_size(); |
10316 | 10312 |
10317 Handle<JSArrayBuffer> GetBuffer(); | 10313 Handle<JSArrayBuffer> GetBuffer(); |
10318 | 10314 |
10319 // Dispatched behavior. | 10315 // Dispatched behavior. |
10320 DECLARE_PRINTER(JSTypedArray) | 10316 DECLARE_PRINTER(JSTypedArray) |
10321 DECLARE_VERIFIER(JSTypedArray) | 10317 DECLARE_VERIFIER(JSTypedArray) |
10322 | 10318 |
10323 static const int kLengthOffset = kViewSize + kPointerSize; | 10319 static const int kLengthOffset = kViewSize + kPointerSize; |
10324 static const int kSize = kLengthOffset + kPointerSize; | 10320 static const int kSize = kLengthOffset + kPointerSize; |
10325 | 10321 |
10326 static const int kSizeWithInternalFields = | 10322 static const int kSizeWithInternalFields = |
10327 kSize + v8::ArrayBufferView::kInternalFieldCount * kPointerSize; | 10323 kSize + v8::ArrayBufferView::kInternalFieldCount * kPointerSize; |
10328 | 10324 |
10329 private: | 10325 private: |
10330 static Handle<JSArrayBuffer> MaterializeArrayBuffer( | 10326 static Handle<JSArrayBuffer> MaterializeArrayBuffer( |
10331 Handle<JSTypedArray> typed_array); | 10327 Handle<JSTypedArray> typed_array); |
| 10328 #ifdef VERIFY_HEAP |
| 10329 DECL_ACCESSORS(raw_length, Object) |
| 10330 #endif |
10332 | 10331 |
10333 DISALLOW_IMPLICIT_CONSTRUCTORS(JSTypedArray); | 10332 DISALLOW_IMPLICIT_CONSTRUCTORS(JSTypedArray); |
10334 }; | 10333 }; |
10335 | 10334 |
10336 | 10335 |
10337 class JSDataView: public JSArrayBufferView { | 10336 class JSDataView: public JSArrayBufferView { |
10338 public: | 10337 public: |
10339 // Only neuters this DataView | |
10340 void Neuter(); | |
10341 | |
10342 DECLARE_CAST(JSDataView) | 10338 DECLARE_CAST(JSDataView) |
10343 | 10339 |
10344 // Dispatched behavior. | 10340 // Dispatched behavior. |
10345 DECLARE_PRINTER(JSDataView) | 10341 DECLARE_PRINTER(JSDataView) |
10346 DECLARE_VERIFIER(JSDataView) | 10342 DECLARE_VERIFIER(JSDataView) |
10347 | 10343 |
10348 static const int kSize = kViewSize; | 10344 static const int kSize = kViewSize; |
10349 | 10345 |
10350 static const int kSizeWithInternalFields = | 10346 static const int kSizeWithInternalFields = |
10351 kSize + v8::ArrayBufferView::kInternalFieldCount * kPointerSize; | 10347 kSize + v8::ArrayBufferView::kInternalFieldCount * kPointerSize; |
(...skipping 735 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
11087 } else { | 11083 } else { |
11088 value &= ~(1 << bit_position); | 11084 value &= ~(1 << bit_position); |
11089 } | 11085 } |
11090 return value; | 11086 return value; |
11091 } | 11087 } |
11092 }; | 11088 }; |
11093 | 11089 |
11094 } } // namespace v8::internal | 11090 } } // namespace v8::internal |
11095 | 11091 |
11096 #endif // V8_OBJECTS_H_ | 11092 #endif // V8_OBJECTS_H_ |
OLD | NEW |