Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(199)

Side by Side Diff: src/hydrogen-instructions.h

Issue 6691054: [Arguments] Merge (7442,7496] from bleeding_edge. (Closed) Base URL: https://v8.googlecode.com/svn/branches/experimental/arguments
Patch Set: Created 9 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/hydrogen.cc ('k') | src/hydrogen-instructions.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 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 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 V(IsNull) \ 117 V(IsNull) \
118 V(IsObject) \ 118 V(IsObject) \
119 V(IsSmi) \ 119 V(IsSmi) \
120 V(IsConstructCall) \ 120 V(IsConstructCall) \
121 V(JSArrayLength) \ 121 V(JSArrayLength) \
122 V(LeaveInlined) \ 122 V(LeaveInlined) \
123 V(LoadContextSlot) \ 123 V(LoadContextSlot) \
124 V(LoadElements) \ 124 V(LoadElements) \
125 V(LoadExternalArrayPointer) \ 125 V(LoadExternalArrayPointer) \
126 V(LoadFunctionPrototype) \ 126 V(LoadFunctionPrototype) \
127 V(LoadGlobal) \ 127 V(LoadGlobalCell) \
128 V(LoadGlobalGeneric) \
128 V(LoadKeyedFastElement) \ 129 V(LoadKeyedFastElement) \
129 V(LoadKeyedGeneric) \ 130 V(LoadKeyedGeneric) \
130 V(LoadKeyedSpecializedArrayElement) \ 131 V(LoadKeyedSpecializedArrayElement) \
131 V(LoadNamedField) \ 132 V(LoadNamedField) \
132 V(LoadNamedFieldPolymorphic) \ 133 V(LoadNamedFieldPolymorphic) \
133 V(LoadNamedGeneric) \ 134 V(LoadNamedGeneric) \
134 V(Mod) \ 135 V(Mod) \
135 V(Mul) \ 136 V(Mul) \
136 V(ObjectLiteral) \ 137 V(ObjectLiteral) \
137 V(OsrEntry) \ 138 V(OsrEntry) \
138 V(OuterContext) \ 139 V(OuterContext) \
139 V(Parameter) \ 140 V(Parameter) \
140 V(Power) \ 141 V(Power) \
141 V(PushArgument) \ 142 V(PushArgument) \
142 V(RegExpLiteral) \ 143 V(RegExpLiteral) \
143 V(Return) \ 144 V(Return) \
144 V(Sar) \ 145 V(Sar) \
145 V(Shl) \ 146 V(Shl) \
146 V(Shr) \ 147 V(Shr) \
147 V(Simulate) \ 148 V(Simulate) \
148 V(StackCheck) \ 149 V(StackCheck) \
149 V(StoreContextSlot) \ 150 V(StoreContextSlot) \
150 V(StoreGlobal) \ 151 V(StoreGlobalCell) \
152 V(StoreGlobalGeneric) \
151 V(StoreKeyedFastElement) \ 153 V(StoreKeyedFastElement) \
152 V(StoreKeyedSpecializedArrayElement) \ 154 V(StoreKeyedSpecializedArrayElement) \
153 V(StoreKeyedGeneric) \ 155 V(StoreKeyedGeneric) \
154 V(StoreNamedField) \ 156 V(StoreNamedField) \
155 V(StoreNamedGeneric) \ 157 V(StoreNamedGeneric) \
156 V(StringCharCodeAt) \ 158 V(StringCharCodeAt) \
157 V(StringCharFromCode) \ 159 V(StringCharFromCode) \
158 V(StringLength) \ 160 V(StringLength) \
159 V(Sub) \ 161 V(Sub) \
160 V(Test) \ 162 V(Test) \
(...skipping 763 matching lines...) Expand 10 before | Expand all | Expand 10 after
924 DECLARE_CONCRETE_INSTRUCTION(Throw, "throw") 926 DECLARE_CONCRETE_INSTRUCTION(Throw, "throw")
925 }; 927 };
926 928
927 929
928 class HChange: public HUnaryOperation { 930 class HChange: public HUnaryOperation {
929 public: 931 public:
930 HChange(HValue* value, 932 HChange(HValue* value,
931 Representation from, 933 Representation from,
932 Representation to, 934 Representation to,
933 bool is_truncating) 935 bool is_truncating)
934 : HUnaryOperation(value), from_(from), to_(to) { 936 : HUnaryOperation(value), from_(from) {
935 ASSERT(!from.IsNone() && !to.IsNone()); 937 ASSERT(!from.IsNone() && !to.IsNone());
936 ASSERT(!from.Equals(to)); 938 ASSERT(!from.Equals(to));
937 set_representation(to); 939 set_representation(to);
938 SetFlag(kUseGVN); 940 SetFlag(kUseGVN);
939 if (is_truncating) SetFlag(kTruncatingToInt32); 941 if (is_truncating) SetFlag(kTruncatingToInt32);
940 if (from.IsInteger32() && to.IsTagged() && value->range() != NULL && 942 if (from.IsInteger32() && to.IsTagged() && value->range() != NULL &&
941 value->range()->IsInSmiRange()) { 943 value->range()->IsInSmiRange()) {
942 set_type(HType::Smi()); 944 set_type(HType::Smi());
943 } 945 }
944 } 946 }
945 947
946 virtual HValue* EnsureAndPropagateNotMinusZero(BitVector* visited); 948 virtual HValue* EnsureAndPropagateNotMinusZero(BitVector* visited);
947 949
948 Representation from() const { return from_; } 950 Representation from() const { return from_; }
949 Representation to() const { return to_; } 951 Representation to() const { return representation(); }
950 virtual Representation RequiredInputRepresentation(int index) const { 952 virtual Representation RequiredInputRepresentation(int index) const {
951 return from_; 953 return from_;
952 } 954 }
953 955
954 bool CanTruncateToInt32() const { return CheckFlag(kTruncatingToInt32); } 956 bool CanTruncateToInt32() const { return CheckFlag(kTruncatingToInt32); }
955 957
956 virtual void PrintDataTo(StringStream* stream); 958 virtual void PrintDataTo(StringStream* stream);
957 959
958 DECLARE_CONCRETE_INSTRUCTION(Change, 960 DECLARE_CONCRETE_INSTRUCTION(Change,
959 CanTruncateToInt32() ? "truncate" : "change") 961 CanTruncateToInt32() ? "truncate" : "change")
960 962
961 protected: 963 protected:
962 virtual bool DataEquals(HValue* other) { 964 virtual bool DataEquals(HValue* other) {
963 if (!other->IsChange()) return false; 965 if (!other->IsChange()) return false;
964 HChange* change = HChange::cast(other); 966 HChange* change = HChange::cast(other);
965 return value() == change->value() 967 return value() == change->value()
966 && to().Equals(change->to()); 968 && to().Equals(change->to());
967 } 969 }
968 970
969 private: 971 private:
970 Representation from_; 972 Representation from_;
971 Representation to_;
972 }; 973 };
973 974
974 975
975 class HSimulate: public HInstruction { 976 class HSimulate: public HInstruction {
976 public: 977 public:
977 HSimulate(int ast_id, int pop_count, int environment_length) 978 HSimulate(int ast_id, int pop_count, int environment_length)
978 : ast_id_(ast_id), 979 : ast_id_(ast_id),
979 pop_count_(pop_count), 980 pop_count_(pop_count),
980 environment_length_(environment_length), 981 environment_length_(environment_length),
981 values_(2), 982 values_(2),
(...skipping 1820 matching lines...) Expand 10 before | Expand all | Expand 10 after
2802 HUnknownOSRValue() { set_representation(Representation::Tagged()); } 2803 HUnknownOSRValue() { set_representation(Representation::Tagged()); }
2803 2804
2804 virtual Representation RequiredInputRepresentation(int index) const { 2805 virtual Representation RequiredInputRepresentation(int index) const {
2805 return Representation::None(); 2806 return Representation::None();
2806 } 2807 }
2807 2808
2808 DECLARE_CONCRETE_INSTRUCTION(UnknownOSRValue, "unknown_osr_value") 2809 DECLARE_CONCRETE_INSTRUCTION(UnknownOSRValue, "unknown_osr_value")
2809 }; 2810 };
2810 2811
2811 2812
2812 class HLoadGlobal: public HTemplateInstruction<0> { 2813 class HLoadGlobalCell: public HTemplateInstruction<0> {
2813 public: 2814 public:
2814 HLoadGlobal(Handle<JSGlobalPropertyCell> cell, bool check_hole_value) 2815 HLoadGlobalCell(Handle<JSGlobalPropertyCell> cell, bool check_hole_value)
2815 : cell_(cell), check_hole_value_(check_hole_value) { 2816 : cell_(cell), check_hole_value_(check_hole_value) {
2816 set_representation(Representation::Tagged()); 2817 set_representation(Representation::Tagged());
2817 SetFlag(kUseGVN); 2818 SetFlag(kUseGVN);
2818 SetFlag(kDependsOnGlobalVars); 2819 SetFlag(kDependsOnGlobalVars);
2819 } 2820 }
2820 2821
2821 Handle<JSGlobalPropertyCell> cell() const { return cell_; } 2822 Handle<JSGlobalPropertyCell> cell() const { return cell_; }
2822 bool check_hole_value() const { return check_hole_value_; } 2823 bool check_hole_value() const { return check_hole_value_; }
2823 2824
2824 virtual void PrintDataTo(StringStream* stream); 2825 virtual void PrintDataTo(StringStream* stream);
2825 2826
2826 virtual intptr_t Hashcode() { 2827 virtual intptr_t Hashcode() {
2827 ASSERT(!HEAP->allow_allocation(false)); 2828 ASSERT(!HEAP->allow_allocation(false));
2828 return reinterpret_cast<intptr_t>(*cell_); 2829 return reinterpret_cast<intptr_t>(*cell_);
2829 } 2830 }
2830 2831
2831 virtual Representation RequiredInputRepresentation(int index) const { 2832 virtual Representation RequiredInputRepresentation(int index) const {
2832 return Representation::None(); 2833 return Representation::None();
2833 } 2834 }
2834 2835
2835 DECLARE_CONCRETE_INSTRUCTION(LoadGlobal, "load_global") 2836 DECLARE_CONCRETE_INSTRUCTION(LoadGlobalCell, "load_global_cell")
2836 2837
2837 protected: 2838 protected:
2838 virtual bool DataEquals(HValue* other) { 2839 virtual bool DataEquals(HValue* other) {
2839 HLoadGlobal* b = HLoadGlobal::cast(other); 2840 HLoadGlobalCell* b = HLoadGlobalCell::cast(other);
2840 return cell_.is_identical_to(b->cell()); 2841 return cell_.is_identical_to(b->cell());
2841 } 2842 }
2842 2843
2843 private: 2844 private:
2844 Handle<JSGlobalPropertyCell> cell_; 2845 Handle<JSGlobalPropertyCell> cell_;
2845 bool check_hole_value_; 2846 bool check_hole_value_;
2846 }; 2847 };
2847 2848
2848 2849
2849 class HStoreGlobal: public HUnaryOperation { 2850 class HLoadGlobalGeneric: public HBinaryOperation {
2850 public: 2851 public:
2851 HStoreGlobal(HValue* value, 2852 HLoadGlobalGeneric(HValue* context,
2852 Handle<JSGlobalPropertyCell> cell, 2853 HValue* global_object,
2853 bool check_hole_value) 2854 Handle<Object> name,
2855 bool for_typeof)
2856 : HBinaryOperation(context, global_object),
2857 name_(name),
2858 for_typeof_(for_typeof) {
2859 set_representation(Representation::Tagged());
2860 SetAllSideEffects();
2861 }
2862
2863 HValue* context() { return OperandAt(0); }
2864 HValue* global_object() { return OperandAt(1); }
2865 Handle<Object> name() const { return name_; }
2866 bool for_typeof() const { return for_typeof_; }
2867
2868 virtual void PrintDataTo(StringStream* stream);
2869
2870 virtual Representation RequiredInputRepresentation(int index) const {
2871 return Representation::Tagged();
2872 }
2873
2874 DECLARE_CONCRETE_INSTRUCTION(LoadGlobalGeneric, "load_global_generic")
2875
2876 private:
2877 Handle<Object> name_;
2878 bool for_typeof_;
2879 };
2880
2881
2882 class HStoreGlobalCell: public HUnaryOperation {
2883 public:
2884 HStoreGlobalCell(HValue* value,
2885 Handle<JSGlobalPropertyCell> cell,
2886 bool check_hole_value)
2854 : HUnaryOperation(value), 2887 : HUnaryOperation(value),
2855 cell_(cell), 2888 cell_(cell),
2856 check_hole_value_(check_hole_value) { 2889 check_hole_value_(check_hole_value) {
2857 SetFlag(kChangesGlobalVars); 2890 SetFlag(kChangesGlobalVars);
2858 } 2891 }
2859 2892
2860 Handle<JSGlobalPropertyCell> cell() const { return cell_; } 2893 Handle<JSGlobalPropertyCell> cell() const { return cell_; }
2861 bool check_hole_value() const { return check_hole_value_; } 2894 bool check_hole_value() const { return check_hole_value_; }
2862 2895
2863 virtual Representation RequiredInputRepresentation(int index) const { 2896 virtual Representation RequiredInputRepresentation(int index) const {
2864 return Representation::Tagged(); 2897 return Representation::Tagged();
2865 } 2898 }
2866 virtual void PrintDataTo(StringStream* stream); 2899 virtual void PrintDataTo(StringStream* stream);
2867 2900
2868 DECLARE_CONCRETE_INSTRUCTION(StoreGlobal, "store_global") 2901 DECLARE_CONCRETE_INSTRUCTION(StoreGlobalCell, "store_global_cell")
2869 2902
2870 private: 2903 private:
2871 Handle<JSGlobalPropertyCell> cell_; 2904 Handle<JSGlobalPropertyCell> cell_;
2872 bool check_hole_value_; 2905 bool check_hole_value_;
2873 }; 2906 };
2874 2907
2875 2908
2909 class HStoreGlobalGeneric: public HTemplateInstruction<3> {
2910 public:
2911 HStoreGlobalGeneric(HValue* context,
2912 HValue* global_object,
2913 Handle<Object> name,
2914 HValue* value)
2915 : name_(name) {
2916 SetOperandAt(0, context);
2917 SetOperandAt(1, global_object);
2918 SetOperandAt(2, value);
2919 set_representation(Representation::Tagged());
2920 SetAllSideEffects();
2921 }
2922
2923 HValue* context() { return OperandAt(0); }
2924 HValue* global_object() { return OperandAt(1); }
2925 Handle<Object> name() const { return name_; }
2926 HValue* value() { return OperandAt(2); }
2927
2928 virtual void PrintDataTo(StringStream* stream);
2929
2930 virtual Representation RequiredInputRepresentation(int index) const {
2931 return Representation::Tagged();
2932 }
2933
2934 DECLARE_CONCRETE_INSTRUCTION(StoreGlobalGeneric, "store_global_generic")
2935
2936 private:
2937 Handle<Object> name_;
2938 };
2939
2940
2876 class HLoadContextSlot: public HUnaryOperation { 2941 class HLoadContextSlot: public HUnaryOperation {
2877 public: 2942 public:
2878 HLoadContextSlot(HValue* context , int slot_index) 2943 HLoadContextSlot(HValue* context , int slot_index)
2879 : HUnaryOperation(context), slot_index_(slot_index) { 2944 : HUnaryOperation(context), slot_index_(slot_index) {
2880 set_representation(Representation::Tagged()); 2945 set_representation(Representation::Tagged());
2881 SetFlag(kUseGVN); 2946 SetFlag(kUseGVN);
2882 SetFlag(kDependsOnContextSlots); 2947 SetFlag(kDependsOnContextSlots);
2883 } 2948 }
2884 2949
2885 int slot_index() const { return slot_index_; } 2950 int slot_index() const { return slot_index_; }
(...skipping 700 matching lines...) Expand 10 before | Expand all | Expand 10 after
3586 HValue* object() { return left(); } 3651 HValue* object() { return left(); }
3587 HValue* key() { return right(); } 3652 HValue* key() { return right(); }
3588 }; 3653 };
3589 3654
3590 #undef DECLARE_INSTRUCTION 3655 #undef DECLARE_INSTRUCTION
3591 #undef DECLARE_CONCRETE_INSTRUCTION 3656 #undef DECLARE_CONCRETE_INSTRUCTION
3592 3657
3593 } } // namespace v8::internal 3658 } } // namespace v8::internal
3594 3659
3595 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ 3660 #endif // V8_HYDROGEN_INSTRUCTIONS_H_
OLDNEW
« no previous file with comments | « src/hydrogen.cc ('k') | src/hydrogen-instructions.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698