| 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 // Review notes: | 5 // Review notes: |
| 6 // | 6 // |
| 7 // - The use of macros in these inline functions may seem superfluous | 7 // - The use of macros in these inline functions may seem superfluous |
| 8 // but it is absolutely needed to make sure gcc generates optimal | 8 // but it is absolutely needed to make sure gcc generates optimal |
| 9 // code. gcc is not happy when attempting to inline too deep. | 9 // code. gcc is not happy when attempting to inline too deep. |
| 10 // | 10 // |
| (...skipping 4294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4305 | 4305 |
| 4306 template <class Traits> | 4306 template <class Traits> |
| 4307 typename Traits::ElementType FixedTypedArray<Traits>::get_scalar(int index) { | 4307 typename Traits::ElementType FixedTypedArray<Traits>::get_scalar(int index) { |
| 4308 DCHECK((index >= 0) && (index < this->length())); | 4308 DCHECK((index >= 0) && (index < this->length())); |
| 4309 ElementType* ptr = reinterpret_cast<ElementType*>( | 4309 ElementType* ptr = reinterpret_cast<ElementType*>( |
| 4310 FIELD_ADDR(this, kDataOffset)); | 4310 FIELD_ADDR(this, kDataOffset)); |
| 4311 return ptr[index]; | 4311 return ptr[index]; |
| 4312 } | 4312 } |
| 4313 | 4313 |
| 4314 | 4314 |
| 4315 template<> inline | |
| 4316 FixedTypedArray<Float64ArrayTraits>::ElementType | |
| 4317 FixedTypedArray<Float64ArrayTraits>::get_scalar(int index) { | |
| 4318 DCHECK((index >= 0) && (index < this->length())); | |
| 4319 return READ_DOUBLE_FIELD(this, ElementOffset(index)); | |
| 4320 } | |
| 4321 | |
| 4322 | |
| 4323 template <class Traits> | 4315 template <class Traits> |
| 4324 void FixedTypedArray<Traits>::set(int index, ElementType value) { | 4316 void FixedTypedArray<Traits>::set(int index, ElementType value) { |
| 4325 DCHECK((index >= 0) && (index < this->length())); | 4317 DCHECK((index >= 0) && (index < this->length())); |
| 4326 ElementType* ptr = reinterpret_cast<ElementType*>( | 4318 ElementType* ptr = reinterpret_cast<ElementType*>( |
| 4327 FIELD_ADDR(this, kDataOffset)); | 4319 FIELD_ADDR(this, kDataOffset)); |
| 4328 ptr[index] = value; | 4320 ptr[index] = value; |
| 4329 } | 4321 } |
| 4330 | 4322 |
| 4331 | 4323 |
| 4332 template<> inline | |
| 4333 void FixedTypedArray<Float64ArrayTraits>::set( | |
| 4334 int index, Float64ArrayTraits::ElementType value) { | |
| 4335 DCHECK((index >= 0) && (index < this->length())); | |
| 4336 WRITE_DOUBLE_FIELD(this, ElementOffset(index), value); | |
| 4337 } | |
| 4338 | |
| 4339 | |
| 4340 template <class Traits> | 4324 template <class Traits> |
| 4341 typename Traits::ElementType FixedTypedArray<Traits>::from_int(int value) { | 4325 typename Traits::ElementType FixedTypedArray<Traits>::from_int(int value) { |
| 4342 return static_cast<ElementType>(value); | 4326 return static_cast<ElementType>(value); |
| 4343 } | 4327 } |
| 4344 | 4328 |
| 4345 | 4329 |
| 4346 template <> inline | 4330 template <> inline |
| 4347 uint8_t FixedTypedArray<Uint8ClampedArrayTraits>::from_int(int value) { | 4331 uint8_t FixedTypedArray<Uint8ClampedArrayTraits>::from_int(int value) { |
| 4348 if (value < 0) return 0; | 4332 if (value < 0) return 0; |
| 4349 if (value > 0xFF) return 0xFF; | 4333 if (value > 0xFF) return 0xFF; |
| (...skipping 3265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7615 #undef READ_SHORT_FIELD | 7599 #undef READ_SHORT_FIELD |
| 7616 #undef WRITE_SHORT_FIELD | 7600 #undef WRITE_SHORT_FIELD |
| 7617 #undef READ_BYTE_FIELD | 7601 #undef READ_BYTE_FIELD |
| 7618 #undef WRITE_BYTE_FIELD | 7602 #undef WRITE_BYTE_FIELD |
| 7619 #undef NOBARRIER_READ_BYTE_FIELD | 7603 #undef NOBARRIER_READ_BYTE_FIELD |
| 7620 #undef NOBARRIER_WRITE_BYTE_FIELD | 7604 #undef NOBARRIER_WRITE_BYTE_FIELD |
| 7621 | 7605 |
| 7622 } } // namespace v8::internal | 7606 } } // namespace v8::internal |
| 7623 | 7607 |
| 7624 #endif // V8_OBJECTS_INL_H_ | 7608 #endif // V8_OBJECTS_INL_H_ |
| OLD | NEW |