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 2157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2168 return reinterpret_cast<FixedArrayBase*>(object); | 2168 return reinterpret_cast<FixedArrayBase*>(object); |
2169 } | 2169 } |
2170 | 2170 |
2171 | 2171 |
2172 Object* FixedArray::get(int index) { | 2172 Object* FixedArray::get(int index) { |
2173 SLOW_ASSERT(index >= 0 && index < this->length()); | 2173 SLOW_ASSERT(index >= 0 && index < this->length()); |
2174 return READ_FIELD(this, kHeaderSize + index * kPointerSize); | 2174 return READ_FIELD(this, kHeaderSize + index * kPointerSize); |
2175 } | 2175 } |
2176 | 2176 |
2177 | 2177 |
| 2178 Handle<Object> FixedArray::get(Handle<FixedArray> array, int index) { |
| 2179 return handle(array->get(index), array->GetIsolate()); |
| 2180 } |
| 2181 |
| 2182 |
2178 bool FixedArray::is_the_hole(int index) { | 2183 bool FixedArray::is_the_hole(int index) { |
2179 return get(index) == GetHeap()->the_hole_value(); | 2184 return get(index) == GetHeap()->the_hole_value(); |
2180 } | 2185 } |
2181 | 2186 |
2182 | 2187 |
2183 void FixedArray::set(int index, Smi* value) { | 2188 void FixedArray::set(int index, Smi* value) { |
2184 ASSERT(map() != GetHeap()->fixed_cow_array_map()); | 2189 ASSERT(map() != GetHeap()->fixed_cow_array_map()); |
2185 ASSERT(index >= 0 && index < this->length()); | 2190 ASSERT(index >= 0 && index < this->length()); |
2186 ASSERT(reinterpret_cast<Object*>(value)->IsSmi()); | 2191 ASSERT(reinterpret_cast<Object*>(value)->IsSmi()); |
2187 int offset = kHeaderSize + index * kPointerSize; | 2192 int offset = kHeaderSize + index * kPointerSize; |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2233 | 2238 |
2234 MaybeObject* FixedDoubleArray::get(int index) { | 2239 MaybeObject* FixedDoubleArray::get(int index) { |
2235 if (is_the_hole(index)) { | 2240 if (is_the_hole(index)) { |
2236 return GetHeap()->the_hole_value(); | 2241 return GetHeap()->the_hole_value(); |
2237 } else { | 2242 } else { |
2238 return GetHeap()->NumberFromDouble(get_scalar(index)); | 2243 return GetHeap()->NumberFromDouble(get_scalar(index)); |
2239 } | 2244 } |
2240 } | 2245 } |
2241 | 2246 |
2242 | 2247 |
2243 Handle<Object> FixedDoubleArray::get_as_handle(int index) { | 2248 Handle<Object> FixedDoubleArray::get(Handle<FixedDoubleArray> array, |
2244 if (is_the_hole(index)) { | 2249 int index) { |
2245 return GetIsolate()->factory()->the_hole_value(); | 2250 if (array->is_the_hole(index)) { |
| 2251 return array->GetIsolate()->factory()->the_hole_value(); |
2246 } else { | 2252 } else { |
2247 return GetIsolate()->factory()->NewNumber(get_scalar(index)); | 2253 return array->GetIsolate()->factory()->NewNumber(array->get_scalar(index)); |
2248 } | 2254 } |
2249 } | 2255 } |
2250 | 2256 |
2251 | 2257 |
2252 void FixedDoubleArray::set(int index, double value) { | 2258 void FixedDoubleArray::set(int index, double value) { |
2253 ASSERT(map() != GetHeap()->fixed_cow_array_map() && | 2259 ASSERT(map() != GetHeap()->fixed_cow_array_map() && |
2254 map() != GetHeap()->fixed_array_map()); | 2260 map() != GetHeap()->fixed_array_map()); |
2255 int offset = kHeaderSize + index * kDoubleSize; | 2261 int offset = kHeaderSize + index * kDoubleSize; |
2256 if (std::isnan(value)) value = canonical_not_the_hole_nan_as_double(); | 2262 if (std::isnan(value)) value = canonical_not_the_hole_nan_as_double(); |
2257 WRITE_DOUBLE_FIELD(this, offset, value); | 2263 WRITE_DOUBLE_FIELD(this, offset, value); |
(...skipping 1310 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3568 } | 3574 } |
3569 | 3575 |
3570 | 3576 |
3571 uint8_t ExternalUint8ClampedArray::get_scalar(int index) { | 3577 uint8_t ExternalUint8ClampedArray::get_scalar(int index) { |
3572 ASSERT((index >= 0) && (index < this->length())); | 3578 ASSERT((index >= 0) && (index < this->length())); |
3573 uint8_t* ptr = external_uint8_clamped_pointer(); | 3579 uint8_t* ptr = external_uint8_clamped_pointer(); |
3574 return ptr[index]; | 3580 return ptr[index]; |
3575 } | 3581 } |
3576 | 3582 |
3577 | 3583 |
3578 MaybeObject* ExternalUint8ClampedArray::get(int index) { | 3584 Object* ExternalUint8ClampedArray::get(int index) { |
3579 return Smi::FromInt(static_cast<int>(get_scalar(index))); | 3585 return Smi::FromInt(static_cast<int>(get_scalar(index))); |
3580 } | 3586 } |
3581 | 3587 |
3582 | 3588 |
| 3589 Handle<Object> ExternalUint8ClampedArray::get( |
| 3590 Handle<ExternalUint8ClampedArray> array, |
| 3591 int index) { |
| 3592 return handle(array->get(index), array->GetIsolate()); |
| 3593 } |
| 3594 |
| 3595 |
3583 void ExternalUint8ClampedArray::set(int index, uint8_t value) { | 3596 void ExternalUint8ClampedArray::set(int index, uint8_t value) { |
3584 ASSERT((index >= 0) && (index < this->length())); | 3597 ASSERT((index >= 0) && (index < this->length())); |
3585 uint8_t* ptr = external_uint8_clamped_pointer(); | 3598 uint8_t* ptr = external_uint8_clamped_pointer(); |
3586 ptr[index] = value; | 3599 ptr[index] = value; |
3587 } | 3600 } |
3588 | 3601 |
3589 | 3602 |
3590 void* ExternalArray::external_pointer() { | 3603 void* ExternalArray::external_pointer() { |
3591 intptr_t ptr = READ_INTPTR_FIELD(this, kExternalPointerOffset); | 3604 intptr_t ptr = READ_INTPTR_FIELD(this, kExternalPointerOffset); |
3592 return reinterpret_cast<void*>(ptr); | 3605 return reinterpret_cast<void*>(ptr); |
3593 } | 3606 } |
3594 | 3607 |
3595 | 3608 |
3596 void ExternalArray::set_external_pointer(void* value, WriteBarrierMode mode) { | 3609 void ExternalArray::set_external_pointer(void* value, WriteBarrierMode mode) { |
3597 intptr_t ptr = reinterpret_cast<intptr_t>(value); | 3610 intptr_t ptr = reinterpret_cast<intptr_t>(value); |
3598 WRITE_INTPTR_FIELD(this, kExternalPointerOffset, ptr); | 3611 WRITE_INTPTR_FIELD(this, kExternalPointerOffset, ptr); |
3599 } | 3612 } |
3600 | 3613 |
3601 | 3614 |
3602 int8_t ExternalInt8Array::get_scalar(int index) { | 3615 int8_t ExternalInt8Array::get_scalar(int index) { |
3603 ASSERT((index >= 0) && (index < this->length())); | 3616 ASSERT((index >= 0) && (index < this->length())); |
3604 int8_t* ptr = static_cast<int8_t*>(external_pointer()); | 3617 int8_t* ptr = static_cast<int8_t*>(external_pointer()); |
3605 return ptr[index]; | 3618 return ptr[index]; |
3606 } | 3619 } |
3607 | 3620 |
3608 | 3621 |
3609 MaybeObject* ExternalInt8Array::get(int index) { | 3622 Object* ExternalInt8Array::get(int index) { |
3610 return Smi::FromInt(static_cast<int>(get_scalar(index))); | 3623 return Smi::FromInt(static_cast<int>(get_scalar(index))); |
3611 } | 3624 } |
3612 | 3625 |
3613 | 3626 |
| 3627 Handle<Object> ExternalInt8Array::get(Handle<ExternalInt8Array> array, |
| 3628 int index) { |
| 3629 return handle(array->get(index), array->GetIsolate()); |
| 3630 } |
| 3631 |
| 3632 |
3614 void ExternalInt8Array::set(int index, int8_t value) { | 3633 void ExternalInt8Array::set(int index, int8_t value) { |
3615 ASSERT((index >= 0) && (index < this->length())); | 3634 ASSERT((index >= 0) && (index < this->length())); |
3616 int8_t* ptr = static_cast<int8_t*>(external_pointer()); | 3635 int8_t* ptr = static_cast<int8_t*>(external_pointer()); |
3617 ptr[index] = value; | 3636 ptr[index] = value; |
3618 } | 3637 } |
3619 | 3638 |
3620 | 3639 |
3621 uint8_t ExternalUint8Array::get_scalar(int index) { | 3640 uint8_t ExternalUint8Array::get_scalar(int index) { |
3622 ASSERT((index >= 0) && (index < this->length())); | 3641 ASSERT((index >= 0) && (index < this->length())); |
3623 uint8_t* ptr = static_cast<uint8_t*>(external_pointer()); | 3642 uint8_t* ptr = static_cast<uint8_t*>(external_pointer()); |
3624 return ptr[index]; | 3643 return ptr[index]; |
3625 } | 3644 } |
3626 | 3645 |
3627 | 3646 |
3628 MaybeObject* ExternalUint8Array::get(int index) { | 3647 Object* ExternalUint8Array::get(int index) { |
3629 return Smi::FromInt(static_cast<int>(get_scalar(index))); | 3648 return Smi::FromInt(static_cast<int>(get_scalar(index))); |
3630 } | 3649 } |
3631 | 3650 |
3632 | 3651 |
| 3652 Handle<Object> ExternalUint8Array::get(Handle<ExternalUint8Array> array, |
| 3653 int index) { |
| 3654 return handle(array->get(index), array->GetIsolate()); |
| 3655 } |
| 3656 |
| 3657 |
3633 void ExternalUint8Array::set(int index, uint8_t value) { | 3658 void ExternalUint8Array::set(int index, uint8_t value) { |
3634 ASSERT((index >= 0) && (index < this->length())); | 3659 ASSERT((index >= 0) && (index < this->length())); |
3635 uint8_t* ptr = static_cast<uint8_t*>(external_pointer()); | 3660 uint8_t* ptr = static_cast<uint8_t*>(external_pointer()); |
3636 ptr[index] = value; | 3661 ptr[index] = value; |
3637 } | 3662 } |
3638 | 3663 |
3639 | 3664 |
3640 int16_t ExternalInt16Array::get_scalar(int index) { | 3665 int16_t ExternalInt16Array::get_scalar(int index) { |
3641 ASSERT((index >= 0) && (index < this->length())); | 3666 ASSERT((index >= 0) && (index < this->length())); |
3642 int16_t* ptr = static_cast<int16_t*>(external_pointer()); | 3667 int16_t* ptr = static_cast<int16_t*>(external_pointer()); |
3643 return ptr[index]; | 3668 return ptr[index]; |
3644 } | 3669 } |
3645 | 3670 |
3646 | 3671 |
3647 MaybeObject* ExternalInt16Array::get(int index) { | 3672 Object* ExternalInt16Array::get(int index) { |
3648 return Smi::FromInt(static_cast<int>(get_scalar(index))); | 3673 return Smi::FromInt(static_cast<int>(get_scalar(index))); |
3649 } | 3674 } |
3650 | 3675 |
3651 | 3676 |
| 3677 Handle<Object> ExternalInt16Array::get(Handle<ExternalInt16Array> array, |
| 3678 int index) { |
| 3679 return handle(array->get(index), array->GetIsolate()); |
| 3680 } |
| 3681 |
| 3682 |
3652 void ExternalInt16Array::set(int index, int16_t value) { | 3683 void ExternalInt16Array::set(int index, int16_t value) { |
3653 ASSERT((index >= 0) && (index < this->length())); | 3684 ASSERT((index >= 0) && (index < this->length())); |
3654 int16_t* ptr = static_cast<int16_t*>(external_pointer()); | 3685 int16_t* ptr = static_cast<int16_t*>(external_pointer()); |
3655 ptr[index] = value; | 3686 ptr[index] = value; |
3656 } | 3687 } |
3657 | 3688 |
3658 | 3689 |
3659 uint16_t ExternalUint16Array::get_scalar(int index) { | 3690 uint16_t ExternalUint16Array::get_scalar(int index) { |
3660 ASSERT((index >= 0) && (index < this->length())); | 3691 ASSERT((index >= 0) && (index < this->length())); |
3661 uint16_t* ptr = static_cast<uint16_t*>(external_pointer()); | 3692 uint16_t* ptr = static_cast<uint16_t*>(external_pointer()); |
3662 return ptr[index]; | 3693 return ptr[index]; |
3663 } | 3694 } |
3664 | 3695 |
3665 | 3696 |
3666 MaybeObject* ExternalUint16Array::get(int index) { | 3697 Object* ExternalUint16Array::get(int index) { |
3667 return Smi::FromInt(static_cast<int>(get_scalar(index))); | 3698 return Smi::FromInt(static_cast<int>(get_scalar(index))); |
3668 } | 3699 } |
3669 | 3700 |
3670 | 3701 |
| 3702 Handle<Object> ExternalUint16Array::get(Handle<ExternalUint16Array> array, |
| 3703 int index) { |
| 3704 return handle(array->get(index), array->GetIsolate()); |
| 3705 } |
| 3706 |
| 3707 |
3671 void ExternalUint16Array::set(int index, uint16_t value) { | 3708 void ExternalUint16Array::set(int index, uint16_t value) { |
3672 ASSERT((index >= 0) && (index < this->length())); | 3709 ASSERT((index >= 0) && (index < this->length())); |
3673 uint16_t* ptr = static_cast<uint16_t*>(external_pointer()); | 3710 uint16_t* ptr = static_cast<uint16_t*>(external_pointer()); |
3674 ptr[index] = value; | 3711 ptr[index] = value; |
3675 } | 3712 } |
3676 | 3713 |
3677 | 3714 |
3678 int32_t ExternalInt32Array::get_scalar(int index) { | 3715 int32_t ExternalInt32Array::get_scalar(int index) { |
3679 ASSERT((index >= 0) && (index < this->length())); | 3716 ASSERT((index >= 0) && (index < this->length())); |
3680 int32_t* ptr = static_cast<int32_t*>(external_pointer()); | 3717 int32_t* ptr = static_cast<int32_t*>(external_pointer()); |
3681 return ptr[index]; | 3718 return ptr[index]; |
3682 } | 3719 } |
3683 | 3720 |
3684 | 3721 |
3685 MaybeObject* ExternalInt32Array::get(int index) { | 3722 MaybeObject* ExternalInt32Array::get(int index) { |
3686 return GetHeap()->NumberFromInt32(get_scalar(index)); | 3723 return GetHeap()->NumberFromInt32(get_scalar(index)); |
3687 } | 3724 } |
3688 | 3725 |
3689 | 3726 |
| 3727 Handle<Object> ExternalInt32Array::get(Handle<ExternalInt32Array> array, |
| 3728 int index) { |
| 3729 return array->GetIsolate()->factory()-> |
| 3730 NewNumberFromInt(array->get_scalar(index)); |
| 3731 } |
| 3732 |
| 3733 |
3690 void ExternalInt32Array::set(int index, int32_t value) { | 3734 void ExternalInt32Array::set(int index, int32_t value) { |
3691 ASSERT((index >= 0) && (index < this->length())); | 3735 ASSERT((index >= 0) && (index < this->length())); |
3692 int32_t* ptr = static_cast<int32_t*>(external_pointer()); | 3736 int32_t* ptr = static_cast<int32_t*>(external_pointer()); |
3693 ptr[index] = value; | 3737 ptr[index] = value; |
3694 } | 3738 } |
3695 | 3739 |
3696 | 3740 |
3697 uint32_t ExternalUint32Array::get_scalar(int index) { | 3741 uint32_t ExternalUint32Array::get_scalar(int index) { |
3698 ASSERT((index >= 0) && (index < this->length())); | 3742 ASSERT((index >= 0) && (index < this->length())); |
3699 uint32_t* ptr = static_cast<uint32_t*>(external_pointer()); | 3743 uint32_t* ptr = static_cast<uint32_t*>(external_pointer()); |
3700 return ptr[index]; | 3744 return ptr[index]; |
3701 } | 3745 } |
3702 | 3746 |
3703 | 3747 |
3704 MaybeObject* ExternalUint32Array::get(int index) { | 3748 MaybeObject* ExternalUint32Array::get(int index) { |
3705 return GetHeap()->NumberFromUint32(get_scalar(index)); | 3749 return GetHeap()->NumberFromUint32(get_scalar(index)); |
3706 } | 3750 } |
3707 | 3751 |
3708 | 3752 |
| 3753 Handle<Object> ExternalUint32Array::get(Handle<ExternalUint32Array> array, |
| 3754 int index) { |
| 3755 return array->GetIsolate()->factory()-> |
| 3756 NewNumberFromUint(array->get_scalar(index)); |
| 3757 } |
| 3758 |
| 3759 |
3709 void ExternalUint32Array::set(int index, uint32_t value) { | 3760 void ExternalUint32Array::set(int index, uint32_t value) { |
3710 ASSERT((index >= 0) && (index < this->length())); | 3761 ASSERT((index >= 0) && (index < this->length())); |
3711 uint32_t* ptr = static_cast<uint32_t*>(external_pointer()); | 3762 uint32_t* ptr = static_cast<uint32_t*>(external_pointer()); |
3712 ptr[index] = value; | 3763 ptr[index] = value; |
3713 } | 3764 } |
3714 | 3765 |
3715 | 3766 |
3716 float ExternalFloat32Array::get_scalar(int index) { | 3767 float ExternalFloat32Array::get_scalar(int index) { |
3717 ASSERT((index >= 0) && (index < this->length())); | 3768 ASSERT((index >= 0) && (index < this->length())); |
3718 float* ptr = static_cast<float*>(external_pointer()); | 3769 float* ptr = static_cast<float*>(external_pointer()); |
3719 return ptr[index]; | 3770 return ptr[index]; |
3720 } | 3771 } |
3721 | 3772 |
3722 | 3773 |
3723 MaybeObject* ExternalFloat32Array::get(int index) { | 3774 MaybeObject* ExternalFloat32Array::get(int index) { |
3724 return GetHeap()->NumberFromDouble(get_scalar(index)); | 3775 return GetHeap()->NumberFromDouble(get_scalar(index)); |
3725 } | 3776 } |
3726 | 3777 |
3727 | 3778 |
| 3779 Handle<Object> ExternalFloat32Array::get(Handle<ExternalFloat32Array> array, |
| 3780 int index) { |
| 3781 return array->GetIsolate()->factory()->NewNumber(array->get_scalar(index)); |
| 3782 } |
| 3783 |
| 3784 |
3728 void ExternalFloat32Array::set(int index, float value) { | 3785 void ExternalFloat32Array::set(int index, float value) { |
3729 ASSERT((index >= 0) && (index < this->length())); | 3786 ASSERT((index >= 0) && (index < this->length())); |
3730 float* ptr = static_cast<float*>(external_pointer()); | 3787 float* ptr = static_cast<float*>(external_pointer()); |
3731 ptr[index] = value; | 3788 ptr[index] = value; |
3732 } | 3789 } |
3733 | 3790 |
3734 | 3791 |
3735 double ExternalFloat64Array::get_scalar(int index) { | 3792 double ExternalFloat64Array::get_scalar(int index) { |
3736 ASSERT((index >= 0) && (index < this->length())); | 3793 ASSERT((index >= 0) && (index < this->length())); |
3737 double* ptr = static_cast<double*>(external_pointer()); | 3794 double* ptr = static_cast<double*>(external_pointer()); |
3738 return ptr[index]; | 3795 return ptr[index]; |
3739 } | 3796 } |
3740 | 3797 |
3741 | 3798 |
3742 MaybeObject* ExternalFloat64Array::get(int index) { | 3799 MaybeObject* ExternalFloat64Array::get(int index) { |
3743 return GetHeap()->NumberFromDouble(get_scalar(index)); | 3800 return GetHeap()->NumberFromDouble(get_scalar(index)); |
3744 } | 3801 } |
3745 | 3802 |
3746 | 3803 |
| 3804 Handle<Object> ExternalFloat64Array::get(Handle<ExternalFloat64Array> array, |
| 3805 int index) { |
| 3806 return array->GetIsolate()->factory()->NewNumber(array->get_scalar(index)); |
| 3807 } |
| 3808 |
| 3809 |
3747 void ExternalFloat64Array::set(int index, double value) { | 3810 void ExternalFloat64Array::set(int index, double value) { |
3748 ASSERT((index >= 0) && (index < this->length())); | 3811 ASSERT((index >= 0) && (index < this->length())); |
3749 double* ptr = static_cast<double*>(external_pointer()); | 3812 double* ptr = static_cast<double*>(external_pointer()); |
3750 ptr[index] = value; | 3813 ptr[index] = value; |
3751 } | 3814 } |
3752 | 3815 |
3753 | 3816 |
3754 void* FixedTypedArrayBase::DataPtr() { | 3817 void* FixedTypedArrayBase::DataPtr() { |
3755 return FIELD_ADDR(this, kDataOffset); | 3818 return FIELD_ADDR(this, kDataOffset); |
3756 } | 3819 } |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3883 return value; | 3946 return value; |
3884 } | 3947 } |
3885 | 3948 |
3886 | 3949 |
3887 template <class Traits> | 3950 template <class Traits> |
3888 MaybeObject* FixedTypedArray<Traits>::get(int index) { | 3951 MaybeObject* FixedTypedArray<Traits>::get(int index) { |
3889 return Traits::ToObject(GetHeap(), get_scalar(index)); | 3952 return Traits::ToObject(GetHeap(), get_scalar(index)); |
3890 } | 3953 } |
3891 | 3954 |
3892 template <class Traits> | 3955 template <class Traits> |
| 3956 Handle<Object> FixedTypedArray<Traits>::get( |
| 3957 Handle<FixedTypedArray<Traits> > array, |
| 3958 int index) { |
| 3959 return Traits::ToHandle(array->GetIsolate(), array->get_scalar(index)); |
| 3960 } |
| 3961 |
| 3962 template <class Traits> |
3893 MaybeObject* FixedTypedArray<Traits>::SetValue(uint32_t index, Object* value) { | 3963 MaybeObject* FixedTypedArray<Traits>::SetValue(uint32_t index, Object* value) { |
3894 ElementType cast_value = Traits::defaultValue(); | 3964 ElementType cast_value = Traits::defaultValue(); |
3895 if (index < static_cast<uint32_t>(length())) { | 3965 if (index < static_cast<uint32_t>(length())) { |
3896 if (value->IsSmi()) { | 3966 if (value->IsSmi()) { |
3897 int int_value = Smi::cast(value)->value(); | 3967 int int_value = Smi::cast(value)->value(); |
3898 cast_value = from_int(int_value); | 3968 cast_value = from_int(int_value); |
3899 } else if (value->IsHeapNumber()) { | 3969 } else if (value->IsHeapNumber()) { |
3900 double double_value = HeapNumber::cast(value)->value(); | 3970 double double_value = HeapNumber::cast(value)->value(); |
3901 cast_value = from_double(double_value); | 3971 cast_value = from_double(double_value); |
3902 } else { | 3972 } else { |
(...skipping 15 matching lines...) Expand all Loading... |
3918 array->SetValue(index, *value), | 3988 array->SetValue(index, *value), |
3919 Object); | 3989 Object); |
3920 } | 3990 } |
3921 | 3991 |
3922 | 3992 |
3923 MaybeObject* Uint8ArrayTraits::ToObject(Heap*, uint8_t scalar) { | 3993 MaybeObject* Uint8ArrayTraits::ToObject(Heap*, uint8_t scalar) { |
3924 return Smi::FromInt(scalar); | 3994 return Smi::FromInt(scalar); |
3925 } | 3995 } |
3926 | 3996 |
3927 | 3997 |
| 3998 Handle<Object> Uint8ArrayTraits::ToHandle(Isolate* isolate, uint8_t scalar) { |
| 3999 return handle(Smi::FromInt(scalar), isolate); |
| 4000 } |
| 4001 |
| 4002 |
3928 MaybeObject* Uint8ClampedArrayTraits::ToObject(Heap*, uint8_t scalar) { | 4003 MaybeObject* Uint8ClampedArrayTraits::ToObject(Heap*, uint8_t scalar) { |
3929 return Smi::FromInt(scalar); | 4004 return Smi::FromInt(scalar); |
3930 } | 4005 } |
3931 | 4006 |
3932 | 4007 |
| 4008 Handle<Object> Uint8ClampedArrayTraits::ToHandle(Isolate* isolate, |
| 4009 uint8_t scalar) { |
| 4010 return handle(Smi::FromInt(scalar), isolate); |
| 4011 } |
| 4012 |
| 4013 |
3933 MaybeObject* Int8ArrayTraits::ToObject(Heap*, int8_t scalar) { | 4014 MaybeObject* Int8ArrayTraits::ToObject(Heap*, int8_t scalar) { |
3934 return Smi::FromInt(scalar); | 4015 return Smi::FromInt(scalar); |
3935 } | 4016 } |
3936 | 4017 |
3937 | 4018 |
| 4019 Handle<Object> Int8ArrayTraits::ToHandle(Isolate* isolate, int8_t scalar) { |
| 4020 return handle(Smi::FromInt(scalar), isolate); |
| 4021 } |
| 4022 |
| 4023 |
3938 MaybeObject* Uint16ArrayTraits::ToObject(Heap*, uint16_t scalar) { | 4024 MaybeObject* Uint16ArrayTraits::ToObject(Heap*, uint16_t scalar) { |
3939 return Smi::FromInt(scalar); | 4025 return Smi::FromInt(scalar); |
3940 } | 4026 } |
3941 | 4027 |
3942 | 4028 |
| 4029 Handle<Object> Uint16ArrayTraits::ToHandle(Isolate* isolate, uint16_t scalar) { |
| 4030 return handle(Smi::FromInt(scalar), isolate); |
| 4031 } |
| 4032 |
| 4033 |
3943 MaybeObject* Int16ArrayTraits::ToObject(Heap*, int16_t scalar) { | 4034 MaybeObject* Int16ArrayTraits::ToObject(Heap*, int16_t scalar) { |
3944 return Smi::FromInt(scalar); | 4035 return Smi::FromInt(scalar); |
3945 } | 4036 } |
3946 | 4037 |
3947 | 4038 |
| 4039 Handle<Object> Int16ArrayTraits::ToHandle(Isolate* isolate, int16_t scalar) { |
| 4040 return handle(Smi::FromInt(scalar), isolate); |
| 4041 } |
| 4042 |
| 4043 |
3948 MaybeObject* Uint32ArrayTraits::ToObject(Heap* heap, uint32_t scalar) { | 4044 MaybeObject* Uint32ArrayTraits::ToObject(Heap* heap, uint32_t scalar) { |
3949 return heap->NumberFromUint32(scalar); | 4045 return heap->NumberFromUint32(scalar); |
3950 } | 4046 } |
3951 | 4047 |
3952 | 4048 |
| 4049 Handle<Object> Uint32ArrayTraits::ToHandle(Isolate* isolate, uint32_t scalar) { |
| 4050 return isolate->factory()->NewNumberFromUint(scalar); |
| 4051 } |
| 4052 |
| 4053 |
3953 MaybeObject* Int32ArrayTraits::ToObject(Heap* heap, int32_t scalar) { | 4054 MaybeObject* Int32ArrayTraits::ToObject(Heap* heap, int32_t scalar) { |
3954 return heap->NumberFromInt32(scalar); | 4055 return heap->NumberFromInt32(scalar); |
3955 } | 4056 } |
3956 | 4057 |
3957 | 4058 |
| 4059 Handle<Object> Int32ArrayTraits::ToHandle(Isolate* isolate, int32_t scalar) { |
| 4060 return isolate->factory()->NewNumberFromInt(scalar); |
| 4061 } |
| 4062 |
| 4063 |
3958 MaybeObject* Float32ArrayTraits::ToObject(Heap* heap, float scalar) { | 4064 MaybeObject* Float32ArrayTraits::ToObject(Heap* heap, float scalar) { |
3959 return heap->NumberFromDouble(scalar); | 4065 return heap->NumberFromDouble(scalar); |
3960 } | 4066 } |
3961 | 4067 |
3962 | 4068 |
| 4069 Handle<Object> Float32ArrayTraits::ToHandle(Isolate* isolate, float scalar) { |
| 4070 return isolate->factory()->NewNumber(scalar); |
| 4071 } |
| 4072 |
| 4073 |
3963 MaybeObject* Float64ArrayTraits::ToObject(Heap* heap, double scalar) { | 4074 MaybeObject* Float64ArrayTraits::ToObject(Heap* heap, double scalar) { |
3964 return heap->NumberFromDouble(scalar); | 4075 return heap->NumberFromDouble(scalar); |
3965 } | 4076 } |
3966 | 4077 |
3967 | 4078 |
| 4079 Handle<Object> Float64ArrayTraits::ToHandle(Isolate* isolate, double scalar) { |
| 4080 return isolate->factory()->NewNumber(scalar); |
| 4081 } |
| 4082 |
| 4083 |
3968 int Map::visitor_id() { | 4084 int Map::visitor_id() { |
3969 return READ_BYTE_FIELD(this, kVisitorIdOffset); | 4085 return READ_BYTE_FIELD(this, kVisitorIdOffset); |
3970 } | 4086 } |
3971 | 4087 |
3972 | 4088 |
3973 void Map::set_visitor_id(int id) { | 4089 void Map::set_visitor_id(int id) { |
3974 ASSERT(0 <= id && id < 256); | 4090 ASSERT(0 <= id && id < 256); |
3975 WRITE_BYTE_FIELD(this, kVisitorIdOffset, static_cast<byte>(id)); | 4091 WRITE_BYTE_FIELD(this, kVisitorIdOffset, static_cast<byte>(id)); |
3976 } | 4092 } |
3977 | 4093 |
(...skipping 2946 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6924 #undef READ_UINT32_FIELD | 7040 #undef READ_UINT32_FIELD |
6925 #undef WRITE_UINT32_FIELD | 7041 #undef WRITE_UINT32_FIELD |
6926 #undef READ_SHORT_FIELD | 7042 #undef READ_SHORT_FIELD |
6927 #undef WRITE_SHORT_FIELD | 7043 #undef WRITE_SHORT_FIELD |
6928 #undef READ_BYTE_FIELD | 7044 #undef READ_BYTE_FIELD |
6929 #undef WRITE_BYTE_FIELD | 7045 #undef WRITE_BYTE_FIELD |
6930 | 7046 |
6931 } } // namespace v8::internal | 7047 } } // namespace v8::internal |
6932 | 7048 |
6933 #endif // V8_OBJECTS_INL_H_ | 7049 #endif // V8_OBJECTS_INL_H_ |
OLD | NEW |