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

Side by Side Diff: src/ast.h

Issue 553134: Add a pass for the fast compiler to label expression nodes.... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 10 years, 10 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/SConscript ('k') | src/compiler.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 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 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
173 // Evaluated for control flow (and side effects). 173 // Evaluated for control flow (and side effects).
174 kTest, 174 kTest,
175 // Evaluated for control flow and side effects. Value is also 175 // Evaluated for control flow and side effects. Value is also
176 // needed if true. 176 // needed if true.
177 kValueTest, 177 kValueTest,
178 // Evaluated for control flow and side effects. Value is also 178 // Evaluated for control flow and side effects. Value is also
179 // needed if false. 179 // needed if false.
180 kTestValue 180 kTestValue
181 }; 181 };
182 182
183 static const int kNoLabel = -1;
184
185 Expression() : num_(kNoLabel) {}
186
183 virtual Expression* AsExpression() { return this; } 187 virtual Expression* AsExpression() { return this; }
184 188
185 virtual bool IsValidJSON() { return false; } 189 virtual bool IsValidJSON() { return false; }
186 virtual bool IsValidLeftHandSide() { return false; } 190 virtual bool IsValidLeftHandSide() { return false; }
187 191
188 // Symbols that cannot be parsed as array indices are considered property 192 // Symbols that cannot be parsed as array indices are considered property
189 // names. We do not treat symbols that can be array indexes as property 193 // names. We do not treat symbols that can be array indexes as property
190 // names because [] for string objects is handled only by keyed ICs. 194 // names because [] for string objects is handled only by keyed ICs.
191 virtual bool IsPropertyName() { return false; } 195 virtual bool IsPropertyName() { return false; }
192 196
193 // Mark the expression as being compiled as an expression 197 // Mark the expression as being compiled as an expression
194 // statement. This is used to transform postfix increments to 198 // statement. This is used to transform postfix increments to
195 // (faster) prefix increments. 199 // (faster) prefix increments.
196 virtual void MarkAsStatement() { /* do nothing */ } 200 virtual void MarkAsStatement() { /* do nothing */ }
197 201
198 // Static type information for this expression. 202 // Static type information for this expression.
199 StaticType* type() { return &type_; } 203 StaticType* type() { return &type_; }
200 204
205 int num() { return num_; }
206
207 // AST node numbering ordered by evaluation order.
208 void set_num(int n) { num_ = n; }
209
201 private: 210 private:
202 StaticType type_; 211 StaticType type_;
212 int num_;
203 }; 213 };
204 214
205 215
206 /** 216 /**
207 * A sentinel used during pre parsing that represents some expression 217 * A sentinel used during pre parsing that represents some expression
208 * that is a valid left hand side without having to actually build 218 * that is a valid left hand side without having to actually build
209 * the expression. 219 * the expression.
210 */ 220 */
211 class ValidLeftHandSideSentinel: public Expression { 221 class ValidLeftHandSideSentinel: public Expression {
212 public: 222 public:
(...skipping 1592 matching lines...) Expand 10 before | Expand all | Expand 10 after
1805 #undef DEF_VISIT 1815 #undef DEF_VISIT
1806 1816
1807 private: 1817 private:
1808 bool stack_overflow_; 1818 bool stack_overflow_;
1809 }; 1819 };
1810 1820
1811 1821
1812 } } // namespace v8::internal 1822 } } // namespace v8::internal
1813 1823
1814 #endif // V8_AST_H_ 1824 #endif // V8_AST_H_
OLDNEW
« no previous file with comments | « src/SConscript ('k') | src/compiler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698