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 2980 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2991 } | 2991 } |
2992 | 2992 |
2993 | 2993 |
2994 // static | 2994 // static |
2995 int HashTableBase::ComputeCapacity(int at_least_space_for) { | 2995 int HashTableBase::ComputeCapacity(int at_least_space_for) { |
2996 const int kMinCapacity = 4; | 2996 const int kMinCapacity = 4; |
2997 int capacity = base::bits::RoundUpToPowerOfTwo32(at_least_space_for * 2); | 2997 int capacity = base::bits::RoundUpToPowerOfTwo32(at_least_space_for * 2); |
2998 return Max(capacity, kMinCapacity); | 2998 return Max(capacity, kMinCapacity); |
2999 } | 2999 } |
3000 | 3000 |
| 3001 bool HashTableBase::IsKey(Heap* heap, Object* k) { |
| 3002 return k != heap->the_hole_value() && k != heap->undefined_value(); |
| 3003 } |
3001 | 3004 |
3002 bool HashTableBase::IsKey(Object* k) { | 3005 bool HashTableBase::IsKey(Object* k) { |
3003 return !k->IsTheHole() && !k->IsUndefined(); | 3006 return !k->IsTheHole() && !k->IsUndefined(); |
3004 } | 3007 } |
3005 | 3008 |
3006 | 3009 |
3007 void HashTableBase::SetNumberOfElements(int nof) { | 3010 void HashTableBase::SetNumberOfElements(int nof) { |
3008 set(kNumberOfElementsIndex, Smi::FromInt(nof)); | 3011 set(kNumberOfElementsIndex, Smi::FromInt(nof)); |
3009 } | 3012 } |
3010 | 3013 |
(...skipping 4824 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7835 #undef WRITE_INT64_FIELD | 7838 #undef WRITE_INT64_FIELD |
7836 #undef READ_BYTE_FIELD | 7839 #undef READ_BYTE_FIELD |
7837 #undef WRITE_BYTE_FIELD | 7840 #undef WRITE_BYTE_FIELD |
7838 #undef NOBARRIER_READ_BYTE_FIELD | 7841 #undef NOBARRIER_READ_BYTE_FIELD |
7839 #undef NOBARRIER_WRITE_BYTE_FIELD | 7842 #undef NOBARRIER_WRITE_BYTE_FIELD |
7840 | 7843 |
7841 } // namespace internal | 7844 } // namespace internal |
7842 } // namespace v8 | 7845 } // namespace v8 |
7843 | 7846 |
7844 #endif // V8_OBJECTS_INL_H_ | 7847 #endif // V8_OBJECTS_INL_H_ |
OLD | NEW |