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 3227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3238 DCHECK(!marking_->IsMarking() || | 3238 DCHECK(!marking_->IsMarking() || |
3239 Marking::Color(array) == Marking::WHITE_OBJECT); | 3239 Marking::Color(array) == Marking::WHITE_OBJECT); |
3240 } | 3240 } |
3241 | 3241 |
3242 | 3242 |
3243 DescriptorArray::WhitenessWitness::~WhitenessWitness() { | 3243 DescriptorArray::WhitenessWitness::~WhitenessWitness() { |
3244 marking_->LeaveNoMarkingScope(); | 3244 marking_->LeaveNoMarkingScope(); |
3245 } | 3245 } |
3246 | 3246 |
3247 | 3247 |
3248 template<typename Derived, typename Shape, typename Key> | 3248 int HashTableBase::ComputeCapacity(int at_least_space_for) { |
3249 int HashTable<Derived, Shape, Key>::ComputeCapacity(int at_least_space_for) { | |
3250 const int kMinCapacity = 32; | 3249 const int kMinCapacity = 32; |
3251 int capacity = base::bits::RoundUpToPowerOfTwo32(at_least_space_for * 2); | 3250 int capacity = base::bits::RoundUpToPowerOfTwo32(at_least_space_for * 2); |
3252 if (capacity < kMinCapacity) { | 3251 if (capacity < kMinCapacity) { |
3253 capacity = kMinCapacity; // Guarantee min capacity. | 3252 capacity = kMinCapacity; // Guarantee min capacity. |
3254 } | 3253 } |
3255 return capacity; | 3254 return capacity; |
3256 } | 3255 } |
3257 | 3256 |
3258 | 3257 |
3259 template<typename Derived, typename Shape, typename Key> | 3258 int HashTableBase::ComputeCapacityForSerialization(int at_least_space_for) { |
| 3259 return base::bits::RoundUpToPowerOfTwo32(at_least_space_for); |
| 3260 } |
| 3261 |
| 3262 |
| 3263 template <typename Derived, typename Shape, typename Key> |
3260 int HashTable<Derived, Shape, Key>::FindEntry(Key key) { | 3264 int HashTable<Derived, Shape, Key>::FindEntry(Key key) { |
3261 return FindEntry(GetIsolate(), key); | 3265 return FindEntry(GetIsolate(), key); |
3262 } | 3266 } |
3263 | 3267 |
3264 | 3268 |
3265 // Find entry for key otherwise return kNotFound. | 3269 // Find entry for key otherwise return kNotFound. |
3266 template<typename Derived, typename Shape, typename Key> | 3270 template<typename Derived, typename Shape, typename Key> |
3267 int HashTable<Derived, Shape, Key>::FindEntry(Isolate* isolate, Key key) { | 3271 int HashTable<Derived, Shape, Key>::FindEntry(Isolate* isolate, Key key) { |
3268 uint32_t capacity = Capacity(); | 3272 uint32_t capacity = Capacity(); |
3269 uint32_t entry = FirstProbe(HashTable::Hash(key), capacity); | 3273 uint32_t entry = FirstProbe(HashTable::Hash(key), capacity); |
(...skipping 4270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7540 #undef READ_SHORT_FIELD | 7544 #undef READ_SHORT_FIELD |
7541 #undef WRITE_SHORT_FIELD | 7545 #undef WRITE_SHORT_FIELD |
7542 #undef READ_BYTE_FIELD | 7546 #undef READ_BYTE_FIELD |
7543 #undef WRITE_BYTE_FIELD | 7547 #undef WRITE_BYTE_FIELD |
7544 #undef NOBARRIER_READ_BYTE_FIELD | 7548 #undef NOBARRIER_READ_BYTE_FIELD |
7545 #undef NOBARRIER_WRITE_BYTE_FIELD | 7549 #undef NOBARRIER_WRITE_BYTE_FIELD |
7546 | 7550 |
7547 } } // namespace v8::internal | 7551 } } // namespace v8::internal |
7548 | 7552 |
7549 #endif // V8_OBJECTS_INL_H_ | 7553 #endif // V8_OBJECTS_INL_H_ |
OLD | NEW |