| 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 4322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4333 SetFlag(kCanOverflow); | 4333 SetFlag(kCanOverflow); |
| 4334 } | 4334 } |
| 4335 }; | 4335 }; |
| 4336 | 4336 |
| 4337 | 4337 |
| 4338 class HMod: public HArithmeticBinaryOperation { | 4338 class HMod: public HArithmeticBinaryOperation { |
| 4339 public: | 4339 public: |
| 4340 static HInstruction* New(Zone* zone, | 4340 static HInstruction* New(Zone* zone, |
| 4341 HValue* context, | 4341 HValue* context, |
| 4342 HValue* left, | 4342 HValue* left, |
| 4343 HValue* right); | 4343 HValue* right, |
| 4344 bool has_fixed_right_arg, |
| 4345 int fixed_right_arg_value); |
| 4346 |
| 4347 bool has_fixed_right_arg() const { return has_fixed_right_arg_; } |
| 4348 int fixed_right_arg_value() const { return fixed_right_arg_value_; } |
| 4344 | 4349 |
| 4345 bool HasPowerOf2Divisor() { | 4350 bool HasPowerOf2Divisor() { |
| 4346 if (right()->IsConstant() && | 4351 if (right()->IsConstant() && |
| 4347 HConstant::cast(right())->HasInteger32Value()) { | 4352 HConstant::cast(right())->HasInteger32Value()) { |
| 4348 int32_t value = HConstant::cast(right())->Integer32Value(); | 4353 int32_t value = HConstant::cast(right())->Integer32Value(); |
| 4349 return value != 0 && (IsPowerOf2(value) || IsPowerOf2(-value)); | 4354 return value != 0 && (IsPowerOf2(value) || IsPowerOf2(-value)); |
| 4350 } | 4355 } |
| 4351 | 4356 |
| 4352 return false; | 4357 return false; |
| 4353 } | 4358 } |
| 4354 | 4359 |
| 4355 virtual HValue* EnsureAndPropagateNotMinusZero(BitVector* visited); | 4360 virtual HValue* EnsureAndPropagateNotMinusZero(BitVector* visited); |
| 4356 | 4361 |
| 4357 virtual HValue* Canonicalize(); | 4362 virtual HValue* Canonicalize(); |
| 4358 | 4363 |
| 4359 DECLARE_CONCRETE_INSTRUCTION(Mod) | 4364 DECLARE_CONCRETE_INSTRUCTION(Mod) |
| 4360 | 4365 |
| 4361 protected: | 4366 protected: |
| 4362 virtual bool DataEquals(HValue* other) { return true; } | 4367 virtual bool DataEquals(HValue* other) { return true; } |
| 4363 | 4368 |
| 4364 virtual Range* InferRange(Zone* zone); | 4369 virtual Range* InferRange(Zone* zone); |
| 4365 | 4370 |
| 4366 private: | 4371 private: |
| 4367 HMod(HValue* context, HValue* left, HValue* right) | 4372 HMod(HValue* context, |
| 4368 : HArithmeticBinaryOperation(context, left, right) { | 4373 HValue* left, |
| 4374 HValue* right, |
| 4375 bool has_fixed_right_arg, |
| 4376 int fixed_right_arg_value) |
| 4377 : HArithmeticBinaryOperation(context, left, right), |
| 4378 has_fixed_right_arg_(has_fixed_right_arg), |
| 4379 fixed_right_arg_value_(fixed_right_arg_value) { |
| 4369 SetFlag(kCanBeDivByZero); | 4380 SetFlag(kCanBeDivByZero); |
| 4370 SetFlag(kCanOverflow); | 4381 SetFlag(kCanOverflow); |
| 4371 } | 4382 } |
| 4383 |
| 4384 const bool has_fixed_right_arg_; |
| 4385 const int fixed_right_arg_value_; |
| 4372 }; | 4386 }; |
| 4373 | 4387 |
| 4374 | 4388 |
| 4375 class HDiv: public HArithmeticBinaryOperation { | 4389 class HDiv: public HArithmeticBinaryOperation { |
| 4376 public: | 4390 public: |
| 4377 static HInstruction* New(Zone* zone, | 4391 static HInstruction* New(Zone* zone, |
| 4378 HValue* context, | 4392 HValue* context, |
| 4379 HValue* left, | 4393 HValue* left, |
| 4380 HValue* right); | 4394 HValue* right); |
| 4381 | 4395 |
| (...skipping 2113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6495 virtual bool IsDeletable() const { return true; } | 6509 virtual bool IsDeletable() const { return true; } |
| 6496 }; | 6510 }; |
| 6497 | 6511 |
| 6498 | 6512 |
| 6499 #undef DECLARE_INSTRUCTION | 6513 #undef DECLARE_INSTRUCTION |
| 6500 #undef DECLARE_CONCRETE_INSTRUCTION | 6514 #undef DECLARE_CONCRETE_INSTRUCTION |
| 6501 | 6515 |
| 6502 } } // namespace v8::internal | 6516 } } // namespace v8::internal |
| 6503 | 6517 |
| 6504 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ | 6518 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ |
| OLD | NEW |