| 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 2741 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2752 __ Integer32ToSmi(input_reg, input_reg); | 2752 __ Integer32ToSmi(input_reg, input_reg); |
| 2753 __ bind(deferred->exit()); | 2753 __ bind(deferred->exit()); |
| 2754 } | 2754 } |
| 2755 } | 2755 } |
| 2756 | 2756 |
| 2757 | 2757 |
| 2758 void LCodeGen::DoMathFloor(LUnaryMathOperation* instr) { | 2758 void LCodeGen::DoMathFloor(LUnaryMathOperation* instr) { |
| 2759 XMMRegister xmm_scratch = xmm0; | 2759 XMMRegister xmm_scratch = xmm0; |
| 2760 Register output_reg = ToRegister(instr->result()); | 2760 Register output_reg = ToRegister(instr->result()); |
| 2761 XMMRegister input_reg = ToDoubleRegister(instr->InputAt(0)); | 2761 XMMRegister input_reg = ToDoubleRegister(instr->InputAt(0)); |
| 2762 Label done; |
| 2762 | 2763 |
| 2763 if (CpuFeatures::IsSupported(SSE4_1)) { | 2764 if (CpuFeatures::IsSupported(SSE4_1)) { |
| 2764 CpuFeatures::Scope scope(SSE4_1); | 2765 CpuFeatures::Scope scope(SSE4_1); |
| 2765 if (instr->hydrogen()->CheckFlag(HValue::kBailoutOnMinusZero)) { | 2766 if (instr->hydrogen()->CheckFlag(HValue::kBailoutOnMinusZero)) { |
| 2766 // Deoptimize if minus zero. | 2767 // Deoptimize if minus zero. |
| 2767 __ movq(output_reg, input_reg); | 2768 __ movq(output_reg, input_reg); |
| 2768 __ subq(output_reg, Immediate(1)); | 2769 __ subq(output_reg, Immediate(1)); |
| 2769 DeoptimizeIf(overflow, instr->environment()); | 2770 DeoptimizeIf(overflow, instr->environment()); |
| 2770 } | 2771 } |
| 2771 __ roundsd(xmm_scratch, input_reg, Assembler::kRoundDown); | 2772 __ roundsd(xmm_scratch, input_reg, Assembler::kRoundDown); |
| 2772 __ cvttsd2si(output_reg, xmm_scratch); | 2773 __ cvttsd2si(output_reg, xmm_scratch); |
| 2773 __ cmpl(output_reg, Immediate(0x80000000)); | 2774 __ cmpl(output_reg, Immediate(0x80000000)); |
| 2774 DeoptimizeIf(equal, instr->environment()); | 2775 DeoptimizeIf(equal, instr->environment()); |
| 2775 } else { | 2776 } else { |
| 2776 // Deoptimize on negative inputs. | 2777 // Deoptimize on negative inputs. |
| 2777 __ xorps(xmm_scratch, xmm_scratch); // Zero the register. | 2778 __ xorps(xmm_scratch, xmm_scratch); // Zero the register. |
| 2778 __ ucomisd(input_reg, xmm_scratch); | 2779 __ ucomisd(input_reg, xmm_scratch); |
| 2779 DeoptimizeIf(below, instr->environment()); | 2780 DeoptimizeIf(below, instr->environment()); |
| 2780 if (instr->hydrogen()->CheckFlag(HValue::kBailoutOnMinusZero)) { | 2781 if (instr->hydrogen()->CheckFlag(HValue::kBailoutOnMinusZero)) { |
| 2781 // Check for negative zero. | 2782 // Check for negative zero. |
| 2783 Label positive_sign; |
| 2782 __ j(above, &positive_sign, Label::kNear); | 2784 __ j(above, &positive_sign, Label::kNear); |
| 2783 __ movmskpd(output_reg, input_reg); | 2785 __ movmskpd(output_reg, input_reg); |
| 2784 __ testq(output_reg, Immediate(1)); | 2786 __ testq(output_reg, Immediate(1)); |
| 2785 DeoptimizeIf(not_zero, instr->environment()); | 2787 DeoptimizeIf(not_zero, instr->environment()); |
| 2786 __ Set(output_reg, Immediate(0)); | 2788 __ Set(output_reg, 0); |
| 2787 __ jmp(&done); | 2789 __ jmp(&done); |
| 2788 __ bind(&positive_sign); | 2790 __ bind(&positive_sign); |
| 2789 } | 2791 } |
| 2790 | 2792 |
| 2791 // Use truncating instruction (OK because input is positive). | 2793 // Use truncating instruction (OK because input is positive). |
| 2792 __ cvttsd2si(output_reg, input_reg); | 2794 __ cvttsd2si(output_reg, input_reg); |
| 2793 | 2795 |
| 2794 // Overflow is signalled with minint. | 2796 // Overflow is signalled with minint. |
| 2795 __ cmpl(output_reg, Immediate(0x80000000)); | 2797 __ cmpl(output_reg, Immediate(0x80000000)); |
| 2796 DeoptimizeIf(equal, instr->environment()); | 2798 DeoptimizeIf(equal, instr->environment()); |
| (...skipping 1400 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4197 RegisterEnvironmentForDeoptimization(environment); | 4199 RegisterEnvironmentForDeoptimization(environment); |
| 4198 ASSERT(osr_pc_offset_ == -1); | 4200 ASSERT(osr_pc_offset_ == -1); |
| 4199 osr_pc_offset_ = masm()->pc_offset(); | 4201 osr_pc_offset_ = masm()->pc_offset(); |
| 4200 } | 4202 } |
| 4201 | 4203 |
| 4202 #undef __ | 4204 #undef __ |
| 4203 | 4205 |
| 4204 } } // namespace v8::internal | 4206 } } // namespace v8::internal |
| 4205 | 4207 |
| 4206 #endif // V8_TARGET_ARCH_X64 | 4208 #endif // V8_TARGET_ARCH_X64 |
| OLD | NEW |