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

Side by Side Diff: src/hydrogen-instructions.h

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: Review feedback Created 7 years, 7 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/arm/lithium-arm.cc ('k') | src/ia32/lithium-codegen-ia32.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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 3339 matching lines...) Expand 10 before | Expand all | Expand 10 after
3350 SetOperandAt(1, left); 3350 SetOperandAt(1, left);
3351 SetOperandAt(2, right); 3351 SetOperandAt(2, right);
3352 observed_input_representation_[0] = Representation::None(); 3352 observed_input_representation_[0] = Representation::None();
3353 observed_input_representation_[1] = Representation::None(); 3353 observed_input_representation_[1] = Representation::None();
3354 } 3354 }
3355 3355
3356 HValue* context() { return OperandAt(0); } 3356 HValue* context() { return OperandAt(0); }
3357 HValue* left() { return OperandAt(1); } 3357 HValue* left() { return OperandAt(1); }
3358 HValue* right() { return OperandAt(2); } 3358 HValue* right() { return OperandAt(2); }
3359 3359
3360 // TODO(kasperl): Move these helpers to the IA-32 Lithium 3360 // True if switching left and right operands likely generates better code.
3361 // instruction sequence builder. 3361 bool AreOperandsBetterSwitched() {
3362 HValue* LeastConstantOperand() { 3362 if (!IsCommutative()) return false;
3363 if (IsCommutative() && left()->IsConstant()) return right(); 3363
3364 return left(); 3364 // Constant operands are better off on the right, they can be inlined in
3365 // many situations on most platforms.
3366 if (left()->IsConstant()) return true;
3367 if (right()->IsConstant()) return false;
3368
3369 // Otherwise, if there is only one use of the right operand, it would be
3370 // better off on the left for platforms that only have 2-arg arithmetic
3371 // ops (e.g ia32, x64) that clobber the left operand.
3372 return (right()->UseCount() == 1);
3365 } 3373 }
3366 3374
3367 HValue* MostConstantOperand() { 3375 HValue* BetterLeftOperand() {
3368 if (IsCommutative() && left()->IsConstant()) return left(); 3376 return AreOperandsBetterSwitched() ? right() : left();
3369 return right(); 3377 }
3378
3379 HValue* BetterRightOperand() {
3380 return AreOperandsBetterSwitched() ? left() : right();
3370 } 3381 }
3371 3382
3372 void set_observed_input_representation(int index, Representation rep) { 3383 void set_observed_input_representation(int index, Representation rep) {
3373 ASSERT(index >= 1 && index <= 2); 3384 ASSERT(index >= 1 && index <= 2);
3374 observed_input_representation_[index - 1] = rep; 3385 observed_input_representation_[index - 1] = rep;
3375 } 3386 }
3376 3387
3377 virtual void initialize_output_representation(Representation observed) { 3388 virtual void initialize_output_representation(Representation observed) {
3378 observed_output_representation_ = observed; 3389 observed_output_representation_ = observed;
3379 } 3390 }
(...skipping 3142 matching lines...) Expand 10 before | Expand all | Expand 10 after
6522 virtual bool IsDeletable() const { return true; } 6533 virtual bool IsDeletable() const { return true; }
6523 }; 6534 };
6524 6535
6525 6536
6526 #undef DECLARE_INSTRUCTION 6537 #undef DECLARE_INSTRUCTION
6527 #undef DECLARE_CONCRETE_INSTRUCTION 6538 #undef DECLARE_CONCRETE_INSTRUCTION
6528 6539
6529 } } // namespace v8::internal 6540 } } // namespace v8::internal
6530 6541
6531 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ 6542 #endif // V8_HYDROGEN_INSTRUCTIONS_H_
OLDNEW
« no previous file with comments | « src/arm/lithium-arm.cc ('k') | src/ia32/lithium-codegen-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698