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

Side by Side Diff: src/ia32/ic-ia32.cc

Issue 155350: Changed hash table to use more of the hash value when probing. (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 11 years, 5 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 | Annotate | Revision Log
OLDNEW
1 // Copyright 2006-2008 the V8 project authors. All rights reserved. 1 // Copyright 2006-2008 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 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 // Compute the capacity mask. 90 // Compute the capacity mask.
91 const int kCapacityOffset = 91 const int kCapacityOffset =
92 Array::kHeaderSize + StringDictionary::kCapacityIndex * kPointerSize; 92 Array::kHeaderSize + StringDictionary::kCapacityIndex * kPointerSize;
93 __ mov(r2, FieldOperand(r0, kCapacityOffset)); 93 __ mov(r2, FieldOperand(r0, kCapacityOffset));
94 __ shr(r2, kSmiTagSize); // convert smi to int 94 __ shr(r2, kSmiTagSize); // convert smi to int
95 __ dec(r2); 95 __ dec(r2);
96 96
97 // Generate an unrolled loop that performs a few probes before 97 // Generate an unrolled loop that performs a few probes before
98 // giving up. Measurements done on Gmail indicate that 2 probes 98 // giving up. Measurements done on Gmail indicate that 2 probes
99 // cover ~93% of loads from dictionaries. 99 // cover ~93% of loads from dictionaries.
100 static const int kProbes = 4;
101 const int kElementsStartOffset = 100 const int kElementsStartOffset =
102 Array::kHeaderSize + StringDictionary::kElementsStartIndex * kPointerSize; 101 Array::kHeaderSize + StringDictionary::kElementsStartIndex * kPointerSize;
103 for (int i = 0; i < kProbes; i++) { 102
104 // Compute the masked index: (hash + i + i * i) & mask. 103 static const uint32_t kProbes =
104 HashTable<StringDictionaryShape, String*>::kNofFastProbes;
105 static const uint32_t kShift =
106 HashTable<StringDictionaryShape, String*>::kHashRotateShift;
107
108 for (uint32_t i = 0; i < kProbes; i++) {
109 // Compute the masked index.
105 __ mov(r1, FieldOperand(name, String::kLengthOffset)); 110 __ mov(r1, FieldOperand(name, String::kLengthOffset));
106 __ shr(r1, String::kHashShift); 111 __ shr(r1, String::kHashShift);
107 if (i > 0) { 112 if (i > 0) {
108 __ add(Operand(r1), Immediate(StringDictionary::GetProbeOffset(i))); 113 __ ror(r1, (kShift * i) % kBitsPerInt);
109 } 114 }
110 __ and_(r1, Operand(r2)); 115 __ and_(r1, Operand(r2));
111 116
112 // Scale the index by multiplying by the entry size. 117 // Scale the index by multiplying by the entry size.
113 ASSERT(StringDictionary::kEntrySize == 3); 118 ASSERT(StringDictionary::kEntrySize == 3);
114 __ lea(r1, Operand(r1, r1, times_2, 0)); // r1 = r1 * 3 119 __ lea(r1, Operand(r1, r1, times_2, 0)); // r1 = r1 * 3
115 120
116 // Check if the key is identical to the name. 121 // Check if the key is identical to the name.
117 __ cmp(name, 122 __ cmp(name,
118 Operand(r0, r1, times_4, kElementsStartOffset - kHeapObjectTag)); 123 Operand(r0, r1, times_4, kElementsStartOffset - kHeapObjectTag));
(...skipping 856 matching lines...) Expand 10 before | Expand all | Expand 10 after
975 980
976 // Do tail-call to runtime routine. 981 // Do tail-call to runtime routine.
977 __ TailCallRuntime( 982 __ TailCallRuntime(
978 ExternalReference(IC_Utility(kSharedStoreIC_ExtendStorage)), 3); 983 ExternalReference(IC_Utility(kSharedStoreIC_ExtendStorage)), 3);
979 } 984 }
980 985
981 #undef __ 986 #undef __
982 987
983 988
984 } } // namespace v8::internal 989 } } // namespace v8::internal
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698