Commit 5804db9c authored by Junliang Yan's avatar Junliang Yan Committed by Commit Bot

PPC/s390: [Compiler] Use conditional move / select to generate poison mask.

Port 66870070

Original Commit Message:

    Replace bitwise arithmetic with conditional move / select instructions
    on ia32, x64, Arm and Arm64. In local tests this improves --noopt Ignition
    performance by between 2-5%.

R=rmcilroy@chromium.org, joransiu@ca.ibm.com, michael_dawson@ca.ibm.com
BUG=chromium:798964
LOG=N

Change-Id: I3cb65bdf2cf48df30e97b8a12966636fa6aca5ec
Reviewed-on: https://chromium-review.googlesource.com/939852
Commit-Queue: Michael Achenbach <machenbach@chromium.org>
Reviewed-by: 's avatarJoran Siu <joransiu@ca.ibm.com>
Cr-Commit-Position: refs/heads/master@{#51658}
parent 433b3699
......@@ -844,18 +844,11 @@ void CodeGenerator::GenerateSpeculationPoison() {
// Calculate a mask which has all bits set in the normal case, but has all
// bits cleared if we are speculatively executing the wrong PC.
// difference = (current - expected) | (expected - current)
// poison = ~(difference >> (kBitsPerPointer - 1))
__ mr(kSpeculationPoisonRegister, scratch);
__ sub(kSpeculationPoisonRegister, kSpeculationPoisonRegister,
kJavaScriptCallCodeStartRegister);
__ sub(kJavaScriptCallCodeStartRegister, kJavaScriptCallCodeStartRegister,
scratch);
__ orx(kSpeculationPoisonRegister, kSpeculationPoisonRegister,
kJavaScriptCallCodeStartRegister);
__ ShiftRightArithImm(kSpeculationPoisonRegister, kSpeculationPoisonRegister,
kBitsPerPointer - 1);
__ notx(kSpeculationPoisonRegister, kSpeculationPoisonRegister);
__ cmp(kJavaScriptCallCodeStartRegister, scratch);
__ li(scratch, Operand::Zero());
__ notx(kSpeculationPoisonRegister, scratch);
__ isel(eq, kSpeculationPoisonRegister,
kSpeculationPoisonRegister, scratch);
}
void CodeGenerator::AssembleRegisterArgumentPoisoning() {
......
......@@ -1084,18 +1084,10 @@ void CodeGenerator::GenerateSpeculationPoison() {
// Calculate a mask which has all bits set in the normal case, but has all
// bits cleared if we are speculatively executing the wrong PC.
// difference = (current - expected) | (expected - current)
// poison = ~(difference >> (kBitsPerPointer - 1))
__ LoadRR(kSpeculationPoisonRegister, scratch);
__ SubP(kSpeculationPoisonRegister, kSpeculationPoisonRegister,
kJavaScriptCallCodeStartRegister);
__ SubP(kJavaScriptCallCodeStartRegister, kJavaScriptCallCodeStartRegister,
scratch);
__ OrP(kSpeculationPoisonRegister, kSpeculationPoisonRegister,
kJavaScriptCallCodeStartRegister);
__ ShiftRightArithP(kSpeculationPoisonRegister, kSpeculationPoisonRegister,
Operand(kBitsPerPointer - 1));
__ NotP(kSpeculationPoisonRegister, kSpeculationPoisonRegister);
__ LoadImmP(kSpeculationPoisonRegister, Operand::Zero());
__ LoadImmP(r0, Operand(-1));
__ CmpP(kJavaScriptCallCodeStartRegister, scratch);
__ LoadOnConditionP(eq, kSpeculationPoisonRegister, r0);
}
void CodeGenerator::AssembleRegisterArgumentPoisoning() {
......
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