Commit 5382e686 authored by bmeurer's avatar bmeurer Committed by Commit bot

[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}
parent 161a0e00
......@@ -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());
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment