X87: fix the deoptimization issue.

On X87 the count of double register number is landed on the top
       of x87 register stack for deoptimization. (chunyang.dai@intle.com)

R=weiliang.lin@intel.com
BUG=

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

Cr-Commit-Position: refs/heads/master@{#31728}
This commit is contained in:
zhengxing.li 2015-11-02 21:01:31 -08:00 committed by Commit bot
parent 8a93f12995
commit a080d4c50c

View File

@ -415,6 +415,26 @@ void CodeGenerator::AssembleArchInstruction(Instruction* instr) {
case kArchDeoptimize: {
int deopt_state_id =
BuildTranslation(instr, -1, 0, OutputFrameStateCombine::Ignore());
int double_register_param_count = 0;
int x87_layout = 0;
for (size_t i = 0; i < instr->InputCount(); i++) {
if (instr->InputAt(i)->IsDoubleRegister()) {
double_register_param_count++;
}
}
// Currently we use only one X87 register. If we use more X87 register
// in the future. we need to generate the x87 layout according to the
// used double registers.
DCHECK(double_register_param_count < 2);
if (double_register_param_count == 1) {
x87_layout = (0 << 3) | 1;
}
// The layout of x87 register stack is loaded on the top of FPU register
// stack for deoptimization.
__ push(Immediate(x87_layout));
__ fild_s(MemOperand(esp, 0));
__ lea(esp, Operand(esp, kPointerSize));
AssembleDeoptimizerCall(deopt_state_id, Deoptimizer::EAGER);
break;
}