Chromium Code Reviews| 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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 47 class HEnvironment; | 47 class HEnvironment; |
| 48 class HInferRepresentation; | 48 class HInferRepresentation; |
| 49 class HInstruction; | 49 class HInstruction; |
| 50 class HLoopInformation; | 50 class HLoopInformation; |
| 51 class HValue; | 51 class HValue; |
| 52 class LInstruction; | 52 class LInstruction; |
| 53 class LChunkBuilder; | 53 class LChunkBuilder; |
| 54 | 54 |
| 55 | 55 |
| 56 #define HYDROGEN_ABSTRACT_INSTRUCTION_LIST(V) \ | 56 #define HYDROGEN_ABSTRACT_INSTRUCTION_LIST(V) \ |
| 57 V(ArithmeticBinaryOperation) \ | |
| 57 V(BinaryOperation) \ | 58 V(BinaryOperation) \ |
| 58 V(BitwiseBinaryOperation) \ | 59 V(BitwiseBinaryOperation) \ |
| 59 V(ControlInstruction) \ | 60 V(ControlInstruction) \ |
| 60 V(Instruction) \ | 61 V(Instruction) \ |
| 61 | 62 |
| 62 | 63 |
| 63 #define HYDROGEN_CONCRETE_INSTRUCTION_LIST(V) \ | 64 #define HYDROGEN_CONCRETE_INSTRUCTION_LIST(V) \ |
| 64 V(AbnormalExit) \ | 65 V(AbnormalExit) \ |
| 65 V(AccessArgumentsAt) \ | 66 V(AccessArgumentsAt) \ |
| 66 V(Add) \ | 67 V(Add) \ |
| (...skipping 723 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 790 // Track instructions that are dominating side effects. If an instruction | 791 // Track instructions that are dominating side effects. If an instruction |
| 791 // sets this flag, it must implement SetSideEffectDominator() and should | 792 // sets this flag, it must implement SetSideEffectDominator() and should |
| 792 // indicate which side effects to track by setting GVN flags. | 793 // indicate which side effects to track by setting GVN flags. |
| 793 kTrackSideEffectDominators, | 794 kTrackSideEffectDominators, |
| 794 kCanOverflow, | 795 kCanOverflow, |
| 795 kBailoutOnMinusZero, | 796 kBailoutOnMinusZero, |
| 796 kCanBeDivByZero, | 797 kCanBeDivByZero, |
| 797 kAllowUndefinedAsNaN, | 798 kAllowUndefinedAsNaN, |
| 798 kIsArguments, | 799 kIsArguments, |
| 799 kTruncatingToInt32, | 800 kTruncatingToInt32, |
| 801 kAllUsesTruncatingToInt32, | |
| 800 // Set after an instruction is killed. | 802 // Set after an instruction is killed. |
| 801 kIsDead, | 803 kIsDead, |
| 802 // Instructions that are allowed to produce full range unsigned integer | 804 // Instructions that are allowed to produce full range unsigned integer |
| 803 // values are marked with kUint32 flag. If arithmetic shift or a load from | 805 // values are marked with kUint32 flag. If arithmetic shift or a load from |
| 804 // EXTERNAL_UNSIGNED_INT_ELEMENTS array is not marked with this flag | 806 // EXTERNAL_UNSIGNED_INT_ELEMENTS array is not marked with this flag |
| 805 // it will deoptimize if result does not fit into signed integer range. | 807 // it will deoptimize if result does not fit into signed integer range. |
| 806 // HGraph::ComputeSafeUint32Operations is responsible for setting this | 808 // HGraph::ComputeSafeUint32Operations is responsible for setting this |
| 807 // flag. | 809 // flag. |
| 808 kUint32, | 810 kUint32, |
| 809 // If a phi is involved in the evaluation of a numeric constraint the | 811 // If a phi is involved in the evaluation of a numeric constraint the |
| (...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 989 // Mark this HValue as dead and to be removed from other HValues' use lists. | 991 // Mark this HValue as dead and to be removed from other HValues' use lists. |
| 990 void Kill(); | 992 void Kill(); |
| 991 | 993 |
| 992 int flags() const { return flags_; } | 994 int flags() const { return flags_; } |
| 993 void SetFlag(Flag f) { flags_ |= (1 << f); } | 995 void SetFlag(Flag f) { flags_ |= (1 << f); } |
| 994 void ClearFlag(Flag f) { flags_ &= ~(1 << f); } | 996 void ClearFlag(Flag f) { flags_ &= ~(1 << f); } |
| 995 bool CheckFlag(Flag f) const { return (flags_ & (1 << f)) != 0; } | 997 bool CheckFlag(Flag f) const { return (flags_ & (1 << f)) != 0; } |
| 996 | 998 |
| 997 // Returns true if the flag specified is set for all uses, false otherwise. | 999 // Returns true if the flag specified is set for all uses, false otherwise. |
| 998 bool CheckUsesForFlag(Flag f); | 1000 bool CheckUsesForFlag(Flag f); |
| 1001 // Returns true if the flag specified is set for all uses, and this set | |
| 1002 // of uses is non-empty. | |
| 1003 bool HasAtLeastOneUseWithFlagAndNoneWithout(Flag f); | |
|
Sven Panne
2013/06/11 07:59:30
This helper predicate is totally confusing and har
| |
| 999 | 1004 |
| 1000 GVNFlagSet gvn_flags() const { return gvn_flags_; } | 1005 GVNFlagSet gvn_flags() const { return gvn_flags_; } |
| 1001 void SetGVNFlag(GVNFlag f) { gvn_flags_.Add(f); } | 1006 void SetGVNFlag(GVNFlag f) { gvn_flags_.Add(f); } |
| 1002 void ClearGVNFlag(GVNFlag f) { gvn_flags_.Remove(f); } | 1007 void ClearGVNFlag(GVNFlag f) { gvn_flags_.Remove(f); } |
| 1003 bool CheckGVNFlag(GVNFlag f) const { return gvn_flags_.Contains(f); } | 1008 bool CheckGVNFlag(GVNFlag f) const { return gvn_flags_.Contains(f); } |
| 1004 void SetAllSideEffects() { gvn_flags_.Add(AllSideEffectsFlagSet()); } | 1009 void SetAllSideEffects() { gvn_flags_.Add(AllSideEffectsFlagSet()); } |
| 1005 void ClearAllSideEffects() { | 1010 void ClearAllSideEffects() { |
| 1006 gvn_flags_.Remove(AllSideEffectsFlagSet()); | 1011 gvn_flags_.Remove(AllSideEffectsFlagSet()); |
| 1007 } | 1012 } |
| 1008 bool HasSideEffects() const { | 1013 bool HasSideEffects() const { |
| (...skipping 2834 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3843 } | 3848 } |
| 3844 } | 3849 } |
| 3845 | 3850 |
| 3846 virtual HType CalculateInferredType(); | 3851 virtual HType CalculateInferredType(); |
| 3847 virtual Representation RequiredInputRepresentation(int index) { | 3852 virtual Representation RequiredInputRepresentation(int index) { |
| 3848 return index == 0 | 3853 return index == 0 |
| 3849 ? Representation::Tagged() | 3854 ? Representation::Tagged() |
| 3850 : representation(); | 3855 : representation(); |
| 3851 } | 3856 } |
| 3852 | 3857 |
| 3853 virtual HValue* Canonicalize(); | 3858 DECLARE_ABSTRACT_INSTRUCTION(ArithmeticBinaryOperation) |
| 3854 | 3859 |
| 3855 private: | 3860 private: |
| 3856 virtual bool IsDeletable() const { return true; } | 3861 virtual bool IsDeletable() const { return true; } |
| 3857 }; | 3862 }; |
| 3858 | 3863 |
| 3859 | 3864 |
| 3860 class HCompareGeneric: public HBinaryOperation { | 3865 class HCompareGeneric: public HBinaryOperation { |
| 3861 public: | 3866 public: |
| 3862 HCompareGeneric(HValue* context, | 3867 HCompareGeneric(HValue* context, |
| 3863 HValue* left, | 3868 HValue* left, |
| (...skipping 611 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4475 | 4480 |
| 4476 | 4481 |
| 4477 class HDiv: public HArithmeticBinaryOperation { | 4482 class HDiv: public HArithmeticBinaryOperation { |
| 4478 public: | 4483 public: |
| 4479 static HInstruction* New(Zone* zone, | 4484 static HInstruction* New(Zone* zone, |
| 4480 HValue* context, | 4485 HValue* context, |
| 4481 HValue* left, | 4486 HValue* left, |
| 4482 HValue* right); | 4487 HValue* right); |
| 4483 | 4488 |
| 4484 bool HasPowerOf2Divisor() { | 4489 bool HasPowerOf2Divisor() { |
| 4485 if (right()->IsConstant() && | 4490 if (right()->IsInteger32Constant()) { |
| 4486 HConstant::cast(right())->HasInteger32Value()) { | 4491 int32_t value = right()->GetInteger32Constant(); |
| 4487 int32_t value = HConstant::cast(right())->Integer32Value(); | |
| 4488 return value != 0 && (IsPowerOf2(value) || IsPowerOf2(-value)); | 4492 return value != 0 && (IsPowerOf2(value) || IsPowerOf2(-value)); |
| 4489 } | 4493 } |
| 4490 | 4494 |
| 4491 return false; | 4495 return false; |
| 4492 } | 4496 } |
| 4493 | 4497 |
| 4494 virtual HValue* EnsureAndPropagateNotMinusZero(BitVector* visited); | 4498 virtual HValue* EnsureAndPropagateNotMinusZero(BitVector* visited); |
| 4495 | 4499 |
| 4496 virtual HValue* Canonicalize(); | 4500 virtual HValue* Canonicalize(); |
| 4497 | 4501 |
| (...skipping 2072 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 6570 virtual bool IsDeletable() const { return true; } | 6574 virtual bool IsDeletable() const { return true; } |
| 6571 }; | 6575 }; |
| 6572 | 6576 |
| 6573 | 6577 |
| 6574 #undef DECLARE_INSTRUCTION | 6578 #undef DECLARE_INSTRUCTION |
| 6575 #undef DECLARE_CONCRETE_INSTRUCTION | 6579 #undef DECLARE_CONCRETE_INSTRUCTION |
| 6576 | 6580 |
| 6577 } } // namespace v8::internal | 6581 } } // namespace v8::internal |
| 6578 | 6582 |
| 6579 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ | 6583 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ |
| OLD | NEW |