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 #ifndef V8_OBJECTS_H_ | 5 #ifndef V8_OBJECTS_H_ |
6 #define V8_OBJECTS_H_ | 6 #define V8_OBJECTS_H_ |
7 | 7 |
8 #include "src/allocation.h" | 8 #include "src/allocation.h" |
9 #include "src/assert-scope.h" | 9 #include "src/assert-scope.h" |
| 10 #include "src/base/bits.h" |
10 #include "src/builtins.h" | 11 #include "src/builtins.h" |
11 #include "src/checks.h" | 12 #include "src/checks.h" |
12 #include "src/elements-kind.h" | 13 #include "src/elements-kind.h" |
13 #include "src/field-index.h" | 14 #include "src/field-index.h" |
14 #include "src/flags.h" | 15 #include "src/flags.h" |
15 #include "src/list.h" | 16 #include "src/list.h" |
16 #include "src/property-details.h" | 17 #include "src/property-details.h" |
17 #include "src/smart-pointers.h" | 18 #include "src/smart-pointers.h" |
18 #include "src/unicode-inl.h" | 19 #include "src/unicode-inl.h" |
19 #include "src/zone.h" | 20 #include "src/zone.h" |
(...skipping 3667 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3687 // use bit-wise AND with a mask, so the capacity must be positive | 3688 // use bit-wise AND with a mask, so the capacity must be positive |
3688 // and non-zero. | 3689 // and non-zero. |
3689 DCHECK(capacity > 0); | 3690 DCHECK(capacity > 0); |
3690 DCHECK(capacity <= kMaxCapacity); | 3691 DCHECK(capacity <= kMaxCapacity); |
3691 set(kCapacityIndex, Smi::FromInt(capacity)); | 3692 set(kCapacityIndex, Smi::FromInt(capacity)); |
3692 } | 3693 } |
3693 | 3694 |
3694 | 3695 |
3695 // Returns probe entry. | 3696 // Returns probe entry. |
3696 static uint32_t GetProbe(uint32_t hash, uint32_t number, uint32_t size) { | 3697 static uint32_t GetProbe(uint32_t hash, uint32_t number, uint32_t size) { |
3697 DCHECK(IsPowerOf2(size)); | 3698 DCHECK(base::bits::IsPowerOfTwo32(size)); |
3698 return (hash + GetProbeOffset(number)) & (size - 1); | 3699 return (hash + GetProbeOffset(number)) & (size - 1); |
3699 } | 3700 } |
3700 | 3701 |
3701 inline static uint32_t FirstProbe(uint32_t hash, uint32_t size) { | 3702 inline static uint32_t FirstProbe(uint32_t hash, uint32_t size) { |
3702 return hash & (size - 1); | 3703 return hash & (size - 1); |
3703 } | 3704 } |
3704 | 3705 |
3705 inline static uint32_t NextProbe( | 3706 inline static uint32_t NextProbe( |
3706 uint32_t last, uint32_t number, uint32_t size) { | 3707 uint32_t last, uint32_t number, uint32_t size) { |
3707 return (last + number) & (size - 1); | 3708 return (last + number) & (size - 1); |
(...skipping 7445 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
11153 } else { | 11154 } else { |
11154 value &= ~(1 << bit_position); | 11155 value &= ~(1 << bit_position); |
11155 } | 11156 } |
11156 return value; | 11157 return value; |
11157 } | 11158 } |
11158 }; | 11159 }; |
11159 | 11160 |
11160 } } // namespace v8::internal | 11161 } } // namespace v8::internal |
11161 | 11162 |
11162 #endif // V8_OBJECTS_H_ | 11163 #endif // V8_OBJECTS_H_ |
OLD | NEW |