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

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 merge 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
« no previous file with comments | « src/objects.cc ('k') | src/runtime/runtime.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 3282 matching lines...) Expand 10 before | Expand all | Expand 10 after
3293 return Max(capacity, kMinCapacity); 3293 return Max(capacity, kMinCapacity);
3294 } 3294 }
3295 3295
3296 3296
3297 template <typename Derived, typename Shape, typename Key> 3297 template <typename Derived, typename Shape, typename Key>
3298 int HashTable<Derived, Shape, Key>::FindEntry(Key key) { 3298 int HashTable<Derived, Shape, Key>::FindEntry(Key key) {
3299 return FindEntry(GetIsolate(), key); 3299 return FindEntry(GetIsolate(), key);
3300 } 3300 }
3301 3301
3302 3302
3303 template<typename Derived, typename Shape, typename Key>
3304 int HashTable<Derived, Shape, Key>::FindEntry(Isolate* isolate, Key key) {
3305 return FindEntry(isolate, key, HashTable::Hash(key));
3306 }
3307
3308
3303 // Find entry for key otherwise return kNotFound. 3309 // Find entry for key otherwise return kNotFound.
3304 template<typename Derived, typename Shape, typename Key> 3310 template <typename Derived, typename Shape, typename Key>
3305 int HashTable<Derived, Shape, Key>::FindEntry(Isolate* isolate, Key key) { 3311 int HashTable<Derived, Shape, Key>::FindEntry(Isolate* isolate, Key key,
3312 int32_t hash) {
3306 uint32_t capacity = Capacity(); 3313 uint32_t capacity = Capacity();
3307 uint32_t entry = FirstProbe(HashTable::Hash(key), capacity); 3314 uint32_t entry = FirstProbe(hash, capacity);
3308 uint32_t count = 1; 3315 uint32_t count = 1;
3309 // EnsureCapacity will guarantee the hash table is never full. 3316 // EnsureCapacity will guarantee the hash table is never full.
3310 while (true) { 3317 while (true) {
3311 Object* element = KeyAt(entry); 3318 Object* element = KeyAt(entry);
3312 // Empty entry. Uses raw unchecked accessors because it is called by the 3319 // Empty entry. Uses raw unchecked accessors because it is called by the
3313 // string table during bootstrapping. 3320 // string table during bootstrapping.
3314 if (element == isolate->heap()->raw_unchecked_undefined_value()) break; 3321 if (element == isolate->heap()->raw_unchecked_undefined_value()) break;
3315 if (element != isolate->heap()->raw_unchecked_the_hole_value() && 3322 if (element != isolate->heap()->raw_unchecked_the_hole_value() &&
3316 Shape::IsMatch(key, element)) return entry; 3323 Shape::IsMatch(key, element)) return entry;
3317 entry = NextProbe(entry, count++, capacity); 3324 entry = NextProbe(entry, count++, capacity);
(...skipping 4316 matching lines...) Expand 10 before | Expand all | Expand 10 after
7634 #undef READ_SHORT_FIELD 7641 #undef READ_SHORT_FIELD
7635 #undef WRITE_SHORT_FIELD 7642 #undef WRITE_SHORT_FIELD
7636 #undef READ_BYTE_FIELD 7643 #undef READ_BYTE_FIELD
7637 #undef WRITE_BYTE_FIELD 7644 #undef WRITE_BYTE_FIELD
7638 #undef NOBARRIER_READ_BYTE_FIELD 7645 #undef NOBARRIER_READ_BYTE_FIELD
7639 #undef NOBARRIER_WRITE_BYTE_FIELD 7646 #undef NOBARRIER_WRITE_BYTE_FIELD
7640 7647
7641 } } // namespace v8::internal 7648 } } // namespace v8::internal
7642 7649
7643 #endif // V8_OBJECTS_INL_H_ 7650 #endif // V8_OBJECTS_INL_H_
OLDNEW
« no previous file with comments | « src/objects.cc ('k') | src/runtime/runtime.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698