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/base/utils/random-number-generator.h" | 9 #include "src/base/utils/random-number-generator.h" |
10 #include "src/bootstrapper.h" | 10 #include "src/bootstrapper.h" |
(...skipping 725 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
736 test(ecx, Immediate(0x20)); | 736 test(ecx, Immediate(0x20)); |
737 j(equal, &done, Label::kNear); | 737 j(equal, &done, Label::kNear); |
738 mov(low, high); | 738 mov(low, high); |
739 sar(high, 31); | 739 sar(high, 31); |
740 bind(&done); | 740 bind(&done); |
741 } | 741 } |
742 | 742 |
743 bool MacroAssembler::IsUnsafeImmediate(const Immediate& x) { | 743 bool MacroAssembler::IsUnsafeImmediate(const Immediate& x) { |
744 static const int kMaxImmediateBits = 17; | 744 static const int kMaxImmediateBits = 17; |
745 if (!RelocInfo::IsNone(x.rmode_)) return false; | 745 if (!RelocInfo::IsNone(x.rmode_)) return false; |
746 return !is_intn(x.x_, kMaxImmediateBits); | 746 return !is_intn(x.immediate(), kMaxImmediateBits); |
747 } | 747 } |
748 | 748 |
749 | 749 |
750 void MacroAssembler::SafeMove(Register dst, const Immediate& x) { | 750 void MacroAssembler::SafeMove(Register dst, const Immediate& x) { |
751 if (IsUnsafeImmediate(x) && jit_cookie() != 0) { | 751 if (IsUnsafeImmediate(x) && jit_cookie() != 0) { |
752 Move(dst, Immediate(x.x_ ^ jit_cookie())); | 752 Move(dst, Immediate(x.immediate() ^ jit_cookie())); |
753 xor_(dst, jit_cookie()); | 753 xor_(dst, jit_cookie()); |
754 } else { | 754 } else { |
755 Move(dst, x); | 755 Move(dst, x); |
756 } | 756 } |
757 } | 757 } |
758 | 758 |
759 | 759 |
760 void MacroAssembler::SafePush(const Immediate& x) { | 760 void MacroAssembler::SafePush(const Immediate& x) { |
761 if (IsUnsafeImmediate(x) && jit_cookie() != 0) { | 761 if (IsUnsafeImmediate(x) && jit_cookie() != 0) { |
762 push(Immediate(x.x_ ^ jit_cookie())); | 762 push(Immediate(x.immediate() ^ jit_cookie())); |
763 xor_(Operand(esp, 0), Immediate(jit_cookie())); | 763 xor_(Operand(esp, 0), Immediate(jit_cookie())); |
764 } else { | 764 } else { |
765 push(x); | 765 push(x); |
766 } | 766 } |
767 } | 767 } |
768 | 768 |
769 | 769 |
770 void MacroAssembler::CmpObjectType(Register heap_object, | 770 void MacroAssembler::CmpObjectType(Register heap_object, |
771 InstanceType type, | 771 InstanceType type, |
772 Register map) { | 772 Register map) { |
(...skipping 1272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2045 | 2045 |
2046 | 2046 |
2047 void MacroAssembler::Move(Register dst, Register src) { | 2047 void MacroAssembler::Move(Register dst, Register src) { |
2048 if (!dst.is(src)) { | 2048 if (!dst.is(src)) { |
2049 mov(dst, src); | 2049 mov(dst, src); |
2050 } | 2050 } |
2051 } | 2051 } |
2052 | 2052 |
2053 | 2053 |
2054 void MacroAssembler::Move(Register dst, const Immediate& x) { | 2054 void MacroAssembler::Move(Register dst, const Immediate& x) { |
2055 if (x.is_zero() && RelocInfo::IsNone(x.rmode_)) { | 2055 if (!x.is_heap_number() && x.is_zero() && RelocInfo::IsNone(x.rmode_)) { |
2056 xor_(dst, dst); // Shorter than mov of 32-bit immediate 0. | 2056 xor_(dst, dst); // Shorter than mov of 32-bit immediate 0. |
2057 } else { | 2057 } else { |
2058 mov(dst, x); | 2058 mov(dst, x); |
2059 } | 2059 } |
2060 } | 2060 } |
2061 | 2061 |
2062 | 2062 |
2063 void MacroAssembler::Move(const Operand& dst, const Immediate& x) { | 2063 void MacroAssembler::Move(const Operand& dst, const Immediate& x) { |
2064 mov(dst, x); | 2064 mov(dst, x); |
2065 } | 2065 } |
(...skipping 712 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2778 mov(eax, dividend); | 2778 mov(eax, dividend); |
2779 shr(eax, 31); | 2779 shr(eax, 31); |
2780 add(edx, eax); | 2780 add(edx, eax); |
2781 } | 2781 } |
2782 | 2782 |
2783 | 2783 |
2784 } // namespace internal | 2784 } // namespace internal |
2785 } // namespace v8 | 2785 } // namespace v8 |
2786 | 2786 |
2787 #endif // V8_TARGET_ARCH_IA32 | 2787 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |