| 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 4612 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4623 inline uint8_t* external_uint8_clamped_pointer(); | 4623 inline uint8_t* external_uint8_clamped_pointer(); |
| 4624 | 4624 |
| 4625 // Setter and getter. | 4625 // Setter and getter. |
| 4626 inline uint8_t get_scalar(int index); | 4626 inline uint8_t get_scalar(int index); |
| 4627 static inline Handle<Object> get(Handle<ExternalUint8ClampedArray> array, | 4627 static inline Handle<Object> get(Handle<ExternalUint8ClampedArray> array, |
| 4628 int index); | 4628 int index); |
| 4629 inline void set(int index, uint8_t value); | 4629 inline void set(int index, uint8_t value); |
| 4630 | 4630 |
| 4631 // This accessor applies the correct conversion from Smi, HeapNumber | 4631 // This accessor applies the correct conversion from Smi, HeapNumber |
| 4632 // and undefined and clamps the converted value between 0 and 255. | 4632 // and undefined and clamps the converted value between 0 and 255. |
| 4633 static Handle<Object> SetValue(Handle<ExternalUint8ClampedArray> array, | 4633 static Handle<Object> SetValue(Handle<JSObject> holder, |
| 4634 uint32_t index, | 4634 Handle<ExternalUint8ClampedArray> array, |
| 4635 Handle<Object> value); | 4635 uint32_t index, Handle<Object> value); |
| 4636 | 4636 |
| 4637 DECLARE_CAST(ExternalUint8ClampedArray) | 4637 DECLARE_CAST(ExternalUint8ClampedArray) |
| 4638 | 4638 |
| 4639 // Dispatched behavior. | 4639 // Dispatched behavior. |
| 4640 DECLARE_PRINTER(ExternalUint8ClampedArray) | 4640 DECLARE_PRINTER(ExternalUint8ClampedArray) |
| 4641 DECLARE_VERIFIER(ExternalUint8ClampedArray) | 4641 DECLARE_VERIFIER(ExternalUint8ClampedArray) |
| 4642 | 4642 |
| 4643 private: | 4643 private: |
| 4644 DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalUint8ClampedArray); | 4644 DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalUint8ClampedArray); |
| 4645 }; | 4645 }; |
| 4646 | 4646 |
| 4647 | 4647 |
| 4648 class ExternalInt8Array: public ExternalArray { | 4648 class ExternalInt8Array: public ExternalArray { |
| 4649 public: | 4649 public: |
| 4650 // Setter and getter. | 4650 // Setter and getter. |
| 4651 inline int8_t get_scalar(int index); | 4651 inline int8_t get_scalar(int index); |
| 4652 static inline Handle<Object> get(Handle<ExternalInt8Array> array, int index); | 4652 static inline Handle<Object> get(Handle<ExternalInt8Array> array, int index); |
| 4653 inline void set(int index, int8_t value); | 4653 inline void set(int index, int8_t value); |
| 4654 | 4654 |
| 4655 // This accessor applies the correct conversion from Smi, HeapNumber | 4655 // This accessor applies the correct conversion from Smi, HeapNumber |
| 4656 // and undefined. | 4656 // and undefined. |
| 4657 static Handle<Object> SetValue(Handle<ExternalInt8Array> array, | 4657 static Handle<Object> SetValue(Handle<JSObject> holder, |
| 4658 uint32_t index, | 4658 Handle<ExternalInt8Array> array, |
| 4659 Handle<Object> value); | 4659 uint32_t index, Handle<Object> value); |
| 4660 | 4660 |
| 4661 DECLARE_CAST(ExternalInt8Array) | 4661 DECLARE_CAST(ExternalInt8Array) |
| 4662 | 4662 |
| 4663 // Dispatched behavior. | 4663 // Dispatched behavior. |
| 4664 DECLARE_PRINTER(ExternalInt8Array) | 4664 DECLARE_PRINTER(ExternalInt8Array) |
| 4665 DECLARE_VERIFIER(ExternalInt8Array) | 4665 DECLARE_VERIFIER(ExternalInt8Array) |
| 4666 | 4666 |
| 4667 private: | 4667 private: |
| 4668 DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalInt8Array); | 4668 DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalInt8Array); |
| 4669 }; | 4669 }; |
| 4670 | 4670 |
| 4671 | 4671 |
| 4672 class ExternalUint8Array: public ExternalArray { | 4672 class ExternalUint8Array: public ExternalArray { |
| 4673 public: | 4673 public: |
| 4674 // Setter and getter. | 4674 // Setter and getter. |
| 4675 inline uint8_t get_scalar(int index); | 4675 inline uint8_t get_scalar(int index); |
| 4676 static inline Handle<Object> get(Handle<ExternalUint8Array> array, int index); | 4676 static inline Handle<Object> get(Handle<ExternalUint8Array> array, int index); |
| 4677 inline void set(int index, uint8_t value); | 4677 inline void set(int index, uint8_t value); |
| 4678 | 4678 |
| 4679 // This accessor applies the correct conversion from Smi, HeapNumber | 4679 // This accessor applies the correct conversion from Smi, HeapNumber |
| 4680 // and undefined. | 4680 // and undefined. |
| 4681 static Handle<Object> SetValue(Handle<ExternalUint8Array> array, | 4681 static Handle<Object> SetValue(Handle<JSObject> holder, |
| 4682 uint32_t index, | 4682 Handle<ExternalUint8Array> array, |
| 4683 Handle<Object> value); | 4683 uint32_t index, Handle<Object> value); |
| 4684 | 4684 |
| 4685 DECLARE_CAST(ExternalUint8Array) | 4685 DECLARE_CAST(ExternalUint8Array) |
| 4686 | 4686 |
| 4687 // Dispatched behavior. | 4687 // Dispatched behavior. |
| 4688 DECLARE_PRINTER(ExternalUint8Array) | 4688 DECLARE_PRINTER(ExternalUint8Array) |
| 4689 DECLARE_VERIFIER(ExternalUint8Array) | 4689 DECLARE_VERIFIER(ExternalUint8Array) |
| 4690 | 4690 |
| 4691 private: | 4691 private: |
| 4692 DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalUint8Array); | 4692 DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalUint8Array); |
| 4693 }; | 4693 }; |
| 4694 | 4694 |
| 4695 | 4695 |
| 4696 class ExternalInt16Array: public ExternalArray { | 4696 class ExternalInt16Array: public ExternalArray { |
| 4697 public: | 4697 public: |
| 4698 // Setter and getter. | 4698 // Setter and getter. |
| 4699 inline int16_t get_scalar(int index); | 4699 inline int16_t get_scalar(int index); |
| 4700 static inline Handle<Object> get(Handle<ExternalInt16Array> array, int index); | 4700 static inline Handle<Object> get(Handle<ExternalInt16Array> array, int index); |
| 4701 inline void set(int index, int16_t value); | 4701 inline void set(int index, int16_t value); |
| 4702 | 4702 |
| 4703 // This accessor applies the correct conversion from Smi, HeapNumber | 4703 // This accessor applies the correct conversion from Smi, HeapNumber |
| 4704 // and undefined. | 4704 // and undefined. |
| 4705 static Handle<Object> SetValue(Handle<ExternalInt16Array> array, | 4705 static Handle<Object> SetValue(Handle<JSObject> holder, |
| 4706 uint32_t index, | 4706 Handle<ExternalInt16Array> array, |
| 4707 Handle<Object> value); | 4707 uint32_t index, Handle<Object> value); |
| 4708 | 4708 |
| 4709 DECLARE_CAST(ExternalInt16Array) | 4709 DECLARE_CAST(ExternalInt16Array) |
| 4710 | 4710 |
| 4711 // Dispatched behavior. | 4711 // Dispatched behavior. |
| 4712 DECLARE_PRINTER(ExternalInt16Array) | 4712 DECLARE_PRINTER(ExternalInt16Array) |
| 4713 DECLARE_VERIFIER(ExternalInt16Array) | 4713 DECLARE_VERIFIER(ExternalInt16Array) |
| 4714 | 4714 |
| 4715 private: | 4715 private: |
| 4716 DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalInt16Array); | 4716 DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalInt16Array); |
| 4717 }; | 4717 }; |
| 4718 | 4718 |
| 4719 | 4719 |
| 4720 class ExternalUint16Array: public ExternalArray { | 4720 class ExternalUint16Array: public ExternalArray { |
| 4721 public: | 4721 public: |
| 4722 // Setter and getter. | 4722 // Setter and getter. |
| 4723 inline uint16_t get_scalar(int index); | 4723 inline uint16_t get_scalar(int index); |
| 4724 static inline Handle<Object> get(Handle<ExternalUint16Array> array, | 4724 static inline Handle<Object> get(Handle<ExternalUint16Array> array, |
| 4725 int index); | 4725 int index); |
| 4726 inline void set(int index, uint16_t value); | 4726 inline void set(int index, uint16_t value); |
| 4727 | 4727 |
| 4728 // This accessor applies the correct conversion from Smi, HeapNumber | 4728 // This accessor applies the correct conversion from Smi, HeapNumber |
| 4729 // and undefined. | 4729 // and undefined. |
| 4730 static Handle<Object> SetValue(Handle<ExternalUint16Array> array, | 4730 static Handle<Object> SetValue(Handle<JSObject> holder, |
| 4731 uint32_t index, | 4731 Handle<ExternalUint16Array> array, |
| 4732 Handle<Object> value); | 4732 uint32_t index, Handle<Object> value); |
| 4733 | 4733 |
| 4734 DECLARE_CAST(ExternalUint16Array) | 4734 DECLARE_CAST(ExternalUint16Array) |
| 4735 | 4735 |
| 4736 // Dispatched behavior. | 4736 // Dispatched behavior. |
| 4737 DECLARE_PRINTER(ExternalUint16Array) | 4737 DECLARE_PRINTER(ExternalUint16Array) |
| 4738 DECLARE_VERIFIER(ExternalUint16Array) | 4738 DECLARE_VERIFIER(ExternalUint16Array) |
| 4739 | 4739 |
| 4740 private: | 4740 private: |
| 4741 DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalUint16Array); | 4741 DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalUint16Array); |
| 4742 }; | 4742 }; |
| 4743 | 4743 |
| 4744 | 4744 |
| 4745 class ExternalInt32Array: public ExternalArray { | 4745 class ExternalInt32Array: public ExternalArray { |
| 4746 public: | 4746 public: |
| 4747 // Setter and getter. | 4747 // Setter and getter. |
| 4748 inline int32_t get_scalar(int index); | 4748 inline int32_t get_scalar(int index); |
| 4749 static inline Handle<Object> get(Handle<ExternalInt32Array> array, int index); | 4749 static inline Handle<Object> get(Handle<ExternalInt32Array> array, int index); |
| 4750 inline void set(int index, int32_t value); | 4750 inline void set(int index, int32_t value); |
| 4751 | 4751 |
| 4752 // This accessor applies the correct conversion from Smi, HeapNumber | 4752 // This accessor applies the correct conversion from Smi, HeapNumber |
| 4753 // and undefined. | 4753 // and undefined. |
| 4754 static Handle<Object> SetValue(Handle<ExternalInt32Array> array, | 4754 static Handle<Object> SetValue(Handle<JSObject> holder, |
| 4755 uint32_t index, | 4755 Handle<ExternalInt32Array> array, |
| 4756 Handle<Object> value); | 4756 uint32_t index, Handle<Object> value); |
| 4757 | 4757 |
| 4758 DECLARE_CAST(ExternalInt32Array) | 4758 DECLARE_CAST(ExternalInt32Array) |
| 4759 | 4759 |
| 4760 // Dispatched behavior. | 4760 // Dispatched behavior. |
| 4761 DECLARE_PRINTER(ExternalInt32Array) | 4761 DECLARE_PRINTER(ExternalInt32Array) |
| 4762 DECLARE_VERIFIER(ExternalInt32Array) | 4762 DECLARE_VERIFIER(ExternalInt32Array) |
| 4763 | 4763 |
| 4764 private: | 4764 private: |
| 4765 DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalInt32Array); | 4765 DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalInt32Array); |
| 4766 }; | 4766 }; |
| 4767 | 4767 |
| 4768 | 4768 |
| 4769 class ExternalUint32Array: public ExternalArray { | 4769 class ExternalUint32Array: public ExternalArray { |
| 4770 public: | 4770 public: |
| 4771 // Setter and getter. | 4771 // Setter and getter. |
| 4772 inline uint32_t get_scalar(int index); | 4772 inline uint32_t get_scalar(int index); |
| 4773 static inline Handle<Object> get(Handle<ExternalUint32Array> array, | 4773 static inline Handle<Object> get(Handle<ExternalUint32Array> array, |
| 4774 int index); | 4774 int index); |
| 4775 inline void set(int index, uint32_t value); | 4775 inline void set(int index, uint32_t value); |
| 4776 | 4776 |
| 4777 // This accessor applies the correct conversion from Smi, HeapNumber | 4777 // This accessor applies the correct conversion from Smi, HeapNumber |
| 4778 // and undefined. | 4778 // and undefined. |
| 4779 static Handle<Object> SetValue(Handle<ExternalUint32Array> array, | 4779 static Handle<Object> SetValue(Handle<JSObject> holder, |
| 4780 uint32_t index, | 4780 Handle<ExternalUint32Array> array, |
| 4781 Handle<Object> value); | 4781 uint32_t index, Handle<Object> value); |
| 4782 | 4782 |
| 4783 DECLARE_CAST(ExternalUint32Array) | 4783 DECLARE_CAST(ExternalUint32Array) |
| 4784 | 4784 |
| 4785 // Dispatched behavior. | 4785 // Dispatched behavior. |
| 4786 DECLARE_PRINTER(ExternalUint32Array) | 4786 DECLARE_PRINTER(ExternalUint32Array) |
| 4787 DECLARE_VERIFIER(ExternalUint32Array) | 4787 DECLARE_VERIFIER(ExternalUint32Array) |
| 4788 | 4788 |
| 4789 private: | 4789 private: |
| 4790 DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalUint32Array); | 4790 DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalUint32Array); |
| 4791 }; | 4791 }; |
| 4792 | 4792 |
| 4793 | 4793 |
| 4794 class ExternalFloat32Array: public ExternalArray { | 4794 class ExternalFloat32Array: public ExternalArray { |
| 4795 public: | 4795 public: |
| 4796 // Setter and getter. | 4796 // Setter and getter. |
| 4797 inline float get_scalar(int index); | 4797 inline float get_scalar(int index); |
| 4798 static inline Handle<Object> get(Handle<ExternalFloat32Array> array, | 4798 static inline Handle<Object> get(Handle<ExternalFloat32Array> array, |
| 4799 int index); | 4799 int index); |
| 4800 inline void set(int index, float value); | 4800 inline void set(int index, float value); |
| 4801 | 4801 |
| 4802 // This accessor applies the correct conversion from Smi, HeapNumber | 4802 // This accessor applies the correct conversion from Smi, HeapNumber |
| 4803 // and undefined. | 4803 // and undefined. |
| 4804 static Handle<Object> SetValue(Handle<ExternalFloat32Array> array, | 4804 static Handle<Object> SetValue(Handle<JSObject> holder, |
| 4805 uint32_t index, | 4805 Handle<ExternalFloat32Array> array, |
| 4806 Handle<Object> value); | 4806 uint32_t index, Handle<Object> value); |
| 4807 | 4807 |
| 4808 DECLARE_CAST(ExternalFloat32Array) | 4808 DECLARE_CAST(ExternalFloat32Array) |
| 4809 | 4809 |
| 4810 // Dispatched behavior. | 4810 // Dispatched behavior. |
| 4811 DECLARE_PRINTER(ExternalFloat32Array) | 4811 DECLARE_PRINTER(ExternalFloat32Array) |
| 4812 DECLARE_VERIFIER(ExternalFloat32Array) | 4812 DECLARE_VERIFIER(ExternalFloat32Array) |
| 4813 | 4813 |
| 4814 private: | 4814 private: |
| 4815 DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalFloat32Array); | 4815 DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalFloat32Array); |
| 4816 }; | 4816 }; |
| 4817 | 4817 |
| 4818 | 4818 |
| 4819 class ExternalFloat64Array: public ExternalArray { | 4819 class ExternalFloat64Array: public ExternalArray { |
| 4820 public: | 4820 public: |
| 4821 // Setter and getter. | 4821 // Setter and getter. |
| 4822 inline double get_scalar(int index); | 4822 inline double get_scalar(int index); |
| 4823 static inline Handle<Object> get(Handle<ExternalFloat64Array> array, | 4823 static inline Handle<Object> get(Handle<ExternalFloat64Array> array, |
| 4824 int index); | 4824 int index); |
| 4825 inline void set(int index, double value); | 4825 inline void set(int index, double value); |
| 4826 | 4826 |
| 4827 // This accessor applies the correct conversion from Smi, HeapNumber | 4827 // This accessor applies the correct conversion from Smi, HeapNumber |
| 4828 // and undefined. | 4828 // and undefined. |
| 4829 static Handle<Object> SetValue(Handle<ExternalFloat64Array> array, | 4829 static Handle<Object> SetValue(Handle<JSObject> holder, |
| 4830 uint32_t index, | 4830 Handle<ExternalFloat64Array> array, |
| 4831 Handle<Object> value); | 4831 uint32_t index, Handle<Object> value); |
| 4832 | 4832 |
| 4833 DECLARE_CAST(ExternalFloat64Array) | 4833 DECLARE_CAST(ExternalFloat64Array) |
| 4834 | 4834 |
| 4835 // Dispatched behavior. | 4835 // Dispatched behavior. |
| 4836 DECLARE_PRINTER(ExternalFloat64Array) | 4836 DECLARE_PRINTER(ExternalFloat64Array) |
| 4837 DECLARE_VERIFIER(ExternalFloat64Array) | 4837 DECLARE_VERIFIER(ExternalFloat64Array) |
| 4838 | 4838 |
| 4839 private: | 4839 private: |
| 4840 DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalFloat64Array); | 4840 DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalFloat64Array); |
| 4841 }; | 4841 }; |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4884 | 4884 |
| 4885 inline ElementType get_scalar(int index); | 4885 inline ElementType get_scalar(int index); |
| 4886 static inline Handle<Object> get(Handle<FixedTypedArray> array, int index); | 4886 static inline Handle<Object> get(Handle<FixedTypedArray> array, int index); |
| 4887 inline void set(int index, ElementType value); | 4887 inline void set(int index, ElementType value); |
| 4888 | 4888 |
| 4889 static inline ElementType from_int(int value); | 4889 static inline ElementType from_int(int value); |
| 4890 static inline ElementType from_double(double value); | 4890 static inline ElementType from_double(double value); |
| 4891 | 4891 |
| 4892 // This accessor applies the correct conversion from Smi, HeapNumber | 4892 // This accessor applies the correct conversion from Smi, HeapNumber |
| 4893 // and undefined. | 4893 // and undefined. |
| 4894 static Handle<Object> SetValue(Handle<FixedTypedArray<Traits> > array, | 4894 static Handle<Object> SetValue(Handle<JSObject> holder, |
| 4895 uint32_t index, | 4895 Handle<FixedTypedArray<Traits> > array, |
| 4896 Handle<Object> value); | 4896 uint32_t index, Handle<Object> value); |
| 4897 | 4897 |
| 4898 DECLARE_PRINTER(FixedTypedArray) | 4898 DECLARE_PRINTER(FixedTypedArray) |
| 4899 DECLARE_VERIFIER(FixedTypedArray) | 4899 DECLARE_VERIFIER(FixedTypedArray) |
| 4900 | 4900 |
| 4901 private: | 4901 private: |
| 4902 DISALLOW_IMPLICIT_CONSTRUCTORS(FixedTypedArray); | 4902 DISALLOW_IMPLICIT_CONSTRUCTORS(FixedTypedArray); |
| 4903 }; | 4903 }; |
| 4904 | 4904 |
| 4905 #define FIXED_TYPED_ARRAY_TRAITS(Type, type, TYPE, elementType, size) \ | 4905 #define FIXED_TYPED_ARRAY_TRAITS(Type, type, TYPE, elementType, size) \ |
| 4906 class Type##ArrayTraits { \ | 4906 class Type##ArrayTraits { \ |
| (...skipping 5302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10209 | 10209 |
| 10210 inline bool is_external(); | 10210 inline bool is_external(); |
| 10211 inline void set_is_external(bool value); | 10211 inline void set_is_external(bool value); |
| 10212 | 10212 |
| 10213 inline bool should_be_freed(); | 10213 inline bool should_be_freed(); |
| 10214 inline void set_should_be_freed(bool value); | 10214 inline void set_should_be_freed(bool value); |
| 10215 | 10215 |
| 10216 inline bool is_neuterable(); | 10216 inline bool is_neuterable(); |
| 10217 inline void set_is_neuterable(bool value); | 10217 inline void set_is_neuterable(bool value); |
| 10218 | 10218 |
| 10219 inline bool was_neutered(); |
| 10220 inline void set_was_neutered(bool value); |
| 10221 |
| 10219 // [weak_next]: linked list of array buffers. | 10222 // [weak_next]: linked list of array buffers. |
| 10220 DECL_ACCESSORS(weak_next, Object) | 10223 DECL_ACCESSORS(weak_next, Object) |
| 10221 | 10224 |
| 10222 // [weak_first_array]: weak linked list of views. | |
| 10223 DECL_ACCESSORS(weak_first_view, Object) | |
| 10224 | |
| 10225 DECLARE_CAST(JSArrayBuffer) | 10225 DECLARE_CAST(JSArrayBuffer) |
| 10226 | 10226 |
| 10227 // Neutering. Only neuters the buffer, not associated typed arrays. | |
| 10228 void Neuter(); | 10227 void Neuter(); |
| 10229 | 10228 |
| 10230 // Dispatched behavior. | 10229 // Dispatched behavior. |
| 10231 DECLARE_PRINTER(JSArrayBuffer) | 10230 DECLARE_PRINTER(JSArrayBuffer) |
| 10232 DECLARE_VERIFIER(JSArrayBuffer) | 10231 DECLARE_VERIFIER(JSArrayBuffer) |
| 10233 | 10232 |
| 10234 static const int kBackingStoreOffset = JSObject::kHeaderSize; | 10233 static const int kBackingStoreOffset = JSObject::kHeaderSize; |
| 10235 static const int kByteLengthOffset = kBackingStoreOffset + kPointerSize; | 10234 static const int kByteLengthOffset = kBackingStoreOffset + kPointerSize; |
| 10236 static const int kFlagOffset = kByteLengthOffset + kPointerSize; | 10235 static const int kFlagOffset = kByteLengthOffset + kPointerSize; |
| 10237 static const int kWeakNextOffset = kFlagOffset + kPointerSize; | 10236 static const int kWeakNextOffset = kFlagOffset + kPointerSize; |
| 10238 static const int kWeakFirstViewOffset = kWeakNextOffset + kPointerSize; | 10237 static const int kSize = kWeakNextOffset + kPointerSize; |
| 10239 static const int kSize = kWeakFirstViewOffset + kPointerSize; | |
| 10240 | 10238 |
| 10241 static const int kSizeWithInternalFields = | 10239 static const int kSizeWithInternalFields = |
| 10242 kSize + v8::ArrayBuffer::kInternalFieldCount * kPointerSize; | 10240 kSize + v8::ArrayBuffer::kInternalFieldCount * kPointerSize; |
| 10243 | 10241 |
| 10244 private: | |
| 10245 // Bit position in a flag | 10242 // Bit position in a flag |
| 10246 static const int kIsExternalBit = 0; | 10243 static const int kIsExternalBit = 0; |
| 10247 static const int kShouldBeFreed = 1; | 10244 static const int kShouldBeFreed = 1; |
| 10248 static const int kIsNeuterableBit = 2; | 10245 static const int kIsNeuterableBit = 2; |
| 10246 static const int kWasNeuteredBit = 3; |
| 10249 | 10247 |
| 10248 private: |
| 10250 DISALLOW_IMPLICIT_CONSTRUCTORS(JSArrayBuffer); | 10249 DISALLOW_IMPLICIT_CONSTRUCTORS(JSArrayBuffer); |
| 10251 }; | 10250 }; |
| 10252 | 10251 |
| 10253 | 10252 |
| 10254 class JSArrayBufferView: public JSObject { | 10253 class JSArrayBufferView: public JSObject { |
| 10255 public: | 10254 public: |
| 10256 // [buffer]: ArrayBuffer that this typed array views. | 10255 // [buffer]: ArrayBuffer that this typed array views. |
| 10257 DECL_ACCESSORS(buffer, Object) | 10256 DECL_ACCESSORS(buffer, Object) |
| 10258 | 10257 |
| 10259 // [byte_length]: offset of typed array in bytes. | 10258 // [byte_length]: offset of typed array in bytes. |
| 10260 DECL_ACCESSORS(byte_offset, Object) | 10259 DECL_ACCESSORS(byte_offset, Object) |
| 10261 | 10260 |
| 10262 // [byte_length]: length of typed array in bytes. | 10261 // [byte_length]: length of typed array in bytes. |
| 10263 DECL_ACCESSORS(byte_length, Object) | 10262 DECL_ACCESSORS(byte_length, Object) |
| 10264 | 10263 |
| 10265 // [weak_next]: linked list of typed arrays over the same array buffer. | |
| 10266 DECL_ACCESSORS(weak_next, Object) | |
| 10267 | |
| 10268 DECLARE_CAST(JSArrayBufferView) | 10264 DECLARE_CAST(JSArrayBufferView) |
| 10269 | 10265 |
| 10270 DECLARE_VERIFIER(JSArrayBufferView) | 10266 DECLARE_VERIFIER(JSArrayBufferView) |
| 10271 | 10267 |
| 10272 static const int kBufferOffset = JSObject::kHeaderSize; | 10268 static const int kBufferOffset = JSObject::kHeaderSize; |
| 10273 static const int kByteOffsetOffset = kBufferOffset + kPointerSize; | 10269 static const int kByteOffsetOffset = kBufferOffset + kPointerSize; |
| 10274 static const int kByteLengthOffset = kByteOffsetOffset + kPointerSize; | 10270 static const int kByteLengthOffset = kByteOffsetOffset + kPointerSize; |
| 10275 static const int kWeakNextOffset = kByteLengthOffset + kPointerSize; | 10271 static const int kViewSize = kByteLengthOffset + kPointerSize; |
| 10276 static const int kViewSize = kWeakNextOffset + kPointerSize; | |
| 10277 | |
| 10278 protected: | |
| 10279 void NeuterView(); | |
| 10280 | 10272 |
| 10281 private: | 10273 private: |
| 10282 DISALLOW_IMPLICIT_CONSTRUCTORS(JSArrayBufferView); | 10274 DISALLOW_IMPLICIT_CONSTRUCTORS(JSArrayBufferView); |
| 10283 }; | 10275 }; |
| 10284 | 10276 |
| 10285 | 10277 |
| 10286 class JSTypedArray: public JSArrayBufferView { | 10278 class JSTypedArray: public JSArrayBufferView { |
| 10287 public: | 10279 public: |
| 10288 // [length]: length of typed array in elements. | 10280 // [length]: length of typed array in elements. |
| 10289 DECL_ACCESSORS(length, Object) | 10281 DECL_ACCESSORS(length, Object) |
| 10290 | 10282 |
| 10291 // Neutering. Only neuters this typed array. | |
| 10292 void Neuter(); | |
| 10293 | |
| 10294 DECLARE_CAST(JSTypedArray) | 10283 DECLARE_CAST(JSTypedArray) |
| 10295 | 10284 |
| 10296 ExternalArrayType type(); | 10285 ExternalArrayType type(); |
| 10297 size_t element_size(); | 10286 size_t element_size(); |
| 10298 | 10287 |
| 10299 Handle<JSArrayBuffer> GetBuffer(); | 10288 Handle<JSArrayBuffer> GetBuffer(); |
| 10300 | 10289 |
| 10301 // Dispatched behavior. | 10290 // Dispatched behavior. |
| 10302 DECLARE_PRINTER(JSTypedArray) | 10291 DECLARE_PRINTER(JSTypedArray) |
| 10303 DECLARE_VERIFIER(JSTypedArray) | 10292 DECLARE_VERIFIER(JSTypedArray) |
| 10304 | 10293 |
| 10305 static const int kLengthOffset = kViewSize + kPointerSize; | 10294 static const int kLengthOffset = kViewSize + kPointerSize; |
| 10306 static const int kSize = kLengthOffset + kPointerSize; | 10295 static const int kSize = kLengthOffset + kPointerSize; |
| 10307 | 10296 |
| 10308 static const int kSizeWithInternalFields = | 10297 static const int kSizeWithInternalFields = |
| 10309 kSize + v8::ArrayBufferView::kInternalFieldCount * kPointerSize; | 10298 kSize + v8::ArrayBufferView::kInternalFieldCount * kPointerSize; |
| 10310 | 10299 |
| 10311 private: | 10300 private: |
| 10312 static Handle<JSArrayBuffer> MaterializeArrayBuffer( | 10301 static Handle<JSArrayBuffer> MaterializeArrayBuffer( |
| 10313 Handle<JSTypedArray> typed_array); | 10302 Handle<JSTypedArray> typed_array); |
| 10314 | 10303 |
| 10315 DISALLOW_IMPLICIT_CONSTRUCTORS(JSTypedArray); | 10304 DISALLOW_IMPLICIT_CONSTRUCTORS(JSTypedArray); |
| 10316 }; | 10305 }; |
| 10317 | 10306 |
| 10318 | 10307 |
| 10319 class JSDataView: public JSArrayBufferView { | 10308 class JSDataView: public JSArrayBufferView { |
| 10320 public: | 10309 public: |
| 10321 // Only neuters this DataView | |
| 10322 void Neuter(); | |
| 10323 | |
| 10324 DECLARE_CAST(JSDataView) | 10310 DECLARE_CAST(JSDataView) |
| 10325 | 10311 |
| 10326 // Dispatched behavior. | 10312 // Dispatched behavior. |
| 10327 DECLARE_PRINTER(JSDataView) | 10313 DECLARE_PRINTER(JSDataView) |
| 10328 DECLARE_VERIFIER(JSDataView) | 10314 DECLARE_VERIFIER(JSDataView) |
| 10329 | 10315 |
| 10330 static const int kSize = kViewSize; | 10316 static const int kSize = kViewSize; |
| 10331 | 10317 |
| 10332 static const int kSizeWithInternalFields = | 10318 static const int kSizeWithInternalFields = |
| 10333 kSize + v8::ArrayBufferView::kInternalFieldCount * kPointerSize; | 10319 kSize + v8::ArrayBufferView::kInternalFieldCount * kPointerSize; |
| (...skipping 735 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 11069 } else { | 11055 } else { |
| 11070 value &= ~(1 << bit_position); | 11056 value &= ~(1 << bit_position); |
| 11071 } | 11057 } |
| 11072 return value; | 11058 return value; |
| 11073 } | 11059 } |
| 11074 }; | 11060 }; |
| 11075 | 11061 |
| 11076 } } // namespace v8::internal | 11062 } } // namespace v8::internal |
| 11077 | 11063 |
| 11078 #endif // V8_OBJECTS_H_ | 11064 #endif // V8_OBJECTS_H_ |
| OLD | NEW |