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 4332 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4343 SetFlag(kCanOverflow); | 4343 SetFlag(kCanOverflow); |
4344 } | 4344 } |
4345 }; | 4345 }; |
4346 | 4346 |
4347 | 4347 |
4348 class HMod: public HArithmeticBinaryOperation { | 4348 class HMod: public HArithmeticBinaryOperation { |
4349 public: | 4349 public: |
4350 static HInstruction* New(Zone* zone, | 4350 static HInstruction* New(Zone* zone, |
4351 HValue* context, | 4351 HValue* context, |
4352 HValue* left, | 4352 HValue* left, |
4353 HValue* right); | 4353 HValue* right, |
| 4354 bool has_fixed_right_arg, |
| 4355 int fixed_right_arg_value); |
| 4356 |
| 4357 bool has_fixed_right_arg() const { return has_fixed_right_arg_; } |
| 4358 int fixed_right_arg_value() const { return fixed_right_arg_value_; } |
4354 | 4359 |
4355 bool HasPowerOf2Divisor() { | 4360 bool HasPowerOf2Divisor() { |
4356 if (right()->IsConstant() && | 4361 if (right()->IsConstant() && |
4357 HConstant::cast(right())->HasInteger32Value()) { | 4362 HConstant::cast(right())->HasInteger32Value()) { |
4358 int32_t value = HConstant::cast(right())->Integer32Value(); | 4363 int32_t value = HConstant::cast(right())->Integer32Value(); |
4359 return value != 0 && (IsPowerOf2(value) || IsPowerOf2(-value)); | 4364 return value != 0 && (IsPowerOf2(value) || IsPowerOf2(-value)); |
4360 } | 4365 } |
4361 | 4366 |
4362 return false; | 4367 return false; |
4363 } | 4368 } |
4364 | 4369 |
4365 virtual HValue* EnsureAndPropagateNotMinusZero(BitVector* visited); | 4370 virtual HValue* EnsureAndPropagateNotMinusZero(BitVector* visited); |
4366 | 4371 |
4367 virtual HValue* Canonicalize(); | 4372 virtual HValue* Canonicalize(); |
4368 | 4373 |
4369 DECLARE_CONCRETE_INSTRUCTION(Mod) | 4374 DECLARE_CONCRETE_INSTRUCTION(Mod) |
4370 | 4375 |
4371 protected: | 4376 protected: |
4372 virtual bool DataEquals(HValue* other) { return true; } | 4377 virtual bool DataEquals(HValue* other) { return true; } |
4373 | 4378 |
4374 virtual Range* InferRange(Zone* zone); | 4379 virtual Range* InferRange(Zone* zone); |
4375 | 4380 |
4376 private: | 4381 private: |
4377 HMod(HValue* context, HValue* left, HValue* right) | 4382 HMod(HValue* context, |
4378 : HArithmeticBinaryOperation(context, left, right) { | 4383 HValue* left, |
| 4384 HValue* right, |
| 4385 bool has_fixed_right_arg, |
| 4386 int fixed_right_arg_value) |
| 4387 : HArithmeticBinaryOperation(context, left, right), |
| 4388 has_fixed_right_arg_(has_fixed_right_arg), |
| 4389 fixed_right_arg_value_(fixed_right_arg_value) { |
4379 SetFlag(kCanBeDivByZero); | 4390 SetFlag(kCanBeDivByZero); |
4380 SetFlag(kCanOverflow); | 4391 SetFlag(kCanOverflow); |
4381 } | 4392 } |
| 4393 |
| 4394 const bool has_fixed_right_arg_; |
| 4395 const int fixed_right_arg_value_; |
4382 }; | 4396 }; |
4383 | 4397 |
4384 | 4398 |
4385 class HDiv: public HArithmeticBinaryOperation { | 4399 class HDiv: public HArithmeticBinaryOperation { |
4386 public: | 4400 public: |
4387 static HInstruction* New(Zone* zone, | 4401 static HInstruction* New(Zone* zone, |
4388 HValue* context, | 4402 HValue* context, |
4389 HValue* left, | 4403 HValue* left, |
4390 HValue* right); | 4404 HValue* right); |
4391 | 4405 |
(...skipping 2108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6500 virtual bool IsDeletable() const { return true; } | 6514 virtual bool IsDeletable() const { return true; } |
6501 }; | 6515 }; |
6502 | 6516 |
6503 | 6517 |
6504 #undef DECLARE_INSTRUCTION | 6518 #undef DECLARE_INSTRUCTION |
6505 #undef DECLARE_CONCRETE_INSTRUCTION | 6519 #undef DECLARE_CONCRETE_INSTRUCTION |
6506 | 6520 |
6507 } } // namespace v8::internal | 6521 } } // namespace v8::internal |
6508 | 6522 |
6509 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ | 6523 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ |
OLD | NEW |