OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #if V8_TARGET_ARCH_X64 | 5 #if V8_TARGET_ARCH_X64 |
6 | 6 |
7 #include "src/bootstrapper.h" | 7 #include "src/bootstrapper.h" |
8 #include "src/code-stubs.h" | 8 #include "src/code-stubs.h" |
9 #include "src/codegen.h" | 9 #include "src/codegen.h" |
10 #include "src/ic/handler-compiler.h" | 10 #include "src/ic/handler-compiler.h" |
(...skipping 1677 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1688 | 1688 |
1689 #ifdef DEBUG | 1689 #ifdef DEBUG |
1690 __ Abort(kUnexpectedFallThroughFromStringComparison); | 1690 __ Abort(kUnexpectedFallThroughFromStringComparison); |
1691 #endif | 1691 #endif |
1692 | 1692 |
1693 __ bind(&check_unequal_objects); | 1693 __ bind(&check_unequal_objects); |
1694 if (cc == equal && !strict()) { | 1694 if (cc == equal && !strict()) { |
1695 // Not strict equality. Objects are unequal if | 1695 // Not strict equality. Objects are unequal if |
1696 // they are both JSObjects and not undetectable, | 1696 // they are both JSObjects and not undetectable, |
1697 // and their pointers are different. | 1697 // and their pointers are different. |
1698 Label return_unequal; | 1698 Label return_unequal, undetectable; |
1699 // At most one is a smi, so we can test for smi by adding the two. | 1699 // At most one is a smi, so we can test for smi by adding the two. |
1700 // A smi plus a heap object has the low bit set, a heap object plus | 1700 // A smi plus a heap object has the low bit set, a heap object plus |
1701 // a heap object has the low bit clear. | 1701 // a heap object has the low bit clear. |
1702 STATIC_ASSERT(kSmiTag == 0); | 1702 STATIC_ASSERT(kSmiTag == 0); |
1703 STATIC_ASSERT(kSmiTagMask == 1); | 1703 STATIC_ASSERT(kSmiTagMask == 1); |
1704 __ leap(rcx, Operand(rax, rdx, times_1, 0)); | 1704 __ leap(rcx, Operand(rax, rdx, times_1, 0)); |
1705 __ testb(rcx, Immediate(kSmiTagMask)); | 1705 __ testb(rcx, Immediate(kSmiTagMask)); |
1706 __ j(not_zero, &runtime_call, Label::kNear); | 1706 __ j(not_zero, &runtime_call, Label::kNear); |
1707 __ CmpObjectType(rax, FIRST_JS_RECEIVER_TYPE, rbx); | 1707 |
1708 __ j(below, &runtime_call, Label::kNear); | 1708 __ movp(rbx, FieldOperand(rax, HeapObject::kMapOffset)); |
1709 __ CmpObjectType(rdx, FIRST_JS_RECEIVER_TYPE, rcx); | 1709 __ movp(rcx, FieldOperand(rdx, HeapObject::kMapOffset)); |
1710 __ j(below, &runtime_call, Label::kNear); | |
1711 __ testb(FieldOperand(rbx, Map::kBitFieldOffset), | 1710 __ testb(FieldOperand(rbx, Map::kBitFieldOffset), |
1712 Immediate(1 << Map::kIsUndetectable)); | 1711 Immediate(1 << Map::kIsUndetectable)); |
1713 __ j(zero, &return_unequal, Label::kNear); | 1712 __ j(not_zero, &undetectable); |
1714 __ testb(FieldOperand(rcx, Map::kBitFieldOffset), | 1713 __ testb(FieldOperand(rcx, Map::kBitFieldOffset), |
1715 Immediate(1 << Map::kIsUndetectable)); | 1714 Immediate(1 << Map::kIsUndetectable)); |
1716 __ j(zero, &return_unequal, Label::kNear); | 1715 __ j(not_zero, &return_unequal); |
1717 // The objects are both undetectable, so they both compare as the value | 1716 |
1718 // undefined, and are equal. | 1717 __ CmpInstanceType(rbx, FIRST_JS_RECEIVER_TYPE); |
| 1718 __ j(below, &runtime_call, Label::kNear); |
| 1719 __ CmpInstanceType(rcx, FIRST_JS_RECEIVER_TYPE); |
| 1720 __ j(below, &runtime_call, Label::kNear); |
| 1721 |
| 1722 __ bind(&return_unequal); |
| 1723 // Return non-equal by returning the non-zero object pointer in rax. |
| 1724 __ ret(0); |
| 1725 |
| 1726 __ bind(&undetectable); |
| 1727 __ testb(FieldOperand(rcx, Map::kBitFieldOffset), |
| 1728 Immediate(1 << Map::kIsUndetectable)); |
| 1729 __ j(zero, &return_unequal); |
1719 __ Set(rax, EQUAL); | 1730 __ Set(rax, EQUAL); |
1720 __ bind(&return_unequal); | |
1721 // Return non-equal by returning the non-zero object pointer in rax, | |
1722 // or return equal if we fell through to here. | |
1723 __ ret(0); | 1731 __ ret(0); |
1724 } | 1732 } |
1725 __ bind(&runtime_call); | 1733 __ bind(&runtime_call); |
1726 | 1734 |
1727 // Push arguments below the return address to prepare jump to builtin. | 1735 // Push arguments below the return address to prepare jump to builtin. |
1728 __ PopReturnAddressTo(rcx); | 1736 __ PopReturnAddressTo(rcx); |
1729 __ Push(rdx); | 1737 __ Push(rdx); |
1730 __ Push(rax); | 1738 __ Push(rax); |
1731 | 1739 |
1732 // Figure out which native to call and setup the arguments. | 1740 // Figure out which native to call and setup the arguments. |
(...skipping 3844 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5577 NULL); | 5585 NULL); |
5578 } | 5586 } |
5579 | 5587 |
5580 | 5588 |
5581 #undef __ | 5589 #undef __ |
5582 | 5590 |
5583 } // namespace internal | 5591 } // namespace internal |
5584 } // namespace v8 | 5592 } // namespace v8 |
5585 | 5593 |
5586 #endif // V8_TARGET_ARCH_X64 | 5594 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |