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 906 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
917 int value = source->value(); | 917 int value = source->value(); |
918 if (value == 0) { | 918 if (value == 0) { |
919 xorl(kScratchRegister, kScratchRegister); | 919 xorl(kScratchRegister, kScratchRegister); |
920 return kScratchRegister; | 920 return kScratchRegister; |
921 } | 921 } |
922 LoadSmiConstant(kScratchRegister, source); | 922 LoadSmiConstant(kScratchRegister, source); |
923 return kScratchRegister; | 923 return kScratchRegister; |
924 } | 924 } |
925 | 925 |
926 | 926 |
927 void MacroAssembler::LoadSmiConstant(Register dst, Smi* source) { | 927 void MacroAssembler::LoadSmiConstant(Register dst, Smi* source) { |
Benedikt Meurer
2015/05/08 10:46:31
Hm, we tried that before, see https://codereview.c
| |
928 Move(dst, source, Assembler::RelocInfoNone()); | 928 if (source->value() == 0) { |
929 xorl(dst, dst); | |
930 } else { | |
931 Move(dst, source, Assembler::RelocInfoNone()); | |
932 } | |
929 } | 933 } |
930 | 934 |
931 | 935 |
932 void MacroAssembler::Integer32ToSmi(Register dst, Register src) { | 936 void MacroAssembler::Integer32ToSmi(Register dst, Register src) { |
933 STATIC_ASSERT(kSmiTag == 0); | 937 STATIC_ASSERT(kSmiTag == 0); |
934 if (!dst.is(src)) { | 938 if (!dst.is(src)) { |
935 movl(dst, src); | 939 movl(dst, src); |
936 } | 940 } |
937 shlp(dst, Immediate(kSmiShift)); | 941 shlp(dst, Immediate(kSmiShift)); |
938 } | 942 } |
(...skipping 4151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
5090 if (mag.shift > 0) sarl(rdx, Immediate(mag.shift)); | 5094 if (mag.shift > 0) sarl(rdx, Immediate(mag.shift)); |
5091 movl(rax, dividend); | 5095 movl(rax, dividend); |
5092 shrl(rax, Immediate(31)); | 5096 shrl(rax, Immediate(31)); |
5093 addl(rdx, rax); | 5097 addl(rdx, rax); |
5094 } | 5098 } |
5095 | 5099 |
5096 | 5100 |
5097 } } // namespace v8::internal | 5101 } } // namespace v8::internal |
5098 | 5102 |
5099 #endif // V8_TARGET_ARCH_X64 | 5103 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |