| 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 918 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 929 | 929 |
| 930 __ CompareObjectType(lhs, r3, r3, FIRST_SPEC_OBJECT_TYPE); | 930 __ CompareObjectType(lhs, r3, r3, FIRST_SPEC_OBJECT_TYPE); |
| 931 __ b(ge, &return_not_equal); | 931 __ b(ge, &return_not_equal); |
| 932 | 932 |
| 933 // Check for oddballs: true, false, null, undefined. | 933 // Check for oddballs: true, false, null, undefined. |
| 934 __ cmp(r3, Operand(ODDBALL_TYPE)); | 934 __ cmp(r3, Operand(ODDBALL_TYPE)); |
| 935 __ b(eq, &return_not_equal); | 935 __ b(eq, &return_not_equal); |
| 936 | 936 |
| 937 // Now that we have the types we might as well check for | 937 // Now that we have the types we might as well check for |
| 938 // internalized-internalized. | 938 // internalized-internalized. |
| 939 Label not_internalized; | 939 STATIC_ASSERT(kInternalizedTag == 0 && kStringTag == 0); |
| 940 STATIC_ASSERT(kInternalizedTag != 0); | 940 __ orr(r2, r2, Operand(r3)); |
| 941 __ and_(r2, r2, Operand(kIsNotStringMask | kIsInternalizedMask)); | 941 __ tst(r2, Operand(kIsNotStringMask | kIsNotInternalizedMask)); |
| 942 __ cmp(r2, Operand(kInternalizedTag | kStringTag)); | 942 __ b(eq, &return_not_equal); |
| 943 __ b(ne, ¬_internalized); // r2 (rhs) is not an internalized string | |
| 944 | |
| 945 __ and_(r3, r3, Operand(kIsNotStringMask | kIsInternalizedMask)); | |
| 946 __ cmp(r3, Operand(kInternalizedTag | kStringTag)); | |
| 947 __ b(eq, &return_not_equal); // both rhs and lhs are internalized strings | |
| 948 | |
| 949 __ bind(¬_internalized); | |
| 950 } | 943 } |
| 951 | 944 |
| 952 | 945 |
| 953 // See comment at call site. | 946 // See comment at call site. |
| 954 static void EmitCheckForTwoHeapNumbers(MacroAssembler* masm, | 947 static void EmitCheckForTwoHeapNumbers(MacroAssembler* masm, |
| 955 Register lhs, | 948 Register lhs, |
| 956 Register rhs, | 949 Register rhs, |
| 957 Label* both_loaded_as_doubles, | 950 Label* both_loaded_as_doubles, |
| 958 Label* not_heap_numbers, | 951 Label* not_heap_numbers, |
| 959 Label* slow) { | 952 Label* slow) { |
| (...skipping 20 matching lines...) Expand all Loading... |
| 980 static void EmitCheckForInternalizedStringsOrObjects(MacroAssembler* masm, | 973 static void EmitCheckForInternalizedStringsOrObjects(MacroAssembler* masm, |
| 981 Register lhs, | 974 Register lhs, |
| 982 Register rhs, | 975 Register rhs, |
| 983 Label* possible_strings, | 976 Label* possible_strings, |
| 984 Label* not_both_strings) { | 977 Label* not_both_strings) { |
| 985 ASSERT((lhs.is(r0) && rhs.is(r1)) || | 978 ASSERT((lhs.is(r0) && rhs.is(r1)) || |
| 986 (lhs.is(r1) && rhs.is(r0))); | 979 (lhs.is(r1) && rhs.is(r0))); |
| 987 | 980 |
| 988 // r2 is object type of rhs. | 981 // r2 is object type of rhs. |
| 989 Label object_test; | 982 Label object_test; |
| 990 STATIC_ASSERT(kInternalizedTag != 0); | 983 STATIC_ASSERT(kInternalizedTag == 0 && kStringTag == 0); |
| 991 __ tst(r2, Operand(kIsNotStringMask)); | 984 __ tst(r2, Operand(kIsNotStringMask)); |
| 992 __ b(ne, &object_test); | 985 __ b(ne, &object_test); |
| 993 __ tst(r2, Operand(kIsInternalizedMask)); | 986 __ tst(r2, Operand(kIsNotInternalizedMask)); |
| 994 __ b(eq, possible_strings); | 987 __ b(ne, possible_strings); |
| 995 __ CompareObjectType(lhs, r3, r3, FIRST_NONSTRING_TYPE); | 988 __ CompareObjectType(lhs, r3, r3, FIRST_NONSTRING_TYPE); |
| 996 __ b(ge, not_both_strings); | 989 __ b(ge, not_both_strings); |
| 997 __ tst(r3, Operand(kIsInternalizedMask)); | 990 __ tst(r3, Operand(kIsNotInternalizedMask)); |
| 998 __ b(eq, possible_strings); | 991 __ b(ne, possible_strings); |
| 999 | 992 |
| 1000 // Both are internalized. We already checked they weren't the same pointer | 993 // Both are internalized. We already checked they weren't the same pointer |
| 1001 // so they are not equal. | 994 // so they are not equal. |
| 1002 __ mov(r0, Operand(NOT_EQUAL)); | 995 __ mov(r0, Operand(NOT_EQUAL)); |
| 1003 __ Ret(); | 996 __ Ret(); |
| 1004 | 997 |
| 1005 __ bind(&object_test); | 998 __ bind(&object_test); |
| 1006 __ cmp(r2, Operand(FIRST_SPEC_OBJECT_TYPE)); | 999 __ cmp(r2, Operand(FIRST_SPEC_OBJECT_TYPE)); |
| 1007 __ b(lt, not_both_strings); | 1000 __ b(lt, not_both_strings); |
| 1008 __ CompareObjectType(lhs, r2, r3, FIRST_SPEC_OBJECT_TYPE); | 1001 __ CompareObjectType(lhs, r2, r3, FIRST_SPEC_OBJECT_TYPE); |
| (...skipping 4989 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5998 Register tmp2 = r3; | 5991 Register tmp2 = r3; |
| 5999 | 5992 |
| 6000 // Check that both operands are heap objects. | 5993 // Check that both operands are heap objects. |
| 6001 __ JumpIfEitherSmi(left, right, &miss); | 5994 __ JumpIfEitherSmi(left, right, &miss); |
| 6002 | 5995 |
| 6003 // Check that both operands are internalized strings. | 5996 // Check that both operands are internalized strings. |
| 6004 __ ldr(tmp1, FieldMemOperand(left, HeapObject::kMapOffset)); | 5997 __ ldr(tmp1, FieldMemOperand(left, HeapObject::kMapOffset)); |
| 6005 __ ldr(tmp2, FieldMemOperand(right, HeapObject::kMapOffset)); | 5998 __ ldr(tmp2, FieldMemOperand(right, HeapObject::kMapOffset)); |
| 6006 __ ldrb(tmp1, FieldMemOperand(tmp1, Map::kInstanceTypeOffset)); | 5999 __ ldrb(tmp1, FieldMemOperand(tmp1, Map::kInstanceTypeOffset)); |
| 6007 __ ldrb(tmp2, FieldMemOperand(tmp2, Map::kInstanceTypeOffset)); | 6000 __ ldrb(tmp2, FieldMemOperand(tmp2, Map::kInstanceTypeOffset)); |
| 6008 STATIC_ASSERT(kInternalizedTag != 0); | 6001 STATIC_ASSERT(kInternalizedTag == 0 && kStringTag == 0); |
| 6009 | 6002 __ orr(tmp1, tmp1, Operand(tmp2)); |
| 6010 __ and_(tmp1, tmp1, Operand(kIsNotStringMask | kIsInternalizedMask)); | 6003 __ tst(tmp1, Operand(kIsNotStringMask | kIsNotInternalizedMask)); |
| 6011 __ cmp(tmp1, Operand(kInternalizedTag | kStringTag)); | |
| 6012 __ b(ne, &miss); | |
| 6013 | |
| 6014 __ and_(tmp2, tmp2, Operand(kIsNotStringMask | kIsInternalizedMask)); | |
| 6015 __ cmp(tmp2, Operand(kInternalizedTag | kStringTag)); | |
| 6016 __ b(ne, &miss); | 6004 __ b(ne, &miss); |
| 6017 | 6005 |
| 6018 // Internalized strings are compared by identity. | 6006 // Internalized strings are compared by identity. |
| 6019 __ cmp(left, right); | 6007 __ cmp(left, right); |
| 6020 // Make sure r0 is non-zero. At this point input operands are | 6008 // Make sure r0 is non-zero. At this point input operands are |
| 6021 // guaranteed to be non-zero. | 6009 // guaranteed to be non-zero. |
| 6022 ASSERT(right.is(r0)); | 6010 ASSERT(right.is(r0)); |
| 6023 STATIC_ASSERT(EQUAL == 0); | 6011 STATIC_ASSERT(EQUAL == 0); |
| 6024 STATIC_ASSERT(kSmiTag == 0); | 6012 STATIC_ASSERT(kSmiTag == 0); |
| 6025 __ mov(r0, Operand(Smi::FromInt(EQUAL)), LeaveCC, eq); | 6013 __ mov(r0, Operand(Smi::FromInt(EQUAL)), LeaveCC, eq); |
| (...skipping 13 matching lines...) Expand all Loading... |
| 6039 Register left = r1; | 6027 Register left = r1; |
| 6040 Register right = r0; | 6028 Register right = r0; |
| 6041 Register tmp1 = r2; | 6029 Register tmp1 = r2; |
| 6042 Register tmp2 = r3; | 6030 Register tmp2 = r3; |
| 6043 | 6031 |
| 6044 // Check that both operands are heap objects. | 6032 // Check that both operands are heap objects. |
| 6045 __ JumpIfEitherSmi(left, right, &miss); | 6033 __ JumpIfEitherSmi(left, right, &miss); |
| 6046 | 6034 |
| 6047 // Check that both operands are unique names. This leaves the instance | 6035 // Check that both operands are unique names. This leaves the instance |
| 6048 // types loaded in tmp1 and tmp2. | 6036 // types loaded in tmp1 and tmp2. |
| 6049 STATIC_ASSERT(kInternalizedTag != 0); | |
| 6050 __ ldr(tmp1, FieldMemOperand(left, HeapObject::kMapOffset)); | 6037 __ ldr(tmp1, FieldMemOperand(left, HeapObject::kMapOffset)); |
| 6051 __ ldr(tmp2, FieldMemOperand(right, HeapObject::kMapOffset)); | 6038 __ ldr(tmp2, FieldMemOperand(right, HeapObject::kMapOffset)); |
| 6052 __ ldrb(tmp1, FieldMemOperand(tmp1, Map::kInstanceTypeOffset)); | 6039 __ ldrb(tmp1, FieldMemOperand(tmp1, Map::kInstanceTypeOffset)); |
| 6053 __ ldrb(tmp2, FieldMemOperand(tmp2, Map::kInstanceTypeOffset)); | 6040 __ ldrb(tmp2, FieldMemOperand(tmp2, Map::kInstanceTypeOffset)); |
| 6054 | 6041 |
| 6055 __ JumpIfNotUniqueName(tmp1, &miss); | 6042 __ JumpIfNotUniqueName(tmp1, &miss); |
| 6056 __ JumpIfNotUniqueName(tmp2, &miss); | 6043 __ JumpIfNotUniqueName(tmp2, &miss); |
| 6057 | 6044 |
| 6058 // Unique names are compared by identity. | 6045 // Unique names are compared by identity. |
| 6059 __ cmp(left, right); | 6046 __ cmp(left, right); |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6105 __ mov(r0, Operand(Smi::FromInt(EQUAL)), LeaveCC, eq); | 6092 __ mov(r0, Operand(Smi::FromInt(EQUAL)), LeaveCC, eq); |
| 6106 __ Ret(eq); | 6093 __ Ret(eq); |
| 6107 | 6094 |
| 6108 // Handle not identical strings. | 6095 // Handle not identical strings. |
| 6109 | 6096 |
| 6110 // Check that both strings are internalized strings. If they are, we're done | 6097 // Check that both strings are internalized strings. If they are, we're done |
| 6111 // because we already know they are not identical. We know they are both | 6098 // because we already know they are not identical. We know they are both |
| 6112 // strings. | 6099 // strings. |
| 6113 if (equality) { | 6100 if (equality) { |
| 6114 ASSERT(GetCondition() == eq); | 6101 ASSERT(GetCondition() == eq); |
| 6115 STATIC_ASSERT(kInternalizedTag != 0); | 6102 STATIC_ASSERT(kInternalizedTag == 0); |
| 6116 __ and_(tmp3, tmp1, Operand(tmp2)); | 6103 __ orr(tmp3, tmp1, Operand(tmp2)); |
| 6117 __ tst(tmp3, Operand(kIsInternalizedMask)); | 6104 __ tst(tmp3, Operand(kIsNotInternalizedMask)); |
| 6118 // Make sure r0 is non-zero. At this point input operands are | 6105 // Make sure r0 is non-zero. At this point input operands are |
| 6119 // guaranteed to be non-zero. | 6106 // guaranteed to be non-zero. |
| 6120 ASSERT(right.is(r0)); | 6107 ASSERT(right.is(r0)); |
| 6121 __ Ret(ne); | 6108 __ Ret(eq); |
| 6122 } | 6109 } |
| 6123 | 6110 |
| 6124 // Check that both strings are sequential ASCII. | 6111 // Check that both strings are sequential ASCII. |
| 6125 Label runtime; | 6112 Label runtime; |
| 6126 __ JumpIfBothInstanceTypesAreNotSequentialAscii( | 6113 __ JumpIfBothInstanceTypesAreNotSequentialAscii( |
| 6127 tmp1, tmp2, tmp3, tmp4, &runtime); | 6114 tmp1, tmp2, tmp3, tmp4, &runtime); |
| 6128 | 6115 |
| 6129 // Compare flat ASCII strings. Returns when done. | 6116 // Compare flat ASCII strings. Returns when done. |
| 6130 if (equality) { | 6117 if (equality) { |
| 6131 StringCompareStub::GenerateFlatAsciiStringEquals( | 6118 StringCompareStub::GenerateFlatAsciiStringEquals( |
| (...skipping 1078 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7210 __ bind(&fast_elements_case); | 7197 __ bind(&fast_elements_case); |
| 7211 GenerateCase(masm, FAST_ELEMENTS); | 7198 GenerateCase(masm, FAST_ELEMENTS); |
| 7212 } | 7199 } |
| 7213 | 7200 |
| 7214 | 7201 |
| 7215 #undef __ | 7202 #undef __ |
| 7216 | 7203 |
| 7217 } } // namespace v8::internal | 7204 } } // namespace v8::internal |
| 7218 | 7205 |
| 7219 #endif // V8_TARGET_ARCH_ARM | 7206 #endif // V8_TARGET_ARCH_ARM |
| OLD | NEW |