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

Side by Side Diff: src/compiler/ia32/instruction-selector-ia32.cc

Issue 2507683002: [turbofan] Remove redundant cmp operands swap. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 1 month 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 unified diff | Download patch
« no previous file with comments | « no previous file | src/compiler/x64/instruction-selector-x64.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/base/adapters.h" 5 #include "src/base/adapters.h"
6 #include "src/compiler/instruction-selector-impl.h" 6 #include "src/compiler/instruction-selector-impl.h"
7 #include "src/compiler/node-matchers.h" 7 #include "src/compiler/node-matchers.h"
8 #include "src/compiler/node-properties.h" 8 #include "src/compiler/node-properties.h"
9 9
10 namespace v8 { 10 namespace v8 {
(...skipping 1334 matching lines...) Expand 10 before | Expand all | Expand 10 after
1345 // Match memory operands on left side of comparison. 1345 // Match memory operands on left side of comparison.
1346 if (g.CanBeMemoryOperand(narrowed_opcode, node, left, effect_level)) { 1346 if (g.CanBeMemoryOperand(narrowed_opcode, node, left, effect_level)) {
1347 bool needs_byte_register = 1347 bool needs_byte_register =
1348 narrowed_opcode == kIA32Test8 || narrowed_opcode == kIA32Cmp8; 1348 narrowed_opcode == kIA32Test8 || narrowed_opcode == kIA32Cmp8;
1349 return VisitCompareWithMemoryOperand( 1349 return VisitCompareWithMemoryOperand(
1350 selector, narrowed_opcode, left, 1350 selector, narrowed_opcode, left,
1351 needs_byte_register ? g.UseByteRegister(right) : g.UseRegister(right), 1351 needs_byte_register ? g.UseByteRegister(right) : g.UseRegister(right),
1352 cont); 1352 cont);
1353 } 1353 }
1354 1354
1355 if (g.CanBeBetterLeftOperand(right)) {
1356 if (!node->op()->HasProperty(Operator::kCommutative)) cont->Commute();
1357 std::swap(left, right);
1358 }
1359
1360 return VisitCompare(selector, opcode, left, right, cont, 1355 return VisitCompare(selector, opcode, left, right, cont,
1361 node->op()->HasProperty(Operator::kCommutative)); 1356 node->op()->HasProperty(Operator::kCommutative));
1362 } 1357 }
1363 1358
1364 void VisitWordCompare(InstructionSelector* selector, Node* node, 1359 void VisitWordCompare(InstructionSelector* selector, Node* node,
1365 FlagsContinuation* cont) { 1360 FlagsContinuation* cont) {
1366 IA32OperandGenerator g(selector); 1361 IA32OperandGenerator g(selector);
1367 Int32BinopMatcher m(node); 1362 Int32BinopMatcher m(node);
1368 if (m.left().IsLoad() && m.right().IsLoadStackPointer()) { 1363 if (m.left().IsLoad() && m.right().IsLoadStackPointer()) {
1369 LoadMatcher<ExternalReferenceMatcher> mleft(m.left().node()); 1364 LoadMatcher<ExternalReferenceMatcher> mleft(m.left().node());
(...skipping 377 matching lines...) Expand 10 before | Expand all | Expand 10 after
1747 // static 1742 // static
1748 MachineOperatorBuilder::AlignmentRequirements 1743 MachineOperatorBuilder::AlignmentRequirements
1749 InstructionSelector::AlignmentRequirements() { 1744 InstructionSelector::AlignmentRequirements() {
1750 return MachineOperatorBuilder::AlignmentRequirements:: 1745 return MachineOperatorBuilder::AlignmentRequirements::
1751 FullUnalignedAccessSupport(); 1746 FullUnalignedAccessSupport();
1752 } 1747 }
1753 1748
1754 } // namespace compiler 1749 } // namespace compiler
1755 } // namespace internal 1750 } // namespace internal
1756 } // namespace v8 1751 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | src/compiler/x64/instruction-selector-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698