OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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_X87 | 5 #if V8_TARGET_ARCH_X87 |
6 | 6 |
7 #include "src/base/bits.h" | 7 #include "src/base/bits.h" |
8 #include "src/bootstrapper.h" | 8 #include "src/bootstrapper.h" |
9 #include "src/code-stubs.h" | 9 #include "src/code-stubs.h" |
10 #include "src/codegen.h" | 10 #include "src/codegen.h" |
(...skipping 1555 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1566 } | 1566 } |
1567 #ifdef DEBUG | 1567 #ifdef DEBUG |
1568 __ Abort(kUnexpectedFallThroughFromStringComparison); | 1568 __ Abort(kUnexpectedFallThroughFromStringComparison); |
1569 #endif | 1569 #endif |
1570 | 1570 |
1571 __ bind(&check_unequal_objects); | 1571 __ bind(&check_unequal_objects); |
1572 if (cc == equal && !strict()) { | 1572 if (cc == equal && !strict()) { |
1573 // Non-strict equality. Objects are unequal if | 1573 // Non-strict equality. Objects are unequal if |
1574 // they are both JSObjects and not undetectable, | 1574 // they are both JSObjects and not undetectable, |
1575 // and their pointers are different. | 1575 // and their pointers are different. |
1576 Label return_unequal; | 1576 Label return_unequal, undetectable; |
1577 // At most one is a smi, so we can test for smi by adding the two. | 1577 // At most one is a smi, so we can test for smi by adding the two. |
1578 // A smi plus a heap object has the low bit set, a heap object plus | 1578 // A smi plus a heap object has the low bit set, a heap object plus |
1579 // a heap object has the low bit clear. | 1579 // a heap object has the low bit clear. |
1580 STATIC_ASSERT(kSmiTag == 0); | 1580 STATIC_ASSERT(kSmiTag == 0); |
1581 STATIC_ASSERT(kSmiTagMask == 1); | 1581 STATIC_ASSERT(kSmiTagMask == 1); |
1582 __ lea(ecx, Operand(eax, edx, times_1, 0)); | 1582 __ lea(ecx, Operand(eax, edx, times_1, 0)); |
1583 __ test(ecx, Immediate(kSmiTagMask)); | 1583 __ test(ecx, Immediate(kSmiTagMask)); |
1584 __ j(not_zero, &runtime_call, Label::kNear); | 1584 __ j(not_zero, &runtime_call, Label::kNear); |
1585 __ CmpObjectType(eax, FIRST_JS_RECEIVER_TYPE, ecx); | 1585 |
| 1586 __ mov(ecx, FieldOperand(eax, HeapObject::kMapOffset)); |
| 1587 __ mov(ebx, FieldOperand(edx, HeapObject::kMapOffset)); |
| 1588 |
| 1589 __ test_b(FieldOperand(ebx, Map::kBitFieldOffset), |
| 1590 1 << Map::kIsUndetectable); |
| 1591 __ j(not_zero, &undetectable, Label::kNear); |
| 1592 __ test_b(FieldOperand(ecx, Map::kBitFieldOffset), |
| 1593 1 << Map::kIsUndetectable); |
| 1594 __ j(not_zero, &return_unequal, Label::kNear); |
| 1595 |
| 1596 __ CmpInstanceType(ebx, FIRST_JS_RECEIVER_TYPE); |
1586 __ j(below, &runtime_call, Label::kNear); | 1597 __ j(below, &runtime_call, Label::kNear); |
1587 __ CmpObjectType(edx, FIRST_JS_RECEIVER_TYPE, ebx); | 1598 __ CmpInstanceType(ecx, FIRST_JS_RECEIVER_TYPE); |
1588 __ j(below, &runtime_call, Label::kNear); | 1599 __ j(below, &runtime_call, Label::kNear); |
1589 // We do not bail out after this point. Both are JSObjects, and | 1600 |
1590 // they are equal if and only if both are undetectable. | 1601 __ bind(&return_unequal); |
1591 // The and of the undetectable flags is 1 if and only if they are equal. | 1602 // Return non-equal by returning the non-zero object pointer in eax. |
| 1603 __ ret(0); // eax, edx were pushed |
| 1604 |
| 1605 __ bind(&undetectable); |
1592 __ test_b(FieldOperand(ecx, Map::kBitFieldOffset), | 1606 __ test_b(FieldOperand(ecx, Map::kBitFieldOffset), |
1593 1 << Map::kIsUndetectable); | 1607 1 << Map::kIsUndetectable); |
1594 __ j(zero, &return_unequal, Label::kNear); | 1608 __ j(zero, &return_unequal, Label::kNear); |
1595 __ test_b(FieldOperand(ebx, Map::kBitFieldOffset), | |
1596 1 << Map::kIsUndetectable); | |
1597 __ j(zero, &return_unequal, Label::kNear); | |
1598 // The objects are both undetectable, so they both compare as the value | |
1599 // undefined, and are equal. | |
1600 __ Move(eax, Immediate(EQUAL)); | 1609 __ Move(eax, Immediate(EQUAL)); |
1601 __ bind(&return_unequal); | 1610 __ ret(0); // eax, edx were pushed |
1602 // Return non-equal by returning the non-zero object pointer in eax, | |
1603 // or return equal if we fell through to here. | |
1604 __ ret(0); // rax, rdx were pushed | |
1605 } | 1611 } |
1606 __ bind(&runtime_call); | 1612 __ bind(&runtime_call); |
1607 | 1613 |
1608 // Push arguments below the return address. | 1614 // Push arguments below the return address. |
1609 __ pop(ecx); | 1615 __ pop(ecx); |
1610 __ push(edx); | 1616 __ push(edx); |
1611 __ push(eax); | 1617 __ push(eax); |
1612 | 1618 |
1613 // Figure out which native to call and setup the arguments. | 1619 // Figure out which native to call and setup the arguments. |
1614 if (cc == equal) { | 1620 if (cc == equal) { |
(...skipping 3807 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5422 return_value_operand, NULL); | 5428 return_value_operand, NULL); |
5423 } | 5429 } |
5424 | 5430 |
5425 | 5431 |
5426 #undef __ | 5432 #undef __ |
5427 | 5433 |
5428 } // namespace internal | 5434 } // namespace internal |
5429 } // namespace v8 | 5435 } // namespace v8 |
5430 | 5436 |
5431 #endif // V8_TARGET_ARCH_X87 | 5437 #endif // V8_TARGET_ARCH_X87 |
OLD | NEW |