[x64] Use xorl to materialize smi zero.

Before we always loaded smi zero via a movabs with a 64-bit immediate,
which is pretty expensive compared to the xorl.

R=jarin@chromium.org

Committed: https://crrev.com/f236777bfe6e080ff1ead6baf847cc9b6bb4f9cb
Cr-Commit-Position: refs/heads/master@{#27829}

Review URL: https://codereview.chromium.org/1085153002

Cr-Commit-Position: refs/heads/master@{#32784}
This commit is contained in:
bmeurer 2015-12-11 01:38:25 -08:00 committed by Commit bot
parent 161a0e0051
commit 5382e68691

View File

@ -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());
}
}