Index: src/x64/macro-assembler-x64.cc |
diff --git a/src/x64/macro-assembler-x64.cc b/src/x64/macro-assembler-x64.cc |
index efe90044409ebeeaee9d10b59de3f0a8fc9a9071..88ef9824f8d58c8d7ef53863395f776b3a14161f 100644 |
--- a/src/x64/macro-assembler-x64.cc |
+++ b/src/x64/macro-assembler-x64.cc |
@@ -1100,6 +1100,7 @@ void MacroAssembler::SafePush(Smi* src) { |
Register MacroAssembler::GetSmiConstant(Smi* source) { |
+ STATIC_ASSERT(kSmiTag == 0); |
int value = source->value(); |
if (value == 0) { |
xorl(kScratchRegister, kScratchRegister); |
@@ -1111,9 +1112,13 @@ Register MacroAssembler::GetSmiConstant(Smi* source) { |
void MacroAssembler::LoadSmiConstant(Register dst, Smi* source) { |
- // Special-casing 0 here to use xorl seems to make things slower, so we don't |
- // do it. |
- Move(dst, source, Assembler::RelocInfoNone()); |
+ STATIC_ASSERT(kSmiTag == 0); |
+ int value = source->value(); |
+ if (value == 0) { |
+ xorl(dst, dst); |
+ } else { |
+ Move(dst, source, Assembler::RelocInfoNone()); |
+ } |
} |