Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(9)

Side by Side Diff: src/objects-inl.h

Issue 1149863005: Move hash code from hidden string to a private symbol (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix global object hash code. This eated about 5% of weak collection performance Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 // Review notes: 5 // Review notes:
6 // 6 //
7 // - The use of macros in these inline functions may seem superfluous 7 // - The use of macros in these inline functions may seem superfluous
8 // but it is absolutely needed to make sure gcc generates optimal 8 // but it is absolutely needed to make sure gcc generates optimal
9 // code. gcc is not happy when attempting to inline too deep. 9 // code. gcc is not happy when attempting to inline too deep.
10 // 10 //
(...skipping 3268 matching lines...) Expand 10 before | Expand all | Expand 10 after
3279 return Max(capacity, kMinCapacity); 3279 return Max(capacity, kMinCapacity);
3280 } 3280 }
3281 3281
3282 3282
3283 template <typename Derived, typename Shape, typename Key> 3283 template <typename Derived, typename Shape, typename Key>
3284 int HashTable<Derived, Shape, Key>::FindEntry(Key key) { 3284 int HashTable<Derived, Shape, Key>::FindEntry(Key key) {
3285 return FindEntry(GetIsolate(), key); 3285 return FindEntry(GetIsolate(), key);
3286 } 3286 }
3287 3287
3288 3288
3289 template<typename Derived, typename Shape, typename Key>
3290 int HashTable<Derived, Shape, Key>::FindEntry(Isolate* isolate, Key key) {
3291 return FindEntry(isolate, key, HashTable::Hash(key));
3292 }
3293
3294
3289 // Find entry for key otherwise return kNotFound. 3295 // Find entry for key otherwise return kNotFound.
3290 template<typename Derived, typename Shape, typename Key> 3296 template <typename Derived, typename Shape, typename Key>
3291 int HashTable<Derived, Shape, Key>::FindEntry(Isolate* isolate, Key key) { 3297 int HashTable<Derived, Shape, Key>::FindEntry(Isolate* isolate, Key key,
3298 int32_t hash) {
3292 uint32_t capacity = Capacity(); 3299 uint32_t capacity = Capacity();
3293 uint32_t entry = FirstProbe(HashTable::Hash(key), capacity); 3300 uint32_t entry = FirstProbe(hash, capacity);
3294 uint32_t count = 1; 3301 uint32_t count = 1;
3295 // EnsureCapacity will guarantee the hash table is never full. 3302 // EnsureCapacity will guarantee the hash table is never full.
3296 while (true) { 3303 while (true) {
3297 Object* element = KeyAt(entry); 3304 Object* element = KeyAt(entry);
3298 // Empty entry. Uses raw unchecked accessors because it is called by the 3305 // Empty entry. Uses raw unchecked accessors because it is called by the
3299 // string table during bootstrapping. 3306 // string table during bootstrapping.
3300 if (element == isolate->heap()->raw_unchecked_undefined_value()) break; 3307 if (element == isolate->heap()->raw_unchecked_undefined_value()) break;
3301 if (element != isolate->heap()->raw_unchecked_the_hole_value() && 3308 if (element != isolate->heap()->raw_unchecked_the_hole_value() &&
3302 Shape::IsMatch(key, element)) return entry; 3309 Shape::IsMatch(key, element)) return entry;
3303 entry = NextProbe(entry, count++, capacity); 3310 entry = NextProbe(entry, count++, capacity);
(...skipping 4329 matching lines...) Expand 10 before | Expand all | Expand 10 after
7633 #undef READ_SHORT_FIELD 7640 #undef READ_SHORT_FIELD
7634 #undef WRITE_SHORT_FIELD 7641 #undef WRITE_SHORT_FIELD
7635 #undef READ_BYTE_FIELD 7642 #undef READ_BYTE_FIELD
7636 #undef WRITE_BYTE_FIELD 7643 #undef WRITE_BYTE_FIELD
7637 #undef NOBARRIER_READ_BYTE_FIELD 7644 #undef NOBARRIER_READ_BYTE_FIELD
7638 #undef NOBARRIER_WRITE_BYTE_FIELD 7645 #undef NOBARRIER_WRITE_BYTE_FIELD
7639 7646
7640 } } // namespace v8::internal 7647 } } // namespace v8::internal
7641 7648
7642 #endif // V8_OBJECTS_INL_H_ 7649 #endif // V8_OBJECTS_INL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698