OLD | NEW |
1 // Copyright 2006-2009 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2009 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 1970 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1981 fast_set(this, kCapacityIndex, Smi::FromInt(capacity)); | 1981 fast_set(this, kCapacityIndex, Smi::FromInt(capacity)); |
1982 } | 1982 } |
1983 | 1983 |
1984 | 1984 |
1985 // Returns probe entry. | 1985 // Returns probe entry. |
1986 static uint32_t GetProbe(uint32_t hash, uint32_t number, uint32_t size) { | 1986 static uint32_t GetProbe(uint32_t hash, uint32_t number, uint32_t size) { |
1987 ASSERT(IsPowerOf2(size)); | 1987 ASSERT(IsPowerOf2(size)); |
1988 return (hash + GetProbeOffset(number)) & (size - 1); | 1988 return (hash + GetProbeOffset(number)) & (size - 1); |
1989 } | 1989 } |
1990 | 1990 |
| 1991 static uint32_t FirstProbe(uint32_t hash, uint32_t size) { |
| 1992 return hash & (size - 1); |
| 1993 } |
| 1994 |
| 1995 static uint32_t NextProbe(uint32_t last, uint32_t number, uint32_t size) { |
| 1996 return (last + number) & (size - 1); |
| 1997 } |
| 1998 |
1991 // Ensure enough space for n additional elements. | 1999 // Ensure enough space for n additional elements. |
1992 Object* EnsureCapacity(int n, Key key); | 2000 Object* EnsureCapacity(int n, Key key); |
1993 }; | 2001 }; |
1994 | 2002 |
1995 | 2003 |
1996 | 2004 |
1997 // HashTableKey is an abstract superclass for virtual key behavior. | 2005 // HashTableKey is an abstract superclass for virtual key behavior. |
1998 class HashTableKey { | 2006 class HashTableKey { |
1999 public: | 2007 public: |
2000 // Returns whether the other object matches this key. | 2008 // Returns whether the other object matches this key. |
(...skipping 2899 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4900 } else { | 4908 } else { |
4901 value &= ~(1 << bit_position); | 4909 value &= ~(1 << bit_position); |
4902 } | 4910 } |
4903 return value; | 4911 return value; |
4904 } | 4912 } |
4905 }; | 4913 }; |
4906 | 4914 |
4907 } } // namespace v8::internal | 4915 } } // namespace v8::internal |
4908 | 4916 |
4909 #endif // V8_OBJECTS_H_ | 4917 #endif // V8_OBJECTS_H_ |
OLD | NEW |