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 2889 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2900 } | 2900 } |
2901 void ElementsRemoved(int n) { | 2901 void ElementsRemoved(int n) { |
2902 SetNumberOfElements(NumberOfElements() - n); | 2902 SetNumberOfElements(NumberOfElements() - n); |
2903 SetNumberOfDeletedElements(NumberOfDeletedElements() + n); | 2903 SetNumberOfDeletedElements(NumberOfDeletedElements() + n); |
2904 } | 2904 } |
2905 | 2905 |
2906 // Computes the required capacity for a table holding the given | 2906 // Computes the required capacity for a table holding the given |
2907 // number of elements. May be more than HashTable::kMaxCapacity. | 2907 // number of elements. May be more than HashTable::kMaxCapacity. |
2908 static inline int ComputeCapacity(int at_least_space_for); | 2908 static inline int ComputeCapacity(int at_least_space_for); |
2909 | 2909 |
| 2910 // Use a different heuristic to compute capacity when serializing. |
| 2911 static inline int ComputeCapacityForSerialization(int at_least_space_for); |
| 2912 |
2910 // Tells whether k is a real key. The hole and undefined are not allowed | 2913 // Tells whether k is a real key. The hole and undefined are not allowed |
2911 // as keys and can be used to indicate missing or deleted elements. | 2914 // as keys and can be used to indicate missing or deleted elements. |
2912 bool IsKey(Object* k) { | 2915 bool IsKey(Object* k) { |
2913 return !k->IsTheHole() && !k->IsUndefined(); | 2916 return !k->IsTheHole() && !k->IsUndefined(); |
2914 } | 2917 } |
2915 | 2918 |
2916 // Compute the probe offset (quadratic probing). | 2919 // Compute the probe offset (quadratic probing). |
2917 INLINE(static uint32_t GetProbeOffset(uint32_t n)) { | 2920 INLINE(static uint32_t GetProbeOffset(uint32_t n)) { |
2918 return (n + n * n) >> 1; | 2921 return (n + n * n) >> 1; |
2919 } | 2922 } |
(...skipping 7618 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10538 } else { | 10541 } else { |
10539 value &= ~(1 << bit_position); | 10542 value &= ~(1 << bit_position); |
10540 } | 10543 } |
10541 return value; | 10544 return value; |
10542 } | 10545 } |
10543 }; | 10546 }; |
10544 | 10547 |
10545 } } // namespace v8::internal | 10548 } } // namespace v8::internal |
10546 | 10549 |
10547 #endif // V8_OBJECTS_H_ | 10550 #endif // V8_OBJECTS_H_ |
OLD | NEW |