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

Unified Diff: src/ia32/lithium-ia32.cc

Issue 14856015: Bias commutative single-use register inputs and support lea adds (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 8 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/ia32/lithium-ia32.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/ia32/lithium-ia32.cc
diff --git a/src/ia32/lithium-ia32.cc b/src/ia32/lithium-ia32.cc
index 371c16c8e6dab1daab58c074b95f82178f6ee70b..6768f393d229cca21381650da854247c677ac0ba 100644
--- a/src/ia32/lithium-ia32.cc
+++ b/src/ia32/lithium-ia32.cc
@@ -1392,8 +1392,10 @@ LInstruction* LChunkBuilder::DoBitwise(HBitwise* instr) {
ASSERT(instr->left()->representation().IsInteger32());
ASSERT(instr->right()->representation().IsInteger32());
- LOperand* left = UseRegisterAtStart(instr->LeastConstantOperand());
- LOperand* right = UseOrConstantAtStart(instr->MostConstantOperand());
+ LOperand* left =
+ UseRegisterAtStart(instr->BetterCandidateForRegisterOperand());
+ LOperand* right =
+ UseOrConstantAtStart(instr->WorseCandidateForRegisterOperand());
return DefineSameAsFirst(new(zone()) LBitI(left, right));
} else {
ASSERT(instr->representation().IsTagged());
@@ -1560,8 +1562,10 @@ LInstruction* LChunkBuilder::DoMul(HMul* instr) {
if (instr->representation().IsInteger32()) {
ASSERT(instr->left()->representation().IsInteger32());
ASSERT(instr->right()->representation().IsInteger32());
- LOperand* left = UseRegisterAtStart(instr->LeastConstantOperand());
- LOperand* right = UseOrConstant(instr->MostConstantOperand());
+ LOperand* left =
+ UseRegisterAtStart(instr->BetterCandidateForRegisterOperand());
+ LOperand* right =
+ UseOrConstant(instr->WorseCandidateForRegisterOperand());
LOperand* temp = NULL;
if (instr->CheckFlag(HValue::kBailoutOnMinusZero)) {
temp = TempRegister();
@@ -1604,13 +1608,25 @@ LInstruction* LChunkBuilder::DoSub(HSub* instr) {
LInstruction* LChunkBuilder::DoAdd(HAdd* instr) {
if (instr->representation().IsInteger32()) {
+ bool use_lea = LAddI::UseLea(instr);
ASSERT(instr->left()->representation().IsInteger32());
ASSERT(instr->right()->representation().IsInteger32());
- LOperand* left = UseRegisterAtStart(instr->LeastConstantOperand());
- LOperand* right = UseOrConstantAtStart(instr->MostConstantOperand());
+ LOperand* left =
+ UseRegisterAtStart(instr->BetterCandidateForRegisterOperand());
+ HValue* worse_candidate = instr->WorseCandidateForRegisterOperand();
+ LOperand* right = use_lea
+ ? UseRegisterOrConstantAtStart(worse_candidate)
+ : UseOrConstantAtStart(worse_candidate);
LAddI* add = new(zone()) LAddI(left, right);
- LInstruction* result = DefineSameAsFirst(add);
- if (instr->CheckFlag(HValue::kCanOverflow)) {
+ bool can_overflow = instr->CheckFlag(HValue::kCanOverflow);
+ // Check to see if it would be advantageous to use
Jakob Kummerow 2013/05/03 09:01:37 nit: use what?
+ LInstruction* result = NULL;
+ if (use_lea) {
+ result = DefineAsRegister(add);
+ } else {
+ result = DefineSameAsFirst(add);
+ }
+ if (can_overflow) {
result = AssignEnvironment(result);
}
return result;
@@ -1629,8 +1645,8 @@ LInstruction* LChunkBuilder::DoMathMinMax(HMathMinMax* instr) {
if (instr->representation().IsInteger32()) {
ASSERT(instr->left()->representation().IsInteger32());
ASSERT(instr->right()->representation().IsInteger32());
- left = UseRegisterAtStart(instr->LeastConstantOperand());
- right = UseOrConstantAtStart(instr->MostConstantOperand());
+ left = UseRegisterAtStart(instr->BetterCandidateForRegisterOperand());
+ right = UseOrConstantAtStart(instr->WorseCandidateForRegisterOperand());
} else {
ASSERT(instr->representation().IsDouble());
ASSERT(instr->left()->representation().IsDouble());
« no previous file with comments | « src/ia32/lithium-ia32.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698