| OLD | NEW |
| 1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 2754 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2765 __ movq(kScratchRegister, V8_INT64_C(0x3FE0000000000000), RelocInfo::NONE); | 2765 __ movq(kScratchRegister, V8_INT64_C(0x3FE0000000000000), RelocInfo::NONE); |
| 2766 __ movq(xmm_scratch, kScratchRegister); | 2766 __ movq(xmm_scratch, kScratchRegister); |
| 2767 Label below_half; | 2767 Label below_half; |
| 2768 __ ucomisd(xmm_scratch, input_reg); | 2768 __ ucomisd(xmm_scratch, input_reg); |
| 2769 // If input_reg is NaN, this doesn't jump. | 2769 // If input_reg is NaN, this doesn't jump. |
| 2770 __ j(above, &below_half, Label::kNear); | 2770 __ j(above, &below_half, Label::kNear); |
| 2771 // input = input + 0.5 | 2771 // input = input + 0.5 |
| 2772 // This addition might give a result that isn't the correct for | 2772 // This addition might give a result that isn't the correct for |
| 2773 // rounding, due to loss of precision, but only for a number that's | 2773 // rounding, due to loss of precision, but only for a number that's |
| 2774 // so big that the conversion below will overflow anyway. | 2774 // so big that the conversion below will overflow anyway. |
| 2775 __ addsd(input_reg, xmm_scratch); | 2775 __ addsd(xmm_scratch, input_reg); |
| 2776 // Compute Math.floor(input). | 2776 // Compute Math.floor(input). |
| 2777 // Use truncating instruction (OK because input is positive). | 2777 // Use truncating instruction (OK because input is positive). |
| 2778 __ cvttsd2si(output_reg, input_reg); | 2778 __ cvttsd2si(output_reg, xmm_scratch); |
| 2779 // Overflow is signalled with minint. | 2779 // Overflow is signalled with minint. |
| 2780 __ cmpl(output_reg, Immediate(0x80000000)); | 2780 __ cmpl(output_reg, Immediate(0x80000000)); |
| 2781 DeoptimizeIf(equal, instr->environment()); | 2781 DeoptimizeIf(equal, instr->environment()); |
| 2782 __ jmp(&done); | 2782 __ jmp(&done); |
| 2783 | 2783 |
| 2784 __ bind(&below_half); | 2784 __ bind(&below_half); |
| 2785 if (instr->hydrogen()->CheckFlag(HValue::kBailoutOnMinusZero)) { | 2785 if (instr->hydrogen()->CheckFlag(HValue::kBailoutOnMinusZero)) { |
| 2786 // Bailout if negative (including -0). | 2786 // Bailout if negative (including -0). |
| 2787 __ movq(output_reg, input_reg); | 2787 __ movq(output_reg, input_reg); |
| 2788 __ testq(output_reg, output_reg); | 2788 __ testq(output_reg, output_reg); |
| (...skipping 1357 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4146 RegisterEnvironmentForDeoptimization(environment); | 4146 RegisterEnvironmentForDeoptimization(environment); |
| 4147 ASSERT(osr_pc_offset_ == -1); | 4147 ASSERT(osr_pc_offset_ == -1); |
| 4148 osr_pc_offset_ = masm()->pc_offset(); | 4148 osr_pc_offset_ = masm()->pc_offset(); |
| 4149 } | 4149 } |
| 4150 | 4150 |
| 4151 #undef __ | 4151 #undef __ |
| 4152 | 4152 |
| 4153 } } // namespace v8::internal | 4153 } } // namespace v8::internal |
| 4154 | 4154 |
| 4155 #endif // V8_TARGET_ARCH_X64 | 4155 #endif // V8_TARGET_ARCH_X64 |
| OLD | NEW |