| OLD | NEW |
| 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 3460 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3471 | 3471 |
| 3472 // True if switching left and right operands likely generates better code. | 3472 // True if switching left and right operands likely generates better code. |
| 3473 bool AreOperandsBetterSwitched() { | 3473 bool AreOperandsBetterSwitched() { |
| 3474 if (!IsCommutative()) return false; | 3474 if (!IsCommutative()) return false; |
| 3475 | 3475 |
| 3476 // Constant operands are better off on the right, they can be inlined in | 3476 // Constant operands are better off on the right, they can be inlined in |
| 3477 // many situations on most platforms. | 3477 // many situations on most platforms. |
| 3478 if (left()->IsConstant()) return true; | 3478 if (left()->IsConstant()) return true; |
| 3479 if (right()->IsConstant()) return false; | 3479 if (right()->IsConstant()) return false; |
| 3480 | 3480 |
| 3481 #ifdef V8_BETTER_OPERAND_ON_RIGHT |
| 3482 // Otherwise, if there is only one use of the left operand, the define |
| 3483 // says it would be better off on the right. |
| 3484 return (left()->UseCount() == 1); |
| 3485 #else |
| 3481 // Otherwise, if there is only one use of the right operand, it would be | 3486 // Otherwise, if there is only one use of the right operand, it would be |
| 3482 // better off on the left for platforms that only have 2-arg arithmetic | 3487 // better off on the left for platforms that only have 2-arg arithmetic |
| 3483 // ops (e.g ia32, x64) that clobber the left operand. | 3488 // ops (e.g ia32, x64) that clobber the left operand. |
| 3484 return right()->UseCount() == 1; | 3489 return right()->UseCount() == 1; |
| 3490 #endif |
| 3485 } | 3491 } |
| 3486 | 3492 |
| 3487 HValue* BetterLeftOperand() { | 3493 HValue* BetterLeftOperand() { |
| 3488 return AreOperandsBetterSwitched() ? right() : left(); | 3494 return AreOperandsBetterSwitched() ? right() : left(); |
| 3489 } | 3495 } |
| 3490 | 3496 |
| 3491 HValue* BetterRightOperand() { | 3497 HValue* BetterRightOperand() { |
| 3492 return AreOperandsBetterSwitched() ? left() : right(); | 3498 return AreOperandsBetterSwitched() ? left() : right(); |
| 3493 } | 3499 } |
| 3494 | 3500 |
| (...skipping 3286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6781 virtual bool IsDeletable() const { return true; } | 6787 virtual bool IsDeletable() const { return true; } |
| 6782 }; | 6788 }; |
| 6783 | 6789 |
| 6784 | 6790 |
| 6785 #undef DECLARE_INSTRUCTION | 6791 #undef DECLARE_INSTRUCTION |
| 6786 #undef DECLARE_CONCRETE_INSTRUCTION | 6792 #undef DECLARE_CONCRETE_INSTRUCTION |
| 6787 | 6793 |
| 6788 } } // namespace v8::internal | 6794 } } // namespace v8::internal |
| 6789 | 6795 |
| 6790 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ | 6796 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ |
| OLD | NEW |