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 2821 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2832 marking_->LeaveNoMarkingScope(); | 2832 marking_->LeaveNoMarkingScope(); |
2833 } | 2833 } |
2834 | 2834 |
2835 | 2835 |
2836 int HashTableBase::ComputeCapacity(int at_least_space_for) { | 2836 int HashTableBase::ComputeCapacity(int at_least_space_for) { |
2837 const int kMinCapacity = 4; | 2837 const int kMinCapacity = 4; |
2838 int capacity = base::bits::RoundUpToPowerOfTwo32(at_least_space_for * 2); | 2838 int capacity = base::bits::RoundUpToPowerOfTwo32(at_least_space_for * 2); |
2839 return Max(capacity, kMinCapacity); | 2839 return Max(capacity, kMinCapacity); |
2840 } | 2840 } |
2841 | 2841 |
| 2842 |
| 2843 int HashTableBase::ComputeCapacityForSerialization(int at_least_space_for) { |
| 2844 const int kMinCapacity = 1; |
| 2845 int capacity = base::bits::RoundUpToPowerOfTwo32(at_least_space_for); |
| 2846 return Max(capacity, kMinCapacity); |
| 2847 } |
| 2848 |
2842 | 2849 |
2843 template <typename Derived, typename Shape, typename Key> | 2850 template <typename Derived, typename Shape, typename Key> |
2844 int HashTable<Derived, Shape, Key>::FindEntry(Key key) { | 2851 int HashTable<Derived, Shape, Key>::FindEntry(Key key) { |
2845 return FindEntry(GetIsolate(), key); | 2852 return FindEntry(GetIsolate(), key); |
2846 } | 2853 } |
2847 | 2854 |
2848 | 2855 |
2849 template<typename Derived, typename Shape, typename Key> | 2856 template<typename Derived, typename Shape, typename Key> |
2850 int HashTable<Derived, Shape, Key>::FindEntry(Isolate* isolate, Key key) { | 2857 int HashTable<Derived, Shape, Key>::FindEntry(Isolate* isolate, Key key) { |
2851 return FindEntry(isolate, key, HashTable::Hash(key)); | 2858 return FindEntry(isolate, key, HashTable::Hash(key)); |
(...skipping 4234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7086 #undef READ_SHORT_FIELD | 7093 #undef READ_SHORT_FIELD |
7087 #undef WRITE_SHORT_FIELD | 7094 #undef WRITE_SHORT_FIELD |
7088 #undef READ_BYTE_FIELD | 7095 #undef READ_BYTE_FIELD |
7089 #undef WRITE_BYTE_FIELD | 7096 #undef WRITE_BYTE_FIELD |
7090 #undef NOBARRIER_READ_BYTE_FIELD | 7097 #undef NOBARRIER_READ_BYTE_FIELD |
7091 #undef NOBARRIER_WRITE_BYTE_FIELD | 7098 #undef NOBARRIER_WRITE_BYTE_FIELD |
7092 | 7099 |
7093 } } // namespace v8::internal | 7100 } } // namespace v8::internal |
7094 | 7101 |
7095 #endif // V8_OBJECTS_INL_H_ | 7102 #endif // V8_OBJECTS_INL_H_ |
OLD | NEW |