| OLD | NEW |
| 1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 915 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 926 __ b(ne, ¬_identical); | 926 __ b(ne, ¬_identical); |
| 927 | 927 |
| 928 // The two objects are identical. If we know that one of them isn't NaN then | 928 // The two objects are identical. If we know that one of them isn't NaN then |
| 929 // we now know they test equal. | 929 // we now know they test equal. |
| 930 if (cond != eq || !never_nan_nan) { | 930 if (cond != eq || !never_nan_nan) { |
| 931 // Test for NaN. Sadly, we can't just compare to FACTORY->nan_value(), | 931 // Test for NaN. Sadly, we can't just compare to FACTORY->nan_value(), |
| 932 // so we do the second best thing - test it ourselves. | 932 // so we do the second best thing - test it ourselves. |
| 933 // They are both equal and they are not both Smis so both of them are not | 933 // They are both equal and they are not both Smis so both of them are not |
| 934 // Smis. If it's not a heap number, then return equal. | 934 // Smis. If it's not a heap number, then return equal. |
| 935 if (cond == lt || cond == gt) { | 935 if (cond == lt || cond == gt) { |
| 936 __ CompareObjectType(r0, r4, r4, FIRST_JS_OBJECT_TYPE); | 936 __ CompareObjectType(r0, r4, r4, FIRST_SPEC_OBJECT_TYPE); |
| 937 __ b(ge, slow); | 937 __ b(ge, slow); |
| 938 } else { | 938 } else { |
| 939 __ CompareObjectType(r0, r4, r4, HEAP_NUMBER_TYPE); | 939 __ CompareObjectType(r0, r4, r4, HEAP_NUMBER_TYPE); |
| 940 __ b(eq, &heap_number); | 940 __ b(eq, &heap_number); |
| 941 // Comparing JS objects with <=, >= is complicated. | 941 // Comparing JS objects with <=, >= is complicated. |
| 942 if (cond != eq) { | 942 if (cond != eq) { |
| 943 __ cmp(r4, Operand(FIRST_JS_OBJECT_TYPE)); | 943 __ cmp(r4, Operand(FIRST_SPEC_OBJECT_TYPE)); |
| 944 __ b(ge, slow); | 944 __ b(ge, slow); |
| 945 // Normally here we fall through to return_equal, but undefined is | 945 // Normally here we fall through to return_equal, but undefined is |
| 946 // special: (undefined == undefined) == true, but | 946 // special: (undefined == undefined) == true, but |
| 947 // (undefined <= undefined) == false! See ECMAScript 11.8.5. | 947 // (undefined <= undefined) == false! See ECMAScript 11.8.5. |
| 948 if (cond == le || cond == ge) { | 948 if (cond == le || cond == ge) { |
| 949 __ cmp(r4, Operand(ODDBALL_TYPE)); | 949 __ cmp(r4, Operand(ODDBALL_TYPE)); |
| 950 __ b(ne, &return_equal); | 950 __ b(ne, &return_equal); |
| 951 __ LoadRoot(r2, Heap::kUndefinedValueRootIndex); | 951 __ LoadRoot(r2, Heap::kUndefinedValueRootIndex); |
| 952 __ cmp(r0, r2); | 952 __ cmp(r0, r2); |
| 953 __ b(ne, &return_equal); | 953 __ b(ne, &return_equal); |
| (...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1215 } | 1215 } |
| 1216 | 1216 |
| 1217 | 1217 |
| 1218 // See comment at call site. | 1218 // See comment at call site. |
| 1219 static void EmitStrictTwoHeapObjectCompare(MacroAssembler* masm, | 1219 static void EmitStrictTwoHeapObjectCompare(MacroAssembler* masm, |
| 1220 Register lhs, | 1220 Register lhs, |
| 1221 Register rhs) { | 1221 Register rhs) { |
| 1222 ASSERT((lhs.is(r0) && rhs.is(r1)) || | 1222 ASSERT((lhs.is(r0) && rhs.is(r1)) || |
| 1223 (lhs.is(r1) && rhs.is(r0))); | 1223 (lhs.is(r1) && rhs.is(r0))); |
| 1224 | 1224 |
| 1225 // If either operand is a JSObject or an oddball value, then they are | 1225 // If either operand is a JS object or an oddball value, then they are |
| 1226 // not equal since their pointers are different. | 1226 // not equal since their pointers are different. |
| 1227 // There is no test for undetectability in strict equality. | 1227 // There is no test for undetectability in strict equality. |
| 1228 STATIC_ASSERT(LAST_TYPE == JS_FUNCTION_TYPE); | 1228 STATIC_ASSERT(LAST_TYPE == LAST_CALLABLE_SPEC_OBJECT_TYPE); |
| 1229 Label first_non_object; | 1229 Label first_non_object; |
| 1230 // Get the type of the first operand into r2 and compare it with | 1230 // Get the type of the first operand into r2 and compare it with |
| 1231 // FIRST_JS_OBJECT_TYPE. | 1231 // FIRST_SPEC_OBJECT_TYPE. |
| 1232 __ CompareObjectType(rhs, r2, r2, FIRST_JS_OBJECT_TYPE); | 1232 __ CompareObjectType(rhs, r2, r2, FIRST_SPEC_OBJECT_TYPE); |
| 1233 __ b(lt, &first_non_object); | 1233 __ b(lt, &first_non_object); |
| 1234 | 1234 |
| 1235 // Return non-zero (r0 is not zero) | 1235 // Return non-zero (r0 is not zero) |
| 1236 Label return_not_equal; | 1236 Label return_not_equal; |
| 1237 __ bind(&return_not_equal); | 1237 __ bind(&return_not_equal); |
| 1238 __ Ret(); | 1238 __ Ret(); |
| 1239 | 1239 |
| 1240 __ bind(&first_non_object); | 1240 __ bind(&first_non_object); |
| 1241 // Check for oddballs: true, false, null, undefined. | 1241 // Check for oddballs: true, false, null, undefined. |
| 1242 __ cmp(r2, Operand(ODDBALL_TYPE)); | 1242 __ cmp(r2, Operand(ODDBALL_TYPE)); |
| 1243 __ b(eq, &return_not_equal); | 1243 __ b(eq, &return_not_equal); |
| 1244 | 1244 |
| 1245 __ CompareObjectType(lhs, r3, r3, FIRST_JS_OBJECT_TYPE); | 1245 __ CompareObjectType(lhs, r3, r3, FIRST_SPEC_OBJECT_TYPE); |
| 1246 __ b(ge, &return_not_equal); | 1246 __ b(ge, &return_not_equal); |
| 1247 | 1247 |
| 1248 // Check for oddballs: true, false, null, undefined. | 1248 // Check for oddballs: true, false, null, undefined. |
| 1249 __ cmp(r3, Operand(ODDBALL_TYPE)); | 1249 __ cmp(r3, Operand(ODDBALL_TYPE)); |
| 1250 __ b(eq, &return_not_equal); | 1250 __ b(eq, &return_not_equal); |
| 1251 | 1251 |
| 1252 // Now that we have the types we might as well check for symbol-symbol. | 1252 // Now that we have the types we might as well check for symbol-symbol. |
| 1253 // Ensure that no non-strings have the symbol bit set. | 1253 // Ensure that no non-strings have the symbol bit set. |
| 1254 STATIC_ASSERT(LAST_TYPE < kNotStringTag + kIsSymbolMask); | 1254 STATIC_ASSERT(LAST_TYPE < kNotStringTag + kIsSymbolMask); |
| 1255 STATIC_ASSERT(kSymbolTag != 0); | 1255 STATIC_ASSERT(kSymbolTag != 0); |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1312 __ b(ge, not_both_strings); | 1312 __ b(ge, not_both_strings); |
| 1313 __ tst(r3, Operand(kIsSymbolMask)); | 1313 __ tst(r3, Operand(kIsSymbolMask)); |
| 1314 __ b(eq, possible_strings); | 1314 __ b(eq, possible_strings); |
| 1315 | 1315 |
| 1316 // Both are symbols. We already checked they weren't the same pointer | 1316 // Both are symbols. We already checked they weren't the same pointer |
| 1317 // so they are not equal. | 1317 // so they are not equal. |
| 1318 __ mov(r0, Operand(NOT_EQUAL)); | 1318 __ mov(r0, Operand(NOT_EQUAL)); |
| 1319 __ Ret(); | 1319 __ Ret(); |
| 1320 | 1320 |
| 1321 __ bind(&object_test); | 1321 __ bind(&object_test); |
| 1322 __ cmp(r2, Operand(FIRST_JS_OBJECT_TYPE)); | 1322 __ cmp(r2, Operand(FIRST_SPEC_OBJECT_TYPE)); |
| 1323 __ b(lt, not_both_strings); | 1323 __ b(lt, not_both_strings); |
| 1324 __ CompareObjectType(lhs, r2, r3, FIRST_JS_OBJECT_TYPE); | 1324 __ CompareObjectType(lhs, r2, r3, FIRST_SPEC_OBJECT_TYPE); |
| 1325 __ b(lt, not_both_strings); | 1325 __ b(lt, not_both_strings); |
| 1326 // If both objects are undetectable, they are equal. Otherwise, they | 1326 // If both objects are undetectable, they are equal. Otherwise, they |
| 1327 // are not equal, since they are different objects and an object is not | 1327 // are not equal, since they are different objects and an object is not |
| 1328 // equal to undefined. | 1328 // equal to undefined. |
| 1329 __ ldr(r3, FieldMemOperand(rhs, HeapObject::kMapOffset)); | 1329 __ ldr(r3, FieldMemOperand(rhs, HeapObject::kMapOffset)); |
| 1330 __ ldrb(r2, FieldMemOperand(r2, Map::kBitFieldOffset)); | 1330 __ ldrb(r2, FieldMemOperand(r2, Map::kBitFieldOffset)); |
| 1331 __ ldrb(r3, FieldMemOperand(r3, Map::kBitFieldOffset)); | 1331 __ ldrb(r3, FieldMemOperand(r3, Map::kBitFieldOffset)); |
| 1332 __ and_(r0, r2, Operand(r3)); | 1332 __ and_(r0, r2, Operand(r3)); |
| 1333 __ and_(r0, r0, Operand(1 << Map::kIsUndetectable)); | 1333 __ and_(r0, r0, Operand(1 << Map::kIsUndetectable)); |
| 1334 __ eor(r0, r0, Operand(1 << Map::kIsUndetectable)); | 1334 __ eor(r0, r0, Operand(1 << Map::kIsUndetectable)); |
| (...skipping 341 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1676 // Undetectable => false. | 1676 // Undetectable => false. |
| 1677 __ ldr(ip, FieldMemOperand(tos_, HeapObject::kMapOffset)); | 1677 __ ldr(ip, FieldMemOperand(tos_, HeapObject::kMapOffset)); |
| 1678 __ ldrb(scratch, FieldMemOperand(ip, Map::kBitFieldOffset)); | 1678 __ ldrb(scratch, FieldMemOperand(ip, Map::kBitFieldOffset)); |
| 1679 __ and_(scratch, scratch, Operand(1 << Map::kIsUndetectable)); | 1679 __ and_(scratch, scratch, Operand(1 << Map::kIsUndetectable)); |
| 1680 __ cmp(scratch, Operand(1 << Map::kIsUndetectable)); | 1680 __ cmp(scratch, Operand(1 << Map::kIsUndetectable)); |
| 1681 __ b(&false_result, eq); | 1681 __ b(&false_result, eq); |
| 1682 | 1682 |
| 1683 // JavaScript object => true. | 1683 // JavaScript object => true. |
| 1684 __ ldr(scratch, FieldMemOperand(tos_, HeapObject::kMapOffset)); | 1684 __ ldr(scratch, FieldMemOperand(tos_, HeapObject::kMapOffset)); |
| 1685 __ ldrb(scratch, FieldMemOperand(scratch, Map::kInstanceTypeOffset)); | 1685 __ ldrb(scratch, FieldMemOperand(scratch, Map::kInstanceTypeOffset)); |
| 1686 __ cmp(scratch, Operand(FIRST_JS_OBJECT_TYPE)); | 1686 __ cmp(scratch, Operand(FIRST_SPEC_OBJECT_TYPE)); |
| 1687 // "tos_" is a register and contains a non-zero value. | 1687 // "tos_" is a register and contains a non-zero value. |
| 1688 // Hence we implicitly return true if the greater than | 1688 // Hence we implicitly return true if the greater than |
| 1689 // condition is satisfied. | 1689 // condition is satisfied. |
| 1690 __ Ret(gt); | 1690 __ Ret(gt); |
| 1691 | 1691 |
| 1692 // Check for string | 1692 // Check for string |
| 1693 __ ldr(scratch, FieldMemOperand(tos_, HeapObject::kMapOffset)); | 1693 __ ldr(scratch, FieldMemOperand(tos_, HeapObject::kMapOffset)); |
| 1694 __ ldrb(scratch, FieldMemOperand(scratch, Map::kInstanceTypeOffset)); | 1694 __ ldrb(scratch, FieldMemOperand(scratch, Map::kInstanceTypeOffset)); |
| 1695 __ cmp(scratch, Operand(FIRST_NONSTRING_TYPE)); | 1695 __ cmp(scratch, Operand(FIRST_NONSTRING_TYPE)); |
| 1696 // "tos_" is a register and contains a non-zero value. | 1696 // "tos_" is a register and contains a non-zero value. |
| (...skipping 4732 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6429 __ mov(result, Operand(0)); | 6429 __ mov(result, Operand(0)); |
| 6430 __ Ret(); | 6430 __ Ret(); |
| 6431 } | 6431 } |
| 6432 | 6432 |
| 6433 | 6433 |
| 6434 #undef __ | 6434 #undef __ |
| 6435 | 6435 |
| 6436 } } // namespace v8::internal | 6436 } } // namespace v8::internal |
| 6437 | 6437 |
| 6438 #endif // V8_TARGET_ARCH_ARM | 6438 #endif // V8_TARGET_ARCH_ARM |
| OLD | NEW |