| 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 604 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 615 // implement DataEquals(), which will be used to determine if other | 615 // implement DataEquals(), which will be used to determine if other |
| 616 // occurrences of the instruction are indeed the same. | 616 // occurrences of the instruction are indeed the same. |
| 617 kUseGVN, | 617 kUseGVN, |
| 618 // Track instructions that are dominating side effects. If an instruction | 618 // Track instructions that are dominating side effects. If an instruction |
| 619 // sets this flag, it must implement HandleSideEffectDominator() and should | 619 // sets this flag, it must implement HandleSideEffectDominator() and should |
| 620 // indicate which side effects to track by setting GVN flags. | 620 // indicate which side effects to track by setting GVN flags. |
| 621 kTrackSideEffectDominators, | 621 kTrackSideEffectDominators, |
| 622 kCanOverflow, | 622 kCanOverflow, |
| 623 kBailoutOnMinusZero, | 623 kBailoutOnMinusZero, |
| 624 kCanBeDivByZero, | 624 kCanBeDivByZero, |
| 625 kLeftCanBeMinInt, |
| 625 kAllowUndefinedAsNaN, | 626 kAllowUndefinedAsNaN, |
| 626 kIsArguments, | 627 kIsArguments, |
| 627 kTruncatingToInt32, | 628 kTruncatingToInt32, |
| 628 kAllUsesTruncatingToInt32, | 629 kAllUsesTruncatingToInt32, |
| 629 kTruncatingToSmi, | 630 kTruncatingToSmi, |
| 630 kAllUsesTruncatingToSmi, | 631 kAllUsesTruncatingToSmi, |
| 631 // Set after an instruction is killed. | 632 // Set after an instruction is killed. |
| 632 kIsDead, | 633 kIsDead, |
| 633 // Instructions that are allowed to produce full range unsigned integer | 634 // Instructions that are allowed to produce full range unsigned integer |
| 634 // values are marked with kUint32 flag. If arithmetic shift or a load from | 635 // values are marked with kUint32 flag. If arithmetic shift or a load from |
| (...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 848 GVNFlagSet ObservableChangesFlags() const { | 849 GVNFlagSet ObservableChangesFlags() const { |
| 849 GVNFlagSet result = ChangesFlags(); | 850 GVNFlagSet result = ChangesFlags(); |
| 850 result.Intersect(AllObservableSideEffectsFlagSet()); | 851 result.Intersect(AllObservableSideEffectsFlagSet()); |
| 851 return result; | 852 return result; |
| 852 } | 853 } |
| 853 | 854 |
| 854 Range* range() const { return range_; } | 855 Range* range() const { return range_; } |
| 855 // TODO(svenpanne) We should really use the null object pattern here. | 856 // TODO(svenpanne) We should really use the null object pattern here. |
| 856 bool HasRange() const { return range_ != NULL; } | 857 bool HasRange() const { return range_ != NULL; } |
| 857 bool CanBeNegative() const { return !HasRange() || range()->CanBeNegative(); } | 858 bool CanBeNegative() const { return !HasRange() || range()->CanBeNegative(); } |
| 858 bool RangeCanInclude(int value) const { | |
| 859 return !HasRange() || range()->Includes(value); | |
| 860 } | |
| 861 void AddNewRange(Range* r, Zone* zone); | 859 void AddNewRange(Range* r, Zone* zone); |
| 862 void RemoveLastAddedRange(); | 860 void RemoveLastAddedRange(); |
| 863 void ComputeInitialRange(Zone* zone); | 861 void ComputeInitialRange(Zone* zone); |
| 864 | 862 |
| 865 // Escape analysis helpers. | 863 // Escape analysis helpers. |
| 866 virtual bool HasEscapingOperandAt(int index) { return true; } | 864 virtual bool HasEscapingOperandAt(int index) { return true; } |
| 867 virtual bool HasOutOfBoundsAccess(int size) { return false; } | 865 virtual bool HasOutOfBoundsAccess(int size) { return false; } |
| 868 | 866 |
| 869 // Representation helpers. | 867 // Representation helpers. |
| 870 virtual Representation observed_input_representation(int index) { | 868 virtual Representation observed_input_representation(int index) { |
| (...skipping 2887 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3758 } | 3756 } |
| 3759 | 3757 |
| 3760 bool RightIsPowerOf2() { | 3758 bool RightIsPowerOf2() { |
| 3761 if (!right()->IsInteger32Constant()) return false; | 3759 if (!right()->IsInteger32Constant()) return false; |
| 3762 int32_t value = right()->GetInteger32Constant(); | 3760 int32_t value = right()->GetInteger32Constant(); |
| 3763 return value != 0 && (IsPowerOf2(value) || IsPowerOf2(-value)); | 3761 return value != 0 && (IsPowerOf2(value) || IsPowerOf2(-value)); |
| 3764 } | 3762 } |
| 3765 | 3763 |
| 3766 DECLARE_ABSTRACT_INSTRUCTION(BinaryOperation) | 3764 DECLARE_ABSTRACT_INSTRUCTION(BinaryOperation) |
| 3767 | 3765 |
| 3768 protected: | |
| 3769 Range* InferRangeForDiv(Zone* zone); | |
| 3770 | |
| 3771 private: | 3766 private: |
| 3772 bool IgnoreObservedOutputRepresentation(Representation current_rep); | 3767 bool IgnoreObservedOutputRepresentation(Representation current_rep); |
| 3773 | 3768 |
| 3774 Representation observed_input_representation_[2]; | 3769 Representation observed_input_representation_[2]; |
| 3775 Representation observed_output_representation_; | 3770 Representation observed_output_representation_; |
| 3776 }; | 3771 }; |
| 3777 | 3772 |
| 3778 | 3773 |
| 3779 class HWrapReceiver V8_FINAL : public HTemplateInstruction<2> { | 3774 class HWrapReceiver V8_FINAL : public HTemplateInstruction<2> { |
| 3780 public: | 3775 public: |
| (...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4102 protected: | 4097 protected: |
| 4103 virtual bool DataEquals(HValue* other) V8_OVERRIDE { return true; } | 4098 virtual bool DataEquals(HValue* other) V8_OVERRIDE { return true; } |
| 4104 | 4099 |
| 4105 private: | 4100 private: |
| 4106 HMathFloorOfDiv(HValue* context, HValue* left, HValue* right) | 4101 HMathFloorOfDiv(HValue* context, HValue* left, HValue* right) |
| 4107 : HBinaryOperation(context, left, right) { | 4102 : HBinaryOperation(context, left, right) { |
| 4108 set_representation(Representation::Integer32()); | 4103 set_representation(Representation::Integer32()); |
| 4109 SetFlag(kUseGVN); | 4104 SetFlag(kUseGVN); |
| 4110 SetFlag(kCanOverflow); | 4105 SetFlag(kCanOverflow); |
| 4111 SetFlag(kCanBeDivByZero); | 4106 SetFlag(kCanBeDivByZero); |
| 4107 SetFlag(kLeftCanBeMinInt); |
| 4112 SetFlag(kAllowUndefinedAsNaN); | 4108 SetFlag(kAllowUndefinedAsNaN); |
| 4113 } | 4109 } |
| 4114 | 4110 |
| 4115 virtual Range* InferRange(Zone* zone) V8_OVERRIDE; | 4111 virtual Range* InferRange(Zone* zone) V8_OVERRIDE; |
| 4116 | 4112 |
| 4117 virtual bool IsDeletable() const V8_OVERRIDE { return true; } | 4113 virtual bool IsDeletable() const V8_OVERRIDE { return true; } |
| 4118 }; | 4114 }; |
| 4119 | 4115 |
| 4120 | 4116 |
| 4121 class HArithmeticBinaryOperation : public HBinaryOperation { | 4117 class HArithmeticBinaryOperation : public HBinaryOperation { |
| (...skipping 3386 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7508 virtual bool IsDeletable() const V8_OVERRIDE { return true; } | 7504 virtual bool IsDeletable() const V8_OVERRIDE { return true; } |
| 7509 }; | 7505 }; |
| 7510 | 7506 |
| 7511 | 7507 |
| 7512 #undef DECLARE_INSTRUCTION | 7508 #undef DECLARE_INSTRUCTION |
| 7513 #undef DECLARE_CONCRETE_INSTRUCTION | 7509 #undef DECLARE_CONCRETE_INSTRUCTION |
| 7514 | 7510 |
| 7515 } } // namespace v8::internal | 7511 } } // namespace v8::internal |
| 7516 | 7512 |
| 7517 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ | 7513 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ |
| OLD | NEW |