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 4396 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4407 HConstant::cast(right())->HasInteger32Value()) { | 4407 HConstant::cast(right())->HasInteger32Value()) { |
4408 int32_t value = HConstant::cast(right())->Integer32Value(); | 4408 int32_t value = HConstant::cast(right())->Integer32Value(); |
4409 return value != 0 && (IsPowerOf2(value) || IsPowerOf2(-value)); | 4409 return value != 0 && (IsPowerOf2(value) || IsPowerOf2(-value)); |
4410 } | 4410 } |
4411 | 4411 |
4412 return false; | 4412 return false; |
4413 } | 4413 } |
4414 | 4414 |
4415 virtual HValue* EnsureAndPropagateNotMinusZero(BitVector* visited); | 4415 virtual HValue* EnsureAndPropagateNotMinusZero(BitVector* visited); |
4416 | 4416 |
| 4417 virtual HValue* Canonicalize(); |
| 4418 |
4417 DECLARE_CONCRETE_INSTRUCTION(Mod) | 4419 DECLARE_CONCRETE_INSTRUCTION(Mod) |
4418 | 4420 |
4419 protected: | 4421 protected: |
4420 virtual bool DataEquals(HValue* other) { return true; } | 4422 virtual bool DataEquals(HValue* other) { return true; } |
4421 | 4423 |
4422 virtual Range* InferRange(Zone* zone); | 4424 virtual Range* InferRange(Zone* zone); |
4423 | 4425 |
4424 private: | 4426 private: |
4425 HMod(HValue* context, HValue* left, HValue* right) | 4427 HMod(HValue* context, HValue* left, HValue* right) |
4426 : HArithmeticBinaryOperation(context, left, right) { | 4428 : HArithmeticBinaryOperation(context, left, right) { |
4427 SetFlag(kCanBeDivByZero); | 4429 SetFlag(kCanBeDivByZero); |
| 4430 SetFlag(kCanOverflow); |
4428 } | 4431 } |
4429 }; | 4432 }; |
4430 | 4433 |
4431 | 4434 |
4432 class HDiv: public HArithmeticBinaryOperation { | 4435 class HDiv: public HArithmeticBinaryOperation { |
4433 public: | 4436 public: |
4434 static HInstruction* New(Zone* zone, | 4437 static HInstruction* New(Zone* zone, |
4435 HValue* context, | 4438 HValue* context, |
4436 HValue* left, | 4439 HValue* left, |
4437 HValue* right); | 4440 HValue* right); |
4438 | 4441 |
4439 bool HasPowerOf2Divisor() { | 4442 bool HasPowerOf2Divisor() { |
4440 if (right()->IsConstant() && | 4443 if (right()->IsConstant() && |
4441 HConstant::cast(right())->HasInteger32Value()) { | 4444 HConstant::cast(right())->HasInteger32Value()) { |
4442 int32_t value = HConstant::cast(right())->Integer32Value(); | 4445 int32_t value = HConstant::cast(right())->Integer32Value(); |
4443 return value != 0 && (IsPowerOf2(value) || IsPowerOf2(-value)); | 4446 return value != 0 && (IsPowerOf2(value) || IsPowerOf2(-value)); |
4444 } | 4447 } |
4445 | 4448 |
4446 return false; | 4449 return false; |
4447 } | 4450 } |
4448 | 4451 |
4449 virtual HValue* EnsureAndPropagateNotMinusZero(BitVector* visited); | 4452 virtual HValue* EnsureAndPropagateNotMinusZero(BitVector* visited); |
4450 | 4453 |
| 4454 virtual HValue* Canonicalize(); |
| 4455 |
4451 DECLARE_CONCRETE_INSTRUCTION(Div) | 4456 DECLARE_CONCRETE_INSTRUCTION(Div) |
4452 | 4457 |
4453 protected: | 4458 protected: |
4454 virtual bool DataEquals(HValue* other) { return true; } | 4459 virtual bool DataEquals(HValue* other) { return true; } |
4455 | 4460 |
4456 virtual Range* InferRange(Zone* zone); | 4461 virtual Range* InferRange(Zone* zone); |
4457 | 4462 |
4458 private: | 4463 private: |
4459 HDiv(HValue* context, HValue* left, HValue* right) | 4464 HDiv(HValue* context, HValue* left, HValue* right) |
4460 : HArithmeticBinaryOperation(context, left, right) { | 4465 : HArithmeticBinaryOperation(context, left, right) { |
(...skipping 2006 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6467 virtual bool IsDeletable() const { return true; } | 6472 virtual bool IsDeletable() const { return true; } |
6468 }; | 6473 }; |
6469 | 6474 |
6470 | 6475 |
6471 #undef DECLARE_INSTRUCTION | 6476 #undef DECLARE_INSTRUCTION |
6472 #undef DECLARE_CONCRETE_INSTRUCTION | 6477 #undef DECLARE_CONCRETE_INSTRUCTION |
6473 | 6478 |
6474 } } // namespace v8::internal | 6479 } } // namespace v8::internal |
6475 | 6480 |
6476 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ | 6481 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ |
OLD | NEW |