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

Side by Side Diff: src/ia32/stub-cache-ia32.cc

Issue 6932010: Unroll more StringDictionary lookup probes both for positive and negative dictionary lookups. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: revive inlined portions Created 9 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 | Annotate | Revision Log
« no previous file with comments | « src/ia32/ic-ia32.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 Label* miss_label, 111 Label* miss_label,
112 Register receiver, 112 Register receiver,
113 String* name, 113 String* name,
114 Register r0, 114 Register r0,
115 Register r1) { 115 Register r1) {
116 ASSERT(name->IsSymbol()); 116 ASSERT(name->IsSymbol());
117 Counters* counters = masm->isolate()->counters(); 117 Counters* counters = masm->isolate()->counters();
118 __ IncrementCounter(counters->negative_lookups(), 1); 118 __ IncrementCounter(counters->negative_lookups(), 1);
119 __ IncrementCounter(counters->negative_lookups_miss(), 1); 119 __ IncrementCounter(counters->negative_lookups_miss(), 1);
120 120
121 Label done;
122 __ mov(r0, FieldOperand(receiver, HeapObject::kMapOffset)); 121 __ mov(r0, FieldOperand(receiver, HeapObject::kMapOffset));
123 122
124 const int kInterceptorOrAccessCheckNeededMask = 123 const int kInterceptorOrAccessCheckNeededMask =
125 (1 << Map::kHasNamedInterceptor) | (1 << Map::kIsAccessCheckNeeded); 124 (1 << Map::kHasNamedInterceptor) | (1 << Map::kIsAccessCheckNeeded);
126 125
127 // Bail out if the receiver has a named interceptor or requires access checks. 126 // Bail out if the receiver has a named interceptor or requires access checks.
128 __ test_b(FieldOperand(r0, Map::kBitFieldOffset), 127 __ test_b(FieldOperand(r0, Map::kBitFieldOffset),
129 kInterceptorOrAccessCheckNeededMask); 128 kInterceptorOrAccessCheckNeededMask);
130 __ j(not_zero, miss_label, not_taken); 129 __ j(not_zero, miss_label, not_taken);
131 130
(...skipping 15 matching lines...) Expand all
147 StringDictionary::kHeaderSize + 146 StringDictionary::kHeaderSize +
148 StringDictionary::kCapacityIndex * kPointerSize; 147 StringDictionary::kCapacityIndex * kPointerSize;
149 148
150 // Generate an unrolled loop that performs a few probes before 149 // Generate an unrolled loop that performs a few probes before
151 // giving up. 150 // giving up.
152 static const int kProbes = 4; 151 static const int kProbes = 4;
153 const int kElementsStartOffset = 152 const int kElementsStartOffset =
154 StringDictionary::kHeaderSize + 153 StringDictionary::kHeaderSize +
155 StringDictionary::kElementsStartIndex * kPointerSize; 154 StringDictionary::kElementsStartIndex * kPointerSize;
156 155
156 Label done;
157
157 // If names of slots in range from 1 to kProbes - 1 for the hash value are 158 // If names of slots in range from 1 to kProbes - 1 for the hash value are
158 // not equal to the name and kProbes-th slot is not used (its name is the 159 // not equal to the name and kProbes-th slot is not used (its name is the
159 // undefined value), it guarantees the hash table doesn't contain the 160 // undefined value), it guarantees the hash table doesn't contain the
160 // property. It's true even if some slots represent deleted properties 161 // property. It's true even if some slots represent deleted properties
161 // (their names are the null value). 162 // (their names are the null value).
162 for (int i = 0; i < kProbes; i++) { 163 for (int i = 0; i < kProbes; i++) {
163 // r0 points to properties hash. 164 // r0 points to properties hash.
164 // Compute the masked index: (hash + i + i * i) & mask. 165 // Compute the masked index: (hash + i + i * i) & mask.
165 Register index = r1; 166 Register index = r1;
166 // Capacity is smi 2^n. 167 // Capacity is smi 2^n.
167 __ mov(index, FieldOperand(properties, kCapacityOffset)); 168 __ mov(index, FieldOperand(properties, kCapacityOffset));
168 __ dec(index); 169 __ dec(index);
169 __ and_(Operand(index), 170 __ and_(Operand(index),
170 Immediate(Smi::FromInt(name->Hash() + 171 Immediate(Smi::FromInt(name->Hash() +
Mads Ager (chromium) 2011/05/04 15:03:21 Accidental edit?
171 StringDictionary::GetProbeOffset(i)))); 172 StringDictionary::GetProbeOffset(i))));
172 173
173 // Scale the index by multiplying by the entry size. 174 // Scale the index by multiplying by the entry size.
174 ASSERT(StringDictionary::kEntrySize == 3); 175 ASSERT(StringDictionary::kEntrySize == 3);
175 __ lea(index, Operand(index, index, times_2, 0)); // index *= 3. 176 __ lea(index, Operand(index, index, times_2, 0)); // index *= 3.
176
177 Register entity_name = r1; 177 Register entity_name = r1;
178 // Having undefined at this place means the name is not contained. 178 // Having undefined at this place means the name is not contained.
179 ASSERT_EQ(kSmiTagSize, 1); 179 ASSERT_EQ(kSmiTagSize, 1);
180 __ mov(entity_name, Operand(properties, index, times_half_pointer_size, 180 __ mov(entity_name, Operand(properties, index, times_half_pointer_size,
181 kElementsStartOffset - kHeapObjectTag)); 181 kElementsStartOffset - kHeapObjectTag));
182 __ cmp(entity_name, masm->isolate()->factory()->undefined_value()); 182 __ cmp(entity_name, masm->isolate()->factory()->undefined_value());
183 if (i != kProbes - 1) { 183 __ j(equal, &done, taken);
184 __ j(equal, &done, taken);
185 184
186 // Stop if found the property. 185 // Stop if found the property.
187 __ cmp(entity_name, Handle<String>(name)); 186 __ cmp(entity_name, Handle<String>(name));
188 __ j(equal, miss_label, not_taken); 187 __ j(equal, miss_label, not_taken);
189 188
190 // Check if the entry name is not a symbol. 189 // Check if the entry name is not a symbol.
191 __ mov(entity_name, FieldOperand(entity_name, HeapObject::kMapOffset)); 190 __ mov(entity_name, FieldOperand(entity_name, HeapObject::kMapOffset));
192 __ test_b(FieldOperand(entity_name, Map::kInstanceTypeOffset), 191 __ test_b(FieldOperand(entity_name, Map::kInstanceTypeOffset),
193 kIsSymbolMask); 192 kIsSymbolMask);
194 __ j(zero, miss_label, not_taken); 193 __ j(zero, miss_label, not_taken);
195 } else {
196 // Give up probing if still not found the undefined value.
197 __ j(not_equal, miss_label, not_taken);
198 }
199 } 194 }
200 195
196 StringDictionaryLookupStub stub(properties,
197 r1,
198 r1,
199 StringDictionaryLookupStub::NEGATIVE_LOOKUP);
200 __ push(Immediate(Handle<Object>(name)));
201 __ push(Immediate(name->Hash()));
202 __ CallStub(&stub);
203 __ test(r1, Operand(r1));
204 __ j(not_zero, miss_label);
201 __ bind(&done); 205 __ bind(&done);
202 __ DecrementCounter(counters->negative_lookups_miss(), 1); 206 __ DecrementCounter(counters->negative_lookups_miss(), 1);
203 } 207 }
204 208
205 209
206 void StubCache::GenerateProbe(MacroAssembler* masm, 210 void StubCache::GenerateProbe(MacroAssembler* masm,
207 Code::Flags flags, 211 Code::Flags flags,
208 Register receiver, 212 Register receiver,
209 Register name, 213 Register name,
210 Register scratch, 214 Register scratch,
(...skipping 3504 matching lines...) Expand 10 before | Expand all | Expand 10 after
3715 3719
3716 return GetCode(flags); 3720 return GetCode(flags);
3717 } 3721 }
3718 3722
3719 3723
3720 #undef __ 3724 #undef __
3721 3725
3722 } } // namespace v8::internal 3726 } } // namespace v8::internal
3723 3727
3724 #endif // V8_TARGET_ARCH_IA32 3728 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « src/ia32/ic-ia32.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698