OLD | NEW |
1 // Copyright 2009 the V8 project authors. All rights reserved. | 1 // Copyright 2009 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 5626 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5637 __ bind(&return_equal); | 5637 __ bind(&return_equal); |
5638 __ xor_(rax, rax); | 5638 __ xor_(rax, rax); |
5639 __ ret(0); | 5639 __ ret(0); |
5640 | 5640 |
5641 __ bind(&heap_number); | 5641 __ bind(&heap_number); |
5642 // It is a heap number, so return non-equal if it's NaN and equal if it's | 5642 // It is a heap number, so return non-equal if it's NaN and equal if it's |
5643 // not NaN. | 5643 // not NaN. |
5644 // The representation of NaN values has all exponent bits (52..62) set, | 5644 // The representation of NaN values has all exponent bits (52..62) set, |
5645 // and not all mantissa bits (0..51) clear. | 5645 // and not all mantissa bits (0..51) clear. |
5646 // Read double representation into rax. | 5646 // Read double representation into rax. |
5647 __ movq(rbx, 0x7ff0000000000000, RelocInfo::NONE); | 5647 __ movq(rbx, V8_UINT64_C(0x7ff0000000000000), RelocInfo::NONE); |
5648 __ movq(rax, FieldOperand(rdx, HeapNumber::kValueOffset)); | 5648 __ movq(rax, FieldOperand(rdx, HeapNumber::kValueOffset)); |
5649 // Test that exponent bits are all set. | 5649 // Test that exponent bits are all set. |
5650 __ or_(rbx, rax); | 5650 __ or_(rbx, rax); |
5651 __ cmpq(rbx, rax); | 5651 __ cmpq(rbx, rax); |
5652 __ j(not_equal, &return_equal); | 5652 __ j(not_equal, &return_equal); |
5653 // Shift out flag and all exponent bits, retaining only mantissa. | 5653 // Shift out flag and all exponent bits, retaining only mantissa. |
5654 __ shl(rax, Immediate(12)); | 5654 __ shl(rax, Immediate(12)); |
5655 // If all bits in the mantissa are zero the number is Infinity, and | 5655 // If all bits in the mantissa are zero the number is Infinity, and |
5656 // we return zero. Otherwise it is a NaN, and we return non-zero. | 5656 // we return zero. Otherwise it is a NaN, and we return non-zero. |
5657 // We cannot just return rax because only eax is tested on return. | 5657 // We cannot just return rax because only eax is tested on return. |
5658 // TODO(X64): Solve this using movcc, when implemented. | 5658 __ setcc(not_zero, rax); |
5659 __ movq(kScratchRegister, rax); | |
5660 __ shr(kScratchRegister, Immediate(32)); | |
5661 __ or_(rax, kScratchRegister); | |
5662 __ ret(0); | 5659 __ ret(0); |
5663 | 5660 |
5664 __ bind(¬_identical); | 5661 __ bind(¬_identical); |
5665 } | 5662 } |
5666 | 5663 |
5667 // If we're doing a strict equality comparison, we don't have to do | 5664 // If we're doing a strict equality comparison, we don't have to do |
5668 // type conversion, so we generate code to do fast comparison for objects | 5665 // type conversion, so we generate code to do fast comparison for objects |
5669 // and oddballs. Non-smi numbers and strings still go through the usual | 5666 // and oddballs. Non-smi numbers and strings still go through the usual |
5670 // slow-case code. | 5667 // slow-case code. |
5671 if (strict_) { | 5668 if (strict_) { |
(...skipping 1294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6966 int CompareStub::MinorKey() { | 6963 int CompareStub::MinorKey() { |
6967 // Encode the two parameters in a unique 16 bit value. | 6964 // Encode the two parameters in a unique 16 bit value. |
6968 ASSERT(static_cast<unsigned>(cc_) < (1 << 15)); | 6965 ASSERT(static_cast<unsigned>(cc_) < (1 << 15)); |
6969 return (static_cast<unsigned>(cc_) << 1) | (strict_ ? 1 : 0); | 6966 return (static_cast<unsigned>(cc_) << 1) | (strict_ ? 1 : 0); |
6970 } | 6967 } |
6971 | 6968 |
6972 | 6969 |
6973 #undef __ | 6970 #undef __ |
6974 | 6971 |
6975 } } // namespace v8::internal | 6972 } } // namespace v8::internal |
OLD | NEW |