| 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 <iosfwd> | 8 #include <iosfwd> |
| 9 | 9 |
| 10 #include "src/allocation.h" | 10 #include "src/allocation.h" |
| (...skipping 2932 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2943 } | 2943 } |
| 2944 void ElementsRemoved(int n) { | 2944 void ElementsRemoved(int n) { |
| 2945 SetNumberOfElements(NumberOfElements() - n); | 2945 SetNumberOfElements(NumberOfElements() - n); |
| 2946 SetNumberOfDeletedElements(NumberOfDeletedElements() + n); | 2946 SetNumberOfDeletedElements(NumberOfDeletedElements() + n); |
| 2947 } | 2947 } |
| 2948 | 2948 |
| 2949 // Computes the required capacity for a table holding the given | 2949 // Computes the required capacity for a table holding the given |
| 2950 // number of elements. May be more than HashTable::kMaxCapacity. | 2950 // number of elements. May be more than HashTable::kMaxCapacity. |
| 2951 static inline int ComputeCapacity(int at_least_space_for); | 2951 static inline int ComputeCapacity(int at_least_space_for); |
| 2952 | 2952 |
| 2953 // Use a different heuristic to compute capacity when serializing. | |
| 2954 static inline int ComputeCapacityForSerialization(int at_least_space_for); | |
| 2955 | |
| 2956 // Tells whether k is a real key. The hole and undefined are not allowed | 2953 // Tells whether k is a real key. The hole and undefined are not allowed |
| 2957 // as keys and can be used to indicate missing or deleted elements. | 2954 // as keys and can be used to indicate missing or deleted elements. |
| 2958 bool IsKey(Object* k) { | 2955 bool IsKey(Object* k) { |
| 2959 return !k->IsTheHole() && !k->IsUndefined(); | 2956 return !k->IsTheHole() && !k->IsUndefined(); |
| 2960 } | 2957 } |
| 2961 | 2958 |
| 2962 // Compute the probe offset (quadratic probing). | 2959 // Compute the probe offset (quadratic probing). |
| 2963 INLINE(static uint32_t GetProbeOffset(uint32_t n)) { | 2960 INLINE(static uint32_t GetProbeOffset(uint32_t n)) { |
| 2964 return (n + n * n) >> 1; | 2961 return (n + n * n) >> 1; |
| 2965 } | 2962 } |
| (...skipping 7580 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10546 } else { | 10543 } else { |
| 10547 value &= ~(1 << bit_position); | 10544 value &= ~(1 << bit_position); |
| 10548 } | 10545 } |
| 10549 return value; | 10546 return value; |
| 10550 } | 10547 } |
| 10551 }; | 10548 }; |
| 10552 | 10549 |
| 10553 } } // namespace v8::internal | 10550 } } // namespace v8::internal |
| 10554 | 10551 |
| 10555 #endif // V8_OBJECTS_H_ | 10552 #endif // V8_OBJECTS_H_ |
| OLD | NEW |