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