Commit 02acf4a0 authored by Seth Brenith's avatar Seth Brenith Committed by Commit Bot

[turbofan][x64][ptr-compr] Use root register for kHeapConstant equality

VisitWord32EqualImpl was checking for inputs of type
kCompressedHeapConstant, but it can also sometimes have inputs of type
kHeapConstant. In either case, we can check for whether to do a load
from the roots array. This improves Octane score by about 3% (or about
1.5% if --no-opt is specified).

Bug: v8:8948
Change-Id: Iab6c0b1dacd96c74e4cfb54c772aa92e5baf00ff
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2213081
Commit-Queue: Seth Brenith <seth.brenith@microsoft.com>
Reviewed-by: 's avatarJakob Gruber <jgruber@chromium.org>
Reviewed-by: 's avatarSantiago Aboy Solanes <solanes@chromium.org>
Cr-Commit-Position: refs/heads/master@{#67981}
parent 2bf94b86
......@@ -1898,16 +1898,33 @@ void VisitWord32EqualImpl(InstructionSelector* selector, Node* node,
X64OperandGenerator g(selector);
const RootsTable& roots_table = selector->isolate()->roots_table();
RootIndex root_index;
CompressedHeapObjectBinopMatcher m(node);
if (m.right().HasValue() &&
roots_table.IsRootHandle(m.right().Value(), &root_index)) {
Node* left = nullptr;
Handle<HeapObject> right;
// HeapConstants and CompressedHeapConstants can be treated the same when
// using them as an input to a 32-bit comparison. Check whether either is
// present.
{
CompressedHeapObjectBinopMatcher m(node);
if (m.right().HasValue()) {
left = m.left().node();
right = m.right().Value();
} else {
HeapObjectBinopMatcher m2(node);
if (m2.right().HasValue()) {
left = m2.left().node();
right = m2.right().Value();
}
}
}
if (!right.is_null() && roots_table.IsRootHandle(right, &root_index)) {
DCHECK_NE(left, nullptr);
InstructionCode opcode =
kX64Cmp32 | AddressingModeField::encode(kMode_Root);
return VisitCompare(
selector, opcode,
g.TempImmediate(
TurboAssemblerBase::RootRegisterOffsetForRootIndex(root_index)),
g.UseRegister(m.left().node()), cont);
g.UseRegister(left), cont);
}
}
VisitWordCompare(selector, node, kX64Cmp32, cont);
......
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