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 3197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3208 int HashTable<Derived, Shape, Key>::FindEntry(Isolate* isolate, Key key, | 3208 int HashTable<Derived, Shape, Key>::FindEntry(Isolate* isolate, Key key, |
3209 int32_t hash) { | 3209 int32_t hash) { |
3210 uint32_t capacity = Capacity(); | 3210 uint32_t capacity = Capacity(); |
3211 uint32_t entry = FirstProbe(hash, capacity); | 3211 uint32_t entry = FirstProbe(hash, capacity); |
3212 uint32_t count = 1; | 3212 uint32_t count = 1; |
3213 // EnsureCapacity will guarantee the hash table is never full. | 3213 // EnsureCapacity will guarantee the hash table is never full. |
3214 while (true) { | 3214 while (true) { |
3215 Object* element = KeyAt(entry); | 3215 Object* element = KeyAt(entry); |
3216 // Empty entry. Uses raw unchecked accessors because it is called by the | 3216 // Empty entry. Uses raw unchecked accessors because it is called by the |
3217 // string table during bootstrapping. | 3217 // string table during bootstrapping. |
3218 if (element == isolate->heap()->raw_unchecked_undefined_value()) break; | 3218 if (element == isolate->heap()->root(Heap::kUndefinedValueRootIndex)) break; |
3219 if (element != isolate->heap()->raw_unchecked_the_hole_value() && | 3219 if (element != isolate->heap()->root(Heap::kTheHoleValueRootIndex) && |
3220 Shape::IsMatch(key, element)) return entry; | 3220 Shape::IsMatch(key, element)) return entry; |
3221 entry = NextProbe(entry, count++, capacity); | 3221 entry = NextProbe(entry, count++, capacity); |
3222 } | 3222 } |
3223 return kNotFound; | 3223 return kNotFound; |
3224 } | 3224 } |
3225 | 3225 |
3226 | 3226 |
3227 bool SeededNumberDictionary::requires_slow_elements() { | 3227 bool SeededNumberDictionary::requires_slow_elements() { |
3228 Object* max_index_object = get(kMaxNumberKeyIndex); | 3228 Object* max_index_object = get(kMaxNumberKeyIndex); |
3229 if (!max_index_object->IsSmi()) return false; | 3229 if (!max_index_object->IsSmi()) return false; |
(...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3504 NOBARRIER_SMI_ACCESSORS(FreeSpace, size, kSizeOffset) | 3504 NOBARRIER_SMI_ACCESSORS(FreeSpace, size, kSizeOffset) |
3505 | 3505 |
3506 SMI_ACCESSORS(String, length, kLengthOffset) | 3506 SMI_ACCESSORS(String, length, kLengthOffset) |
3507 SYNCHRONIZED_SMI_ACCESSORS(String, length, kLengthOffset) | 3507 SYNCHRONIZED_SMI_ACCESSORS(String, length, kLengthOffset) |
3508 | 3508 |
3509 | 3509 |
3510 int FreeSpace::Size() { return size(); } | 3510 int FreeSpace::Size() { return size(); } |
3511 | 3511 |
3512 | 3512 |
3513 FreeSpace* FreeSpace::next() { | 3513 FreeSpace* FreeSpace::next() { |
3514 DCHECK(map() == GetHeap()->raw_unchecked_free_space_map() || | 3514 DCHECK(map() == GetHeap()->root(Heap::kFreeSpaceMapRootIndex) || |
3515 (!GetHeap()->deserialization_complete() && map() == NULL)); | 3515 (!GetHeap()->deserialization_complete() && map() == NULL)); |
3516 DCHECK_LE(kNextOffset + kPointerSize, nobarrier_size()); | 3516 DCHECK_LE(kNextOffset + kPointerSize, nobarrier_size()); |
3517 return reinterpret_cast<FreeSpace*>( | 3517 return reinterpret_cast<FreeSpace*>( |
3518 Memory::Address_at(address() + kNextOffset)); | 3518 Memory::Address_at(address() + kNextOffset)); |
3519 } | 3519 } |
3520 | 3520 |
3521 | 3521 |
3522 FreeSpace** FreeSpace::next_address() { | 3522 FreeSpace** FreeSpace::next_address() { |
3523 DCHECK(map() == GetHeap()->raw_unchecked_free_space_map() || | 3523 DCHECK(map() == GetHeap()->root(Heap::kFreeSpaceMapRootIndex) || |
3524 (!GetHeap()->deserialization_complete() && map() == NULL)); | 3524 (!GetHeap()->deserialization_complete() && map() == NULL)); |
3525 DCHECK_LE(kNextOffset + kPointerSize, nobarrier_size()); | 3525 DCHECK_LE(kNextOffset + kPointerSize, nobarrier_size()); |
3526 return reinterpret_cast<FreeSpace**>(address() + kNextOffset); | 3526 return reinterpret_cast<FreeSpace**>(address() + kNextOffset); |
3527 } | 3527 } |
3528 | 3528 |
3529 | 3529 |
3530 void FreeSpace::set_next(FreeSpace* next) { | 3530 void FreeSpace::set_next(FreeSpace* next) { |
3531 DCHECK(map() == GetHeap()->raw_unchecked_free_space_map() || | 3531 DCHECK(map() == GetHeap()->root(Heap::kFreeSpaceMapRootIndex) || |
3532 (!GetHeap()->deserialization_complete() && map() == NULL)); | 3532 (!GetHeap()->deserialization_complete() && map() == NULL)); |
3533 DCHECK_LE(kNextOffset + kPointerSize, nobarrier_size()); | 3533 DCHECK_LE(kNextOffset + kPointerSize, nobarrier_size()); |
3534 base::NoBarrier_Store( | 3534 base::NoBarrier_Store( |
3535 reinterpret_cast<base::AtomicWord*>(address() + kNextOffset), | 3535 reinterpret_cast<base::AtomicWord*>(address() + kNextOffset), |
3536 reinterpret_cast<base::AtomicWord>(next)); | 3536 reinterpret_cast<base::AtomicWord>(next)); |
3537 } | 3537 } |
3538 | 3538 |
3539 | 3539 |
3540 FreeSpace* FreeSpace::cast(HeapObject* o) { | 3540 FreeSpace* FreeSpace::cast(HeapObject* o) { |
3541 SLOW_DCHECK(!o->GetHeap()->deserialization_complete() || o->IsFreeSpace()); | 3541 SLOW_DCHECK(!o->GetHeap()->deserialization_complete() || o->IsFreeSpace()); |
(...skipping 4328 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7870 #undef READ_INT64_FIELD | 7870 #undef READ_INT64_FIELD |
7871 #undef WRITE_INT64_FIELD | 7871 #undef WRITE_INT64_FIELD |
7872 #undef READ_BYTE_FIELD | 7872 #undef READ_BYTE_FIELD |
7873 #undef WRITE_BYTE_FIELD | 7873 #undef WRITE_BYTE_FIELD |
7874 #undef NOBARRIER_READ_BYTE_FIELD | 7874 #undef NOBARRIER_READ_BYTE_FIELD |
7875 #undef NOBARRIER_WRITE_BYTE_FIELD | 7875 #undef NOBARRIER_WRITE_BYTE_FIELD |
7876 | 7876 |
7877 } } // namespace v8::internal | 7877 } } // namespace v8::internal |
7878 | 7878 |
7879 #endif // V8_OBJECTS_INL_H_ | 7879 #endif // V8_OBJECTS_INL_H_ |
OLD | NEW |