Commit a88d4191 authored by zhengxing.li's avatar zhengxing.li Committed by Commit bot

X87: [ia32] Propagate rmodes when computing MemoryOperands.

  port 8c1ba59a (r36911)

  original commit message:
  RelocInfo modes were not propagated when computing
  MemoryOperands, on IA32. This needed to be fixed so that we can
  compile wasm code before creating instances, since the compiled code
  needs to be patched up for memory and globals references.

  This surfaces in asm-to-wasm scenarios.

  Added testing (rather, enhanced existing tests).
  Note patch#1 where we fail on ia32, and patch#2 with the fix.

BUG=

Review-Url: https://codereview.chromium.org/2097583003
Cr-Commit-Position: refs/heads/master@{#37245}
parent 90e4fd13
......@@ -113,8 +113,8 @@ class X87OperandConverter : public InstructionOperandConverter {
}
case kMode_MRI: {
Register base = InputRegister(NextOffset(offset));
int32_t disp = InputInt32(NextOffset(offset));
return Operand(base, disp);
Constant ctant = ToConstant(instr_->InputAt(NextOffset(offset)));
return Operand(base, ctant.ToInt32(), ctant.rmode());
}
case kMode_MR1:
case kMode_MR2:
......@@ -133,8 +133,8 @@ class X87OperandConverter : public InstructionOperandConverter {
Register base = InputRegister(NextOffset(offset));
Register index = InputRegister(NextOffset(offset));
ScaleFactor scale = ScaleFor(kMode_MR1I, mode);
int32_t disp = InputInt32(NextOffset(offset));
return Operand(base, index, scale, disp);
Constant ctant = ToConstant(instr_->InputAt(NextOffset(offset)));
return Operand(base, index, scale, ctant.ToInt32(), ctant.rmode());
}
case kMode_M1:
case kMode_M2:
......@@ -151,12 +151,12 @@ class X87OperandConverter : public InstructionOperandConverter {
case kMode_M8I: {
Register index = InputRegister(NextOffset(offset));
ScaleFactor scale = ScaleFor(kMode_M1I, mode);
int32_t disp = InputInt32(NextOffset(offset));
return Operand(index, scale, disp);
Constant ctant = ToConstant(instr_->InputAt(NextOffset(offset)));
return Operand(index, scale, ctant.ToInt32(), ctant.rmode());
}
case kMode_MI: {
int32_t disp = InputInt32(NextOffset(offset));
return Operand(Immediate(disp));
Constant ctant = ToConstant(instr_->InputAt(NextOffset(offset)));
return Operand(ctant.ToInt32(), ctant.rmode());
}
case kMode_None:
UNREACHABLE();
......
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