| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #if V8_TARGET_ARCH_IA32 | 5 #if V8_TARGET_ARCH_IA32 |
| 6 | 6 |
| 7 #include "src/base/bits.h" | 7 #include "src/base/bits.h" |
| 8 #include "src/base/division-by-constant.h" | 8 #include "src/base/division-by-constant.h" |
| 9 #include "src/bootstrapper.h" | 9 #include "src/bootstrapper.h" |
| 10 #include "src/codegen.h" | 10 #include "src/codegen.h" |
| (...skipping 569 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 580 call(ces.GetCode(), RelocInfo::DEBUGGER_STATEMENT); | 580 call(ces.GetCode(), RelocInfo::DEBUGGER_STATEMENT); |
| 581 } | 581 } |
| 582 | 582 |
| 583 | 583 |
| 584 void MacroAssembler::Cvtsi2sd(XMMRegister dst, const Operand& src) { | 584 void MacroAssembler::Cvtsi2sd(XMMRegister dst, const Operand& src) { |
| 585 xorps(dst, dst); | 585 xorps(dst, dst); |
| 586 cvtsi2sd(dst, src); | 586 cvtsi2sd(dst, src); |
| 587 } | 587 } |
| 588 | 588 |
| 589 | 589 |
| 590 void MacroAssembler::Cvtui2ss(XMMRegister dst, Register src, Register tmp) { |
| 591 Label msb_set_src; |
| 592 Label jmp_return; |
| 593 test(src, src); |
| 594 j(sign, &msb_set_src, Label::kNear); |
| 595 cvtsi2ss(dst, src); |
| 596 jmp(&jmp_return, Label::kNear); |
| 597 bind(&msb_set_src); |
| 598 mov(tmp, src); |
| 599 shr(src, 1); |
| 600 // Recover the least significant bit to avoid rounding errors. |
| 601 and_(tmp, Immediate(1)); |
| 602 or_(src, tmp); |
| 603 cvtsi2ss(dst, src); |
| 604 addss(dst, dst); |
| 605 bind(&jmp_return); |
| 606 } |
| 607 |
| 608 |
| 590 bool MacroAssembler::IsUnsafeImmediate(const Immediate& x) { | 609 bool MacroAssembler::IsUnsafeImmediate(const Immediate& x) { |
| 591 static const int kMaxImmediateBits = 17; | 610 static const int kMaxImmediateBits = 17; |
| 592 if (!RelocInfo::IsNone(x.rmode_)) return false; | 611 if (!RelocInfo::IsNone(x.rmode_)) return false; |
| 593 return !is_intn(x.x_, kMaxImmediateBits); | 612 return !is_intn(x.x_, kMaxImmediateBits); |
| 594 } | 613 } |
| 595 | 614 |
| 596 | 615 |
| 597 void MacroAssembler::SafeMove(Register dst, const Immediate& x) { | 616 void MacroAssembler::SafeMove(Register dst, const Immediate& x) { |
| 598 if (IsUnsafeImmediate(x) && jit_cookie() != 0) { | 617 if (IsUnsafeImmediate(x) && jit_cookie() != 0) { |
| 599 Move(dst, Immediate(x.x_ ^ jit_cookie())); | 618 Move(dst, Immediate(x.x_ ^ jit_cookie())); |
| (...skipping 2504 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3104 mov(eax, dividend); | 3123 mov(eax, dividend); |
| 3105 shr(eax, 31); | 3124 shr(eax, 31); |
| 3106 add(edx, eax); | 3125 add(edx, eax); |
| 3107 } | 3126 } |
| 3108 | 3127 |
| 3109 | 3128 |
| 3110 } // namespace internal | 3129 } // namespace internal |
| 3111 } // namespace v8 | 3130 } // namespace v8 |
| 3112 | 3131 |
| 3113 #endif // V8_TARGET_ARCH_IA32 | 3132 #endif // V8_TARGET_ARCH_IA32 |
| OLD | NEW |