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

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

Issue 651383003: [x86] Several small performance improvements. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Fix Created 6 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 | « no previous file | src/compiler/x64/code-generator-x64.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/compiler/ia32/instruction-selector-ia32.cc
diff --git a/src/compiler/ia32/instruction-selector-ia32.cc b/src/compiler/ia32/instruction-selector-ia32.cc
index add0a3f2b1fc17f47ffc1926844fadaadedb303f..99685f14e58ff106ead5107fc1886f5f6e6b1cdf 100644
--- a/src/compiler/ia32/instruction-selector-ia32.cc
+++ b/src/compiler/ia32/instruction-selector-ia32.cc
@@ -259,7 +259,18 @@ static void VisitBinop(InstructionSelector* selector, Node* node,
size_t output_count = 0;
// TODO(turbofan): match complex addressing modes.
- if (g.CanBeImmediate(right)) {
+ if (left == right) {
+ // If both inputs refer to the same operand, enforce allocating a register
+ // for both of them to ensure that we don't end up generating code like
+ // this:
+ //
+ // mov eax, [ebp-0x10]
+ // add eax, [ebp-0x10]
+ // jo label
+ InstructionOperand* const input = g.UseRegister(left);
+ inputs[input_count++] = input;
+ inputs[input_count++] = input;
+ } else if (g.CanBeImmediate(right)) {
inputs[input_count++] = g.UseRegister(left);
inputs[input_count++] = g.UseImmediate(right);
} else {
@@ -674,13 +685,6 @@ static inline void VisitWordCompare(InstructionSelector* selector, Node* node,
}
-static void VisitWordTest(InstructionSelector* selector, Node* node,
- FlagsContinuation* cont) {
- IA32OperandGenerator g(selector);
- VisitCompare(selector, kIA32Test, g.Use(node), g.TempImmediate(-1), cont);
-}
-
-
// Shared routine for multiple float compare operations.
static void VisitFloat64Compare(InstructionSelector* selector, Node* node,
FlagsContinuation* cont) {
@@ -694,7 +698,7 @@ static void VisitFloat64Compare(InstructionSelector* selector, Node* node,
void InstructionSelector::VisitBranch(Node* branch, BasicBlock* tbranch,
BasicBlock* fbranch) {
- OperandGenerator g(this);
+ IA32OperandGenerator g(this);
Node* user = branch;
Node* value = branch->InputAt(0);
@@ -780,7 +784,7 @@ void InstructionSelector::VisitBranch(Node* branch, BasicBlock* tbranch,
}
// Branch could not be combined with a compare, emit compare against 0.
- VisitWordTest(this, value, &cont);
+ VisitCompare(this, kIA32Cmp, g.Use(value), g.TempImmediate(0), &cont);
}
@@ -799,7 +803,6 @@ void InstructionSelector::VisitWord32Equal(Node* const node) {
default:
break;
}
- return VisitWordTest(this, value, &cont);
}
}
return VisitWordCompare(this, node, kIA32Cmp, &cont, false);
« no previous file with comments | « no previous file | src/compiler/x64/code-generator-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698