OLD | NEW |
1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 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 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
152 // Mark the expression as being compiled as an expression | 152 // Mark the expression as being compiled as an expression |
153 // statement. This is used to transform postfix increments to | 153 // statement. This is used to transform postfix increments to |
154 // (faster) prefix increments. | 154 // (faster) prefix increments. |
155 virtual void MarkAsStatement() { /* do nothing */ } | 155 virtual void MarkAsStatement() { /* do nothing */ } |
156 | 156 |
157 // Generate code to store into an expression evaluated as the left-hand | 157 // Generate code to store into an expression evaluated as the left-hand |
158 // side of an assignment. The code will expect the stored value on top of | 158 // side of an assignment. The code will expect the stored value on top of |
159 // the expression stack, and a reference containing the expression | 159 // the expression stack, and a reference containing the expression |
160 // immediately below that. This function is overridden for expression | 160 // immediately below that. This function is overridden for expression |
161 // types that can be stored into. | 161 // types that can be stored into. |
162 virtual void GenerateStoreCode(MacroAssembler* masm, | 162 virtual void GenerateStoreCode(CodeGenerator* cgen, |
163 Scope* scope, | |
164 Reference* ref, | 163 Reference* ref, |
165 InitState init_state) { | 164 InitState init_state) { |
166 UNREACHABLE(); | 165 UNREACHABLE(); |
167 } | 166 } |
168 }; | 167 }; |
169 | 168 |
170 | 169 |
171 /** | 170 /** |
172 * A sentinel used during pre parsing that represents some expression | 171 * A sentinel used during pre parsing that represents some expression |
173 * that is a valid left hand side without having to actually build | 172 * that is a valid left hand side without having to actually build |
(...skipping 582 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
756 bool is_this() const { return is_this_; } | 755 bool is_this() const { return is_this_; } |
757 bool inside_with() const { return inside_with_; } | 756 bool inside_with() const { return inside_with_; } |
758 | 757 |
759 // Bind this proxy to the variable var. | 758 // Bind this proxy to the variable var. |
760 void BindTo(Variable* var); | 759 void BindTo(Variable* var); |
761 | 760 |
762 // Generate code to store into an expression evaluated as the left-hand | 761 // Generate code to store into an expression evaluated as the left-hand |
763 // side of an assignment. The code will expect the stored value on top of | 762 // side of an assignment. The code will expect the stored value on top of |
764 // the expression stack, and a reference containing the expression | 763 // the expression stack, and a reference containing the expression |
765 // immediately below that. | 764 // immediately below that. |
766 virtual void GenerateStoreCode(MacroAssembler* masm, | 765 virtual void GenerateStoreCode(CodeGenerator* cgen, |
767 Scope* scope, | |
768 Reference* ref, | 766 Reference* ref, |
769 InitState init_state); | 767 InitState init_state); |
770 protected: | 768 protected: |
771 Handle<String> name_; | 769 Handle<String> name_; |
772 Variable* var_; // resolved variable, or NULL | 770 Variable* var_; // resolved variable, or NULL |
773 bool is_this_; | 771 bool is_this_; |
774 bool inside_with_; | 772 bool inside_with_; |
775 | 773 |
776 // VariableProxy usage info. | 774 // VariableProxy usage info. |
777 UseCount var_uses_; // uses of the variable value | 775 UseCount var_uses_; // uses of the variable value |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
839 | 837 |
840 // Accessors | 838 // Accessors |
841 Variable* var() const { return var_; } | 839 Variable* var() const { return var_; } |
842 Type type() const { return type_; } | 840 Type type() const { return type_; } |
843 int index() const { return index_; } | 841 int index() const { return index_; } |
844 | 842 |
845 // Generate code to store into an expression evaluated as the left-hand | 843 // Generate code to store into an expression evaluated as the left-hand |
846 // side of an assignment. The code will expect the stored value on top of | 844 // side of an assignment. The code will expect the stored value on top of |
847 // the expression stack, and a reference containing the expression | 845 // the expression stack, and a reference containing the expression |
848 // immediately below that. | 846 // immediately below that. |
849 virtual void GenerateStoreCode(MacroAssembler* masm, | 847 virtual void GenerateStoreCode(CodeGenerator* cgen, |
850 Scope* scope, | |
851 Reference* ref, | 848 Reference* ref, |
852 InitState init_state); | 849 InitState init_state); |
853 private: | 850 private: |
854 Variable* var_; | 851 Variable* var_; |
855 Type type_; | 852 Type type_; |
856 int index_; | 853 int index_; |
857 }; | 854 }; |
858 | 855 |
859 | 856 |
860 class Property: public Expression { | 857 class Property: public Expression { |
(...skipping 13 matching lines...) Expand all Loading... |
874 int position() const { return pos_; } | 871 int position() const { return pos_; } |
875 | 872 |
876 // Returns a property singleton property access on 'this'. Used | 873 // Returns a property singleton property access on 'this'. Used |
877 // during preparsing. | 874 // during preparsing. |
878 static Property* this_property() { return &this_property_; } | 875 static Property* this_property() { return &this_property_; } |
879 | 876 |
880 // Generate code to store into an expression evaluated as the left-hand | 877 // Generate code to store into an expression evaluated as the left-hand |
881 // side of an assignment. The code will expect the stored value on top of | 878 // side of an assignment. The code will expect the stored value on top of |
882 // the expression stack, and a reference containing the expression | 879 // the expression stack, and a reference containing the expression |
883 // immediately below that. | 880 // immediately below that. |
884 virtual void GenerateStoreCode(MacroAssembler* masm, | 881 virtual void GenerateStoreCode(CodeGenerator* cgen, |
885 Scope* scope, | |
886 Reference* ref, | 882 Reference* ref, |
887 InitState init_state); | 883 InitState init_state); |
888 private: | 884 private: |
889 Expression* obj_; | 885 Expression* obj_; |
890 Expression* key_; | 886 Expression* key_; |
891 int pos_; | 887 int pos_; |
892 | 888 |
893 // Dummy property used during preparsing | 889 // Dummy property used during preparsing |
894 static Property this_property_; | 890 static Property this_property_; |
895 }; | 891 }; |
(...skipping 361 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1257 #undef DEF_VISIT | 1253 #undef DEF_VISIT |
1258 | 1254 |
1259 private: | 1255 private: |
1260 bool stack_overflow_; | 1256 bool stack_overflow_; |
1261 }; | 1257 }; |
1262 | 1258 |
1263 | 1259 |
1264 } } // namespace v8::internal | 1260 } } // namespace v8::internal |
1265 | 1261 |
1266 #endif // V8_AST_H_ | 1262 #endif // V8_AST_H_ |
OLD | NEW |