PPC/s390: [turbofan] Support poisoning arguments in JavaScript.

Port be4cd67ce2

Original Commit Message:

    This adds support for poisoning the stack pointer and implicit register
    arguments like the context register and the function register in the
    prologue of generated code with JavaScript linkage. The speculation
    poison is computed similarly to the interpreter by matching expected
    with actual code start addresses.

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

Change-Id: I0d015fd8a8f05982d947a4a1c0be1a825ac19d64
Reviewed-on: https://chromium-review.googlesource.com/940460
Reviewed-by: Joran Siu <joransiu@ca.ibm.com>
Commit-Queue: Junliang Yan <jyan@ca.ibm.com>
Cr-Commit-Position: refs/heads/master@{#51621}
This commit is contained in:
Junliang Yan 2018-02-27 19:03:13 -05:00 committed by Commit Bot
parent 1ce7a7f92a
commit 03caf2c214
2 changed files with 12 additions and 0 deletions

View File

@ -858,6 +858,12 @@ void CodeGenerator::GenerateSpeculationPoison() {
__ notx(kSpeculationPoisonRegister, kSpeculationPoisonRegister);
}
void CodeGenerator::AssembleRegisterArgumentPoisoning() {
__ and_(kJSFunctionRegister, kJSFunctionRegister, kSpeculationPoisonRegister);
__ and_(kContextRegister, kContextRegister, kSpeculationPoisonRegister);
__ and_(sp, sp, kSpeculationPoisonRegister);
}
// Assembles an instruction after register allocation, producing machine code.
CodeGenerator::CodeGenResult CodeGenerator::AssembleArchInstruction(
Instruction* instr) {

View File

@ -1098,6 +1098,12 @@ void CodeGenerator::GenerateSpeculationPoison() {
__ NotP(kSpeculationPoisonRegister, kSpeculationPoisonRegister);
}
void CodeGenerator::AssembleRegisterArgumentPoisoning() {
__ AndP(kJSFunctionRegister, kJSFunctionRegister, kSpeculationPoisonRegister);
__ AndP(kContextRegister, kContextRegister, kSpeculationPoisonRegister);
__ AndP(sp, sp, kSpeculationPoisonRegister);
}
// Assembles an instruction after register allocation, producing machine code.
CodeGenerator::CodeGenResult CodeGenerator::AssembleArchInstruction(
Instruction* instr) {