| OLD | NEW |
| 1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 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 473 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 484 __ mov(scratch, FieldOperand(scratch, key, times_2, FixedArray::kHeaderSize)); | 484 __ mov(scratch, FieldOperand(scratch, key, times_2, FixedArray::kHeaderSize)); |
| 485 __ cmp(Operand(scratch), Immediate(Factory::the_hole_value())); | 485 __ cmp(Operand(scratch), Immediate(Factory::the_hole_value())); |
| 486 // In case the loaded value is the_hole we have to consult GetProperty | 486 // In case the loaded value is the_hole we have to consult GetProperty |
| 487 // to ensure the prototype chain is searched. | 487 // to ensure the prototype chain is searched. |
| 488 __ j(equal, out_of_range); | 488 __ j(equal, out_of_range); |
| 489 if (!result.is(scratch)) { | 489 if (!result.is(scratch)) { |
| 490 __ mov(result, scratch); | 490 __ mov(result, scratch); |
| 491 } | 491 } |
| 492 } | 492 } |
| 493 | 493 |
| 494 // Loads a indexed element from a pixel array. | |
| 495 static void GenerateFastPixelArrayLoad(MacroAssembler* masm, | |
| 496 Register receiver, | |
| 497 Register key, | |
| 498 Register elements, | |
| 499 Register untagged_key, | |
| 500 Register result, | |
| 501 Label* not_pixel_array, | |
| 502 Label* key_not_smi, | |
| 503 Label* out_of_range) { | |
| 504 // Register use: | |
| 505 // receiver - holds the receiver and is unchanged. | |
| 506 // key - holds the key and is unchanged (must be a smi). | |
| 507 // elements - is set to the the receiver's element if | |
| 508 // the receiver doesn't have a pixel array or the | |
| 509 // key is not a smi, otherwise it's the elements' | |
| 510 // external pointer. | |
| 511 // untagged_key - is set to the untagged key | |
| 512 | |
| 513 // Key must be a smi. | |
| 514 if (key_not_smi != NULL) { | |
| 515 __ test(key, Immediate(kSmiTagMask)); | |
| 516 __ j(not_zero, key_not_smi, not_taken); | |
| 517 } | |
| 518 __ mov(untagged_key, key); | |
| 519 __ SmiUntag(untagged_key); | |
| 520 | |
| 521 // Verify that the receiver has pixel array elements. | |
| 522 __ mov(elements, FieldOperand(receiver, JSObject::kElementsOffset)); | |
| 523 __ CheckMap(elements, Factory::pixel_array_map(), not_pixel_array, true); | |
| 524 | |
| 525 // Key must be in range. | |
| 526 __ cmp(untagged_key, FieldOperand(elements, PixelArray::kLengthOffset)); | |
| 527 __ j(above_equal, out_of_range); | |
| 528 | |
| 529 // Perform the indexed load and tag the result as a smi. | |
| 530 __ mov(elements, FieldOperand(elements, PixelArray::kExternalPointerOffset)); | |
| 531 __ movzx_b(result, Operand(elements, untagged_key, times_1, 0)); | |
| 532 __ SmiTag(result); | |
| 533 __ ret(0); | |
| 534 } | |
| 535 | |
| 536 | 494 |
| 537 // Checks whether a key is an array index string or a symbol string. | 495 // Checks whether a key is an array index string or a symbol string. |
| 538 // Falls through if the key is a symbol. | 496 // Falls through if the key is a symbol. |
| 539 static void GenerateKeyStringCheck(MacroAssembler* masm, | 497 static void GenerateKeyStringCheck(MacroAssembler* masm, |
| 540 Register key, | 498 Register key, |
| 541 Register map, | 499 Register map, |
| 542 Register hash, | 500 Register hash, |
| 543 Label* index_string, | 501 Label* index_string, |
| 544 Label* not_symbol) { | 502 Label* not_symbol) { |
| 545 // Register use: | 503 // Register use: |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 591 edx, | 549 edx, |
| 592 eax, | 550 eax, |
| 593 ecx, | 551 ecx, |
| 594 eax, | 552 eax, |
| 595 NULL, | 553 NULL, |
| 596 &slow); | 554 &slow); |
| 597 __ IncrementCounter(&Counters::keyed_load_generic_smi, 1); | 555 __ IncrementCounter(&Counters::keyed_load_generic_smi, 1); |
| 598 __ ret(0); | 556 __ ret(0); |
| 599 | 557 |
| 600 __ bind(&check_pixel_array); | 558 __ bind(&check_pixel_array); |
| 601 GenerateFastPixelArrayLoad(masm, | 559 // Check whether the elements is a pixel array. |
| 602 edx, | 560 // edx: receiver |
| 603 eax, | 561 // eax: key |
| 604 ecx, | 562 __ mov(ecx, FieldOperand(edx, JSObject::kElementsOffset)); |
| 605 ebx, | 563 __ mov(ebx, eax); |
| 606 eax, | 564 __ SmiUntag(ebx); |
| 607 &check_number_dictionary, | 565 __ CheckMap(ecx, Factory::pixel_array_map(), &check_number_dictionary, true); |
| 608 NULL, | 566 __ cmp(ebx, FieldOperand(ecx, PixelArray::kLengthOffset)); |
| 609 &slow); | 567 __ j(above_equal, &slow); |
| 568 __ mov(eax, FieldOperand(ecx, PixelArray::kExternalPointerOffset)); |
| 569 __ movzx_b(eax, Operand(eax, ebx, times_1, 0)); |
| 570 __ SmiTag(eax); |
| 571 __ ret(0); |
| 610 | 572 |
| 611 __ bind(&check_number_dictionary); | 573 __ bind(&check_number_dictionary); |
| 612 // Check whether the elements is a number dictionary. | 574 // Check whether the elements is a number dictionary. |
| 613 // edx: receiver | 575 // edx: receiver |
| 614 // ebx: untagged index | 576 // ebx: untagged index |
| 615 // eax: key | 577 // eax: key |
| 616 // ecx: elements | 578 // ecx: elements |
| 617 __ CheckMap(ecx, Factory::hash_table_map(), &slow, true); | 579 __ CheckMap(ecx, Factory::hash_table_map(), &slow, true); |
| 618 Label slow_pop_receiver; | 580 Label slow_pop_receiver; |
| 619 // Push receiver on the stack to free up a register for the dictionary | 581 // Push receiver on the stack to free up a register for the dictionary |
| (...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 793 // Perform tail call to the entry. | 755 // Perform tail call to the entry. |
| 794 ExternalReference ref = ExternalReference( | 756 ExternalReference ref = ExternalReference( |
| 795 IC_Utility(kKeyedLoadPropertyWithInterceptor)); | 757 IC_Utility(kKeyedLoadPropertyWithInterceptor)); |
| 796 __ TailCallExternalReference(ref, 2, 1); | 758 __ TailCallExternalReference(ref, 2, 1); |
| 797 | 759 |
| 798 __ bind(&slow); | 760 __ bind(&slow); |
| 799 GenerateMiss(masm); | 761 GenerateMiss(masm); |
| 800 } | 762 } |
| 801 | 763 |
| 802 | 764 |
| 803 void KeyedLoadIC::GeneratePixelArray(MacroAssembler* masm) { | |
| 804 // ----------- S t a t e ------------- | |
| 805 // -- eax : key | |
| 806 // -- edx : receiver | |
| 807 // -- esp[0] : return address | |
| 808 // ----------------------------------- | |
| 809 Label slow; | |
| 810 | |
| 811 // Verify that it's safe to access the receiver's elements. | |
| 812 GenerateKeyedLoadReceiverCheck( | |
| 813 masm, edx, ecx, Map::kHasNamedInterceptor, &slow); | |
| 814 | |
| 815 GenerateFastPixelArrayLoad(masm, | |
| 816 edx, | |
| 817 eax, | |
| 818 ecx, | |
| 819 ebx, | |
| 820 eax, | |
| 821 &slow, | |
| 822 &slow, | |
| 823 &slow); | |
| 824 | |
| 825 __ bind(&slow); | |
| 826 GenerateMiss(masm); | |
| 827 } | |
| 828 | |
| 829 | |
| 830 void KeyedStoreIC::GenerateGeneric(MacroAssembler* masm) { | 765 void KeyedStoreIC::GenerateGeneric(MacroAssembler* masm) { |
| 831 // ----------- S t a t e ------------- | 766 // ----------- S t a t e ------------- |
| 832 // -- eax : value | 767 // -- eax : value |
| 833 // -- ecx : key | 768 // -- ecx : key |
| 834 // -- edx : receiver | 769 // -- edx : receiver |
| 835 // -- esp[0] : return address | 770 // -- esp[0] : return address |
| 836 // ----------------------------------- | 771 // ----------------------------------- |
| 837 Label slow, fast, array, extra, check_pixel_array; | 772 Label slow, fast, array, extra, check_pixel_array; |
| 838 | 773 |
| 839 // Check that the object isn't a smi. | 774 // Check that the object isn't a smi. |
| (...skipping 998 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1838 Condition cc = *jmp_address == Assembler::kJncShortOpcode | 1773 Condition cc = *jmp_address == Assembler::kJncShortOpcode |
| 1839 ? not_zero | 1774 ? not_zero |
| 1840 : zero; | 1775 : zero; |
| 1841 *jmp_address = static_cast<byte>(Assembler::kJccShortPrefix | cc); | 1776 *jmp_address = static_cast<byte>(Assembler::kJccShortPrefix | cc); |
| 1842 } | 1777 } |
| 1843 | 1778 |
| 1844 | 1779 |
| 1845 } } // namespace v8::internal | 1780 } } // namespace v8::internal |
| 1846 | 1781 |
| 1847 #endif // V8_TARGET_ARCH_IA32 | 1782 #endif // V8_TARGET_ARCH_IA32 |
| OLD | NEW |