| 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 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 271 // Get the map and type of the heap object. | 271 // Get the map and type of the heap object. |
| 272 __ mov(edx, FieldOperand(eax, HeapObject::kMapOffset)); | 272 __ mov(edx, FieldOperand(eax, HeapObject::kMapOffset)); |
| 273 __ movzx_b(ecx, FieldOperand(edx, Map::kInstanceTypeOffset)); | 273 __ movzx_b(ecx, FieldOperand(edx, Map::kInstanceTypeOffset)); |
| 274 | 274 |
| 275 // Undetectable => false. | 275 // Undetectable => false. |
| 276 __ test_b(FieldOperand(edx, Map::kBitFieldOffset), | 276 __ test_b(FieldOperand(edx, Map::kBitFieldOffset), |
| 277 1 << Map::kIsUndetectable); | 277 1 << Map::kIsUndetectable); |
| 278 __ j(not_zero, &false_result, Label::kNear); | 278 __ j(not_zero, &false_result, Label::kNear); |
| 279 | 279 |
| 280 // JavaScript object => true. | 280 // JavaScript object => true. |
| 281 __ CmpInstanceType(edx, FIRST_JS_OBJECT_TYPE); | 281 __ CmpInstanceType(edx, FIRST_SPEC_OBJECT_TYPE); |
| 282 __ j(above_equal, &true_result, Label::kNear); | 282 __ j(above_equal, &true_result, Label::kNear); |
| 283 | 283 |
| 284 // String value => false iff empty. | 284 // String value => false iff empty. |
| 285 __ CmpInstanceType(edx, FIRST_NONSTRING_TYPE); | 285 __ CmpInstanceType(edx, FIRST_NONSTRING_TYPE); |
| 286 __ j(above_equal, ¬_string, Label::kNear); | 286 __ j(above_equal, ¬_string, Label::kNear); |
| 287 STATIC_ASSERT(kSmiTag == 0); | 287 STATIC_ASSERT(kSmiTag == 0); |
| 288 __ cmp(FieldOperand(eax, String::kLengthOffset), Immediate(0)); | 288 __ cmp(FieldOperand(eax, String::kLengthOffset), Immediate(0)); |
| 289 __ j(zero, &false_result, Label::kNear); | 289 __ j(zero, &false_result, Label::kNear); |
| 290 __ jmp(&true_result, Label::kNear); | 290 __ jmp(&true_result, Label::kNear); |
| 291 | 291 |
| (...skipping 3357 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3649 if (never_nan_nan_ && (cc_ == equal)) { | 3649 if (never_nan_nan_ && (cc_ == equal)) { |
| 3650 __ Set(eax, Immediate(Smi::FromInt(EQUAL))); | 3650 __ Set(eax, Immediate(Smi::FromInt(EQUAL))); |
| 3651 __ ret(0); | 3651 __ ret(0); |
| 3652 } else { | 3652 } else { |
| 3653 Label heap_number; | 3653 Label heap_number; |
| 3654 __ cmp(FieldOperand(edx, HeapObject::kMapOffset), | 3654 __ cmp(FieldOperand(edx, HeapObject::kMapOffset), |
| 3655 Immediate(masm->isolate()->factory()->heap_number_map())); | 3655 Immediate(masm->isolate()->factory()->heap_number_map())); |
| 3656 __ j(equal, &heap_number, Label::kNear); | 3656 __ j(equal, &heap_number, Label::kNear); |
| 3657 if (cc_ != equal) { | 3657 if (cc_ != equal) { |
| 3658 // Call runtime on identical JSObjects. Otherwise return equal. | 3658 // Call runtime on identical JSObjects. Otherwise return equal. |
| 3659 __ CmpObjectType(eax, FIRST_JS_OBJECT_TYPE, ecx); | 3659 __ CmpObjectType(eax, FIRST_SPEC_OBJECT_TYPE, ecx); |
| 3660 __ j(above_equal, ¬_identical); | 3660 __ j(above_equal, ¬_identical); |
| 3661 } | 3661 } |
| 3662 __ Set(eax, Immediate(Smi::FromInt(EQUAL))); | 3662 __ Set(eax, Immediate(Smi::FromInt(EQUAL))); |
| 3663 __ ret(0); | 3663 __ ret(0); |
| 3664 | 3664 |
| 3665 __ bind(&heap_number); | 3665 __ bind(&heap_number); |
| 3666 // It is a heap number, so return non-equal if it's NaN and equal if | 3666 // It is a heap number, so return non-equal if it's NaN and equal if |
| 3667 // it's not NaN. | 3667 // it's not NaN. |
| 3668 // The representation of NaN values has all exponent bits (52..62) set, | 3668 // The representation of NaN values has all exponent bits (52..62) set, |
| 3669 // and not all mantissa bits (0..51) clear. | 3669 // and not all mantissa bits (0..51) clear. |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3737 __ ret(0); | 3737 __ ret(0); |
| 3738 | 3738 |
| 3739 __ bind(¬_smis); | 3739 __ bind(¬_smis); |
| 3740 // If either operand is a JSObject or an oddball value, then they are not | 3740 // If either operand is a JSObject or an oddball value, then they are not |
| 3741 // equal since their pointers are different | 3741 // equal since their pointers are different |
| 3742 // There is no test for undetectability in strict equality. | 3742 // There is no test for undetectability in strict equality. |
| 3743 | 3743 |
| 3744 // Get the type of the first operand. | 3744 // Get the type of the first operand. |
| 3745 // If the first object is a JS object, we have done pointer comparison. | 3745 // If the first object is a JS object, we have done pointer comparison. |
| 3746 Label first_non_object; | 3746 Label first_non_object; |
| 3747 STATIC_ASSERT(LAST_TYPE == JS_FUNCTION_TYPE); | 3747 STATIC_ASSERT(LAST_TYPE == LAST_SPEC_OBJECT_TYPE); |
| 3748 __ CmpObjectType(eax, FIRST_JS_OBJECT_TYPE, ecx); | 3748 __ CmpObjectType(eax, FIRST_SPEC_OBJECT_TYPE, ecx); |
| 3749 __ j(below, &first_non_object, Label::kNear); | 3749 __ j(below, &first_non_object, Label::kNear); |
| 3750 | 3750 |
| 3751 // Return non-zero (eax is not zero) | 3751 // Return non-zero (eax is not zero) |
| 3752 Label return_not_equal; | 3752 Label return_not_equal; |
| 3753 STATIC_ASSERT(kHeapObjectTag != 0); | 3753 STATIC_ASSERT(kHeapObjectTag != 0); |
| 3754 __ bind(&return_not_equal); | 3754 __ bind(&return_not_equal); |
| 3755 __ ret(0); | 3755 __ ret(0); |
| 3756 | 3756 |
| 3757 __ bind(&first_non_object); | 3757 __ bind(&first_non_object); |
| 3758 // Check for oddballs: true, false, null, undefined. | 3758 // Check for oddballs: true, false, null, undefined. |
| 3759 __ CmpInstanceType(ecx, ODDBALL_TYPE); | 3759 __ CmpInstanceType(ecx, ODDBALL_TYPE); |
| 3760 __ j(equal, &return_not_equal); | 3760 __ j(equal, &return_not_equal); |
| 3761 | 3761 |
| 3762 __ CmpObjectType(edx, FIRST_JS_OBJECT_TYPE, ecx); | 3762 __ CmpObjectType(edx, FIRST_SPEC_OBJECT_TYPE, ecx); |
| 3763 __ j(above_equal, &return_not_equal); | 3763 __ j(above_equal, &return_not_equal); |
| 3764 | 3764 |
| 3765 // Check for oddballs: true, false, null, undefined. | 3765 // Check for oddballs: true, false, null, undefined. |
| 3766 __ CmpInstanceType(ecx, ODDBALL_TYPE); | 3766 __ CmpInstanceType(ecx, ODDBALL_TYPE); |
| 3767 __ j(equal, &return_not_equal); | 3767 __ j(equal, &return_not_equal); |
| 3768 | 3768 |
| 3769 // Fall through to the general case. | 3769 // Fall through to the general case. |
| 3770 __ bind(&slow); | 3770 __ bind(&slow); |
| 3771 } | 3771 } |
| 3772 | 3772 |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3876 Label not_both_objects; | 3876 Label not_both_objects; |
| 3877 Label return_unequal; | 3877 Label return_unequal; |
| 3878 // At most one is a smi, so we can test for smi by adding the two. | 3878 // At most one is a smi, so we can test for smi by adding the two. |
| 3879 // A smi plus a heap object has the low bit set, a heap object plus | 3879 // A smi plus a heap object has the low bit set, a heap object plus |
| 3880 // a heap object has the low bit clear. | 3880 // a heap object has the low bit clear. |
| 3881 STATIC_ASSERT(kSmiTag == 0); | 3881 STATIC_ASSERT(kSmiTag == 0); |
| 3882 STATIC_ASSERT(kSmiTagMask == 1); | 3882 STATIC_ASSERT(kSmiTagMask == 1); |
| 3883 __ lea(ecx, Operand(eax, edx, times_1, 0)); | 3883 __ lea(ecx, Operand(eax, edx, times_1, 0)); |
| 3884 __ test(ecx, Immediate(kSmiTagMask)); | 3884 __ test(ecx, Immediate(kSmiTagMask)); |
| 3885 __ j(not_zero, ¬_both_objects, Label::kNear); | 3885 __ j(not_zero, ¬_both_objects, Label::kNear); |
| 3886 __ CmpObjectType(eax, FIRST_JS_OBJECT_TYPE, ecx); | 3886 __ CmpObjectType(eax, FIRST_SPEC_OBJECT_TYPE, ecx); |
| 3887 __ j(below, ¬_both_objects, Label::kNear); | 3887 __ j(below, ¬_both_objects, Label::kNear); |
| 3888 __ CmpObjectType(edx, FIRST_JS_OBJECT_TYPE, ebx); | 3888 __ CmpObjectType(edx, FIRST_SPEC_OBJECT_TYPE, ebx); |
| 3889 __ j(below, ¬_both_objects, Label::kNear); | 3889 __ j(below, ¬_both_objects, Label::kNear); |
| 3890 // We do not bail out after this point. Both are JSObjects, and | 3890 // We do not bail out after this point. Both are JSObjects, and |
| 3891 // they are equal if and only if both are undetectable. | 3891 // they are equal if and only if both are undetectable. |
| 3892 // The and of the undetectable flags is 1 if and only if they are equal. | 3892 // The and of the undetectable flags is 1 if and only if they are equal. |
| 3893 __ test_b(FieldOperand(ecx, Map::kBitFieldOffset), | 3893 __ test_b(FieldOperand(ecx, Map::kBitFieldOffset), |
| 3894 1 << Map::kIsUndetectable); | 3894 1 << Map::kIsUndetectable); |
| 3895 __ j(zero, &return_unequal, Label::kNear); | 3895 __ j(zero, &return_unequal, Label::kNear); |
| 3896 __ test_b(FieldOperand(ebx, Map::kBitFieldOffset), | 3896 __ test_b(FieldOperand(ebx, Map::kBitFieldOffset), |
| 3897 1 << Map::kIsUndetectable); | 3897 1 << Map::kIsUndetectable); |
| 3898 __ j(zero, &return_unequal, Label::kNear); | 3898 __ j(zero, &return_unequal, Label::kNear); |
| (...skipping 2304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6203 __ Drop(1); | 6203 __ Drop(1); |
| 6204 __ ret(2 * kPointerSize); | 6204 __ ret(2 * kPointerSize); |
| 6205 } | 6205 } |
| 6206 | 6206 |
| 6207 | 6207 |
| 6208 #undef __ | 6208 #undef __ |
| 6209 | 6209 |
| 6210 } } // namespace v8::internal | 6210 } } // namespace v8::internal |
| 6211 | 6211 |
| 6212 #endif // V8_TARGET_ARCH_IA32 | 6212 #endif // V8_TARGET_ARCH_IA32 |
| OLD | NEW |