Commit f6fc9d6e authored by Jakob Gruber's avatar Jakob Gruber Committed by Commit Bot

[ia32] Add a root-relative addressing mode

.. and use it for generating faster loads of external references. This
changes the stack check instruction sequence from

mov ecx,0x567651dc  // The address of the stack limit.
cmp esp,[ecx]

to

cmp esp,[ebx+0x3c]

This addressing mode was likely forgotten when we recently added root
register support on ia32.

Bug: chromium:998751,v8:9534
Change-Id: I3521519da1e9d373dfcd83831b3e399e0e9c895b
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1781056Reviewed-by: 's avatarSigurd Schneider <sigurds@chromium.org>
Commit-Queue: Jakob Gruber <jgruber@chromium.org>
Cr-Commit-Position: refs/heads/master@{#63508}
parent 6039d7ba
......@@ -165,6 +165,11 @@ class IA32OperandConverter : public InstructionOperandConverter {
Constant ctant = ToConstant(instr_->InputAt(NextOffset(offset)));
return Operand(ctant.ToInt32(), ctant.rmode());
}
case kMode_Root: {
Register base = kRootRegister;
int32_t disp = InputInt32(NextOffset(offset));
return Operand(base, disp);
}
case kMode_None:
UNREACHABLE();
}
......
......@@ -393,7 +393,8 @@ namespace compiler {
V(M2I) /* [ %r2*2 + K] */ \
V(M4I) /* [ %r2*4 + K] */ \
V(M8I) /* [ %r2*8 + K] */ \
V(MI) /* [ K] */
V(MI) /* [ K] */ \
V(Root) /* [%root + K] */
} // namespace compiler
} // namespace internal
......
......@@ -152,6 +152,21 @@ class IA32OperandGenerator final : public OperandGenerator {
AddressingMode GetEffectiveAddressMemoryOperand(Node* node,
InstructionOperand inputs[],
size_t* input_count) {
{
LoadMatcher<ExternalReferenceMatcher> m(node);
if (m.index().HasValue() && m.object().HasValue() &&
selector()->CanAddressRelativeToRootsRegister(m.object().Value())) {
ptrdiff_t const delta =
m.index().Value() +
TurboAssemblerBase::RootRegisterOffsetForExternalReference(
selector()->isolate(), m.object().Value());
if (is_int32(delta)) {
inputs[(*input_count)++] = TempImmediate(static_cast<int32_t>(delta));
return kMode_Root;
}
}
}
BaseWithIndexAndDisplacement32Matcher m(node, AddressOption::kAllowAll);
DCHECK(m.matches());
if ((m.displacement() == nullptr || CanBeImmediate(m.displacement()))) {
......
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