OLD | NEW |
---|---|
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 1220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1231 | 1231 |
1232 | 1232 |
1233 void StubCompiler::GenerateDictionaryLoadCallback(Register receiver, | 1233 void StubCompiler::GenerateDictionaryLoadCallback(Register receiver, |
1234 Register name_reg, | 1234 Register name_reg, |
1235 Register scratch1, | 1235 Register scratch1, |
1236 Register scratch2, | 1236 Register scratch2, |
1237 Register scratch3, | 1237 Register scratch3, |
1238 Handle<AccessorInfo> callback, | 1238 Handle<AccessorInfo> callback, |
1239 Handle<String> name, | 1239 Handle<String> name, |
1240 Label* miss) { | 1240 Label* miss) { |
1241 ASSERT(!receiver.is(scratch2)); | |
1242 ASSERT(!receiver.is(scratch3)); | |
1241 Register dictionary = scratch1; | 1243 Register dictionary = scratch1; |
1242 Register index = scratch2; | 1244 bool must_preserve_dictionary_reg = receiver.is(dictionary); |
1245 | |
1246 // Load the properties dictionary. | |
1247 if (must_preserve_dictionary_reg) { | |
1248 __ push(dictionary); | |
Erik Corry
2012/08/14 11:03:33
This is slow on ARM and unnecessary when there are
Michael Starzinger
2012/08/14 11:44:05
Done.
| |
1249 } | |
1243 __ ldr(dictionary, FieldMemOperand(receiver, JSObject::kPropertiesOffset)); | 1250 __ ldr(dictionary, FieldMemOperand(receiver, JSObject::kPropertiesOffset)); |
1244 | 1251 |
1245 // Probe the dictionary. | 1252 // Probe the dictionary. |
1246 Label probe_done; | 1253 Label probe_done, pop_and_miss; |
1247 StringDictionaryLookupStub::GeneratePositiveLookup(masm(), | 1254 StringDictionaryLookupStub::GeneratePositiveLookup(masm(), |
1248 miss, | 1255 &pop_and_miss, |
1249 &probe_done, | 1256 &probe_done, |
1250 dictionary, | 1257 dictionary, |
1251 name_reg, | 1258 name_reg, |
1252 index, // Set if we hit. | 1259 scratch2, |
1253 scratch3); | 1260 scratch3); |
1261 __ bind(&pop_and_miss); | |
1262 if (must_preserve_dictionary_reg) { | |
1263 __ pop(dictionary); | |
1264 } | |
1265 __ jmp(miss); | |
1254 __ bind(&probe_done); | 1266 __ bind(&probe_done); |
1267 if (must_preserve_dictionary_reg) { | |
1268 __ pop(dictionary); | |
1269 } | |
1255 | 1270 |
1256 // If probing finds an entry in the dictionary, check that the value is the | 1271 // If probing finds an entry in the dictionary, scratch3 contains the |
1257 // callback. | 1272 // pointer into the dictionary. Check that the value is the callback. |
1258 const int kElementsStartOffset = | 1273 Register pointer = scratch3; |
1259 StringDictionary::kHeaderSize + | 1274 const int kElementsStartOffset = StringDictionary::kHeaderSize + |
1260 StringDictionary::kElementsStartIndex * kPointerSize; | 1275 StringDictionary::kElementsStartIndex * kPointerSize; |
1261 const int kValueOffset = kElementsStartOffset + kPointerSize; | 1276 const int kValueOffset = kElementsStartOffset + kPointerSize; |
1262 __ add(scratch1, dictionary, Operand(kValueOffset - kHeapObjectTag)); | 1277 __ ldr(scratch2, FieldMemOperand(pointer, kValueOffset)); |
1263 __ ldr(scratch3, MemOperand(scratch1, index, LSL, kPointerSizeLog2)); | 1278 __ cmp(scratch2, Operand(callback)); |
1264 __ cmp(scratch3, Operand(callback)); | |
1265 __ b(ne, miss); | 1279 __ b(ne, miss); |
1266 } | 1280 } |
1267 | 1281 |
1268 | 1282 |
1269 void StubCompiler::GenerateLoadCallback(Handle<JSObject> object, | 1283 void StubCompiler::GenerateLoadCallback(Handle<JSObject> object, |
1270 Handle<JSObject> holder, | 1284 Handle<JSObject> holder, |
1271 Register receiver, | 1285 Register receiver, |
1272 Register name_reg, | 1286 Register name_reg, |
1273 Register scratch1, | 1287 Register scratch1, |
1274 Register scratch2, | 1288 Register scratch2, |
1275 Register scratch3, | 1289 Register scratch3, |
1276 Handle<AccessorInfo> callback, | 1290 Handle<AccessorInfo> callback, |
1277 Handle<String> name, | 1291 Handle<String> name, |
1278 Label* miss) { | 1292 Label* miss) { |
1279 // Check that the receiver isn't a smi. | 1293 // Check that the receiver isn't a smi. |
1280 __ JumpIfSmi(receiver, miss); | 1294 __ JumpIfSmi(receiver, miss); |
1281 | 1295 |
1282 // Check that the maps haven't changed. | 1296 // Check that the maps haven't changed. |
1283 Register reg = CheckPrototypes(object, receiver, holder, scratch1, | 1297 Register reg = CheckPrototypes(object, receiver, holder, scratch1, |
1284 scratch2, scratch3, name, miss); | 1298 scratch2, scratch3, name, miss); |
1285 | 1299 |
1286 if (!holder->HasFastProperties() && !holder->IsJSGlobalObject()) { | 1300 if (!holder->HasFastProperties() && !holder->IsJSGlobalObject()) { |
1287 GenerateDictionaryLoadCallback( | 1301 GenerateDictionaryLoadCallback( |
1288 receiver, name_reg, scratch1, scratch2, scratch3, callback, name, miss); | 1302 reg, name_reg, scratch1, scratch2, scratch3, callback, name, miss); |
1289 } | 1303 } |
1290 | 1304 |
1291 // Build AccessorInfo::args_ list on the stack and push property name below | 1305 // Build AccessorInfo::args_ list on the stack and push property name below |
1292 // the exit frame to make GC aware of them and store pointers to them. | 1306 // the exit frame to make GC aware of them and store pointers to them. |
1293 __ push(receiver); | 1307 __ push(receiver); |
1294 __ mov(scratch2, sp); // scratch2 = AccessorInfo::args_ | 1308 __ mov(scratch2, sp); // scratch2 = AccessorInfo::args_ |
1295 if (heap()->InNewSpace(callback->data())) { | 1309 if (heap()->InNewSpace(callback->data())) { |
1296 __ Move(scratch3, callback); | 1310 __ Move(scratch3, callback); |
1297 __ ldr(scratch3, FieldMemOperand(scratch3, AccessorInfo::kDataOffset)); | 1311 __ ldr(scratch3, FieldMemOperand(scratch3, AccessorInfo::kDataOffset)); |
1298 } else { | 1312 } else { |
(...skipping 3422 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4721 __ Jump(ic_slow, RelocInfo::CODE_TARGET); | 4735 __ Jump(ic_slow, RelocInfo::CODE_TARGET); |
4722 } | 4736 } |
4723 } | 4737 } |
4724 | 4738 |
4725 | 4739 |
4726 #undef __ | 4740 #undef __ |
4727 | 4741 |
4728 } } // namespace v8::internal | 4742 } } // namespace v8::internal |
4729 | 4743 |
4730 #endif // V8_TARGET_ARCH_ARM | 4744 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |