| 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 2752 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2763 XMMRegister xmm_scratch = xmm0; | 2763 XMMRegister xmm_scratch = xmm0; |
| 2764 Register output_reg = ToRegister(instr->result()); | 2764 Register output_reg = ToRegister(instr->result()); |
| 2765 XMMRegister input_reg = ToDoubleRegister(instr->value()); | 2765 XMMRegister input_reg = ToDoubleRegister(instr->value()); |
| 2766 | 2766 |
| 2767 Label below_half, done; | 2767 Label below_half, done; |
| 2768 // xmm_scratch = 0.5 | 2768 // xmm_scratch = 0.5 |
| 2769 ExternalReference one_half = ExternalReference::address_of_one_half(); | 2769 ExternalReference one_half = ExternalReference::address_of_one_half(); |
| 2770 __ movdbl(xmm_scratch, Operand::StaticVariable(one_half)); | 2770 __ movdbl(xmm_scratch, Operand::StaticVariable(one_half)); |
| 2771 __ ucomisd(xmm_scratch, input_reg); | 2771 __ ucomisd(xmm_scratch, input_reg); |
| 2772 __ j(above, &below_half); | 2772 __ j(above, &below_half); |
| 2773 // input = input + 0.5 | 2773 // xmm_scratch = input + 0.5 |
| 2774 __ addsd(input_reg, xmm_scratch); | 2774 __ addsd(xmm_scratch, input_reg); |
| 2775 | 2775 |
| 2776 // Compute Math.floor(value + 0.5). | 2776 // Compute Math.floor(value + 0.5). |
| 2777 // Use truncating instruction (OK because input is positive). | 2777 // Use truncating instruction (OK because input is positive). |
| 2778 __ cvttsd2si(output_reg, Operand(input_reg)); | 2778 __ cvttsd2si(output_reg, Operand(xmm_scratch)); |
| 2779 | 2779 |
| 2780 // Overflow is signalled with minint. | 2780 // Overflow is signalled with minint. |
| 2781 __ cmp(output_reg, 0x80000000u); | 2781 __ cmp(output_reg, 0x80000000u); |
| 2782 DeoptimizeIf(equal, instr->environment()); | 2782 DeoptimizeIf(equal, instr->environment()); |
| 2783 __ jmp(&done); | 2783 __ jmp(&done); |
| 2784 | 2784 |
| 2785 __ bind(&below_half); | 2785 __ bind(&below_half); |
| 2786 | 2786 |
| 2787 // We return 0 for the input range [+0, 0.5[, or [-0.5, 0.5[ if | 2787 // We return 0 for the input range [+0, 0.5[, or [-0.5, 0.5[ if |
| 2788 // we can ignore the difference between a result of -0 and +0. | 2788 // we can ignore the difference between a result of -0 and +0. |
| (...skipping 1589 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4378 env->deoptimization_index()); | 4378 env->deoptimization_index()); |
| 4379 __ InvokeBuiltin(Builtins::IN, CALL_FUNCTION, safepoint_generator); | 4379 __ InvokeBuiltin(Builtins::IN, CALL_FUNCTION, safepoint_generator); |
| 4380 } | 4380 } |
| 4381 | 4381 |
| 4382 | 4382 |
| 4383 #undef __ | 4383 #undef __ |
| 4384 | 4384 |
| 4385 } } // namespace v8::internal | 4385 } } // namespace v8::internal |
| 4386 | 4386 |
| 4387 #endif // V8_TARGET_ARCH_IA32 | 4387 #endif // V8_TARGET_ARCH_IA32 |
| OLD | NEW |