| 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 664 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 675 } | 675 } |
| 676 | 676 |
| 677 void MacroAssembler::DebugBreak() { | 677 void MacroAssembler::DebugBreak() { |
| 678 Move(eax, Immediate(0)); | 678 Move(eax, Immediate(0)); |
| 679 mov(ebx, Immediate(ExternalReference(Runtime::kHandleDebuggerStatement, | 679 mov(ebx, Immediate(ExternalReference(Runtime::kHandleDebuggerStatement, |
| 680 isolate()))); | 680 isolate()))); |
| 681 CEntryStub ces(isolate(), 1); | 681 CEntryStub ces(isolate(), 1); |
| 682 call(ces.GetCode(), RelocInfo::DEBUGGER_STATEMENT); | 682 call(ces.GetCode(), RelocInfo::DEBUGGER_STATEMENT); |
| 683 } | 683 } |
| 684 | 684 |
| 685 | |
| 686 void MacroAssembler::Cvtsi2sd(XMMRegister dst, const Operand& src) { | 685 void MacroAssembler::Cvtsi2sd(XMMRegister dst, const Operand& src) { |
| 687 xorps(dst, dst); | 686 xorps(dst, dst); |
| 688 cvtsi2sd(dst, src); | 687 cvtsi2sd(dst, src); |
| 689 } | 688 } |
| 690 | 689 |
| 691 | 690 |
| 692 void MacroAssembler::Cvtui2ss(XMMRegister dst, Register src, Register tmp) { | 691 void MacroAssembler::Cvtui2ss(XMMRegister dst, Register src, Register tmp) { |
| 693 Label msb_set_src; | 692 Label msb_set_src; |
| 694 Label jmp_return; | 693 Label jmp_return; |
| 695 test(src, src); | 694 test(src, src); |
| 696 j(sign, &msb_set_src, Label::kNear); | 695 j(sign, &msb_set_src, Label::kNear); |
| 697 cvtsi2ss(dst, src); | 696 cvtsi2ss(dst, src); |
| 698 jmp(&jmp_return, Label::kNear); | 697 jmp(&jmp_return, Label::kNear); |
| 699 bind(&msb_set_src); | 698 bind(&msb_set_src); |
| 700 mov(tmp, src); | 699 mov(tmp, src); |
| 701 shr(src, 1); | 700 shr(src, 1); |
| 702 // Recover the least significant bit to avoid rounding errors. | 701 // Recover the least significant bit to avoid rounding errors. |
| 703 and_(tmp, Immediate(1)); | 702 and_(tmp, Immediate(1)); |
| 704 or_(src, tmp); | 703 or_(src, tmp); |
| 705 cvtsi2ss(dst, src); | 704 cvtsi2ss(dst, src); |
| 706 addss(dst, dst); | 705 addss(dst, dst); |
| 707 bind(&jmp_return); | 706 bind(&jmp_return); |
| 708 } | 707 } |
| 709 | 708 |
| 709 void MacroAssembler::PairShl(Register dst, Register src, uint8_t shift) { |
| 710 if (shift >= 32) { |
| 711 mov(dst, src); |
| 712 shl(dst, shift - 32); |
| 713 xor_(src, src); |
| 714 } else { |
| 715 shld(dst, src, shift); |
| 716 shl(src, shift); |
| 717 } |
| 718 } |
| 719 |
| 720 void MacroAssembler::PairShl_cl(Register dst, Register src) { |
| 721 shld_cl(dst, src); |
| 722 shl_cl(src); |
| 723 Label done; |
| 724 test(ecx, Immediate(0x20)); |
| 725 j(equal, &done, Label::kNear); |
| 726 mov(dst, src); |
| 727 xor_(src, src); |
| 728 bind(&done); |
| 729 } |
| 710 | 730 |
| 711 bool MacroAssembler::IsUnsafeImmediate(const Immediate& x) { | 731 bool MacroAssembler::IsUnsafeImmediate(const Immediate& x) { |
| 712 static const int kMaxImmediateBits = 17; | 732 static const int kMaxImmediateBits = 17; |
| 713 if (!RelocInfo::IsNone(x.rmode_)) return false; | 733 if (!RelocInfo::IsNone(x.rmode_)) return false; |
| 714 return !is_intn(x.x_, kMaxImmediateBits); | 734 return !is_intn(x.x_, kMaxImmediateBits); |
| 715 } | 735 } |
| 716 | 736 |
| 717 | 737 |
| 718 void MacroAssembler::SafeMove(Register dst, const Immediate& x) { | 738 void MacroAssembler::SafeMove(Register dst, const Immediate& x) { |
| 719 if (IsUnsafeImmediate(x) && jit_cookie() != 0) { | 739 if (IsUnsafeImmediate(x) && jit_cookie() != 0) { |
| (...skipping 2510 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3230 mov(eax, dividend); | 3250 mov(eax, dividend); |
| 3231 shr(eax, 31); | 3251 shr(eax, 31); |
| 3232 add(edx, eax); | 3252 add(edx, eax); |
| 3233 } | 3253 } |
| 3234 | 3254 |
| 3235 | 3255 |
| 3236 } // namespace internal | 3256 } // namespace internal |
| 3237 } // namespace v8 | 3257 } // namespace v8 |
| 3238 | 3258 |
| 3239 #endif // V8_TARGET_ARCH_IA32 | 3259 #endif // V8_TARGET_ARCH_IA32 |
| OLD | NEW |