OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 1949 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1960 | 1960 |
1961 void DescriptorArray::Swap(int first, int second) { | 1961 void DescriptorArray::Swap(int first, int second) { |
1962 fast_swap(this, ToKeyIndex(first), ToKeyIndex(second)); | 1962 fast_swap(this, ToKeyIndex(first), ToKeyIndex(second)); |
1963 FixedArray* content_array = GetContentArray(); | 1963 FixedArray* content_array = GetContentArray(); |
1964 fast_swap(content_array, ToValueIndex(first), ToValueIndex(second)); | 1964 fast_swap(content_array, ToValueIndex(first), ToValueIndex(second)); |
1965 fast_swap(content_array, ToDetailsIndex(first), ToDetailsIndex(second)); | 1965 fast_swap(content_array, ToDetailsIndex(first), ToDetailsIndex(second)); |
1966 } | 1966 } |
1967 | 1967 |
1968 | 1968 |
1969 template<typename Shape, typename Key> | 1969 template<typename Shape, typename Key> |
| 1970 int HashTable<Shape, Key>::ComputeCapacity(int at_least_space_for) { |
| 1971 const int kMinCapacity = 32; |
| 1972 int capacity = RoundUpToPowerOf2(at_least_space_for * 2); |
| 1973 if (capacity < kMinCapacity) { |
| 1974 capacity = kMinCapacity; // Guarantee min capacity. |
| 1975 } |
| 1976 return capacity; |
| 1977 } |
| 1978 |
| 1979 |
| 1980 template<typename Shape, typename Key> |
1970 int HashTable<Shape, Key>::FindEntry(Key key) { | 1981 int HashTable<Shape, Key>::FindEntry(Key key) { |
1971 return FindEntry(GetIsolate(), key); | 1982 return FindEntry(GetIsolate(), key); |
1972 } | 1983 } |
1973 | 1984 |
1974 | 1985 |
1975 // Find entry for key otherwise return kNotFound. | 1986 // Find entry for key otherwise return kNotFound. |
1976 template<typename Shape, typename Key> | 1987 template<typename Shape, typename Key> |
1977 int HashTable<Shape, Key>::FindEntry(Isolate* isolate, Key key) { | 1988 int HashTable<Shape, Key>::FindEntry(Isolate* isolate, Key key) { |
1978 uint32_t capacity = Capacity(); | 1989 uint32_t capacity = Capacity(); |
1979 uint32_t entry = FirstProbe(Shape::Hash(key), capacity); | 1990 uint32_t entry = FirstProbe(Shape::Hash(key), capacity); |
(...skipping 2520 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4500 #undef WRITE_INT_FIELD | 4511 #undef WRITE_INT_FIELD |
4501 #undef READ_SHORT_FIELD | 4512 #undef READ_SHORT_FIELD |
4502 #undef WRITE_SHORT_FIELD | 4513 #undef WRITE_SHORT_FIELD |
4503 #undef READ_BYTE_FIELD | 4514 #undef READ_BYTE_FIELD |
4504 #undef WRITE_BYTE_FIELD | 4515 #undef WRITE_BYTE_FIELD |
4505 | 4516 |
4506 | 4517 |
4507 } } // namespace v8::internal | 4518 } } // namespace v8::internal |
4508 | 4519 |
4509 #endif // V8_OBJECTS_INL_H_ | 4520 #endif // V8_OBJECTS_INL_H_ |
OLD | NEW |