| 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 4018 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4029 | 4029 |
| 4030 template <class Traits> | 4030 template <class Traits> |
| 4031 Handle<Object> FixedTypedArray<Traits>::get( | 4031 Handle<Object> FixedTypedArray<Traits>::get( |
| 4032 Handle<FixedTypedArray<Traits> > array, | 4032 Handle<FixedTypedArray<Traits> > array, |
| 4033 int index) { | 4033 int index) { |
| 4034 return Traits::ToHandle(array->GetIsolate(), array->get_scalar(index)); | 4034 return Traits::ToHandle(array->GetIsolate(), array->get_scalar(index)); |
| 4035 } | 4035 } |
| 4036 | 4036 |
| 4037 | 4037 |
| 4038 template <class Traits> | 4038 template <class Traits> |
| 4039 Handle<Object> FixedTypedArray<Traits>::SetValue( | 4039 void FixedTypedArray<Traits>::SetValue(Handle<JSObject> holder, |
| 4040 Handle<JSObject> holder, Handle<FixedTypedArray<Traits> > array, | 4040 Handle<FixedTypedArray<Traits> > array, |
| 4041 uint32_t index, Handle<Object> value) { | 4041 uint32_t index, Handle<Object> value) { |
| 4042 ElementType cast_value = Traits::defaultValue(); | 4042 ElementType cast_value = Traits::defaultValue(); |
| 4043 Handle<JSArrayBufferView> view = Handle<JSArrayBufferView>::cast(holder); | 4043 Handle<JSArrayBufferView> view = Handle<JSArrayBufferView>::cast(holder); |
| 4044 if (!view->WasNeutered()) { | 4044 if (!view->WasNeutered()) { |
| 4045 if (index < static_cast<uint32_t>(array->length())) { | 4045 if (index < static_cast<uint32_t>(array->length())) { |
| 4046 if (value->IsSmi()) { | 4046 if (value->IsSmi()) { |
| 4047 int int_value = Handle<Smi>::cast(value)->value(); | 4047 int int_value = Handle<Smi>::cast(value)->value(); |
| 4048 cast_value = from_int(int_value); | 4048 cast_value = from_int(int_value); |
| 4049 } else if (value->IsHeapNumber()) { | 4049 } else if (value->IsHeapNumber()) { |
| 4050 double double_value = Handle<HeapNumber>::cast(value)->value(); | 4050 double double_value = Handle<HeapNumber>::cast(value)->value(); |
| 4051 cast_value = from_double(double_value); | 4051 cast_value = from_double(double_value); |
| 4052 } else { | 4052 } else { |
| 4053 // Clamp undefined to the default value. All other types have been | 4053 // Clamp undefined to the default value. All other types have been |
| 4054 // converted to a number type further up in the call chain. | 4054 // converted to a number type further up in the call chain. |
| 4055 DCHECK(value->IsUndefined()); | 4055 DCHECK(value->IsUndefined()); |
| 4056 } | 4056 } |
| 4057 array->set(index, cast_value); | 4057 array->set(index, cast_value); |
| 4058 } | 4058 } |
| 4059 } | 4059 } |
| 4060 return Traits::ToHandle(array->GetIsolate(), cast_value); | |
| 4061 } | 4060 } |
| 4062 | 4061 |
| 4063 | 4062 |
| 4064 Handle<Object> Uint8ArrayTraits::ToHandle(Isolate* isolate, uint8_t scalar) { | 4063 Handle<Object> Uint8ArrayTraits::ToHandle(Isolate* isolate, uint8_t scalar) { |
| 4065 return handle(Smi::FromInt(scalar), isolate); | 4064 return handle(Smi::FromInt(scalar), isolate); |
| 4066 } | 4065 } |
| 4067 | 4066 |
| 4068 | 4067 |
| 4069 Handle<Object> Uint8ClampedArrayTraits::ToHandle(Isolate* isolate, | 4068 Handle<Object> Uint8ClampedArrayTraits::ToHandle(Isolate* isolate, |
| 4070 uint8_t scalar) { | 4069 uint8_t scalar) { |
| (...skipping 3293 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7364 #undef READ_SHORT_FIELD | 7363 #undef READ_SHORT_FIELD |
| 7365 #undef WRITE_SHORT_FIELD | 7364 #undef WRITE_SHORT_FIELD |
| 7366 #undef READ_BYTE_FIELD | 7365 #undef READ_BYTE_FIELD |
| 7367 #undef WRITE_BYTE_FIELD | 7366 #undef WRITE_BYTE_FIELD |
| 7368 #undef NOBARRIER_READ_BYTE_FIELD | 7367 #undef NOBARRIER_READ_BYTE_FIELD |
| 7369 #undef NOBARRIER_WRITE_BYTE_FIELD | 7368 #undef NOBARRIER_WRITE_BYTE_FIELD |
| 7370 | 7369 |
| 7371 } } // namespace v8::internal | 7370 } } // namespace v8::internal |
| 7372 | 7371 |
| 7373 #endif // V8_OBJECTS_INL_H_ | 7372 #endif // V8_OBJECTS_INL_H_ |
| OLD | NEW |