OLD | NEW |
1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 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 11668 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
11679 __ bind(&check_for_nan); | 11679 __ bind(&check_for_nan); |
11680 } | 11680 } |
11681 | 11681 |
11682 // Test for NaN. Sadly, we can't just compare to Factory::nan_value(), | 11682 // Test for NaN. Sadly, we can't just compare to Factory::nan_value(), |
11683 // so we do the second best thing - test it ourselves. | 11683 // so we do the second best thing - test it ourselves. |
11684 // Note: if cc_ != equal, never_nan_nan_ is not used. | 11684 // Note: if cc_ != equal, never_nan_nan_ is not used. |
11685 if (never_nan_nan_ && (cc_ == equal)) { | 11685 if (never_nan_nan_ && (cc_ == equal)) { |
11686 __ Set(eax, Immediate(Smi::FromInt(EQUAL))); | 11686 __ Set(eax, Immediate(Smi::FromInt(EQUAL))); |
11687 __ ret(0); | 11687 __ ret(0); |
11688 } else { | 11688 } else { |
11689 Label return_equal; | |
11690 Label heap_number; | 11689 Label heap_number; |
11691 // If it's not a heap number, then return equal. | |
11692 __ cmp(FieldOperand(edx, HeapObject::kMapOffset), | 11690 __ cmp(FieldOperand(edx, HeapObject::kMapOffset), |
11693 Immediate(Factory::heap_number_map())); | 11691 Immediate(Factory::heap_number_map())); |
11694 __ j(equal, &heap_number); | 11692 if (cc_ == equal) { |
11695 __ bind(&return_equal); | 11693 __ j(equal, &heap_number); |
11696 __ Set(eax, Immediate(Smi::FromInt(EQUAL))); | 11694 // Identical objects are equal for operators ==, !=, and ===. |
11697 __ ret(0); | 11695 __ Set(eax, Immediate(Smi::FromInt(EQUAL))); |
11698 | 11696 __ ret(0); |
| 11697 } else { |
| 11698 // Identical objects must call ToPrimitive for <, <=, >, and >=. |
| 11699 __ j(not_equal, ¬_identical); |
| 11700 } |
11699 __ bind(&heap_number); | 11701 __ bind(&heap_number); |
11700 // It is a heap number, so return non-equal if it's NaN and equal if | 11702 // It is a heap number, so return non-equal if it's NaN and equal if |
11701 // it's not NaN. | 11703 // it's not NaN. |
11702 // The representation of NaN values has all exponent bits (52..62) set, | 11704 // The representation of NaN values has all exponent bits (52..62) set, |
11703 // and not all mantissa bits (0..51) clear. | 11705 // and not all mantissa bits (0..51) clear. |
11704 // We only accept QNaNs, which have bit 51 set. | 11706 // We only accept QNaNs, which have bit 51 set. |
11705 // Read top bits of double representation (second word of value). | 11707 // Read top bits of double representation (second word of value). |
11706 | 11708 |
11707 // Value is a QNaN if value & kQuietNaNMask == kQuietNaNMask, i.e., | 11709 // Value is a QNaN if value & kQuietNaNMask == kQuietNaNMask, i.e., |
11708 // all bits in the mask are set. We only need to check the word | 11710 // all bits in the mask are set. We only need to check the word |
(...skipping 2025 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
13734 masm.GetCode(&desc); | 13736 masm.GetCode(&desc); |
13735 // Call the function from C++. | 13737 // Call the function from C++. |
13736 return FUNCTION_CAST<MemCopyFunction>(buffer); | 13738 return FUNCTION_CAST<MemCopyFunction>(buffer); |
13737 } | 13739 } |
13738 | 13740 |
13739 #undef __ | 13741 #undef __ |
13740 | 13742 |
13741 } } // namespace v8::internal | 13743 } } // namespace v8::internal |
13742 | 13744 |
13743 #endif // V8_TARGET_ARCH_IA32 | 13745 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |