| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 3260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3271 if (input_reg.is(result_reg)) { | 3271 if (input_reg.is(result_reg)) { |
| 3272 subp(rsp, Immediate(kDoubleSize)); | 3272 subp(rsp, Immediate(kDoubleSize)); |
| 3273 movsd(MemOperand(rsp, 0), xmm0); | 3273 movsd(MemOperand(rsp, 0), xmm0); |
| 3274 SlowTruncateToI(result_reg, rsp, 0); | 3274 SlowTruncateToI(result_reg, rsp, 0); |
| 3275 addp(rsp, Immediate(kDoubleSize)); | 3275 addp(rsp, Immediate(kDoubleSize)); |
| 3276 } else { | 3276 } else { |
| 3277 SlowTruncateToI(result_reg, input_reg); | 3277 SlowTruncateToI(result_reg, input_reg); |
| 3278 } | 3278 } |
| 3279 | 3279 |
| 3280 bind(&done); | 3280 bind(&done); |
| 3281 // Keep our invariant that the upper 32 bits are zero. |
| 3282 movl(result_reg, result_reg); |
| 3281 } | 3283 } |
| 3282 | 3284 |
| 3283 | 3285 |
| 3284 void MacroAssembler::TruncateDoubleToI(Register result_reg, | 3286 void MacroAssembler::TruncateDoubleToI(Register result_reg, |
| 3285 XMMRegister input_reg) { | 3287 XMMRegister input_reg) { |
| 3286 Label done; | 3288 Label done; |
| 3287 cvttsd2siq(result_reg, input_reg); | 3289 cvttsd2siq(result_reg, input_reg); |
| 3288 cmpq(result_reg, Immediate(1)); | 3290 cmpq(result_reg, Immediate(1)); |
| 3289 j(no_overflow, &done, Label::kNear); | 3291 j(no_overflow, &done, Label::kNear); |
| 3290 | 3292 |
| 3291 subp(rsp, Immediate(kDoubleSize)); | 3293 subp(rsp, Immediate(kDoubleSize)); |
| 3292 movsd(MemOperand(rsp, 0), input_reg); | 3294 movsd(MemOperand(rsp, 0), input_reg); |
| 3293 SlowTruncateToI(result_reg, rsp, 0); | 3295 SlowTruncateToI(result_reg, rsp, 0); |
| 3294 addp(rsp, Immediate(kDoubleSize)); | 3296 addp(rsp, Immediate(kDoubleSize)); |
| 3295 | 3297 |
| 3296 bind(&done); | 3298 bind(&done); |
| 3299 // Keep our invariant that the upper 32 bits are zero. |
| 3300 movl(result_reg, result_reg); |
| 3297 } | 3301 } |
| 3298 | 3302 |
| 3299 | 3303 |
| 3300 void MacroAssembler::DoubleToI(Register result_reg, | 3304 void MacroAssembler::DoubleToI(Register result_reg, |
| 3301 XMMRegister input_reg, | 3305 XMMRegister input_reg, |
| 3302 XMMRegister scratch, | 3306 XMMRegister scratch, |
| 3303 MinusZeroMode minus_zero_mode, | 3307 MinusZeroMode minus_zero_mode, |
| 3304 Label* conversion_failed, | 3308 Label* conversion_failed, |
| 3305 Label::Distance dst) { | 3309 Label::Distance dst) { |
| 3306 cvttsd2si(result_reg, input_reg); | 3310 cvttsd2si(result_reg, input_reg); |
| (...skipping 1844 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5151 if (ms.shift() > 0) sarl(rdx, Immediate(ms.shift())); | 5155 if (ms.shift() > 0) sarl(rdx, Immediate(ms.shift())); |
| 5152 movl(rax, dividend); | 5156 movl(rax, dividend); |
| 5153 shrl(rax, Immediate(31)); | 5157 shrl(rax, Immediate(31)); |
| 5154 addl(rdx, rax); | 5158 addl(rdx, rax); |
| 5155 } | 5159 } |
| 5156 | 5160 |
| 5157 | 5161 |
| 5158 } } // namespace v8::internal | 5162 } } // namespace v8::internal |
| 5159 | 5163 |
| 5160 #endif // V8_TARGET_ARCH_X64 | 5164 #endif // V8_TARGET_ARCH_X64 |
| OLD | NEW |