OLD | NEW |
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 4877 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4888 | 4888 |
4889 template <class Traits> | 4889 template <class Traits> |
4890 class FixedTypedArray: public FixedTypedArrayBase { | 4890 class FixedTypedArray: public FixedTypedArrayBase { |
4891 public: | 4891 public: |
4892 typedef typename Traits::ElementType ElementType; | 4892 typedef typename Traits::ElementType ElementType; |
4893 static const InstanceType kInstanceType = Traits::kInstanceType; | 4893 static const InstanceType kInstanceType = Traits::kInstanceType; |
4894 | 4894 |
4895 // Casting: | 4895 // Casting: |
4896 static inline FixedTypedArray<Traits>* cast(Object* obj); | 4896 static inline FixedTypedArray<Traits>* cast(Object* obj); |
4897 | 4897 |
| 4898 static inline int ElementOffset(int index) { |
| 4899 return kDataOffset + index * sizeof(ElementType); |
| 4900 } |
| 4901 |
4898 static inline int SizeFor(int length) { | 4902 static inline int SizeFor(int length) { |
4899 return kDataOffset + length * sizeof(ElementType); | 4903 return ElementOffset(length); |
4900 } | 4904 } |
4901 | 4905 |
4902 inline ElementType get_scalar(int index); | 4906 inline ElementType get_scalar(int index); |
4903 MUST_USE_RESULT inline MaybeObject* get(int index); | 4907 MUST_USE_RESULT inline MaybeObject* get(int index); |
4904 inline void set(int index, ElementType value); | 4908 inline void set(int index, ElementType value); |
4905 | 4909 |
4906 // This accessor applies the correct conversion from Smi, HeapNumber | 4910 // This accessor applies the correct conversion from Smi, HeapNumber |
4907 // and undefined. | 4911 // and undefined. |
4908 MUST_USE_RESULT MaybeObject* SetValue(uint32_t index, Object* value); | 4912 MUST_USE_RESULT MaybeObject* SetValue(uint32_t index, Object* value); |
4909 | 4913 |
(...skipping 5857 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10767 } else { | 10771 } else { |
10768 value &= ~(1 << bit_position); | 10772 value &= ~(1 << bit_position); |
10769 } | 10773 } |
10770 return value; | 10774 return value; |
10771 } | 10775 } |
10772 }; | 10776 }; |
10773 | 10777 |
10774 } } // namespace v8::internal | 10778 } } // namespace v8::internal |
10775 | 10779 |
10776 #endif // V8_OBJECTS_H_ | 10780 #endif // V8_OBJECTS_H_ |
OLD | NEW |