Index: src/hydrogen-instructions.h |
diff --git a/src/hydrogen-instructions.h b/src/hydrogen-instructions.h |
index 2bfb284f829fcd1fad85f37d9e888c1c0ee851d2..e209ffb27d1f58b4344581d588ef906882ea6f74 100644 |
--- a/src/hydrogen-instructions.h |
+++ b/src/hydrogen-instructions.h |
@@ -967,6 +967,7 @@ class HValue : public ZoneObject { |
Representation RepresentationFromUses(); |
Representation RepresentationFromUseRequirements(); |
bool HasNonSmiUse(); |
+ bool UsedBy(HValue* value); |
virtual void UpdateRepresentation(Representation new_rep, |
HInferRepresentationPhase* h_infer, |
const char* reason); |
@@ -3545,8 +3546,17 @@ class HBinaryOperation : public HTemplateInstruction<3> { |
// Constant operands are better off on the right, they can be inlined in |
// many situations on most platforms. |
- if (left()->IsConstant()) return true; |
- if (right()->IsConstant()) return false; |
+ if (left()->IsConstant() && |
+ (!representation().IsDouble() || left()->UseCount() > 1)) { |
+ return true; |
+ } |
+ if (right()->IsConstant() && |
+ (!representation().IsDouble() || right()->UseCount() > 1)) { |
+ return false; |
+ } |
+ |
+ if (left()->IsPhi() && UsedBy(left())) return false; |
+ if (right()->IsPhi() && UsedBy(right())) return true; |
haitao.feng
2014/05/15 05:56:20
How about writing codes in this way?
- if (left
|
// Otherwise, if there is only one use of the right operand, it would be |
// better off on the left for platforms that only have 2-arg arithmetic |