| 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 2875 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2886 XMMRegister xmm_scratch = xmm0; | 2886 XMMRegister xmm_scratch = xmm0; |
| 2887 Register output_reg = ToRegister(instr->result()); | 2887 Register output_reg = ToRegister(instr->result()); |
| 2888 XMMRegister input_reg = ToDoubleRegister(instr->value()); | 2888 XMMRegister input_reg = ToDoubleRegister(instr->value()); |
| 2889 | 2889 |
| 2890 Label below_half, done; | 2890 Label below_half, done; |
| 2891 // xmm_scratch = 0.5 | 2891 // xmm_scratch = 0.5 |
| 2892 ExternalReference one_half = ExternalReference::address_of_one_half(); | 2892 ExternalReference one_half = ExternalReference::address_of_one_half(); |
| 2893 __ movdbl(xmm_scratch, Operand::StaticVariable(one_half)); | 2893 __ movdbl(xmm_scratch, Operand::StaticVariable(one_half)); |
| 2894 __ ucomisd(xmm_scratch, input_reg); | 2894 __ ucomisd(xmm_scratch, input_reg); |
| 2895 __ j(above, &below_half); | 2895 __ j(above, &below_half); |
| 2896 // input = input + 0.5 | 2896 // xmm_scratch = input + 0.5 |
| 2897 __ addsd(input_reg, xmm_scratch); | 2897 __ addsd(xmm_scratch, input_reg); |
| 2898 | 2898 |
| 2899 // Compute Math.floor(value + 0.5). | 2899 // Compute Math.floor(value + 0.5). |
| 2900 // Use truncating instruction (OK because input is positive). | 2900 // Use truncating instruction (OK because input is positive). |
| 2901 __ cvttsd2si(output_reg, Operand(input_reg)); | 2901 __ cvttsd2si(output_reg, Operand(xmm_scratch)); |
| 2902 | 2902 |
| 2903 // Overflow is signalled with minint. | 2903 // Overflow is signalled with minint. |
| 2904 __ cmp(output_reg, 0x80000000u); | 2904 __ cmp(output_reg, 0x80000000u); |
| 2905 DeoptimizeIf(equal, instr->environment()); | 2905 DeoptimizeIf(equal, instr->environment()); |
| 2906 __ jmp(&done); | 2906 __ jmp(&done); |
| 2907 | 2907 |
| 2908 __ bind(&below_half); | 2908 __ bind(&below_half); |
| 2909 | 2909 |
| 2910 // We return 0 for the input range [+0, 0.5[, or [-0.5, 0.5[ if | 2910 // We return 0 for the input range [+0, 0.5[, or [-0.5, 0.5[ if |
| 2911 // we can ignore the difference between a result of -0 and +0. | 2911 // we can ignore the difference between a result of -0 and +0. |
| (...skipping 1719 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4631 this, pointers, Safepoint::kLazyDeopt); | 4631 this, pointers, Safepoint::kLazyDeopt); |
| 4632 __ InvokeBuiltin(Builtins::IN, CALL_FUNCTION, safepoint_generator); | 4632 __ InvokeBuiltin(Builtins::IN, CALL_FUNCTION, safepoint_generator); |
| 4633 } | 4633 } |
| 4634 | 4634 |
| 4635 | 4635 |
| 4636 #undef __ | 4636 #undef __ |
| 4637 | 4637 |
| 4638 } } // namespace v8::internal | 4638 } } // namespace v8::internal |
| 4639 | 4639 |
| 4640 #endif // V8_TARGET_ARCH_IA32 | 4640 #endif // V8_TARGET_ARCH_IA32 |
| OLD | NEW |