| 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 #include "src/v8.h" | 5 #include "src/v8.h" |
| 6 | 6 |
| 7 #if V8_TARGET_ARCH_X64 | 7 #if V8_TARGET_ARCH_X64 |
| 8 | 8 |
| 9 #include "src/base/bits.h" | 9 #include "src/base/bits.h" |
| 10 #include "src/base/division-by-constant.h" | 10 #include "src/base/division-by-constant.h" |
| (...skipping 897 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 908 Push(Immediate(value ^ jit_cookie())); | 908 Push(Immediate(value ^ jit_cookie())); |
| 909 xorp(Operand(rsp, 0), Immediate(jit_cookie())); | 909 xorp(Operand(rsp, 0), Immediate(jit_cookie())); |
| 910 } | 910 } |
| 911 } else { | 911 } else { |
| 912 Push(src); | 912 Push(src); |
| 913 } | 913 } |
| 914 } | 914 } |
| 915 | 915 |
| 916 | 916 |
| 917 Register MacroAssembler::GetSmiConstant(Smi* source) { | 917 Register MacroAssembler::GetSmiConstant(Smi* source) { |
| 918 STATIC_ASSERT(kSmiTag == 0); | |
| 919 int value = source->value(); | 918 int value = source->value(); |
| 920 if (value == 0) { | 919 if (value == 0) { |
| 921 xorl(kScratchRegister, kScratchRegister); | 920 xorl(kScratchRegister, kScratchRegister); |
| 922 return kScratchRegister; | 921 return kScratchRegister; |
| 923 } | 922 } |
| 924 LoadSmiConstant(kScratchRegister, source); | 923 LoadSmiConstant(kScratchRegister, source); |
| 925 return kScratchRegister; | 924 return kScratchRegister; |
| 926 } | 925 } |
| 927 | 926 |
| 928 | 927 |
| 929 void MacroAssembler::LoadSmiConstant(Register dst, Smi* source) { | 928 void MacroAssembler::LoadSmiConstant(Register dst, Smi* source) { |
| 930 STATIC_ASSERT(kSmiTag == 0); | 929 Move(dst, source, Assembler::RelocInfoNone()); |
| 931 int value = source->value(); | |
| 932 if (value == 0) { | |
| 933 xorl(dst, dst); | |
| 934 } else { | |
| 935 Move(dst, source, Assembler::RelocInfoNone()); | |
| 936 } | |
| 937 } | 930 } |
| 938 | 931 |
| 939 | 932 |
| 940 void MacroAssembler::Integer32ToSmi(Register dst, Register src) { | 933 void MacroAssembler::Integer32ToSmi(Register dst, Register src) { |
| 941 STATIC_ASSERT(kSmiTag == 0); | 934 STATIC_ASSERT(kSmiTag == 0); |
| 942 if (!dst.is(src)) { | 935 if (!dst.is(src)) { |
| 943 movl(dst, src); | 936 movl(dst, src); |
| 944 } | 937 } |
| 945 shlp(dst, Immediate(kSmiShift)); | 938 shlp(dst, Immediate(kSmiShift)); |
| 946 } | 939 } |
| (...skipping 4151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5098 if (mag.shift > 0) sarl(rdx, Immediate(mag.shift)); | 5091 if (mag.shift > 0) sarl(rdx, Immediate(mag.shift)); |
| 5099 movl(rax, dividend); | 5092 movl(rax, dividend); |
| 5100 shrl(rax, Immediate(31)); | 5093 shrl(rax, Immediate(31)); |
| 5101 addl(rdx, rax); | 5094 addl(rdx, rax); |
| 5102 } | 5095 } |
| 5103 | 5096 |
| 5104 | 5097 |
| 5105 } } // namespace v8::internal | 5098 } } // namespace v8::internal |
| 5106 | 5099 |
| 5107 #endif // V8_TARGET_ARCH_X64 | 5100 #endif // V8_TARGET_ARCH_X64 |
| OLD | NEW |