OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 6721 matching lines...) Loading... |
6732 __ j(zero, &compare_lengths, Label::kNear); | 6732 __ j(zero, &compare_lengths, Label::kNear); |
6733 | 6733 |
6734 // Compare characters. | 6734 // Compare characters. |
6735 Label result_not_equal; | 6735 Label result_not_equal; |
6736 GenerateAsciiCharsCompareLoop(masm, left, right, min_length, scratch2, | 6736 GenerateAsciiCharsCompareLoop(masm, left, right, min_length, scratch2, |
6737 &result_not_equal, Label::kNear); | 6737 &result_not_equal, Label::kNear); |
6738 | 6738 |
6739 // Compare lengths - strings up to min-length are equal. | 6739 // Compare lengths - strings up to min-length are equal. |
6740 __ bind(&compare_lengths); | 6740 __ bind(&compare_lengths); |
6741 __ test(length_delta, length_delta); | 6741 __ test(length_delta, length_delta); |
6742 #ifndef ENABLE_LATIN_1 | |
6743 __ j(not_zero, &result_not_equal, Label::kNear); | |
6744 #else | |
6745 Label length_not_equal; | 6742 Label length_not_equal; |
6746 __ j(not_zero, &length_not_equal, Label::kNear); | 6743 __ j(not_zero, &length_not_equal, Label::kNear); |
6747 #endif | |
6748 | 6744 |
6749 // Result is EQUAL. | 6745 // Result is EQUAL. |
6750 STATIC_ASSERT(EQUAL == 0); | 6746 STATIC_ASSERT(EQUAL == 0); |
6751 STATIC_ASSERT(kSmiTag == 0); | 6747 STATIC_ASSERT(kSmiTag == 0); |
6752 __ Set(eax, Immediate(Smi::FromInt(EQUAL))); | 6748 __ Set(eax, Immediate(Smi::FromInt(EQUAL))); |
6753 __ ret(0); | 6749 __ ret(0); |
6754 | 6750 |
6755 Label result_greater; | 6751 Label result_greater; |
6756 #ifdef ENABLE_LATIN_1 | |
6757 Label result_less; | 6752 Label result_less; |
6758 __ bind(&length_not_equal); | 6753 __ bind(&length_not_equal); |
6759 __ j(greater, &result_greater, Label::kNear); | 6754 __ j(greater, &result_greater, Label::kNear); |
6760 __ jmp(&result_less, Label::kNear); | 6755 __ jmp(&result_less, Label::kNear); |
6761 #endif | |
6762 __ bind(&result_not_equal); | 6756 __ bind(&result_not_equal); |
6763 #ifndef ENABLE_LATIN_1 | |
6764 __ j(greater, &result_greater, Label::kNear); | |
6765 #else | |
6766 __ j(above, &result_greater, Label::kNear); | 6757 __ j(above, &result_greater, Label::kNear); |
6767 __ bind(&result_less); | 6758 __ bind(&result_less); |
6768 #endif | |
6769 | 6759 |
6770 // Result is LESS. | 6760 // Result is LESS. |
6771 __ Set(eax, Immediate(Smi::FromInt(LESS))); | 6761 __ Set(eax, Immediate(Smi::FromInt(LESS))); |
6772 __ ret(0); | 6762 __ ret(0); |
6773 | 6763 |
6774 // Result is GREATER. | 6764 // Result is GREATER. |
6775 __ bind(&result_greater); | 6765 __ bind(&result_greater); |
6776 __ Set(eax, Immediate(Smi::FromInt(GREATER))); | 6766 __ Set(eax, Immediate(Smi::FromInt(GREATER))); |
6777 __ ret(0); | 6767 __ ret(0); |
6778 } | 6768 } |
(...skipping 1092 matching lines...) Loading... |
7871 // Restore ecx. | 7861 // Restore ecx. |
7872 __ pop(ecx); | 7862 __ pop(ecx); |
7873 __ ret(0); | 7863 __ ret(0); |
7874 } | 7864 } |
7875 | 7865 |
7876 #undef __ | 7866 #undef __ |
7877 | 7867 |
7878 } } // namespace v8::internal | 7868 } } // namespace v8::internal |
7879 | 7869 |
7880 #endif // V8_TARGET_ARCH_IA32 | 7870 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |