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 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
173 V(ThisFunction) \ | 173 V(ThisFunction) \ |
174 V(Throw) \ | 174 V(Throw) \ |
175 V(ToFastProperties) \ | 175 V(ToFastProperties) \ |
176 V(ToInt32) \ | 176 V(ToInt32) \ |
177 V(TransitionElementsKind) \ | 177 V(TransitionElementsKind) \ |
178 V(Typeof) \ | 178 V(Typeof) \ |
179 V(TypeofIsAndBranch) \ | 179 V(TypeofIsAndBranch) \ |
180 V(UnaryMathOperation) \ | 180 V(UnaryMathOperation) \ |
181 V(UnknownOSRValue) \ | 181 V(UnknownOSRValue) \ |
182 V(UseConst) \ | 182 V(UseConst) \ |
183 V(ValueOf) | 183 V(ValueOf) \ |
| 184 V(ForInPrepareMap) \ |
| 185 V(ForInCacheArray) \ |
| 186 V(CheckMapValue) \ |
| 187 V(LoadFieldByIndex) |
184 | 188 |
185 #define GVN_FLAG_LIST(V) \ | 189 #define GVN_FLAG_LIST(V) \ |
186 V(Calls) \ | 190 V(Calls) \ |
187 V(InobjectFields) \ | 191 V(InobjectFields) \ |
188 V(BackingStoreFields) \ | 192 V(BackingStoreFields) \ |
189 V(ElementsKind) \ | 193 V(ElementsKind) \ |
190 V(ElementsPointer) \ | 194 V(ElementsPointer) \ |
191 V(ArrayElements) \ | 195 V(ArrayElements) \ |
192 V(DoubleArrayElements) \ | 196 V(DoubleArrayElements) \ |
193 V(SpecializedArrayElements) \ | 197 V(SpecializedArrayElements) \ |
(...skipping 1810 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2004 | 2008 |
2005 DECLARE_CONCRETE_INSTRUCTION(LoadExternalArrayPointer) | 2009 DECLARE_CONCRETE_INSTRUCTION(LoadExternalArrayPointer) |
2006 | 2010 |
2007 protected: | 2011 protected: |
2008 virtual bool DataEquals(HValue* other) { return true; } | 2012 virtual bool DataEquals(HValue* other) { return true; } |
2009 }; | 2013 }; |
2010 | 2014 |
2011 | 2015 |
2012 class HCheckMap: public HTemplateInstruction<2> { | 2016 class HCheckMap: public HTemplateInstruction<2> { |
2013 public: | 2017 public: |
2014 HCheckMap(HValue* value, Handle<Map> map, | 2018 HCheckMap(HValue* value, |
| 2019 Handle<Map> map, |
2015 HValue* typecheck = NULL, | 2020 HValue* typecheck = NULL, |
2016 CompareMapMode mode = REQUIRE_EXACT_MAP) | 2021 CompareMapMode mode = REQUIRE_EXACT_MAP) |
2017 : map_(map), | 2022 : map_(map), |
2018 mode_(mode) { | 2023 mode_(mode) { |
2019 SetOperandAt(0, value); | 2024 SetOperandAt(0, value); |
2020 // If callers don't depend on a typecheck, they can pass in NULL. In that | 2025 // If callers don't depend on a typecheck, they can pass in NULL. In that |
2021 // case we use a copy of the |value| argument as a dummy value. | 2026 // case we use a copy of the |value| argument as a dummy value. |
2022 SetOperandAt(1, typecheck != NULL ? typecheck : value); | 2027 SetOperandAt(1, typecheck != NULL ? typecheck : value); |
2023 set_representation(Representation::Tagged()); | 2028 set_representation(Representation::Tagged()); |
2024 SetFlag(kUseGVN); | 2029 SetFlag(kUseGVN); |
(...skipping 1782 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3807 | 3812 |
3808 DECLARE_CONCRETE_INSTRUCTION(LoadFunctionPrototype) | 3813 DECLARE_CONCRETE_INSTRUCTION(LoadFunctionPrototype) |
3809 | 3814 |
3810 protected: | 3815 protected: |
3811 virtual bool DataEquals(HValue* other) { return true; } | 3816 virtual bool DataEquals(HValue* other) { return true; } |
3812 }; | 3817 }; |
3813 | 3818 |
3814 | 3819 |
3815 class HLoadKeyedFastElement: public HTemplateInstruction<2> { | 3820 class HLoadKeyedFastElement: public HTemplateInstruction<2> { |
3816 public: | 3821 public: |
3817 HLoadKeyedFastElement(HValue* obj, HValue* key) { | 3822 enum HoleCheckMode { PERFORM_HOLE_CHECK, OMIT_HOLE_CHECK }; |
| 3823 |
| 3824 HLoadKeyedFastElement(HValue* obj, |
| 3825 HValue* key, |
| 3826 HoleCheckMode hole_check_mode = PERFORM_HOLE_CHECK) |
| 3827 : hole_check_mode_(hole_check_mode) { |
3818 SetOperandAt(0, obj); | 3828 SetOperandAt(0, obj); |
3819 SetOperandAt(1, key); | 3829 SetOperandAt(1, key); |
3820 set_representation(Representation::Tagged()); | 3830 set_representation(Representation::Tagged()); |
3821 SetGVNFlag(kDependsOnArrayElements); | 3831 SetGVNFlag(kDependsOnArrayElements); |
3822 SetFlag(kUseGVN); | 3832 SetFlag(kUseGVN); |
3823 } | 3833 } |
3824 | 3834 |
3825 HValue* object() { return OperandAt(0); } | 3835 HValue* object() { return OperandAt(0); } |
3826 HValue* key() { return OperandAt(1); } | 3836 HValue* key() { return OperandAt(1); } |
3827 | 3837 |
3828 virtual Representation RequiredInputRepresentation(int index) { | 3838 virtual Representation RequiredInputRepresentation(int index) { |
3829 // The key is supposed to be Integer32. | 3839 // The key is supposed to be Integer32. |
3830 return index == 0 | 3840 return index == 0 |
3831 ? Representation::Tagged() | 3841 ? Representation::Tagged() |
3832 : Representation::Integer32(); | 3842 : Representation::Integer32(); |
3833 } | 3843 } |
3834 | 3844 |
3835 virtual void PrintDataTo(StringStream* stream); | 3845 virtual void PrintDataTo(StringStream* stream); |
3836 | 3846 |
3837 bool RequiresHoleCheck(); | 3847 bool RequiresHoleCheck(); |
3838 | 3848 |
3839 DECLARE_CONCRETE_INSTRUCTION(LoadKeyedFastElement) | 3849 DECLARE_CONCRETE_INSTRUCTION(LoadKeyedFastElement) |
3840 | 3850 |
3841 protected: | 3851 protected: |
3842 virtual bool DataEquals(HValue* other) { return true; } | 3852 virtual bool DataEquals(HValue* other) { |
| 3853 if (!other->IsLoadKeyedFastElement()) return false; |
| 3854 HLoadKeyedFastElement* other_load = HLoadKeyedFastElement::cast(other); |
| 3855 return hole_check_mode_ == other_load->hole_check_mode_; |
| 3856 } |
| 3857 |
| 3858 private: |
| 3859 HoleCheckMode hole_check_mode_; |
3843 }; | 3860 }; |
3844 | 3861 |
3845 | 3862 |
3846 class HLoadKeyedFastDoubleElement: public HTemplateInstruction<2> { | 3863 class HLoadKeyedFastDoubleElement: public HTemplateInstruction<2> { |
3847 public: | 3864 public: |
3848 HLoadKeyedFastDoubleElement(HValue* elements, HValue* key) { | 3865 HLoadKeyedFastDoubleElement(HValue* elements, HValue* key) { |
3849 SetOperandAt(0, elements); | 3866 SetOperandAt(0, elements); |
3850 SetOperandAt(1, key); | 3867 SetOperandAt(1, key); |
3851 set_representation(Representation::Double()); | 3868 set_representation(Representation::Double()); |
3852 SetGVNFlag(kDependsOnDoubleArrayElements); | 3869 SetGVNFlag(kDependsOnDoubleArrayElements); |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3936 HValue* object() { return OperandAt(0); } | 3953 HValue* object() { return OperandAt(0); } |
3937 HValue* key() { return OperandAt(1); } | 3954 HValue* key() { return OperandAt(1); } |
3938 HValue* context() { return OperandAt(2); } | 3955 HValue* context() { return OperandAt(2); } |
3939 | 3956 |
3940 virtual void PrintDataTo(StringStream* stream); | 3957 virtual void PrintDataTo(StringStream* stream); |
3941 | 3958 |
3942 virtual Representation RequiredInputRepresentation(int index) { | 3959 virtual Representation RequiredInputRepresentation(int index) { |
3943 return Representation::Tagged(); | 3960 return Representation::Tagged(); |
3944 } | 3961 } |
3945 | 3962 |
| 3963 virtual HValue* Canonicalize(); |
| 3964 |
3946 DECLARE_CONCRETE_INSTRUCTION(LoadKeyedGeneric) | 3965 DECLARE_CONCRETE_INSTRUCTION(LoadKeyedGeneric) |
3947 }; | 3966 }; |
3948 | 3967 |
3949 | 3968 |
3950 class HStoreNamedField: public HTemplateInstruction<2> { | 3969 class HStoreNamedField: public HTemplateInstruction<2> { |
3951 public: | 3970 public: |
3952 HStoreNamedField(HValue* obj, | 3971 HStoreNamedField(HValue* obj, |
3953 Handle<String> name, | 3972 Handle<String> name, |
3954 HValue* val, | 3973 HValue* val, |
3955 bool in_object, | 3974 bool in_object, |
(...skipping 654 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4610 | 4629 |
4611 virtual HType CalculateInferredType() { | 4630 virtual HType CalculateInferredType() { |
4612 return HType::Boolean(); | 4631 return HType::Boolean(); |
4613 } | 4632 } |
4614 | 4633 |
4615 virtual void PrintDataTo(StringStream* stream); | 4634 virtual void PrintDataTo(StringStream* stream); |
4616 | 4635 |
4617 DECLARE_CONCRETE_INSTRUCTION(In) | 4636 DECLARE_CONCRETE_INSTRUCTION(In) |
4618 }; | 4637 }; |
4619 | 4638 |
| 4639 |
| 4640 class HCheckMapValue: public HTemplateInstruction<2> { |
| 4641 public: |
| 4642 HCheckMapValue(HValue* value, |
| 4643 HValue* map) { |
| 4644 SetOperandAt(0, value); |
| 4645 SetOperandAt(1, map); |
| 4646 set_representation(Representation::Tagged()); |
| 4647 SetFlag(kUseGVN); |
| 4648 SetGVNFlag(kDependsOnMaps); |
| 4649 SetGVNFlag(kDependsOnElementsKind); |
| 4650 } |
| 4651 |
| 4652 virtual Representation RequiredInputRepresentation(int index) { |
| 4653 return Representation::Tagged(); |
| 4654 } |
| 4655 |
| 4656 virtual void PrintDataTo(StringStream* stream); |
| 4657 |
| 4658 virtual HType CalculateInferredType() { |
| 4659 return HType::Tagged(); |
| 4660 } |
| 4661 |
| 4662 HValue* value() { return OperandAt(0); } |
| 4663 HValue* map() { return OperandAt(1); } |
| 4664 |
| 4665 DECLARE_CONCRETE_INSTRUCTION(CheckMapValue) |
| 4666 |
| 4667 protected: |
| 4668 virtual bool DataEquals(HValue* other) { |
| 4669 return true; |
| 4670 } |
| 4671 }; |
| 4672 |
| 4673 |
| 4674 class HForInPrepareMap : public HTemplateInstruction<2> { |
| 4675 public: |
| 4676 HForInPrepareMap(HValue* context, |
| 4677 HValue* object) { |
| 4678 SetOperandAt(0, context); |
| 4679 SetOperandAt(1, object); |
| 4680 set_representation(Representation::Tagged()); |
| 4681 SetAllSideEffects(); |
| 4682 } |
| 4683 |
| 4684 virtual Representation RequiredInputRepresentation(int index) { |
| 4685 return Representation::Tagged(); |
| 4686 } |
| 4687 |
| 4688 HValue* context() { return OperandAt(0); } |
| 4689 HValue* enumerable() { return OperandAt(1); } |
| 4690 |
| 4691 virtual void PrintDataTo(StringStream* stream); |
| 4692 |
| 4693 virtual HType CalculateInferredType() { |
| 4694 return HType::Tagged(); |
| 4695 } |
| 4696 |
| 4697 DECLARE_CONCRETE_INSTRUCTION(ForInPrepareMap); |
| 4698 }; |
| 4699 |
| 4700 |
| 4701 class HForInCacheArray : public HTemplateInstruction<2> { |
| 4702 public: |
| 4703 HForInCacheArray(HValue* enumerable, |
| 4704 HValue* keys, |
| 4705 int idx) : idx_(idx) { |
| 4706 SetOperandAt(0, enumerable); |
| 4707 SetOperandAt(1, keys); |
| 4708 set_representation(Representation::Tagged()); |
| 4709 } |
| 4710 |
| 4711 virtual Representation RequiredInputRepresentation(int index) { |
| 4712 return Representation::Tagged(); |
| 4713 } |
| 4714 |
| 4715 HValue* enumerable() { return OperandAt(0); } |
| 4716 HValue* keys() { return OperandAt(1); } |
| 4717 int idx() { return idx_; } |
| 4718 |
| 4719 HForInCacheArray* index_cache() { |
| 4720 return index_cache_; |
| 4721 } |
| 4722 |
| 4723 void set_index_cache(HForInCacheArray* index_cache) { |
| 4724 index_cache_ = index_cache; |
| 4725 } |
| 4726 |
| 4727 virtual void PrintDataTo(StringStream* stream); |
| 4728 |
| 4729 virtual HType CalculateInferredType() { |
| 4730 return HType::Tagged(); |
| 4731 } |
| 4732 |
| 4733 DECLARE_CONCRETE_INSTRUCTION(ForInCacheArray); |
| 4734 private: |
| 4735 int idx_; |
| 4736 HForInCacheArray* index_cache_; |
| 4737 }; |
| 4738 |
| 4739 |
| 4740 class HLoadFieldByIndex : public HTemplateInstruction<2> { |
| 4741 public: |
| 4742 HLoadFieldByIndex(HValue* object, |
| 4743 HValue* index) { |
| 4744 SetOperandAt(0, object); |
| 4745 SetOperandAt(1, index); |
| 4746 set_representation(Representation::Tagged()); |
| 4747 } |
| 4748 |
| 4749 virtual Representation RequiredInputRepresentation(int index) { |
| 4750 return Representation::Tagged(); |
| 4751 } |
| 4752 |
| 4753 HValue* object() { return OperandAt(0); } |
| 4754 HValue* index() { return OperandAt(1); } |
| 4755 |
| 4756 virtual void PrintDataTo(StringStream* stream); |
| 4757 |
| 4758 virtual HType CalculateInferredType() { |
| 4759 return HType::Tagged(); |
| 4760 } |
| 4761 |
| 4762 DECLARE_CONCRETE_INSTRUCTION(LoadFieldByIndex); |
| 4763 }; |
| 4764 |
| 4765 |
4620 #undef DECLARE_INSTRUCTION | 4766 #undef DECLARE_INSTRUCTION |
4621 #undef DECLARE_CONCRETE_INSTRUCTION | 4767 #undef DECLARE_CONCRETE_INSTRUCTION |
4622 | 4768 |
4623 } } // namespace v8::internal | 4769 } } // namespace v8::internal |
4624 | 4770 |
4625 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ | 4771 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ |
OLD | NEW |