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 3641 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3652 | 3652 |
3653 | 3653 |
3654 class HDiv: public HArithmeticBinaryOperation { | 3654 class HDiv: public HArithmeticBinaryOperation { |
3655 public: | 3655 public: |
3656 HDiv(HValue* context, HValue* left, HValue* right) | 3656 HDiv(HValue* context, HValue* left, HValue* right) |
3657 : HArithmeticBinaryOperation(context, left, right) { | 3657 : HArithmeticBinaryOperation(context, left, right) { |
3658 SetFlag(kCanBeDivByZero); | 3658 SetFlag(kCanBeDivByZero); |
3659 SetFlag(kCanOverflow); | 3659 SetFlag(kCanOverflow); |
3660 } | 3660 } |
3661 | 3661 |
| 3662 bool HasPowerOf2Divisor() { |
| 3663 if (right()->IsConstant() && |
| 3664 HConstant::cast(right())->HasInteger32Value()) { |
| 3665 int32_t value = HConstant::cast(right())->Integer32Value(); |
| 3666 return value != 0 && (IsPowerOf2(value) || IsPowerOf2(-value)); |
| 3667 } |
| 3668 |
| 3669 return false; |
| 3670 } |
| 3671 |
3662 virtual HValue* EnsureAndPropagateNotMinusZero(BitVector* visited); | 3672 virtual HValue* EnsureAndPropagateNotMinusZero(BitVector* visited); |
3663 | 3673 |
3664 static HInstruction* NewHDiv(Zone* zone, | 3674 static HInstruction* NewHDiv(Zone* zone, |
3665 HValue* context, | 3675 HValue* context, |
3666 HValue* left, | 3676 HValue* left, |
3667 HValue* right); | 3677 HValue* right); |
3668 | 3678 |
3669 DECLARE_CONCRETE_INSTRUCTION(Div) | 3679 DECLARE_CONCRETE_INSTRUCTION(Div) |
3670 | 3680 |
3671 protected: | 3681 protected: |
(...skipping 1746 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5418 virtual bool IsDeletable() const { return true; } | 5428 virtual bool IsDeletable() const { return true; } |
5419 }; | 5429 }; |
5420 | 5430 |
5421 | 5431 |
5422 #undef DECLARE_INSTRUCTION | 5432 #undef DECLARE_INSTRUCTION |
5423 #undef DECLARE_CONCRETE_INSTRUCTION | 5433 #undef DECLARE_CONCRETE_INSTRUCTION |
5424 | 5434 |
5425 } } // namespace v8::internal | 5435 } } // namespace v8::internal |
5426 | 5436 |
5427 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ | 5437 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ |
OLD | NEW |