| OLD | NEW |
| 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 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 129 // Check that the properties array is a dictionary. | 129 // Check that the properties array is a dictionary. |
| 130 __ ldr(map, FieldMemOperand(properties, HeapObject::kMapOffset)); | 130 __ ldr(map, FieldMemOperand(properties, HeapObject::kMapOffset)); |
| 131 Register tmp = properties; | 131 Register tmp = properties; |
| 132 __ LoadRoot(tmp, Heap::kHashTableMapRootIndex); | 132 __ LoadRoot(tmp, Heap::kHashTableMapRootIndex); |
| 133 __ cmp(map, tmp); | 133 __ cmp(map, tmp); |
| 134 __ b(ne, miss_label); | 134 __ b(ne, miss_label); |
| 135 | 135 |
| 136 // Restore the temporarily used register. | 136 // Restore the temporarily used register. |
| 137 __ ldr(properties, FieldMemOperand(receiver, JSObject::kPropertiesOffset)); | 137 __ ldr(properties, FieldMemOperand(receiver, JSObject::kPropertiesOffset)); |
| 138 | 138 |
| 139 // Compute the capacity mask. | |
| 140 const int kCapacityOffset = | |
| 141 StringDictionary::kHeaderSize + | |
| 142 StringDictionary::kCapacityIndex * kPointerSize; | |
| 143 | 139 |
| 144 // Generate an unrolled loop that performs a few probes before | 140 StringDictionaryLookupStub::GenerateNegativeLookup(masm, |
| 145 // giving up. | 141 miss_label, |
| 146 static const int kProbes = 4; | 142 &done, |
| 147 const int kElementsStartOffset = | 143 receiver, |
| 148 StringDictionary::kHeaderSize + | 144 properties, |
| 149 StringDictionary::kElementsStartIndex * kPointerSize; | 145 name, |
| 146 scratch1); |
| 150 | 147 |
| 151 // If names of slots in range from 1 to kProbes - 1 for the hash value are | |
| 152 // not equal to the name and kProbes-th slot is not used (its name is the | |
| 153 // undefined value), it guarantees the hash table doesn't contain the | |
| 154 // property. It's true even if some slots represent deleted properties | |
| 155 // (their names are the null value). | |
| 156 for (int i = 0; i < kProbes; i++) { | |
| 157 // scratch0 points to properties hash. | |
| 158 // Compute the masked index: (hash + i + i * i) & mask. | |
| 159 Register index = scratch1; | |
| 160 // Capacity is smi 2^n. | |
| 161 __ ldr(index, FieldMemOperand(properties, kCapacityOffset)); | |
| 162 __ sub(index, index, Operand(1)); | |
| 163 __ and_(index, index, Operand( | |
| 164 Smi::FromInt(name->Hash() + StringDictionary::GetProbeOffset(i)))); | |
| 165 | |
| 166 // Scale the index by multiplying by the entry size. | |
| 167 ASSERT(StringDictionary::kEntrySize == 3); | |
| 168 __ add(index, index, Operand(index, LSL, 1)); // index *= 3. | |
| 169 | |
| 170 Register entity_name = scratch1; | |
| 171 // Having undefined at this place means the name is not contained. | |
| 172 ASSERT_EQ(kSmiTagSize, 1); | |
| 173 Register tmp = properties; | |
| 174 __ add(tmp, properties, Operand(index, LSL, 1)); | |
| 175 __ ldr(entity_name, FieldMemOperand(tmp, kElementsStartOffset)); | |
| 176 | |
| 177 ASSERT(!tmp.is(entity_name)); | |
| 178 __ LoadRoot(tmp, Heap::kUndefinedValueRootIndex); | |
| 179 __ cmp(entity_name, tmp); | |
| 180 if (i != kProbes - 1) { | |
| 181 __ b(eq, &done); | |
| 182 | |
| 183 // Stop if found the property. | |
| 184 __ cmp(entity_name, Operand(Handle<String>(name))); | |
| 185 __ b(eq, miss_label); | |
| 186 | |
| 187 // Check if the entry name is not a symbol. | |
| 188 __ ldr(entity_name, FieldMemOperand(entity_name, HeapObject::kMapOffset)); | |
| 189 __ ldrb(entity_name, | |
| 190 FieldMemOperand(entity_name, Map::kInstanceTypeOffset)); | |
| 191 __ tst(entity_name, Operand(kIsSymbolMask)); | |
| 192 __ b(eq, miss_label); | |
| 193 | |
| 194 // Restore the properties. | |
| 195 __ ldr(properties, | |
| 196 FieldMemOperand(receiver, JSObject::kPropertiesOffset)); | |
| 197 } else { | |
| 198 // Give up probing if still not found the undefined value. | |
| 199 __ b(ne, miss_label); | |
| 200 } | |
| 201 } | |
| 202 __ bind(&done); | 148 __ bind(&done); |
| 203 __ DecrementCounter(counters->negative_lookups_miss(), 1, scratch0, scratch1); | 149 __ DecrementCounter(counters->negative_lookups_miss(), 1, scratch0, scratch1); |
| 204 } | 150 } |
| 205 | 151 |
| 206 | 152 |
| 207 void StubCache::GenerateProbe(MacroAssembler* masm, | 153 void StubCache::GenerateProbe(MacroAssembler* masm, |
| 208 Code::Flags flags, | 154 Code::Flags flags, |
| 209 Register receiver, | 155 Register receiver, |
| 210 Register name, | 156 Register name, |
| 211 Register scratch, | 157 Register scratch, |
| (...skipping 3885 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4097 | 4043 |
| 4098 return GetCode(flags); | 4044 return GetCode(flags); |
| 4099 } | 4045 } |
| 4100 | 4046 |
| 4101 | 4047 |
| 4102 #undef __ | 4048 #undef __ |
| 4103 | 4049 |
| 4104 } } // namespace v8::internal | 4050 } } // namespace v8::internal |
| 4105 | 4051 |
| 4106 #endif // V8_TARGET_ARCH_ARM | 4052 #endif // V8_TARGET_ARCH_ARM |
| OLD | NEW |