Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(376)

Unified Diff: src/compiler/x64/instruction-selector-x64.cc

Issue 2396923003: [turbofan][x64] Use the root register for comparisons with certain roots. (Closed)
Patch Set: Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/compiler/instruction-selector.cc ('k') | src/heap/heap.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/compiler/x64/instruction-selector-x64.cc
diff --git a/src/compiler/x64/instruction-selector-x64.cc b/src/compiler/x64/instruction-selector-x64.cc
index 9a7657ef32c0783c77a22529eb8217d5c0c8b863..7c72587ab69e1ad7e20707ae57bc070e9326ed2e 100644
--- a/src/compiler/x64/instruction-selector-x64.cc
+++ b/src/compiler/x64/instruction-selector-x64.cc
@@ -1775,6 +1775,29 @@ void VisitWordCompare(InstructionSelector* selector, Node* node,
void VisitWord64Compare(InstructionSelector* selector, Node* node,
FlagsContinuation* cont) {
X64OperandGenerator g(selector);
+ if (selector->CanUseRootsRegister()) {
+ Heap* const heap = selector->isolate()->heap();
+ Heap::RootListIndex root_index;
+ HeapObjectBinopMatcher m(node);
+ if (m.right().HasValue() &&
+ heap->IsRootHandle(m.right().Value(), &root_index)) {
+ if (!node->op()->HasProperty(Operator::kCommutative)) cont->Commute();
+ InstructionCode opcode =
+ kX64Cmp | AddressingModeField::encode(kMode_Root);
+ return VisitCompare(
+ selector, opcode,
+ g.TempImmediate((root_index * kPointerSize) - kRootRegisterBias),
+ g.UseRegister(m.left().node()), cont);
+ } else if (m.left().HasValue() &&
+ heap->IsRootHandle(m.left().Value(), &root_index)) {
+ InstructionCode opcode =
+ kX64Cmp | AddressingModeField::encode(kMode_Root);
+ return VisitCompare(
+ selector, opcode,
+ g.TempImmediate((root_index * kPointerSize) - kRootRegisterBias),
+ g.UseRegister(m.right().node()), cont);
+ }
+ }
Int64BinopMatcher m(node);
if (m.left().IsLoad() && m.right().IsLoadStackPointer()) {
LoadMatcher<ExternalReferenceMatcher> mleft(m.left().node());
« no previous file with comments | « src/compiler/instruction-selector.cc ('k') | src/heap/heap.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698