OLD | NEW |
1 // Copyright 2006-2009 the V8 project authors. All rights reserved. | 1 // Copyright 2006-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 7382 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7393 __ j(equal, &heap_number); | 7393 __ j(equal, &heap_number); |
7394 __ bind(&return_equal); | 7394 __ bind(&return_equal); |
7395 __ Set(eax, Immediate(0)); | 7395 __ Set(eax, Immediate(0)); |
7396 __ ret(0); | 7396 __ ret(0); |
7397 | 7397 |
7398 __ bind(&heap_number); | 7398 __ bind(&heap_number); |
7399 // It is a heap number, so return non-equal if it's NaN and equal if it's | 7399 // It is a heap number, so return non-equal if it's NaN and equal if it's |
7400 // not NaN. | 7400 // not NaN. |
7401 // The representation of NaN values has all exponent bits (52..62) set, | 7401 // The representation of NaN values has all exponent bits (52..62) set, |
7402 // and not all mantissa bits (0..51) clear. | 7402 // and not all mantissa bits (0..51) clear. |
| 7403 // We only accept QNaNs, which have bit 51 set. |
7403 // Read top bits of double representation (second word of value). | 7404 // Read top bits of double representation (second word of value). |
7404 __ mov(eax, FieldOperand(edx, HeapNumber::kExponentOffset)); | |
7405 // Test that exponent bits are all set. | |
7406 __ not_(eax); | |
7407 __ test(eax, Immediate(0x7ff00000)); | |
7408 __ j(not_zero, &return_equal); | |
7409 __ not_(eax); | |
7410 | 7405 |
7411 // Shift out flag and all exponent bits, retaining only mantissa. | 7406 // Value is a QNaN if value & kQuietNaNMask == kQuietNaNMask, i.e., |
7412 __ shl(eax, 12); | 7407 // all bits in the mask are set. We only need to check the word |
7413 // Or with all low-bits of mantissa. | 7408 // that contains the exponent and high bit of the mantissa. |
7414 __ or_(eax, FieldOperand(edx, HeapNumber::kMantissaOffset)); | 7409 ASSERT_NE(0, (kQuietNaNHighBitsMask << 1) & 0x80000000u); |
7415 // Return zero equal if all bits in mantissa is zero (it's an Infinity) | 7410 __ mov(edx, FieldOperand(edx, HeapNumber::kExponentOffset)); |
7416 // and non-zero if not (it's a NaN). | 7411 __ xor_(eax, Operand(eax)); |
| 7412 // Shift value and mask so kQuietNaNHighBitsMask applies to topmost bits. |
| 7413 __ add(edx, Operand(edx)); |
| 7414 __ cmp(edx, kQuietNaNHighBitsMask << 1); |
| 7415 __ setcc(above_equal, eax); |
7417 __ ret(0); | 7416 __ ret(0); |
7418 | 7417 |
7419 __ bind(¬_identical); | 7418 __ bind(¬_identical); |
7420 } | 7419 } |
7421 | 7420 |
7422 // If we're doing a strict equality comparison, we don't have to do | 7421 // If we're doing a strict equality comparison, we don't have to do |
7423 // type conversion, so we generate code to do fast comparison for objects | 7422 // type conversion, so we generate code to do fast comparison for objects |
7424 // and oddballs. Non-smi numbers and strings still go through the usual | 7423 // and oddballs. Non-smi numbers and strings still go through the usual |
7425 // slow-case code. | 7424 // slow-case code. |
7426 if (strict_) { | 7425 if (strict_) { |
(...skipping 641 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8068 | 8067 |
8069 int CompareStub::MinorKey() { | 8068 int CompareStub::MinorKey() { |
8070 // Encode the two parameters in a unique 16 bit value. | 8069 // Encode the two parameters in a unique 16 bit value. |
8071 ASSERT(static_cast<unsigned>(cc_) < (1 << 15)); | 8070 ASSERT(static_cast<unsigned>(cc_) < (1 << 15)); |
8072 return (static_cast<unsigned>(cc_) << 1) | (strict_ ? 1 : 0); | 8071 return (static_cast<unsigned>(cc_) << 1) | (strict_ ? 1 : 0); |
8073 } | 8072 } |
8074 | 8073 |
8075 #undef __ | 8074 #undef __ |
8076 | 8075 |
8077 } } // namespace v8::internal | 8076 } } // namespace v8::internal |
OLD | NEW |