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 3034 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3045 } | 3045 } |
3046 | 3046 |
3047 | 3047 |
3048 // static | 3048 // static |
3049 int HashTableBase::ComputeCapacity(int at_least_space_for) { | 3049 int HashTableBase::ComputeCapacity(int at_least_space_for) { |
3050 const int kMinCapacity = 4; | 3050 const int kMinCapacity = 4; |
3051 int capacity = base::bits::RoundUpToPowerOfTwo32(at_least_space_for * 2); | 3051 int capacity = base::bits::RoundUpToPowerOfTwo32(at_least_space_for * 2); |
3052 return Max(capacity, kMinCapacity); | 3052 return Max(capacity, kMinCapacity); |
3053 } | 3053 } |
3054 | 3054 |
3055 bool HashTableBase::IsKey(Heap* heap, Object* k) { | 3055 bool HashTableBase::IsKey(Isolate* isolate, Object* k) { |
| 3056 Heap* heap = isolate->heap(); |
3056 return k != heap->the_hole_value() && k != heap->undefined_value(); | 3057 return k != heap->the_hole_value() && k != heap->undefined_value(); |
3057 } | 3058 } |
3058 | 3059 |
3059 bool HashTableBase::IsKey(Object* k) { | 3060 bool HashTableBase::IsKey(Object* k) { |
3060 Isolate* isolate = this->GetIsolate(); | 3061 Isolate* isolate = this->GetIsolate(); |
3061 return !k->IsTheHole(isolate) && !k->IsUndefined(isolate); | 3062 return !k->IsTheHole(isolate) && !k->IsUndefined(isolate); |
3062 } | 3063 } |
3063 | 3064 |
3064 | 3065 |
3065 void HashTableBase::SetNumberOfElements(int nof) { | 3066 void HashTableBase::SetNumberOfElements(int nof) { |
(...skipping 4861 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7927 #undef WRITE_INT64_FIELD | 7928 #undef WRITE_INT64_FIELD |
7928 #undef READ_BYTE_FIELD | 7929 #undef READ_BYTE_FIELD |
7929 #undef WRITE_BYTE_FIELD | 7930 #undef WRITE_BYTE_FIELD |
7930 #undef NOBARRIER_READ_BYTE_FIELD | 7931 #undef NOBARRIER_READ_BYTE_FIELD |
7931 #undef NOBARRIER_WRITE_BYTE_FIELD | 7932 #undef NOBARRIER_WRITE_BYTE_FIELD |
7932 | 7933 |
7933 } // namespace internal | 7934 } // namespace internal |
7934 } // namespace v8 | 7935 } // namespace v8 |
7935 | 7936 |
7936 #endif // V8_OBJECTS_INL_H_ | 7937 #endif // V8_OBJECTS_INL_H_ |
OLD | NEW |