| 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 536 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 547 | 547 |
| 548 | 548 |
| 549 | 549 |
| 550 void KeyedLoadIC::GenerateGeneric(MacroAssembler* masm) { | 550 void KeyedLoadIC::GenerateGeneric(MacroAssembler* masm) { |
| 551 // ----------- S t a t e ------------- | 551 // ----------- S t a t e ------------- |
| 552 // -- rax : key | 552 // -- rax : key |
| 553 // -- rdx : receiver | 553 // -- rdx : receiver |
| 554 // -- rsp[0] : return address | 554 // -- rsp[0] : return address |
| 555 // ----------------------------------- | 555 // ----------------------------------- |
| 556 Label slow, check_string, index_smi, index_string, property_array_property; | 556 Label slow, check_string, index_smi, index_string, property_array_property; |
| 557 Label check_pixel_array, probe_dictionary, check_number_dictionary; | 557 Label probe_dictionary, check_number_dictionary; |
| 558 | 558 |
| 559 // Check that the key is a smi. | 559 // Check that the key is a smi. |
| 560 __ JumpIfNotSmi(rax, &check_string); | 560 __ JumpIfNotSmi(rax, &check_string); |
| 561 __ bind(&index_smi); | 561 __ bind(&index_smi); |
| 562 // Now the key is known to be a smi. This place is also jumped to from below | 562 // Now the key is known to be a smi. This place is also jumped to from below |
| 563 // where a numeric string is converted to a smi. | 563 // where a numeric string is converted to a smi. |
| 564 | 564 |
| 565 GenerateKeyedLoadReceiverCheck( | 565 GenerateKeyedLoadReceiverCheck( |
| 566 masm, rdx, rcx, Map::kHasIndexedInterceptor, &slow); | 566 masm, rdx, rcx, Map::kHasIndexedInterceptor, &slow); |
| 567 | 567 |
| 568 // Check the "has fast elements" bit in the receiver's map which is | 568 // Check the "has fast elements" bit in the receiver's map which is |
| 569 // now in rcx. | 569 // now in rcx. |
| 570 __ testb(FieldOperand(rcx, Map::kBitField2Offset), | 570 __ testb(FieldOperand(rcx, Map::kBitField2Offset), |
| 571 Immediate(1 << Map::kHasFastElements)); | 571 Immediate(1 << Map::kHasFastElements)); |
| 572 __ j(zero, &check_pixel_array); | 572 __ j(zero, &check_number_dictionary); |
| 573 | 573 |
| 574 GenerateFastArrayLoad(masm, | 574 GenerateFastArrayLoad(masm, |
| 575 rdx, | 575 rdx, |
| 576 rax, | 576 rax, |
| 577 rcx, | 577 rcx, |
| 578 rbx, | 578 rbx, |
| 579 rax, | 579 rax, |
| 580 NULL, | 580 NULL, |
| 581 &slow); | 581 &slow); |
| 582 __ IncrementCounter(&Counters::keyed_load_generic_smi, 1); | 582 __ IncrementCounter(&Counters::keyed_load_generic_smi, 1); |
| 583 __ ret(0); | 583 __ ret(0); |
| 584 | 584 |
| 585 __ bind(&check_pixel_array); | 585 __ bind(&check_number_dictionary); |
| 586 GenerateFastPixelArrayLoad(masm, | 586 __ SmiToInteger32(rbx, rax); |
| 587 rdx, | 587 __ movq(rcx, FieldOperand(rdx, JSObject::kElementsOffset)); |
| 588 rax, | |
| 589 rcx, | |
| 590 rbx, | |
| 591 rax, | |
| 592 &check_number_dictionary, | |
| 593 NULL, | |
| 594 &slow); | |
| 595 | 588 |
| 596 __ bind(&check_number_dictionary); | |
| 597 // Check whether the elements is a number dictionary. | 589 // Check whether the elements is a number dictionary. |
| 598 // rdx: receiver | 590 // rdx: receiver |
| 599 // rax: key | 591 // rax: key |
| 600 // rbx: key as untagged int32 | 592 // rbx: key as untagged int32 |
| 601 // rcx: elements | 593 // rcx: elements |
| 602 __ CompareRoot(FieldOperand(rcx, HeapObject::kMapOffset), | 594 __ CompareRoot(FieldOperand(rcx, HeapObject::kMapOffset), |
| 603 Heap::kHashTableMapRootIndex); | 595 Heap::kHashTableMapRootIndex); |
| 604 __ j(not_equal, &slow); | 596 __ j(not_equal, &slow); |
| 605 GenerateNumberDictionaryLoad(masm, &slow, rcx, rax, rbx, r9, rdi, rax); | 597 GenerateNumberDictionaryLoad(masm, &slow, rcx, rax, rbx, r9, rdi, rax); |
| 606 __ ret(0); | 598 __ ret(0); |
| (...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 767 | 759 |
| 768 | 760 |
| 769 void KeyedStoreIC::GenerateGeneric(MacroAssembler* masm, | 761 void KeyedStoreIC::GenerateGeneric(MacroAssembler* masm, |
| 770 StrictModeFlag strict_mode) { | 762 StrictModeFlag strict_mode) { |
| 771 // ----------- S t a t e ------------- | 763 // ----------- S t a t e ------------- |
| 772 // -- rax : value | 764 // -- rax : value |
| 773 // -- rcx : key | 765 // -- rcx : key |
| 774 // -- rdx : receiver | 766 // -- rdx : receiver |
| 775 // -- rsp[0] : return address | 767 // -- rsp[0] : return address |
| 776 // ----------------------------------- | 768 // ----------------------------------- |
| 777 Label slow, slow_with_tagged_index, fast, array, extra, check_pixel_array; | 769 Label slow, slow_with_tagged_index, fast, array, extra; |
| 778 | 770 |
| 779 // Check that the object isn't a smi. | 771 // Check that the object isn't a smi. |
| 780 __ JumpIfSmi(rdx, &slow_with_tagged_index); | 772 __ JumpIfSmi(rdx, &slow_with_tagged_index); |
| 781 // Get the map from the receiver. | 773 // Get the map from the receiver. |
| 782 __ movq(rbx, FieldOperand(rdx, HeapObject::kMapOffset)); | 774 __ movq(rbx, FieldOperand(rdx, HeapObject::kMapOffset)); |
| 783 // Check that the receiver does not require access checks. We need | 775 // Check that the receiver does not require access checks. We need |
| 784 // to do this because this generic stub does not perform map checks. | 776 // to do this because this generic stub does not perform map checks. |
| 785 __ testb(FieldOperand(rbx, Map::kBitFieldOffset), | 777 __ testb(FieldOperand(rbx, Map::kBitFieldOffset), |
| 786 Immediate(1 << Map::kIsAccessCheckNeeded)); | 778 Immediate(1 << Map::kIsAccessCheckNeeded)); |
| 787 __ j(not_zero, &slow_with_tagged_index); | 779 __ j(not_zero, &slow_with_tagged_index); |
| 788 // Check that the key is a smi. | 780 // Check that the key is a smi. |
| 789 __ JumpIfNotSmi(rcx, &slow_with_tagged_index); | 781 __ JumpIfNotSmi(rcx, &slow_with_tagged_index); |
| 790 __ SmiToInteger32(rcx, rcx); | 782 __ SmiToInteger32(rcx, rcx); |
| 791 | 783 |
| 792 __ CmpInstanceType(rbx, JS_ARRAY_TYPE); | 784 __ CmpInstanceType(rbx, JS_ARRAY_TYPE); |
| 793 __ j(equal, &array); | 785 __ j(equal, &array); |
| 794 // Check that the object is some kind of JS object. | 786 // Check that the object is some kind of JS object. |
| 795 __ CmpInstanceType(rbx, FIRST_JS_OBJECT_TYPE); | 787 __ CmpInstanceType(rbx, FIRST_JS_OBJECT_TYPE); |
| 796 __ j(below, &slow); | 788 __ j(below, &slow); |
| 797 | 789 |
| 798 // Object case: Check key against length in the elements array. | 790 // Object case: Check key against length in the elements array. |
| 799 // rax: value | 791 // rax: value |
| 800 // rdx: JSObject | 792 // rdx: JSObject |
| 801 // rcx: index | 793 // rcx: index |
| 802 __ movq(rbx, FieldOperand(rdx, JSObject::kElementsOffset)); | 794 __ movq(rbx, FieldOperand(rdx, JSObject::kElementsOffset)); |
| 803 // Check that the object is in fast mode and writable. | 795 // Check that the object is in fast mode and writable. |
| 804 __ CompareRoot(FieldOperand(rbx, HeapObject::kMapOffset), | 796 __ CompareRoot(FieldOperand(rbx, HeapObject::kMapOffset), |
| 805 Heap::kFixedArrayMapRootIndex); | 797 Heap::kFixedArrayMapRootIndex); |
| 806 __ j(not_equal, &check_pixel_array); | 798 __ j(not_equal, &slow); |
| 807 __ SmiCompareInteger32(FieldOperand(rbx, FixedArray::kLengthOffset), rcx); | 799 __ SmiCompareInteger32(FieldOperand(rbx, FixedArray::kLengthOffset), rcx); |
| 808 // rax: value | 800 // rax: value |
| 809 // rbx: FixedArray | 801 // rbx: FixedArray |
| 810 // rcx: index | 802 // rcx: index |
| 811 __ j(above, &fast); | 803 __ j(above, &fast); |
| 812 | 804 |
| 813 // Slow case: call runtime. | 805 // Slow case: call runtime. |
| 814 __ bind(&slow); | 806 __ bind(&slow); |
| 815 __ Integer32ToSmi(rcx, rcx); | 807 __ Integer32ToSmi(rcx, rcx); |
| 816 __ bind(&slow_with_tagged_index); | 808 __ bind(&slow_with_tagged_index); |
| 817 GenerateRuntimeSetProperty(masm, strict_mode); | 809 GenerateRuntimeSetProperty(masm, strict_mode); |
| 818 // Never returns to here. | 810 // Never returns to here. |
| 819 | 811 |
| 820 // Check whether the elements is a pixel array. | |
| 821 // rax: value | |
| 822 // rdx: receiver | |
| 823 // rbx: receiver's elements array | |
| 824 // rcx: index, zero-extended. | |
| 825 __ bind(&check_pixel_array); | |
| 826 GenerateFastPixelArrayStore(masm, | |
| 827 rdx, | |
| 828 rcx, | |
| 829 rax, | |
| 830 rbx, | |
| 831 rdi, | |
| 832 false, | |
| 833 true, | |
| 834 NULL, | |
| 835 &slow, | |
| 836 &slow, | |
| 837 &slow); | |
| 838 | |
| 839 // Extra capacity case: Check if there is extra capacity to | 812 // Extra capacity case: Check if there is extra capacity to |
| 840 // perform the store and update the length. Used for adding one | 813 // perform the store and update the length. Used for adding one |
| 841 // element to the array by writing to array[array.length]. | 814 // element to the array by writing to array[array.length]. |
| 842 __ bind(&extra); | 815 __ bind(&extra); |
| 843 // rax: value | 816 // rax: value |
| 844 // rdx: receiver (a JSArray) | 817 // rdx: receiver (a JSArray) |
| 845 // rbx: receiver's elements array (a FixedArray) | 818 // rbx: receiver's elements array (a FixedArray) |
| 846 // rcx: index | 819 // rcx: index |
| 847 // flags: smicompare (rdx.length(), rbx) | 820 // flags: smicompare (rdx.length(), rbx) |
| 848 __ j(not_equal, &slow); // do not leave holes in the array | 821 __ j(not_equal, &slow); // do not leave holes in the array |
| (...skipping 903 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1752 Condition cc = *jmp_address == Assembler::kJncShortOpcode | 1725 Condition cc = *jmp_address == Assembler::kJncShortOpcode |
| 1753 ? not_zero | 1726 ? not_zero |
| 1754 : zero; | 1727 : zero; |
| 1755 *jmp_address = static_cast<byte>(Assembler::kJccShortPrefix | cc); | 1728 *jmp_address = static_cast<byte>(Assembler::kJccShortPrefix | cc); |
| 1756 } | 1729 } |
| 1757 | 1730 |
| 1758 | 1731 |
| 1759 } } // namespace v8::internal | 1732 } } // namespace v8::internal |
| 1760 | 1733 |
| 1761 #endif // V8_TARGET_ARCH_X64 | 1734 #endif // V8_TARGET_ARCH_X64 |
| OLD | NEW |