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_IA32 | 5 #if V8_TARGET_ARCH_IA32 |
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 1386 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1397 } | 1397 } |
1398 #ifdef DEBUG | 1398 #ifdef DEBUG |
1399 __ Abort(kUnexpectedFallThroughFromStringComparison); | 1399 __ Abort(kUnexpectedFallThroughFromStringComparison); |
1400 #endif | 1400 #endif |
1401 | 1401 |
1402 __ bind(&check_unequal_objects); | 1402 __ bind(&check_unequal_objects); |
1403 if (cc == equal && !strict()) { | 1403 if (cc == equal && !strict()) { |
1404 // Non-strict equality. Objects are unequal if | 1404 // Non-strict equality. Objects are unequal if |
1405 // they are both JSObjects and not undetectable, | 1405 // they are both JSObjects and not undetectable, |
1406 // and their pointers are different. | 1406 // and their pointers are different. |
1407 Label return_unequal, undetectable; | 1407 Label return_equal, return_unequal, undetectable; |
1408 // At most one is a smi, so we can test for smi by adding the two. | 1408 // At most one is a smi, so we can test for smi by adding the two. |
1409 // A smi plus a heap object has the low bit set, a heap object plus | 1409 // A smi plus a heap object has the low bit set, a heap object plus |
1410 // a heap object has the low bit clear. | 1410 // a heap object has the low bit clear. |
1411 STATIC_ASSERT(kSmiTag == 0); | 1411 STATIC_ASSERT(kSmiTag == 0); |
1412 STATIC_ASSERT(kSmiTagMask == 1); | 1412 STATIC_ASSERT(kSmiTagMask == 1); |
1413 __ lea(ecx, Operand(eax, edx, times_1, 0)); | 1413 __ lea(ecx, Operand(eax, edx, times_1, 0)); |
1414 __ test(ecx, Immediate(kSmiTagMask)); | 1414 __ test(ecx, Immediate(kSmiTagMask)); |
1415 __ j(not_zero, &runtime_call, Label::kNear); | 1415 __ j(not_zero, &runtime_call); |
1416 | 1416 |
1417 __ mov(ecx, FieldOperand(eax, HeapObject::kMapOffset)); | 1417 __ mov(ecx, FieldOperand(eax, HeapObject::kMapOffset)); |
1418 __ mov(ebx, FieldOperand(edx, HeapObject::kMapOffset)); | 1418 __ mov(ebx, FieldOperand(edx, HeapObject::kMapOffset)); |
1419 | 1419 |
1420 __ test_b(FieldOperand(ebx, Map::kBitFieldOffset), | 1420 __ test_b(FieldOperand(ebx, Map::kBitFieldOffset), |
1421 1 << Map::kIsUndetectable); | 1421 1 << Map::kIsUndetectable); |
1422 __ j(not_zero, &undetectable, Label::kNear); | 1422 __ j(not_zero, &undetectable, Label::kNear); |
1423 __ test_b(FieldOperand(ecx, Map::kBitFieldOffset), | 1423 __ test_b(FieldOperand(ecx, Map::kBitFieldOffset), |
1424 1 << Map::kIsUndetectable); | 1424 1 << Map::kIsUndetectable); |
1425 __ j(not_zero, &return_unequal, Label::kNear); | 1425 __ j(not_zero, &return_unequal, Label::kNear); |
1426 | 1426 |
1427 __ CmpInstanceType(ebx, FIRST_JS_RECEIVER_TYPE); | 1427 __ CmpInstanceType(ebx, FIRST_JS_RECEIVER_TYPE); |
1428 __ j(below, &runtime_call, Label::kNear); | 1428 __ j(below, &runtime_call, Label::kNear); |
1429 __ CmpInstanceType(ecx, FIRST_JS_RECEIVER_TYPE); | 1429 __ CmpInstanceType(ecx, FIRST_JS_RECEIVER_TYPE); |
1430 __ j(below, &runtime_call, Label::kNear); | 1430 __ j(below, &runtime_call, Label::kNear); |
1431 | 1431 |
1432 __ bind(&return_unequal); | 1432 __ bind(&return_unequal); |
1433 // Return non-equal by returning the non-zero object pointer in eax. | 1433 // Return non-equal by returning the non-zero object pointer in eax. |
1434 __ ret(0); // eax, edx were pushed | 1434 __ ret(0); // eax, edx were pushed |
1435 | 1435 |
1436 __ bind(&undetectable); | 1436 __ bind(&undetectable); |
1437 __ test_b(FieldOperand(ecx, Map::kBitFieldOffset), | 1437 __ test_b(FieldOperand(ecx, Map::kBitFieldOffset), |
1438 1 << Map::kIsUndetectable); | 1438 1 << Map::kIsUndetectable); |
1439 __ j(zero, &return_unequal, Label::kNear); | 1439 __ j(zero, &return_unequal, Label::kNear); |
| 1440 |
| 1441 // If both sides are JSReceivers, then the result is false according to |
| 1442 // the HTML specification, which says that only comparisons with null or |
| 1443 // undefined are affected by special casing for document.all. |
| 1444 __ CmpInstanceType(ebx, ODDBALL_TYPE); |
| 1445 __ j(zero, &return_equal, Label::kNear); |
| 1446 __ CmpInstanceType(ecx, ODDBALL_TYPE); |
| 1447 __ j(not_zero, &return_unequal, Label::kNear); |
| 1448 |
| 1449 __ bind(&return_equal); |
1440 __ Move(eax, Immediate(EQUAL)); | 1450 __ Move(eax, Immediate(EQUAL)); |
1441 __ ret(0); // eax, edx were pushed | 1451 __ ret(0); // eax, edx were pushed |
1442 } | 1452 } |
1443 __ bind(&runtime_call); | 1453 __ bind(&runtime_call); |
1444 | 1454 |
1445 if (cc == equal) { | 1455 if (cc == equal) { |
1446 { | 1456 { |
1447 FrameScope scope(masm, StackFrame::INTERNAL); | 1457 FrameScope scope(masm, StackFrame::INTERNAL); |
1448 __ Push(edx); | 1458 __ Push(edx); |
1449 __ Push(eax); | 1459 __ Push(eax); |
(...skipping 4442 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5892 return_value_operand, NULL); | 5902 return_value_operand, NULL); |
5893 } | 5903 } |
5894 | 5904 |
5895 | 5905 |
5896 #undef __ | 5906 #undef __ |
5897 | 5907 |
5898 } // namespace internal | 5908 } // namespace internal |
5899 } // namespace v8 | 5909 } // namespace v8 |
5900 | 5910 |
5901 #endif // V8_TARGET_ARCH_IA32 | 5911 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |