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 6877 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6888 | 6888 |
6889 __ bind(&miss); | 6889 __ bind(&miss); |
6890 GenerateMiss(masm); | 6890 GenerateMiss(masm); |
6891 } | 6891 } |
6892 | 6892 |
6893 | 6893 |
6894 void ICCompareStub::GenerateStrings(MacroAssembler* masm) { | 6894 void ICCompareStub::GenerateStrings(MacroAssembler* masm) { |
6895 ASSERT(state_ == CompareIC::STRINGS); | 6895 ASSERT(state_ == CompareIC::STRINGS); |
6896 Label miss; | 6896 Label miss; |
6897 | 6897 |
| 6898 bool equality = Token::IsEqualityOp(op_); |
| 6899 |
6898 // Registers containing left and right operands respectively. | 6900 // Registers containing left and right operands respectively. |
6899 Register left = a1; | 6901 Register left = a1; |
6900 Register right = a0; | 6902 Register right = a0; |
6901 Register tmp1 = a2; | 6903 Register tmp1 = a2; |
6902 Register tmp2 = a3; | 6904 Register tmp2 = a3; |
6903 Register tmp3 = t0; | 6905 Register tmp3 = t0; |
6904 Register tmp4 = t1; | 6906 Register tmp4 = t1; |
6905 Register tmp5 = t2; | 6907 Register tmp5 = t2; |
6906 | 6908 |
6907 // Check that both operands are heap objects. | 6909 // Check that both operands are heap objects. |
(...skipping 16 matching lines...) Expand all Loading... |
6924 STATIC_ASSERT(kSmiTag == 0); | 6926 STATIC_ASSERT(kSmiTag == 0); |
6925 __ Branch(&left_ne_right, ne, left, Operand(right), USE_DELAY_SLOT); | 6927 __ Branch(&left_ne_right, ne, left, Operand(right), USE_DELAY_SLOT); |
6926 __ mov(v0, zero_reg); // In the delay slot. | 6928 __ mov(v0, zero_reg); // In the delay slot. |
6927 __ Ret(); | 6929 __ Ret(); |
6928 __ bind(&left_ne_right); | 6930 __ bind(&left_ne_right); |
6929 | 6931 |
6930 // Handle not identical strings. | 6932 // Handle not identical strings. |
6931 | 6933 |
6932 // Check that both strings are symbols. If they are, we're done | 6934 // Check that both strings are symbols. If they are, we're done |
6933 // because we already know they are not identical. | 6935 // because we already know they are not identical. |
6934 ASSERT(GetCondition() == eq); | 6936 if (equality) { |
6935 STATIC_ASSERT(kSymbolTag != 0); | 6937 ASSERT(GetCondition() == eq); |
6936 __ And(tmp3, tmp1, Operand(tmp2)); | 6938 STATIC_ASSERT(kSymbolTag != 0); |
6937 __ And(tmp5, tmp3, Operand(kIsSymbolMask)); | 6939 __ And(tmp3, tmp1, Operand(tmp2)); |
6938 Label is_symbol; | 6940 __ And(tmp5, tmp3, Operand(kIsSymbolMask)); |
6939 __ Branch(&is_symbol, eq, tmp5, Operand(zero_reg), USE_DELAY_SLOT); | 6941 Label is_symbol; |
6940 __ mov(v0, a0); // In the delay slot. | 6942 __ Branch(&is_symbol, eq, tmp5, Operand(zero_reg), USE_DELAY_SLOT); |
6941 // Make sure a0 is non-zero. At this point input operands are | 6943 __ mov(v0, a0); // In the delay slot. |
6942 // guaranteed to be non-zero. | 6944 // Make sure a0 is non-zero. At this point input operands are |
6943 ASSERT(right.is(a0)); | 6945 // guaranteed to be non-zero. |
6944 __ Ret(); | 6946 ASSERT(right.is(a0)); |
6945 __ bind(&is_symbol); | 6947 __ Ret(); |
| 6948 __ bind(&is_symbol); |
| 6949 } |
6946 | 6950 |
6947 // Check that both strings are sequential ASCII. | 6951 // Check that both strings are sequential ASCII. |
6948 Label runtime; | 6952 Label runtime; |
6949 __ JumpIfBothInstanceTypesAreNotSequentialAscii(tmp1, tmp2, tmp3, tmp4, | 6953 __ JumpIfBothInstanceTypesAreNotSequentialAscii( |
6950 &runtime); | 6954 tmp1, tmp2, tmp3, tmp4, &runtime); |
6951 | 6955 |
6952 // Compare flat ASCII strings. Returns when done. | 6956 // Compare flat ASCII strings. Returns when done. |
6953 StringCompareStub::GenerateFlatAsciiStringEquals( | 6957 if (equality) { |
6954 masm, left, right, tmp1, tmp2, tmp3); | 6958 StringCompareStub::GenerateFlatAsciiStringEquals( |
| 6959 masm, left, right, tmp1, tmp2, tmp3); |
| 6960 } else { |
| 6961 StringCompareStub::GenerateCompareFlatAsciiStrings( |
| 6962 masm, left, right, tmp1, tmp2, tmp3, tmp4); |
| 6963 } |
6955 | 6964 |
6956 // Handle more complex cases in runtime. | 6965 // Handle more complex cases in runtime. |
6957 __ bind(&runtime); | 6966 __ bind(&runtime); |
6958 __ Push(left, right); | 6967 __ Push(left, right); |
6959 __ TailCallRuntime(Runtime::kStringEquals, 2, 1); | 6968 if (equality) { |
| 6969 __ TailCallRuntime(Runtime::kStringEquals, 2, 1); |
| 6970 } else { |
| 6971 __ TailCallRuntime(Runtime::kStringCompare, 2, 1); |
| 6972 } |
6960 | 6973 |
6961 __ bind(&miss); | 6974 __ bind(&miss); |
6962 GenerateMiss(masm); | 6975 GenerateMiss(masm); |
6963 } | 6976 } |
6964 | 6977 |
6965 | 6978 |
6966 void ICCompareStub::GenerateObjects(MacroAssembler* masm) { | 6979 void ICCompareStub::GenerateObjects(MacroAssembler* masm) { |
6967 ASSERT(state_ == CompareIC::OBJECTS); | 6980 ASSERT(state_ == CompareIC::OBJECTS); |
6968 Label miss; | 6981 Label miss; |
6969 __ And(a2, a1, Operand(a0)); | 6982 __ And(a2, a1, Operand(a0)); |
(...skipping 699 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7669 __ Ret(USE_DELAY_SLOT); | 7682 __ Ret(USE_DELAY_SLOT); |
7670 __ mov(v0, a0); | 7683 __ mov(v0, a0); |
7671 } | 7684 } |
7672 | 7685 |
7673 | 7686 |
7674 #undef __ | 7687 #undef __ |
7675 | 7688 |
7676 } } // namespace v8::internal | 7689 } } // namespace v8::internal |
7677 | 7690 |
7678 #endif // V8_TARGET_ARCH_MIPS | 7691 #endif // V8_TARGET_ARCH_MIPS |
OLD | NEW |