| 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 2793 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2804 __ movq(kScratchRegister, V8_INT64_C(0x3FE0000000000000), RelocInfo::NONE); | 2804 __ movq(kScratchRegister, V8_INT64_C(0x3FE0000000000000), RelocInfo::NONE); |
| 2805 __ movq(xmm_scratch, kScratchRegister); | 2805 __ movq(xmm_scratch, kScratchRegister); |
| 2806 Label below_half; | 2806 Label below_half; |
| 2807 __ ucomisd(xmm_scratch, input_reg); | 2807 __ ucomisd(xmm_scratch, input_reg); |
| 2808 // If input_reg is NaN, this doesn't jump. | 2808 // If input_reg is NaN, this doesn't jump. |
| 2809 __ j(above, &below_half, Label::kNear); | 2809 __ j(above, &below_half, Label::kNear); |
| 2810 // input = input + 0.5 | 2810 // input = input + 0.5 |
| 2811 // This addition might give a result that isn't the correct for | 2811 // This addition might give a result that isn't the correct for |
| 2812 // rounding, due to loss of precision, but only for a number that's | 2812 // rounding, due to loss of precision, but only for a number that's |
| 2813 // so big that the conversion below will overflow anyway. | 2813 // so big that the conversion below will overflow anyway. |
| 2814 __ addsd(input_reg, xmm_scratch); | 2814 __ addsd(xmm_scratch, input_reg); |
| 2815 // Compute Math.floor(input). | 2815 // Compute Math.floor(input). |
| 2816 // Use truncating instruction (OK because input is positive). | 2816 // Use truncating instruction (OK because input is positive). |
| 2817 __ cvttsd2si(output_reg, input_reg); | 2817 __ cvttsd2si(output_reg, xmm_scratch); |
| 2818 // Overflow is signalled with minint. | 2818 // Overflow is signalled with minint. |
| 2819 __ cmpl(output_reg, Immediate(0x80000000)); | 2819 __ cmpl(output_reg, Immediate(0x80000000)); |
| 2820 DeoptimizeIf(equal, instr->environment()); | 2820 DeoptimizeIf(equal, instr->environment()); |
| 2821 __ jmp(&done); | 2821 __ jmp(&done); |
| 2822 | 2822 |
| 2823 __ bind(&below_half); | 2823 __ bind(&below_half); |
| 2824 if (instr->hydrogen()->CheckFlag(HValue::kBailoutOnMinusZero)) { | 2824 if (instr->hydrogen()->CheckFlag(HValue::kBailoutOnMinusZero)) { |
| 2825 // Bailout if negative (including -0). | 2825 // Bailout if negative (including -0). |
| 2826 __ movq(output_reg, input_reg); | 2826 __ movq(output_reg, input_reg); |
| 2827 __ testq(output_reg, output_reg); | 2827 __ testq(output_reg, output_reg); |
| (...skipping 1484 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4312 RegisterEnvironmentForDeoptimization(environment, Safepoint::kNoLazyDeopt); | 4312 RegisterEnvironmentForDeoptimization(environment, Safepoint::kNoLazyDeopt); |
| 4313 ASSERT(osr_pc_offset_ == -1); | 4313 ASSERT(osr_pc_offset_ == -1); |
| 4314 osr_pc_offset_ = masm()->pc_offset(); | 4314 osr_pc_offset_ = masm()->pc_offset(); |
| 4315 } | 4315 } |
| 4316 | 4316 |
| 4317 #undef __ | 4317 #undef __ |
| 4318 | 4318 |
| 4319 } } // namespace v8::internal | 4319 } } // namespace v8::internal |
| 4320 | 4320 |
| 4321 #endif // V8_TARGET_ARCH_X64 | 4321 #endif // V8_TARGET_ARCH_X64 |
| OLD | NEW |