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

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

Issue 2398603002: [turbofan][x64] Improve code generation for external reference access. (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/x64/instruction-codes-x64.h ('k') | no next file » | 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 bfe7c6264986e19f0b57dd87cdbe9ea5abc231a2..9a7657ef32c0783c77a22529eb8217d5c0c8b863 100644
--- a/src/compiler/x64/instruction-selector-x64.cc
+++ b/src/compiler/x64/instruction-selector-x64.cc
@@ -136,6 +136,22 @@ class X64OperandGenerator final : public OperandGenerator {
AddressingMode GetEffectiveAddressMemoryOperand(Node* operand,
InstructionOperand inputs[],
size_t* input_count) {
+ if (selector()->CanAddressRelativeToRootsRegister()) {
+ LoadMatcher<ExternalReferenceMatcher> m(operand);
+ if (m.index().HasValue() && m.object().HasValue()) {
+ Address const kRootsRegisterValue =
+ kRootRegisterBias +
+ reinterpret_cast<Address>(
+ selector()->isolate()->heap()->roots_array_start());
+ ptrdiff_t const delta =
+ m.index().Value() +
+ (m.object().Value().address() - kRootsRegisterValue);
+ if (is_int32(delta)) {
+ inputs[(*input_count)++] = TempImmediate(static_cast<int32_t>(delta));
+ return kMode_Root;
+ }
+ }
+ }
BaseWithIndexAndDisplacement64Matcher m(operand, AddressOption::kAllowAll);
DCHECK(m.matches());
if ((m.displacement() == nullptr || CanBeImmediate(m.displacement()))) {
@@ -155,6 +171,7 @@ class X64OperandGenerator final : public OperandGenerator {
};
namespace {
+
ArchOpcode GetLoadOpcode(LoadRepresentation load_rep) {
ArchOpcode opcode = kArchNop;
switch (load_rep.representation()) {
@@ -187,6 +204,7 @@ ArchOpcode GetLoadOpcode(LoadRepresentation load_rep) {
}
return opcode;
}
+
} // namespace
void InstructionSelector::VisitLoad(Node* node) {
@@ -723,6 +741,7 @@ bool TryMatchLoadWord64AndShiftRight(InstructionSelector* selector, Node* node,
case kMode_M2I:
case kMode_M4I:
case kMode_M8I:
+ case kMode_Root:
UNREACHABLE();
}
inputs[input_count++] = ImmediateOperand(ImmediateOperand::INLINE, 4);
« no previous file with comments | « src/compiler/x64/instruction-codes-x64.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698