OLD | NEW |
1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 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 <iosfwd> | 8 #include <iosfwd> |
9 | 9 |
10 #include "src/assert-scope.h" | 10 #include "src/assert-scope.h" |
(...skipping 3275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3286 MUST_USE_RESULT static Handle<Derived> Shrink(Handle<Derived> table, Key key); | 3286 MUST_USE_RESULT static Handle<Derived> Shrink(Handle<Derived> table, Key key); |
3287 | 3287 |
3288 // Ensure enough space for n additional elements. | 3288 // Ensure enough space for n additional elements. |
3289 MUST_USE_RESULT static Handle<Derived> EnsureCapacity( | 3289 MUST_USE_RESULT static Handle<Derived> EnsureCapacity( |
3290 Handle<Derived> table, | 3290 Handle<Derived> table, |
3291 int n, | 3291 int n, |
3292 Key key, | 3292 Key key, |
3293 PretenureFlag pretenure = NOT_TENURED); | 3293 PretenureFlag pretenure = NOT_TENURED); |
3294 | 3294 |
3295 // Returns true if this table has sufficient capacity for adding n elements. | 3295 // Returns true if this table has sufficient capacity for adding n elements. |
3296 bool HasSufficientCapacity(int n); | 3296 bool HasSufficientCapacityToAdd(int number_of_additional_elements); |
3297 | 3297 |
3298 // Sets the capacity of the hash table. | 3298 // Sets the capacity of the hash table. |
3299 void SetCapacity(int capacity) { | 3299 void SetCapacity(int capacity) { |
3300 // To scale a computed hash code to fit within the hash table, we | 3300 // To scale a computed hash code to fit within the hash table, we |
3301 // use bit-wise AND with a mask, so the capacity must be positive | 3301 // use bit-wise AND with a mask, so the capacity must be positive |
3302 // and non-zero. | 3302 // and non-zero. |
3303 DCHECK(capacity > 0); | 3303 DCHECK(capacity > 0); |
3304 DCHECK(capacity <= kMaxCapacity); | 3304 DCHECK(capacity <= kMaxCapacity); |
3305 set(kCapacityIndex, Smi::FromInt(capacity)); | 3305 set(kCapacityIndex, Smi::FromInt(capacity)); |
3306 } | 3306 } |
(...skipping 7686 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10993 } | 10993 } |
10994 return value; | 10994 return value; |
10995 } | 10995 } |
10996 }; | 10996 }; |
10997 | 10997 |
10998 | 10998 |
10999 } // NOLINT, false-positive due to second-order macros. | 10999 } // NOLINT, false-positive due to second-order macros. |
11000 } // NOLINT, false-positive due to second-order macros. | 11000 } // NOLINT, false-positive due to second-order macros. |
11001 | 11001 |
11002 #endif // V8_OBJECTS_H_ | 11002 #endif // V8_OBJECTS_H_ |
OLD | NEW |