Chromium Code Reviews| 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 483 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 494 MemOperand(scratch1, key, LSL, kPointerSizeLog2 - kSmiTagSize)); | 494 MemOperand(scratch1, key, LSL, kPointerSizeLog2 - kSmiTagSize)); |
| 495 __ LoadRoot(ip, Heap::kTheHoleValueRootIndex); | 495 __ LoadRoot(ip, Heap::kTheHoleValueRootIndex); |
| 496 __ cmp(scratch2, ip); | 496 __ cmp(scratch2, ip); |
| 497 // In case the loaded value is the_hole we have to consult GetProperty | 497 // In case the loaded value is the_hole we have to consult GetProperty |
| 498 // to ensure the prototype chain is searched. | 498 // to ensure the prototype chain is searched. |
| 499 __ b(eq, out_of_range); | 499 __ b(eq, out_of_range); |
| 500 __ mov(result, scratch2); | 500 __ mov(result, scratch2); |
| 501 } | 501 } |
| 502 | 502 |
| 503 | 503 |
| 504 static void GenerateFastPixelArrayLoad(MacroAssembler* masm, | |
| 505 Register receiver, | |
| 506 Register key, | |
| 507 Register elements_map, | |
| 508 Register elements, | |
| 509 Register scratch1, | |
| 510 Register scratch2, | |
| 511 Register result, | |
| 512 Label* not_pixel_array, | |
| 513 Label* key_not_smi, | |
| 514 Label* out_of_range) { | |
| 515 // Register use: | |
| 516 // | |
| 517 // receiver - holds the receiver on entry. | |
| 518 // Unchanged unless 'result' is the same register. | |
| 519 // | |
| 520 // key - holds the smi key on entry. | |
| 521 // Unchanged unless 'result' is the same register. | |
| 522 // | |
| 523 // elements - set to be the receiver's elements on exit. | |
| 524 // | |
| 525 // elements_map - set to be the map of the receiver's elements | |
| 526 // on exit. | |
| 527 // | |
| 528 // result - holds the result of the pixel array load on exit, | |
| 529 // tagged as a smi if successful. | |
| 530 // | |
| 531 // Scratch registers: | |
| 532 // | |
| 533 // scratch1 - holds the receiver's elements, the length of the | |
| 534 // pixel array, the pointer to external elements and | |
| 535 // the untagged result. | |
| 536 // | |
| 537 // scratch2 - holds the untaged key | |
| 538 | |
| 539 // Verify that the receiver has pixel array elements. | |
| 540 __ ldr(elements, FieldMemOperand(receiver, JSObject::kElementsOffset)); | |
| 541 __ LoadRoot(scratch1, Heap::kPixelArrayMapRootIndex); | |
| 542 __ ldr(elements_map, FieldMemOperand(elements, JSObject::kMapOffset)); | |
| 543 __ cmp(elements_map, scratch1); | |
| 544 __ b(ne, not_pixel_array); | |
| 545 | |
| 546 // Key must be a smi that is in the range of the pixel array. | |
| 547 if (key_not_smi != NULL) | |
| 548 __ JumpIfNotSmi(key, key_not_smi); | |
|
Mads Ager (chromium)
2011/01/28 10:39:16
Either make the entire 'if (...) __ JumpIfNotSmi(.
| |
| 549 __ ldr(scratch1, FieldMemOperand(elements, PixelArray::kLengthOffset)); | |
| 550 __ SmiUntag(scratch2, key); | |
| 551 __ cmp(scratch2, scratch1); | |
| 552 __ b(hs, out_of_range); | |
| 553 | |
| 554 // Perform the indexed load and tag the result as a smi. | |
| 555 __ ldr(scratch1, | |
| 556 FieldMemOperand(elements, PixelArray::kExternalPointerOffset)); | |
| 557 __ ldrb(scratch1, MemOperand(scratch1, scratch2)); | |
| 558 __ SmiTag(r0, scratch1); | |
| 559 __ Ret(); | |
| 560 } | |
| 561 | |
| 562 | |
| 504 // Checks whether a key is an array index string or a symbol string. | 563 // Checks whether a key is an array index string or a symbol string. |
| 505 // Falls through if a key is a symbol. | 564 // Falls through if a key is a symbol. |
| 506 static void GenerateKeyStringCheck(MacroAssembler* masm, | 565 static void GenerateKeyStringCheck(MacroAssembler* masm, |
| 507 Register key, | 566 Register key, |
| 508 Register map, | 567 Register map, |
| 509 Register hash, | 568 Register hash, |
| 510 Label* index_string, | 569 Label* index_string, |
| 511 Label* not_symbol) { | 570 Label* not_symbol) { |
| 512 // The key is not a smi. | 571 // The key is not a smi. |
| 513 // Is it a string? | 572 // Is it a string? |
| (...skipping 668 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1182 | 1241 |
| 1183 GenerateFastArrayLoad( | 1242 GenerateFastArrayLoad( |
| 1184 masm, receiver, key, r4, r3, r2, r0, NULL, &slow); | 1243 masm, receiver, key, r4, r3, r2, r0, NULL, &slow); |
| 1185 __ IncrementCounter(&Counters::keyed_load_generic_smi, 1, r2, r3); | 1244 __ IncrementCounter(&Counters::keyed_load_generic_smi, 1, r2, r3); |
| 1186 __ Ret(); | 1245 __ Ret(); |
| 1187 | 1246 |
| 1188 // Check whether the elements is a pixel array. | 1247 // Check whether the elements is a pixel array. |
| 1189 // r0: key | 1248 // r0: key |
| 1190 // r1: receiver | 1249 // r1: receiver |
| 1191 __ bind(&check_pixel_array); | 1250 __ bind(&check_pixel_array); |
| 1192 __ ldr(r4, FieldMemOperand(r1, JSObject::kElementsOffset)); | 1251 |
| 1193 __ ldr(r3, FieldMemOperand(r4, HeapObject::kMapOffset)); | 1252 GenerateFastPixelArrayLoad(masm, |
| 1194 __ LoadRoot(ip, Heap::kPixelArrayMapRootIndex); | 1253 r1, |
| 1195 __ cmp(r3, ip); | 1254 r0, |
| 1196 __ b(ne, &check_number_dictionary); | 1255 r3, |
| 1197 __ ldr(ip, FieldMemOperand(r4, PixelArray::kLengthOffset)); | 1256 r4, |
| 1198 __ mov(r2, Operand(key, ASR, kSmiTagSize)); | 1257 r2, |
| 1199 __ cmp(r2, ip); | 1258 r5, |
| 1200 __ b(hs, &slow); | 1259 r0, |
| 1201 __ ldr(ip, FieldMemOperand(r4, PixelArray::kExternalPointerOffset)); | 1260 &check_number_dictionary, |
| 1202 __ ldrb(r2, MemOperand(ip, r2)); | 1261 NULL, |
| 1203 __ mov(r0, Operand(r2, LSL, kSmiTagSize)); // Tag result as smi. | 1262 &slow); |
| 1204 __ Ret(); | |
| 1205 | 1263 |
| 1206 __ bind(&check_number_dictionary); | 1264 __ bind(&check_number_dictionary); |
| 1207 // Check whether the elements is a number dictionary. | 1265 // Check whether the elements is a number dictionary. |
| 1208 // r0: key | 1266 // r0: key |
| 1209 // r3: elements map | 1267 // r3: elements map |
| 1210 // r4: elements | 1268 // r4: elements |
| 1211 __ LoadRoot(ip, Heap::kHashTableMapRootIndex); | 1269 __ LoadRoot(ip, Heap::kHashTableMapRootIndex); |
| 1212 __ cmp(r3, ip); | 1270 __ cmp(r3, ip); |
| 1213 __ b(ne, &slow); | 1271 __ b(ne, &slow); |
| 1214 __ mov(r2, Operand(r0, ASR, kSmiTagSize)); | 1272 __ mov(r2, Operand(r0, ASR, kSmiTagSize)); |
| (...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1368 | 1426 |
| 1369 // Perform tail call to the entry. | 1427 // Perform tail call to the entry. |
| 1370 __ TailCallExternalReference(ExternalReference( | 1428 __ TailCallExternalReference(ExternalReference( |
| 1371 IC_Utility(kKeyedLoadPropertyWithInterceptor)), 2, 1); | 1429 IC_Utility(kKeyedLoadPropertyWithInterceptor)), 2, 1); |
| 1372 | 1430 |
| 1373 __ bind(&slow); | 1431 __ bind(&slow); |
| 1374 GenerateMiss(masm); | 1432 GenerateMiss(masm); |
| 1375 } | 1433 } |
| 1376 | 1434 |
| 1377 | 1435 |
| 1436 void KeyedLoadIC::GeneratePixelArray(MacroAssembler* masm) { | |
| 1437 // ---------- S t a t e -------------- | |
| 1438 // -- lr : return address | |
| 1439 // -- r0 : key | |
| 1440 // -- r1 : receiver | |
| 1441 // ----------------------------------- | |
| 1442 | |
| 1443 // Register usage. | |
| 1444 Register key = r0; | |
| 1445 Register receiver = r1; | |
| 1446 | |
| 1447 Label slow; | |
| 1448 | |
| 1449 // Verify that it's safe to access the receiver's elements. | |
| 1450 GenerateKeyedLoadReceiverCheck( | |
| 1451 masm, receiver, r5, r6, | |
| 1452 Map::kHasIndexedInterceptor, &slow); | |
| 1453 | |
| 1454 GenerateFastPixelArrayLoad(masm, | |
| 1455 receiver, | |
| 1456 key, | |
| 1457 r2, | |
| 1458 r3, | |
| 1459 r4, | |
| 1460 r5, | |
| 1461 r0, | |
| 1462 &slow, | |
| 1463 &slow, | |
| 1464 &slow); | |
| 1465 | |
| 1466 __ bind(&slow); | |
| 1467 GenerateMiss(masm); | |
| 1468 } | |
| 1469 | |
| 1470 | |
| 1378 void KeyedStoreIC::GenerateMiss(MacroAssembler* masm) { | 1471 void KeyedStoreIC::GenerateMiss(MacroAssembler* masm) { |
| 1379 // ---------- S t a t e -------------- | 1472 // ---------- S t a t e -------------- |
| 1380 // -- r0 : value | 1473 // -- r0 : value |
| 1381 // -- r1 : key | 1474 // -- r1 : key |
| 1382 // -- r2 : receiver | 1475 // -- r2 : receiver |
| 1383 // -- lr : return address | 1476 // -- lr : return address |
| 1384 // ----------------------------------- | 1477 // ----------------------------------- |
| 1385 | 1478 |
| 1386 // Push receiver, key and value for runtime call. | 1479 // Push receiver, key and value for runtime call. |
| 1387 __ Push(r2, r1, r0); | 1480 __ Push(r2, r1, r0); |
| (...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1705 | 1798 |
| 1706 | 1799 |
| 1707 void PatchInlinedSmiCode(Address address) { | 1800 void PatchInlinedSmiCode(Address address) { |
| 1708 // Currently there is no smi inlining in the ARM full code generator. | 1801 // Currently there is no smi inlining in the ARM full code generator. |
| 1709 } | 1802 } |
| 1710 | 1803 |
| 1711 | 1804 |
| 1712 } } // namespace v8::internal | 1805 } } // namespace v8::internal |
| 1713 | 1806 |
| 1714 #endif // V8_TARGET_ARCH_ARM | 1807 #endif // V8_TARGET_ARCH_ARM |
| OLD | NEW |