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 712 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
723 } | 723 } |
724 | 724 |
725 | 725 |
726 void KeyedLoadIC::GenerateString(MacroAssembler* masm) { | 726 void KeyedLoadIC::GenerateString(MacroAssembler* masm) { |
727 // ----------- S t a t e ------------- | 727 // ----------- S t a t e ------------- |
728 // -- rax : key | 728 // -- rax : key |
729 // -- rdx : receiver | 729 // -- rdx : receiver |
730 // -- rsp[0] : return address | 730 // -- rsp[0] : return address |
731 // ----------------------------------- | 731 // ----------------------------------- |
732 Label miss; | 732 Label miss; |
733 Label index_out_of_range; | |
734 | 733 |
735 Register receiver = rdx; | 734 Register receiver = rdx; |
736 Register index = rax; | 735 Register index = rax; |
737 Register scratch1 = rbx; | 736 Register scratch1 = rbx; |
738 Register scratch2 = rcx; | 737 Register scratch2 = rcx; |
739 Register result = rax; | 738 Register result = rax; |
740 | 739 |
741 StringCharAtGenerator char_at_generator(receiver, | 740 StringCharAtGenerator char_at_generator(receiver, |
742 index, | 741 index, |
743 scratch1, | 742 scratch1, |
744 scratch2, | 743 scratch2, |
745 result, | 744 result, |
746 &miss, // When not a string. | 745 &miss, // When not a string. |
747 &miss, // When not a number. | 746 &miss, // When not a number. |
748 &index_out_of_range, | 747 &miss, // When index out of range. |
749 STRING_INDEX_IS_ARRAY_INDEX); | 748 STRING_INDEX_IS_ARRAY_INDEX); |
750 char_at_generator.GenerateFast(masm); | 749 char_at_generator.GenerateFast(masm); |
751 __ ret(0); | 750 __ ret(0); |
752 | 751 |
753 ICRuntimeCallHelper call_helper; | 752 ICRuntimeCallHelper call_helper; |
754 char_at_generator.GenerateSlow(masm, call_helper); | 753 char_at_generator.GenerateSlow(masm, call_helper); |
755 | 754 |
756 __ bind(&index_out_of_range); | |
757 __ LoadRoot(rax, Heap::kUndefinedValueRootIndex); | |
758 __ ret(0); | |
759 | |
760 __ bind(&miss); | 755 __ bind(&miss); |
761 GenerateMiss(masm); | 756 GenerateMiss(masm); |
762 } | 757 } |
763 | 758 |
764 | 759 |
765 void KeyedLoadIC::GenerateExternalArray(MacroAssembler* masm, | 760 void KeyedLoadIC::GenerateExternalArray(MacroAssembler* masm, |
766 ExternalArrayType array_type) { | 761 ExternalArrayType array_type) { |
767 // ----------- S t a t e ------------- | 762 // ----------- S t a t e ------------- |
768 // -- rax : key | 763 // -- rax : key |
769 // -- rdx : receiver | 764 // -- rdx : receiver |
(...skipping 1124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1894 GenerateMiss(masm); | 1889 GenerateMiss(masm); |
1895 } | 1890 } |
1896 | 1891 |
1897 | 1892 |
1898 #undef __ | 1893 #undef __ |
1899 | 1894 |
1900 | 1895 |
1901 } } // namespace v8::internal | 1896 } } // namespace v8::internal |
1902 | 1897 |
1903 #endif // V8_TARGET_ARCH_X64 | 1898 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |