OLD | NEW |
1 // Copyright 2009 the V8 project authors. All rights reserved. | 1 // Copyright 2009 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 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
166 ASSERT(Code::ExtractTypeFromFlags(flags) == 0); | 166 ASSERT(Code::ExtractTypeFromFlags(flags) == 0); |
167 | 167 |
168 // Make sure that there are no register conflicts. | 168 // Make sure that there are no register conflicts. |
169 ASSERT(!scratch.is(receiver)); | 169 ASSERT(!scratch.is(receiver)); |
170 ASSERT(!scratch.is(name)); | 170 ASSERT(!scratch.is(name)); |
171 | 171 |
172 // Check that the receiver isn't a smi. | 172 // Check that the receiver isn't a smi. |
173 __ JumpIfSmi(receiver, &miss); | 173 __ JumpIfSmi(receiver, &miss); |
174 | 174 |
175 // Get the map of the receiver and compute the hash. | 175 // Get the map of the receiver and compute the hash. |
176 __ movl(scratch, FieldOperand(name, String::kLengthOffset)); | 176 __ movl(scratch, FieldOperand(name, String::kHashFieldOffset)); |
177 // Use only the low 32 bits of the map pointer. | 177 // Use only the low 32 bits of the map pointer. |
178 __ addl(scratch, FieldOperand(receiver, HeapObject::kMapOffset)); | 178 __ addl(scratch, FieldOperand(receiver, HeapObject::kMapOffset)); |
179 __ xor_(scratch, Immediate(flags)); | 179 __ xor_(scratch, Immediate(flags)); |
180 __ and_(scratch, Immediate((kPrimaryTableSize - 1) << kHeapObjectTagSize)); | 180 __ and_(scratch, Immediate((kPrimaryTableSize - 1) << kHeapObjectTagSize)); |
181 | 181 |
182 // Probe the primary table. | 182 // Probe the primary table. |
183 ProbeTable(masm, flags, kPrimary, name, scratch); | 183 ProbeTable(masm, flags, kPrimary, name, scratch); |
184 | 184 |
185 // Primary miss: Compute hash for secondary probe. | 185 // Primary miss: Compute hash for secondary probe. |
186 __ movl(scratch, FieldOperand(name, String::kLengthOffset)); | 186 __ movl(scratch, FieldOperand(name, String::kHashFieldOffset)); |
187 __ addl(scratch, FieldOperand(receiver, HeapObject::kMapOffset)); | 187 __ addl(scratch, FieldOperand(receiver, HeapObject::kMapOffset)); |
188 __ xor_(scratch, Immediate(flags)); | 188 __ xor_(scratch, Immediate(flags)); |
189 __ and_(scratch, Immediate((kPrimaryTableSize - 1) << kHeapObjectTagSize)); | 189 __ and_(scratch, Immediate((kPrimaryTableSize - 1) << kHeapObjectTagSize)); |
190 __ subl(scratch, name); | 190 __ subl(scratch, name); |
191 __ addl(scratch, Immediate(flags)); | 191 __ addl(scratch, Immediate(flags)); |
192 __ and_(scratch, Immediate((kSecondaryTableSize - 1) << kHeapObjectTagSize)); | 192 __ and_(scratch, Immediate((kSecondaryTableSize - 1) << kHeapObjectTagSize)); |
193 | 193 |
194 // Probe the secondary table. | 194 // Probe the secondary table. |
195 ProbeTable(masm, flags, kSecondary, name, scratch); | 195 ProbeTable(masm, flags, kSecondary, name, scratch); |
196 | 196 |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
316 Register scratch, | 316 Register scratch, |
317 Label* miss) { | 317 Label* miss) { |
318 Label load_length, check_wrapper; | 318 Label load_length, check_wrapper; |
319 | 319 |
320 // Check if the object is a string leaving the instance type in the | 320 // Check if the object is a string leaving the instance type in the |
321 // scratch register. | 321 // scratch register. |
322 GenerateStringCheck(masm, receiver, scratch, miss, &check_wrapper); | 322 GenerateStringCheck(masm, receiver, scratch, miss, &check_wrapper); |
323 | 323 |
324 // Load length directly from the string. | 324 // Load length directly from the string. |
325 __ bind(&load_length); | 325 __ bind(&load_length); |
326 __ and_(scratch, Immediate(kStringSizeMask)); | |
327 __ movl(rax, FieldOperand(receiver, String::kLengthOffset)); | 326 __ movl(rax, FieldOperand(receiver, String::kLengthOffset)); |
328 // rcx is also the receiver. | |
329 __ lea(rcx, Operand(scratch, String::kLongLengthShift)); | |
330 __ shr_cl(rax); | |
331 __ Integer32ToSmi(rax, rax); | 327 __ Integer32ToSmi(rax, rax); |
332 __ ret(0); | 328 __ ret(0); |
333 | 329 |
334 // Check if the object is a JSValue wrapper. | 330 // Check if the object is a JSValue wrapper. |
335 __ bind(&check_wrapper); | 331 __ bind(&check_wrapper); |
336 __ cmpl(scratch, Immediate(JS_VALUE_TYPE)); | 332 __ cmpl(scratch, Immediate(JS_VALUE_TYPE)); |
337 __ j(not_equal, miss); | 333 __ j(not_equal, miss); |
338 | 334 |
339 // Check if the wrapped value is a string and load the length | 335 // Check if the wrapped value is a string and load the length |
340 // directly if it is. | 336 // directly if it is. |
(...skipping 1515 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1856 __ Jump(generic_construct_stub, RelocInfo::CODE_TARGET); | 1852 __ Jump(generic_construct_stub, RelocInfo::CODE_TARGET); |
1857 | 1853 |
1858 // Return the generated code. | 1854 // Return the generated code. |
1859 return GetCode(); | 1855 return GetCode(); |
1860 } | 1856 } |
1861 | 1857 |
1862 | 1858 |
1863 #undef __ | 1859 #undef __ |
1864 | 1860 |
1865 } } // namespace v8::internal | 1861 } } // namespace v8::internal |
OLD | NEW |