| OLD | NEW |
| 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 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 66 // r1 - used for the index into the property dictionary | 66 // r1 - used for the index into the property dictionary |
| 67 // - holds the result on exit. | 67 // - holds the result on exit. |
| 68 // | 68 // |
| 69 // r2 - used to hold the capacity of the property dictionary. | 69 // r2 - used to hold the capacity of the property dictionary. |
| 70 | 70 |
| 71 Label done; | 71 Label done; |
| 72 | 72 |
| 73 // Check for the absence of an interceptor. | 73 // Check for the absence of an interceptor. |
| 74 // Load the map into r0. | 74 // Load the map into r0. |
| 75 __ mov(r0, FieldOperand(receiver, JSObject::kMapOffset)); | 75 __ mov(r0, FieldOperand(receiver, JSObject::kMapOffset)); |
| 76 // Test the has_named_interceptor bit in the map. | |
| 77 __ test(FieldOperand(r0, Map::kInstanceAttributesOffset), | |
| 78 Immediate(1 << (Map::kHasNamedInterceptor + (3 * 8)))); | |
| 79 | 76 |
| 80 // Jump to miss if the interceptor bit is set. | 77 // Bail out if the receiver has a named interceptor. |
| 78 __ test(FieldOperand(r0, Map::kBitFieldOffset), |
| 79 Immediate(1 << Map::kHasNamedInterceptor)); |
| 81 __ j(not_zero, miss_label, not_taken); | 80 __ j(not_zero, miss_label, not_taken); |
| 82 | 81 |
| 83 // Bail out if we have a JS global proxy object. | 82 // Bail out if we have a JS global proxy object. |
| 84 __ movzx_b(r0, FieldOperand(r0, Map::kInstanceTypeOffset)); | 83 __ movzx_b(r0, FieldOperand(r0, Map::kInstanceTypeOffset)); |
| 85 __ cmp(r0, JS_GLOBAL_PROXY_TYPE); | 84 __ cmp(r0, JS_GLOBAL_PROXY_TYPE); |
| 86 __ j(equal, miss_label, not_taken); | 85 __ j(equal, miss_label, not_taken); |
| 87 | 86 |
| 88 // Possible work-around for http://crbug.com/16276. | 87 // Possible work-around for http://crbug.com/16276. |
| 89 __ cmp(r0, JS_GLOBAL_OBJECT_TYPE); | 88 __ cmp(r0, JS_GLOBAL_OBJECT_TYPE); |
| 90 __ j(equal, miss_label, not_taken); | 89 __ j(equal, miss_label, not_taken); |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 195 __ shr(r1, 4); | 194 __ shr(r1, 4); |
| 196 __ xor_(r0, Operand(r1)); | 195 __ xor_(r0, Operand(r1)); |
| 197 // hash = hash * 2057; | 196 // hash = hash * 2057; |
| 198 __ imul(r0, r0, 2057); | 197 __ imul(r0, r0, 2057); |
| 199 // hash = hash ^ (hash >> 16); | 198 // hash = hash ^ (hash >> 16); |
| 200 __ mov(r1, r0); | 199 __ mov(r1, r0); |
| 201 __ shr(r1, 16); | 200 __ shr(r1, 16); |
| 202 __ xor_(r0, Operand(r1)); | 201 __ xor_(r0, Operand(r1)); |
| 203 | 202 |
| 204 // Compute capacity mask. | 203 // Compute capacity mask. |
| 205 const int kCapacityOffset = | 204 __ mov(r1, FieldOperand(elements, NumberDictionary::kCapacityOffset)); |
| 206 NumberDictionary::kHeaderSize + | |
| 207 NumberDictionary::kCapacityIndex * kPointerSize; | |
| 208 __ mov(r1, FieldOperand(elements, kCapacityOffset)); | |
| 209 __ shr(r1, kSmiTagSize); // convert smi to int | 205 __ shr(r1, kSmiTagSize); // convert smi to int |
| 210 __ dec(r1); | 206 __ dec(r1); |
| 211 | 207 |
| 212 const int kElementsStartOffset = | |
| 213 NumberDictionary::kHeaderSize + | |
| 214 NumberDictionary::kElementsStartIndex * kPointerSize; | |
| 215 | |
| 216 // Generate an unrolled loop that performs a few probes before giving up. | 208 // Generate an unrolled loop that performs a few probes before giving up. |
| 217 const int kProbes = 4; | 209 const int kProbes = 4; |
| 218 for (int i = 0; i < kProbes; i++) { | 210 for (int i = 0; i < kProbes; i++) { |
| 219 // Use r2 for index calculations and keep the hash intact in r0. | 211 // Use r2 for index calculations and keep the hash intact in r0. |
| 220 __ mov(r2, r0); | 212 __ mov(r2, r0); |
| 221 // Compute the masked index: (hash + i + i * i) & mask. | 213 // Compute the masked index: (hash + i + i * i) & mask. |
| 222 if (i > 0) { | 214 if (i > 0) { |
| 223 __ add(Operand(r2), Immediate(NumberDictionary::GetProbeOffset(i))); | 215 __ add(Operand(r2), Immediate(NumberDictionary::GetProbeOffset(i))); |
| 224 } | 216 } |
| 225 __ and_(r2, Operand(r1)); | 217 __ and_(r2, Operand(r1)); |
| 226 | 218 |
| 227 // Scale the index by multiplying by the entry size. | 219 // Scale the index by multiplying by the entry size. |
| 228 ASSERT(NumberDictionary::kEntrySize == 3); | 220 ASSERT(NumberDictionary::kEntrySize == 3); |
| 229 __ lea(r2, Operand(r2, r2, times_2, 0)); // r2 = r2 * 3 | 221 __ lea(r2, Operand(r2, r2, times_2, 0)); // r2 = r2 * 3 |
| 230 | 222 |
| 231 // Check if the key matches. | 223 // Check if the key matches. |
| 232 __ cmp(key, FieldOperand(elements, | 224 __ cmp(key, FieldOperand(elements, |
| 233 r2, | 225 r2, |
| 234 times_pointer_size, | 226 times_pointer_size, |
| 235 kElementsStartOffset)); | 227 NumberDictionary::kElementsStartOffset)); |
| 236 if (i != (kProbes - 1)) { | 228 if (i != (kProbes - 1)) { |
| 237 __ j(equal, &done, taken); | 229 __ j(equal, &done, taken); |
| 238 } else { | 230 } else { |
| 239 __ j(not_equal, miss, not_taken); | 231 __ j(not_equal, miss, not_taken); |
| 240 } | 232 } |
| 241 } | 233 } |
| 242 | 234 |
| 243 __ bind(&done); | 235 __ bind(&done); |
| 244 // Check that the value is a normal propety. | 236 // Check that the value is a normal propety. |
| 245 const int kDetailsOffset = kElementsStartOffset + 2 * kPointerSize; | 237 const int kDetailsOffset = |
| 238 NumberDictionary::kElementsStartOffset + 2 * kPointerSize; |
| 246 ASSERT_EQ(NORMAL, 0); | 239 ASSERT_EQ(NORMAL, 0); |
| 247 __ test(FieldOperand(elements, r2, times_pointer_size, kDetailsOffset), | 240 __ test(FieldOperand(elements, r2, times_pointer_size, kDetailsOffset), |
| 248 Immediate(PropertyDetails::TypeField::mask() << kSmiTagSize)); | 241 Immediate(PropertyDetails::TypeField::mask() << kSmiTagSize)); |
| 249 __ j(not_zero, miss); | 242 __ j(not_zero, miss); |
| 250 | 243 |
| 251 // Get the value at the masked, scaled index. | 244 // Get the value at the masked, scaled index. |
| 252 const int kValueOffset = kElementsStartOffset + kPointerSize; | 245 const int kValueOffset = |
| 246 NumberDictionary::kElementsStartOffset + kPointerSize; |
| 253 __ mov(key, FieldOperand(elements, r2, times_pointer_size, kValueOffset)); | 247 __ mov(key, FieldOperand(elements, r2, times_pointer_size, kValueOffset)); |
| 254 } | 248 } |
| 255 | 249 |
| 256 | 250 |
| 257 // The offset from the inlined patch site to the start of the | 251 // The offset from the inlined patch site to the start of the |
| 258 // inlined load instruction. It is 7 bytes (test eax, imm) plus | 252 // inlined load instruction. It is 7 bytes (test eax, imm) plus |
| 259 // 6 bytes (jne slow_label). | 253 // 6 bytes (jne slow_label). |
| 260 const int LoadIC::kOffsetToLoadInstruction = 13; | 254 const int LoadIC::kOffsetToLoadInstruction = 13; |
| 261 | 255 |
| 262 | 256 |
| (...skipping 1348 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1611 | 1605 |
| 1612 // Do tail-call to runtime routine. | 1606 // Do tail-call to runtime routine. |
| 1613 ExternalReference ref = ExternalReference(IC_Utility(kKeyedStoreIC_Miss)); | 1607 ExternalReference ref = ExternalReference(IC_Utility(kKeyedStoreIC_Miss)); |
| 1614 __ TailCallExternalReference(ref, 3, 1); | 1608 __ TailCallExternalReference(ref, 3, 1); |
| 1615 } | 1609 } |
| 1616 | 1610 |
| 1617 #undef __ | 1611 #undef __ |
| 1618 | 1612 |
| 1619 | 1613 |
| 1620 } } // namespace v8::internal | 1614 } } // namespace v8::internal |
| OLD | NEW |