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

Side by Side Diff: src/ast.h

Issue 267118: Added first support for tracking locations of expressions in the... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 11 years, 2 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/arm/fast-codegen-arm.cc ('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 10 matching lines...) Expand all
21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 27
28 #ifndef V8_AST_H_ 28 #ifndef V8_AST_H_
29 #define V8_AST_H_ 29 #define V8_AST_H_
30 30
31 #include "location.h"
31 #include "execution.h" 32 #include "execution.h"
32 #include "factory.h" 33 #include "factory.h"
33 #include "jsregexp.h" 34 #include "jsregexp.h"
34 #include "jump-target.h" 35 #include "jump-target.h"
35 #include "runtime.h" 36 #include "runtime.h"
36 #include "token.h" 37 #include "token.h"
37 #include "variables.h" 38 #include "variables.h"
38 39
39 namespace v8 { 40 namespace v8 {
40 namespace internal { 41 namespace internal {
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
154 void set_statement_pos(int statement_pos) { statement_pos_ = statement_pos; } 155 void set_statement_pos(int statement_pos) { statement_pos_ = statement_pos; }
155 int statement_pos() const { return statement_pos_; } 156 int statement_pos() const { return statement_pos_; }
156 157
157 private: 158 private:
158 int statement_pos_; 159 int statement_pos_;
159 }; 160 };
160 161
161 162
162 class Expression: public AstNode { 163 class Expression: public AstNode {
163 public: 164 public:
165 Expression() : location_(Location::Temporary()) {}
166
164 virtual Expression* AsExpression() { return this; } 167 virtual Expression* AsExpression() { return this; }
165 168
166 virtual bool IsValidJSON() { return false; } 169 virtual bool IsValidJSON() { return false; }
167 virtual bool IsValidLeftHandSide() { return false; } 170 virtual bool IsValidLeftHandSide() { return false; }
168 171
169 // Mark the expression as being compiled as an expression 172 // Mark the expression as being compiled as an expression
170 // statement. This is used to transform postfix increments to 173 // statement. This is used to transform postfix increments to
171 // (faster) prefix increments. 174 // (faster) prefix increments.
172 virtual void MarkAsStatement() { /* do nothing */ } 175 virtual void MarkAsStatement() { /* do nothing */ }
173 176
174 // Static type information for this expression. 177 // Static type information for this expression.
175 SmiAnalysis* type() { return &type_; } 178 SmiAnalysis* type() { return &type_; }
176 179
180 Location location() { return location_; }
181 void set_location(Location loc) { location_ = loc; }
182
177 private: 183 private:
178 SmiAnalysis type_; 184 SmiAnalysis type_;
185 Location location_;
179 }; 186 };
180 187
181 188
182 /** 189 /**
183 * A sentinel used during pre parsing that represents some expression 190 * A sentinel used during pre parsing that represents some expression
184 * that is a valid left hand side without having to actually build 191 * that is a valid left hand side without having to actually build
185 * the expression. 192 * the expression.
186 */ 193 */
187 class ValidLeftHandSideSentinel: public Expression { 194 class ValidLeftHandSideSentinel: public Expression {
188 public: 195 public:
(...skipping 1564 matching lines...) Expand 10 before | Expand all | Expand 10 after
1753 #undef DEF_VISIT 1760 #undef DEF_VISIT
1754 1761
1755 private: 1762 private:
1756 bool stack_overflow_; 1763 bool stack_overflow_;
1757 }; 1764 };
1758 1765
1759 1766
1760 } } // namespace v8::internal 1767 } } // namespace v8::internal
1761 1768
1762 #endif // V8_AST_H_ 1769 #endif // V8_AST_H_
OLDNEW
« no previous file with comments | « src/arm/fast-codegen-arm.cc ('k') | src/compiler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698