| 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 2339 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2350 if (obj->IsUndefined(isolate)) return MaybeHandle<T>(); | 2350 if (obj->IsUndefined(isolate)) return MaybeHandle<T>(); |
| 2351 return Handle<T>(T::cast(obj), isolate); | 2351 return Handle<T>(T::cast(obj), isolate); |
| 2352 } | 2352 } |
| 2353 | 2353 |
| 2354 template <class T> | 2354 template <class T> |
| 2355 Handle<T> FixedArray::GetValueChecked(Isolate* isolate, int index) const { | 2355 Handle<T> FixedArray::GetValueChecked(Isolate* isolate, int index) const { |
| 2356 Object* obj = get(index); | 2356 Object* obj = get(index); |
| 2357 CHECK(!obj->IsUndefined(isolate)); | 2357 CHECK(!obj->IsUndefined(isolate)); |
| 2358 return Handle<T>(T::cast(obj), isolate); | 2358 return Handle<T>(T::cast(obj), isolate); |
| 2359 } | 2359 } |
| 2360 | 2360 bool FixedArray::is_the_hole(Isolate* isolate, int index) { |
| 2361 bool FixedArray::is_the_hole(int index) { | 2361 return get(index)->IsTheHole(isolate); |
| 2362 return get(index) == GetHeap()->the_hole_value(); | |
| 2363 } | 2362 } |
| 2364 | 2363 |
| 2365 void FixedArray::set(int index, Smi* value) { | 2364 void FixedArray::set(int index, Smi* value) { |
| 2366 DCHECK(map() != GetHeap()->fixed_cow_array_map()); | 2365 DCHECK(map() != GetHeap()->fixed_cow_array_map()); |
| 2367 DCHECK(index >= 0 && index < this->length()); | 2366 DCHECK(index >= 0 && index < this->length()); |
| 2368 DCHECK(reinterpret_cast<Object*>(value)->IsSmi()); | 2367 DCHECK(reinterpret_cast<Object*>(value)->IsSmi()); |
| 2369 int offset = kHeaderSize + index * kPointerSize; | 2368 int offset = kHeaderSize + index * kPointerSize; |
| 2370 WRITE_FIELD(this, offset, value); | 2369 WRITE_FIELD(this, offset, value); |
| 2371 } | 2370 } |
| 2372 | 2371 |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2422 } | 2421 } |
| 2423 | 2422 |
| 2424 | 2423 |
| 2425 void FixedDoubleArray::set_the_hole(int index) { | 2424 void FixedDoubleArray::set_the_hole(int index) { |
| 2426 DCHECK(map() != GetHeap()->fixed_cow_array_map() && | 2425 DCHECK(map() != GetHeap()->fixed_cow_array_map() && |
| 2427 map() != GetHeap()->fixed_array_map()); | 2426 map() != GetHeap()->fixed_array_map()); |
| 2428 int offset = kHeaderSize + index * kDoubleSize; | 2427 int offset = kHeaderSize + index * kDoubleSize; |
| 2429 WRITE_UINT64_FIELD(this, offset, kHoleNanInt64); | 2428 WRITE_UINT64_FIELD(this, offset, kHoleNanInt64); |
| 2430 } | 2429 } |
| 2431 | 2430 |
| 2431 bool FixedDoubleArray::is_the_hole(Isolate* isolate, int index) { |
| 2432 return is_the_hole(index); |
| 2433 } |
| 2432 | 2434 |
| 2433 bool FixedDoubleArray::is_the_hole(int index) { | 2435 bool FixedDoubleArray::is_the_hole(int index) { |
| 2434 return get_representation(index) == kHoleNanInt64; | 2436 return get_representation(index) == kHoleNanInt64; |
| 2435 } | 2437 } |
| 2436 | 2438 |
| 2437 | 2439 |
| 2438 double* FixedDoubleArray::data_start() { | 2440 double* FixedDoubleArray::data_start() { |
| 2439 return reinterpret_cast<double*>(FIELD_ADDR(this, kHeaderSize)); | 2441 return reinterpret_cast<double*>(FIELD_ADDR(this, kHeaderSize)); |
| 2440 } | 2442 } |
| 2441 | 2443 |
| (...skipping 5979 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8421 #undef WRITE_INT64_FIELD | 8423 #undef WRITE_INT64_FIELD |
| 8422 #undef READ_BYTE_FIELD | 8424 #undef READ_BYTE_FIELD |
| 8423 #undef WRITE_BYTE_FIELD | 8425 #undef WRITE_BYTE_FIELD |
| 8424 #undef NOBARRIER_READ_BYTE_FIELD | 8426 #undef NOBARRIER_READ_BYTE_FIELD |
| 8425 #undef NOBARRIER_WRITE_BYTE_FIELD | 8427 #undef NOBARRIER_WRITE_BYTE_FIELD |
| 8426 | 8428 |
| 8427 } // namespace internal | 8429 } // namespace internal |
| 8428 } // namespace v8 | 8430 } // namespace v8 |
| 8429 | 8431 |
| 8430 #endif // V8_OBJECTS_INL_H_ | 8432 #endif // V8_OBJECTS_INL_H_ |
| OLD | NEW |