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 2165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2176 return BitCast<uint64_t, double>(value) == kHoleNanInt64; | 2176 return BitCast<uint64_t, double>(value) == kHoleNanInt64; |
2177 } | 2177 } |
2178 | 2178 |
2179 | 2179 |
2180 inline double FixedDoubleArray::hole_nan_as_double() { | 2180 inline double FixedDoubleArray::hole_nan_as_double() { |
2181 return BitCast<double, uint64_t>(kHoleNanInt64); | 2181 return BitCast<double, uint64_t>(kHoleNanInt64); |
2182 } | 2182 } |
2183 | 2183 |
2184 | 2184 |
2185 inline double FixedDoubleArray::canonical_not_the_hole_nan_as_double() { | 2185 inline double FixedDoubleArray::canonical_not_the_hole_nan_as_double() { |
2186 ASSERT(BitCast<uint64_t>(OS::nan_value()) != kHoleNanInt64); | 2186 ASSERT(BitCast<uint64_t>(base::OS::nan_value()) != kHoleNanInt64); |
2187 ASSERT((BitCast<uint64_t>(OS::nan_value()) >> 32) != kHoleNanUpper32); | 2187 ASSERT((BitCast<uint64_t>(base::OS::nan_value()) >> 32) != kHoleNanUpper32); |
2188 return OS::nan_value(); | 2188 return base::OS::nan_value(); |
2189 } | 2189 } |
2190 | 2190 |
2191 | 2191 |
2192 double FixedDoubleArray::get_scalar(int index) { | 2192 double FixedDoubleArray::get_scalar(int index) { |
2193 ASSERT(map() != GetHeap()->fixed_cow_array_map() && | 2193 ASSERT(map() != GetHeap()->fixed_cow_array_map() && |
2194 map() != GetHeap()->fixed_array_map()); | 2194 map() != GetHeap()->fixed_array_map()); |
2195 ASSERT(index >= 0 && index < this->length()); | 2195 ASSERT(index >= 0 && index < this->length()); |
2196 double result = READ_DOUBLE_FIELD(this, kHeaderSize + index * kDoubleSize); | 2196 double result = READ_DOUBLE_FIELD(this, kHeaderSize + index * kDoubleSize); |
2197 ASSERT(!is_the_hole_nan(result)); | 2197 ASSERT(!is_the_hole_nan(result)); |
2198 return result; | 2198 return result; |
(...skipping 1746 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3945 int16_t Int16ArrayTraits::defaultValue() { return 0; } | 3945 int16_t Int16ArrayTraits::defaultValue() { return 0; } |
3946 | 3946 |
3947 | 3947 |
3948 uint32_t Uint32ArrayTraits::defaultValue() { return 0; } | 3948 uint32_t Uint32ArrayTraits::defaultValue() { return 0; } |
3949 | 3949 |
3950 | 3950 |
3951 int32_t Int32ArrayTraits::defaultValue() { return 0; } | 3951 int32_t Int32ArrayTraits::defaultValue() { return 0; } |
3952 | 3952 |
3953 | 3953 |
3954 float Float32ArrayTraits::defaultValue() { | 3954 float Float32ArrayTraits::defaultValue() { |
3955 return static_cast<float>(OS::nan_value()); | 3955 return static_cast<float>(base::OS::nan_value()); |
3956 } | 3956 } |
3957 | 3957 |
3958 | 3958 |
3959 double Float64ArrayTraits::defaultValue() { return OS::nan_value(); } | 3959 double Float64ArrayTraits::defaultValue() { return base::OS::nan_value(); } |
3960 | 3960 |
3961 | 3961 |
3962 template <class Traits> | 3962 template <class Traits> |
3963 typename Traits::ElementType FixedTypedArray<Traits>::get_scalar(int index) { | 3963 typename Traits::ElementType FixedTypedArray<Traits>::get_scalar(int index) { |
3964 ASSERT((index >= 0) && (index < this->length())); | 3964 ASSERT((index >= 0) && (index < this->length())); |
3965 ElementType* ptr = reinterpret_cast<ElementType*>( | 3965 ElementType* ptr = reinterpret_cast<ElementType*>( |
3966 FIELD_ADDR(this, kDataOffset)); | 3966 FIELD_ADDR(this, kDataOffset)); |
3967 return ptr[index]; | 3967 return ptr[index]; |
3968 } | 3968 } |
3969 | 3969 |
(...skipping 3052 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7022 #undef READ_SHORT_FIELD | 7022 #undef READ_SHORT_FIELD |
7023 #undef WRITE_SHORT_FIELD | 7023 #undef WRITE_SHORT_FIELD |
7024 #undef READ_BYTE_FIELD | 7024 #undef READ_BYTE_FIELD |
7025 #undef WRITE_BYTE_FIELD | 7025 #undef WRITE_BYTE_FIELD |
7026 #undef NOBARRIER_READ_BYTE_FIELD | 7026 #undef NOBARRIER_READ_BYTE_FIELD |
7027 #undef NOBARRIER_WRITE_BYTE_FIELD | 7027 #undef NOBARRIER_WRITE_BYTE_FIELD |
7028 | 7028 |
7029 } } // namespace v8::internal | 7029 } } // namespace v8::internal |
7030 | 7030 |
7031 #endif // V8_OBJECTS_INL_H_ | 7031 #endif // V8_OBJECTS_INL_H_ |
OLD | NEW |