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 699 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
710 } | 710 } |
711 | 711 |
712 | 712 |
713 void KeyedLoadIC::GenerateString(MacroAssembler* masm) { | 713 void KeyedLoadIC::GenerateString(MacroAssembler* masm) { |
714 // ----------- S t a t e ------------- | 714 // ----------- S t a t e ------------- |
715 // -- eax : key (index) | 715 // -- eax : key (index) |
716 // -- edx : receiver | 716 // -- edx : receiver |
717 // -- esp[0] : return address | 717 // -- esp[0] : return address |
718 // ----------------------------------- | 718 // ----------------------------------- |
719 Label miss; | 719 Label miss; |
720 Label index_out_of_range; | |
721 | 720 |
722 Register receiver = edx; | 721 Register receiver = edx; |
723 Register index = eax; | 722 Register index = eax; |
724 Register scratch1 = ebx; | 723 Register scratch1 = ebx; |
725 Register scratch2 = ecx; | 724 Register scratch2 = ecx; |
726 Register result = eax; | 725 Register result = eax; |
727 | 726 |
728 StringCharAtGenerator char_at_generator(receiver, | 727 StringCharAtGenerator char_at_generator(receiver, |
729 index, | 728 index, |
730 scratch1, | 729 scratch1, |
731 scratch2, | 730 scratch2, |
732 result, | 731 result, |
733 &miss, // When not a string. | 732 &miss, // When not a string. |
734 &miss, // When not a number. | 733 &miss, // When not a number. |
735 &index_out_of_range, | 734 &miss, // When index out of range. |
736 STRING_INDEX_IS_ARRAY_INDEX); | 735 STRING_INDEX_IS_ARRAY_INDEX); |
737 char_at_generator.GenerateFast(masm); | 736 char_at_generator.GenerateFast(masm); |
738 __ ret(0); | 737 __ ret(0); |
739 | 738 |
740 ICRuntimeCallHelper call_helper; | 739 ICRuntimeCallHelper call_helper; |
741 char_at_generator.GenerateSlow(masm, call_helper); | 740 char_at_generator.GenerateSlow(masm, call_helper); |
742 | 741 |
743 __ bind(&index_out_of_range); | |
744 __ Set(eax, Immediate(Factory::undefined_value())); | |
745 __ ret(0); | |
746 | |
747 __ bind(&miss); | 742 __ bind(&miss); |
748 GenerateMiss(masm); | 743 GenerateMiss(masm); |
749 } | 744 } |
750 | 745 |
751 | 746 |
752 void KeyedLoadIC::GenerateExternalArray(MacroAssembler* masm, | 747 void KeyedLoadIC::GenerateExternalArray(MacroAssembler* masm, |
753 ExternalArrayType array_type) { | 748 ExternalArrayType array_type) { |
754 // ----------- S t a t e ------------- | 749 // ----------- S t a t e ------------- |
755 // -- eax : key | 750 // -- eax : key |
756 // -- edx : receiver | 751 // -- edx : receiver |
(...skipping 1221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1978 ExternalReference ref = ExternalReference(IC_Utility(kKeyedStoreIC_Miss)); | 1973 ExternalReference ref = ExternalReference(IC_Utility(kKeyedStoreIC_Miss)); |
1979 __ TailCallExternalReference(ref, 3, 1); | 1974 __ TailCallExternalReference(ref, 3, 1); |
1980 } | 1975 } |
1981 | 1976 |
1982 #undef __ | 1977 #undef __ |
1983 | 1978 |
1984 | 1979 |
1985 } } // namespace v8::internal | 1980 } } // namespace v8::internal |
1986 | 1981 |
1987 #endif // V8_TARGET_ARCH_IA32 | 1982 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |