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_X64 | 5 #if V8_TARGET_ARCH_X64 |
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 1082 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1093 Push(Immediate(value ^ jit_cookie())); | 1093 Push(Immediate(value ^ jit_cookie())); |
1094 xorp(Operand(rsp, 0), Immediate(jit_cookie())); | 1094 xorp(Operand(rsp, 0), Immediate(jit_cookie())); |
1095 } | 1095 } |
1096 } else { | 1096 } else { |
1097 Push(src); | 1097 Push(src); |
1098 } | 1098 } |
1099 } | 1099 } |
1100 | 1100 |
1101 | 1101 |
1102 Register MacroAssembler::GetSmiConstant(Smi* source) { | 1102 Register MacroAssembler::GetSmiConstant(Smi* source) { |
| 1103 STATIC_ASSERT(kSmiTag == 0); |
1103 int value = source->value(); | 1104 int value = source->value(); |
1104 if (value == 0) { | 1105 if (value == 0) { |
1105 xorl(kScratchRegister, kScratchRegister); | 1106 xorl(kScratchRegister, kScratchRegister); |
1106 return kScratchRegister; | 1107 return kScratchRegister; |
1107 } | 1108 } |
1108 LoadSmiConstant(kScratchRegister, source); | 1109 LoadSmiConstant(kScratchRegister, source); |
1109 return kScratchRegister; | 1110 return kScratchRegister; |
1110 } | 1111 } |
1111 | 1112 |
1112 | 1113 |
1113 void MacroAssembler::LoadSmiConstant(Register dst, Smi* source) { | 1114 void MacroAssembler::LoadSmiConstant(Register dst, Smi* source) { |
1114 // Special-casing 0 here to use xorl seems to make things slower, so we don't | 1115 STATIC_ASSERT(kSmiTag == 0); |
1115 // do it. | 1116 int value = source->value(); |
1116 Move(dst, source, Assembler::RelocInfoNone()); | 1117 if (value == 0) { |
| 1118 xorl(dst, dst); |
| 1119 } else { |
| 1120 Move(dst, source, Assembler::RelocInfoNone()); |
| 1121 } |
1117 } | 1122 } |
1118 | 1123 |
1119 | 1124 |
1120 void MacroAssembler::Integer32ToSmi(Register dst, Register src) { | 1125 void MacroAssembler::Integer32ToSmi(Register dst, Register src) { |
1121 STATIC_ASSERT(kSmiTag == 0); | 1126 STATIC_ASSERT(kSmiTag == 0); |
1122 if (!dst.is(src)) { | 1127 if (!dst.is(src)) { |
1123 movl(dst, src); | 1128 movl(dst, src); |
1124 } | 1129 } |
1125 shlp(dst, Immediate(kSmiShift)); | 1130 shlp(dst, Immediate(kSmiShift)); |
1126 } | 1131 } |
(...skipping 4425 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5552 movl(rax, dividend); | 5557 movl(rax, dividend); |
5553 shrl(rax, Immediate(31)); | 5558 shrl(rax, Immediate(31)); |
5554 addl(rdx, rax); | 5559 addl(rdx, rax); |
5555 } | 5560 } |
5556 | 5561 |
5557 | 5562 |
5558 } // namespace internal | 5563 } // namespace internal |
5559 } // namespace v8 | 5564 } // namespace v8 |
5560 | 5565 |
5561 #endif // V8_TARGET_ARCH_X64 | 5566 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |