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 // |
11 | 11 |
12 #ifndef V8_OBJECTS_INL_H_ | 12 #ifndef V8_OBJECTS_INL_H_ |
13 #define V8_OBJECTS_INL_H_ | 13 #define V8_OBJECTS_INL_H_ |
14 | 14 |
15 #include "src/base/atomicops.h" | 15 #include "src/base/atomicops.h" |
| 16 #include "src/base/bits.h" |
16 #include "src/contexts.h" | 17 #include "src/contexts.h" |
17 #include "src/conversions-inl.h" | 18 #include "src/conversions-inl.h" |
18 #include "src/elements.h" | 19 #include "src/elements.h" |
19 #include "src/factory.h" | 20 #include "src/factory.h" |
20 #include "src/field-index-inl.h" | 21 #include "src/field-index-inl.h" |
21 #include "src/heap/heap-inl.h" | 22 #include "src/heap/heap-inl.h" |
22 #include "src/heap/heap.h" | 23 #include "src/heap/heap.h" |
23 #include "src/heap/incremental-marking.h" | 24 #include "src/heap/incremental-marking.h" |
24 #include "src/heap/objects-visiting.h" | 25 #include "src/heap/objects-visiting.h" |
25 #include "src/heap/spaces.h" | 26 #include "src/heap/spaces.h" |
(...skipping 3062 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3088 | 3089 |
3089 | 3090 |
3090 DescriptorArray::WhitenessWitness::~WhitenessWitness() { | 3091 DescriptorArray::WhitenessWitness::~WhitenessWitness() { |
3091 marking_->LeaveNoMarkingScope(); | 3092 marking_->LeaveNoMarkingScope(); |
3092 } | 3093 } |
3093 | 3094 |
3094 | 3095 |
3095 template<typename Derived, typename Shape, typename Key> | 3096 template<typename Derived, typename Shape, typename Key> |
3096 int HashTable<Derived, Shape, Key>::ComputeCapacity(int at_least_space_for) { | 3097 int HashTable<Derived, Shape, Key>::ComputeCapacity(int at_least_space_for) { |
3097 const int kMinCapacity = 32; | 3098 const int kMinCapacity = 32; |
3098 int capacity = RoundUpToPowerOf2(at_least_space_for * 2); | 3099 int capacity = base::bits::RoundUpToPowerOfTwo32(at_least_space_for * 2); |
3099 if (capacity < kMinCapacity) { | 3100 if (capacity < kMinCapacity) { |
3100 capacity = kMinCapacity; // Guarantee min capacity. | 3101 capacity = kMinCapacity; // Guarantee min capacity. |
3101 } | 3102 } |
3102 return capacity; | 3103 return capacity; |
3103 } | 3104 } |
3104 | 3105 |
3105 | 3106 |
3106 template<typename Derived, typename Shape, typename Key> | 3107 template<typename Derived, typename Shape, typename Key> |
3107 int HashTable<Derived, Shape, Key>::FindEntry(Key key) { | 3108 int HashTable<Derived, Shape, Key>::FindEntry(Key key) { |
3108 return FindEntry(GetIsolate(), key); | 3109 return FindEntry(GetIsolate(), key); |
(...skipping 4139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7248 #undef READ_SHORT_FIELD | 7249 #undef READ_SHORT_FIELD |
7249 #undef WRITE_SHORT_FIELD | 7250 #undef WRITE_SHORT_FIELD |
7250 #undef READ_BYTE_FIELD | 7251 #undef READ_BYTE_FIELD |
7251 #undef WRITE_BYTE_FIELD | 7252 #undef WRITE_BYTE_FIELD |
7252 #undef NOBARRIER_READ_BYTE_FIELD | 7253 #undef NOBARRIER_READ_BYTE_FIELD |
7253 #undef NOBARRIER_WRITE_BYTE_FIELD | 7254 #undef NOBARRIER_WRITE_BYTE_FIELD |
7254 | 7255 |
7255 } } // namespace v8::internal | 7256 } } // namespace v8::internal |
7256 | 7257 |
7257 #endif // V8_OBJECTS_INL_H_ | 7258 #endif // V8_OBJECTS_INL_H_ |
OLD | NEW |