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 4883 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4894 SetFlag(kCanOverflow); | 4894 SetFlag(kCanOverflow); |
4895 } | 4895 } |
4896 }; | 4896 }; |
4897 | 4897 |
4898 | 4898 |
4899 class HMod V8_FINAL : public HArithmeticBinaryOperation { | 4899 class HMod V8_FINAL : public HArithmeticBinaryOperation { |
4900 public: | 4900 public: |
4901 static HInstruction* New(Zone* zone, | 4901 static HInstruction* New(Zone* zone, |
4902 HValue* context, | 4902 HValue* context, |
4903 HValue* left, | 4903 HValue* left, |
4904 HValue* right, | 4904 HValue* right); |
4905 Maybe<int> fixed_right_arg); | |
4906 | |
4907 Maybe<int> fixed_right_arg() const { return fixed_right_arg_; } | |
4908 | 4905 |
4909 bool HasPowerOf2Divisor() { | 4906 bool HasPowerOf2Divisor() { |
4910 if (right()->IsConstant() && | 4907 if (right()->IsConstant() && |
4911 HConstant::cast(right())->HasInteger32Value()) { | 4908 HConstant::cast(right())->HasInteger32Value()) { |
4912 int32_t value = HConstant::cast(right())->Integer32Value(); | 4909 int32_t value = HConstant::cast(right())->Integer32Value(); |
4913 return value != 0 && (IsPowerOf2(value) || IsPowerOf2(-value)); | 4910 return value != 0 && (IsPowerOf2(value) || IsPowerOf2(-value)); |
4914 } | 4911 } |
4915 | 4912 |
4916 return false; | 4913 return false; |
4917 } | 4914 } |
(...skipping 13 matching lines...) Expand all Loading... |
4931 DECLARE_CONCRETE_INSTRUCTION(Mod) | 4928 DECLARE_CONCRETE_INSTRUCTION(Mod) |
4932 | 4929 |
4933 protected: | 4930 protected: |
4934 virtual bool DataEquals(HValue* other) V8_OVERRIDE { return true; } | 4931 virtual bool DataEquals(HValue* other) V8_OVERRIDE { return true; } |
4935 | 4932 |
4936 virtual Range* InferRange(Zone* zone) V8_OVERRIDE; | 4933 virtual Range* InferRange(Zone* zone) V8_OVERRIDE; |
4937 | 4934 |
4938 private: | 4935 private: |
4939 HMod(HValue* context, | 4936 HMod(HValue* context, |
4940 HValue* left, | 4937 HValue* left, |
4941 HValue* right, | 4938 HValue* right) : HArithmeticBinaryOperation(context, left, right) { |
4942 Maybe<int> fixed_right_arg) | |
4943 : HArithmeticBinaryOperation(context, left, right), | |
4944 fixed_right_arg_(fixed_right_arg) { | |
4945 SetFlag(kCanBeDivByZero); | 4939 SetFlag(kCanBeDivByZero); |
4946 SetFlag(kCanOverflow); | 4940 SetFlag(kCanOverflow); |
4947 } | 4941 } |
4948 | |
4949 const Maybe<int> fixed_right_arg_; | |
4950 }; | 4942 }; |
4951 | 4943 |
4952 | 4944 |
4953 class HDiv V8_FINAL : public HArithmeticBinaryOperation { | 4945 class HDiv V8_FINAL : public HArithmeticBinaryOperation { |
4954 public: | 4946 public: |
4955 static HInstruction* New(Zone* zone, | 4947 static HInstruction* New(Zone* zone, |
4956 HValue* context, | 4948 HValue* context, |
4957 HValue* left, | 4949 HValue* left, |
4958 HValue* right); | 4950 HValue* right); |
4959 | 4951 |
(...skipping 2498 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7458 virtual bool IsDeletable() const V8_OVERRIDE { return true; } | 7450 virtual bool IsDeletable() const V8_OVERRIDE { return true; } |
7459 }; | 7451 }; |
7460 | 7452 |
7461 | 7453 |
7462 #undef DECLARE_INSTRUCTION | 7454 #undef DECLARE_INSTRUCTION |
7463 #undef DECLARE_CONCRETE_INSTRUCTION | 7455 #undef DECLARE_CONCRETE_INSTRUCTION |
7464 | 7456 |
7465 } } // namespace v8::internal | 7457 } } // namespace v8::internal |
7466 | 7458 |
7467 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ | 7459 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ |
OLD | NEW |