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

Side by Side Diff: src/ast.h

Issue 7860035: Merge bleeding edge up to 9192 into the GC branch. (Closed) Base URL: https://v8.googlecode.com/svn/branches/experimental/gc
Patch Set: Created 9 years, 3 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/array.js ('k') | src/ast.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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 55
56 #define STATEMENT_NODE_LIST(V) \ 56 #define STATEMENT_NODE_LIST(V) \
57 V(Block) \ 57 V(Block) \
58 V(ExpressionStatement) \ 58 V(ExpressionStatement) \
59 V(EmptyStatement) \ 59 V(EmptyStatement) \
60 V(IfStatement) \ 60 V(IfStatement) \
61 V(ContinueStatement) \ 61 V(ContinueStatement) \
62 V(BreakStatement) \ 62 V(BreakStatement) \
63 V(ReturnStatement) \ 63 V(ReturnStatement) \
64 V(WithStatement) \ 64 V(WithStatement) \
65 V(ExitContextStatement) \
66 V(SwitchStatement) \ 65 V(SwitchStatement) \
67 V(DoWhileStatement) \ 66 V(DoWhileStatement) \
68 V(WhileStatement) \ 67 V(WhileStatement) \
69 V(ForStatement) \ 68 V(ForStatement) \
70 V(ForInStatement) \ 69 V(ForInStatement) \
71 V(TryCatchStatement) \ 70 V(TryCatchStatement) \
72 V(TryFinallyStatement) \ 71 V(TryFinallyStatement) \
73 V(DebuggerStatement) 72 V(DebuggerStatement)
74 73
75 #define EXPRESSION_NODE_LIST(V) \ 74 #define EXPRESSION_NODE_LIST(V) \
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 public: 126 public:
128 #define DECLARE_TYPE_ENUM(type) k##type, 127 #define DECLARE_TYPE_ENUM(type) k##type,
129 enum Type { 128 enum Type {
130 AST_NODE_LIST(DECLARE_TYPE_ENUM) 129 AST_NODE_LIST(DECLARE_TYPE_ENUM)
131 kInvalid = -1 130 kInvalid = -1
132 }; 131 };
133 #undef DECLARE_TYPE_ENUM 132 #undef DECLARE_TYPE_ENUM
134 133
135 static const int kNoNumber = -1; 134 static const int kNoNumber = -1;
136 static const int kFunctionEntryId = 2; // Using 0 could disguise errors. 135 static const int kFunctionEntryId = 2; // Using 0 could disguise errors.
136 // This AST id identifies the point after the declarations have been
137 // visited. We need it to capture the environment effects of declarations
138 // that emit code (function declarations).
139 static const int kDeclarationsId = 3;
137 140
138 // Override ZoneObject's new to count allocated AST nodes. 141 // Override ZoneObject's new to count allocated AST nodes.
139 void* operator new(size_t size, Zone* zone) { 142 void* operator new(size_t size, Zone* zone) {
140 Isolate* isolate = zone->isolate(); 143 Isolate* isolate = zone->isolate();
141 isolate->set_ast_node_count(isolate->ast_node_count() + 1); 144 isolate->set_ast_node_count(isolate->ast_node_count() + 1);
142 return zone->New(static_cast<int>(size)); 145 return zone->New(static_cast<int>(size));
143 } 146 }
144 147
145 AstNode() {} 148 AstNode() {}
146 149
147 virtual ~AstNode() { } 150 virtual ~AstNode() { }
148 151
149 virtual void Accept(AstVisitor* v) = 0; 152 virtual void Accept(AstVisitor* v) = 0;
150 virtual Type node_type() const { return kInvalid; } 153 virtual Type node_type() const { return kInvalid; }
151 154
152 // Type testing & conversion functions overridden by concrete subclasses. 155 // Type testing & conversion functions overridden by concrete subclasses.
153 #define DECLARE_NODE_FUNCTIONS(type) \ 156 #define DECLARE_NODE_FUNCTIONS(type) \
154 virtual type* As##type() { return NULL; } 157 virtual type* As##type() { return NULL; }
155 AST_NODE_LIST(DECLARE_NODE_FUNCTIONS) 158 AST_NODE_LIST(DECLARE_NODE_FUNCTIONS)
156 #undef DECLARE_NODE_FUNCTIONS 159 #undef DECLARE_NODE_FUNCTIONS
157 160
158 virtual Statement* AsStatement() { return NULL; } 161 virtual Statement* AsStatement() { return NULL; }
159 virtual Expression* AsExpression() { return NULL; } 162 virtual Expression* AsExpression() { return NULL; }
160 virtual TargetCollector* AsTargetCollector() { return NULL; } 163 virtual TargetCollector* AsTargetCollector() { return NULL; }
161 virtual BreakableStatement* AsBreakableStatement() { return NULL; } 164 virtual BreakableStatement* AsBreakableStatement() { return NULL; }
162 virtual IterationStatement* AsIterationStatement() { return NULL; } 165 virtual IterationStatement* AsIterationStatement() { return NULL; }
163 virtual MaterializedLiteral* AsMaterializedLiteral() { return NULL; } 166 virtual MaterializedLiteral* AsMaterializedLiteral() { return NULL; }
164 virtual Slot* AsSlot() { return NULL; }
165 167
166 // True if the node is simple enough for us to inline calls containing it. 168 // True if the node is simple enough for us to inline calls containing it.
167 virtual bool IsInlineable() const = 0; 169 virtual bool IsInlineable() const = 0;
168 170
169 static int Count() { return Isolate::Current()->ast_node_count(); } 171 static int Count() { return Isolate::Current()->ast_node_count(); }
170 static void ResetIds() { Isolate::Current()->set_ast_node_id(0); } 172 static void ResetIds() { Isolate::Current()->set_ast_node_id(0); }
171 173
172 protected: 174 protected:
173 static unsigned GetNextId(Isolate* isolate) { 175 static unsigned GetNextId(Isolate* isolate) {
174 return ReserveIdRange(isolate, 1); 176 return ReserveIdRange(isolate, 1);
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
309 311
310 unsigned id() const { return id_; } 312 unsigned id() const { return id_; }
311 unsigned test_id() const { return test_id_; } 313 unsigned test_id() const { return test_id_; }
312 314
313 private: 315 private:
314 unsigned id_; 316 unsigned id_;
315 unsigned test_id_; 317 unsigned test_id_;
316 }; 318 };
317 319
318 320
319 /**
320 * A sentinel used during pre parsing that represents some expression
321 * that is a valid left hand side without having to actually build
322 * the expression.
323 */
324 class ValidLeftHandSideSentinel: public Expression {
325 public:
326 explicit ValidLeftHandSideSentinel(Isolate* isolate) : Expression(isolate) {}
327 virtual bool IsValidLeftHandSide() { return true; }
328 virtual void Accept(AstVisitor* v) { UNREACHABLE(); }
329 virtual bool IsInlineable() const;
330 };
331
332
333 class BreakableStatement: public Statement { 321 class BreakableStatement: public Statement {
334 public: 322 public:
335 enum Type { 323 enum Type {
336 TARGET_FOR_ANONYMOUS, 324 TARGET_FOR_ANONYMOUS,
337 TARGET_FOR_NAMED_ONLY 325 TARGET_FOR_NAMED_ONLY
338 }; 326 };
339 327
340 // The labels associated with this statement. May be NULL; 328 // The labels associated with this statement. May be NULL;
341 // if it is != NULL, guaranteed to contain at least one entry. 329 // if it is != NULL, guaranteed to contain at least one entry.
342 ZoneStringList* labels() const { return labels_; } 330 ZoneStringList* labels() const { return labels_; }
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
397 385
398 private: 386 private:
399 ZoneList<Statement*> statements_; 387 ZoneList<Statement*> statements_;
400 bool is_initializer_block_; 388 bool is_initializer_block_;
401 Scope* block_scope_; 389 Scope* block_scope_;
402 }; 390 };
403 391
404 392
405 class Declaration: public AstNode { 393 class Declaration: public AstNode {
406 public: 394 public:
407 Declaration(VariableProxy* proxy, Variable::Mode mode, FunctionLiteral* fun) 395 Declaration(VariableProxy* proxy,
396 Variable::Mode mode,
397 FunctionLiteral* fun,
398 Scope* scope)
408 : proxy_(proxy), 399 : proxy_(proxy),
409 mode_(mode), 400 mode_(mode),
410 fun_(fun) { 401 fun_(fun),
402 scope_(scope) {
411 ASSERT(mode == Variable::VAR || 403 ASSERT(mode == Variable::VAR ||
412 mode == Variable::CONST || 404 mode == Variable::CONST ||
413 mode == Variable::LET); 405 mode == Variable::LET);
414 // At the moment there are no "const functions"'s in JavaScript... 406 // At the moment there are no "const functions"'s in JavaScript...
415 ASSERT(fun == NULL || mode == Variable::VAR || mode == Variable::LET); 407 ASSERT(fun == NULL || mode == Variable::VAR || mode == Variable::LET);
416 } 408 }
417 409
418 DECLARE_NODE_TYPE(Declaration) 410 DECLARE_NODE_TYPE(Declaration)
419 411
420 VariableProxy* proxy() const { return proxy_; } 412 VariableProxy* proxy() const { return proxy_; }
421 Variable::Mode mode() const { return mode_; } 413 Variable::Mode mode() const { return mode_; }
422 FunctionLiteral* fun() const { return fun_; } // may be NULL 414 FunctionLiteral* fun() const { return fun_; } // may be NULL
423 virtual bool IsInlineable() const; 415 virtual bool IsInlineable() const;
416 Scope* scope() const { return scope_; }
424 417
425 private: 418 private:
426 VariableProxy* proxy_; 419 VariableProxy* proxy_;
427 Variable::Mode mode_; 420 Variable::Mode mode_;
428 FunctionLiteral* fun_; 421 FunctionLiteral* fun_;
422
423 // Nested scope from which the declaration originated.
424 Scope* scope_;
429 }; 425 };
430 426
431 427
432 class IterationStatement: public BreakableStatement { 428 class IterationStatement: public BreakableStatement {
433 public: 429 public:
434 // Type testing & conversion. 430 // Type testing & conversion.
435 virtual IterationStatement* AsIterationStatement() { return this; } 431 virtual IterationStatement* AsIterationStatement() { return this; }
436 432
437 Statement* body() const { return body_; } 433 Statement* body() const { return body_; }
438 434
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after
677 Statement* statement() const { return statement_; } 673 Statement* statement() const { return statement_; }
678 674
679 virtual bool IsInlineable() const; 675 virtual bool IsInlineable() const;
680 676
681 private: 677 private:
682 Expression* expression_; 678 Expression* expression_;
683 Statement* statement_; 679 Statement* statement_;
684 }; 680 };
685 681
686 682
687 class ExitContextStatement: public Statement {
688 public:
689 virtual bool IsInlineable() const;
690
691 DECLARE_NODE_TYPE(ExitContextStatement)
692 };
693
694
695 class CaseClause: public ZoneObject { 683 class CaseClause: public ZoneObject {
696 public: 684 public:
697 CaseClause(Isolate* isolate, 685 CaseClause(Isolate* isolate,
698 Expression* label, 686 Expression* label,
699 ZoneList<Statement*>* statements, 687 ZoneList<Statement*>* statements,
700 int pos); 688 int pos);
701 689
702 bool is_default() const { return label_ == NULL; } 690 bool is_default() const { return label_ == NULL; }
703 Expression* label() const { 691 Expression* label() const {
704 CHECK(!is_default()); 692 CHECK(!is_default());
(...skipping 402 matching lines...) Expand 10 before | Expand all | Expand 10 after
1107 int first_element_id_; 1095 int first_element_id_;
1108 }; 1096 };
1109 1097
1110 1098
1111 class VariableProxy: public Expression { 1099 class VariableProxy: public Expression {
1112 public: 1100 public:
1113 VariableProxy(Isolate* isolate, Variable* var); 1101 VariableProxy(Isolate* isolate, Variable* var);
1114 1102
1115 DECLARE_NODE_TYPE(VariableProxy) 1103 DECLARE_NODE_TYPE(VariableProxy)
1116 1104
1117 // Type testing & conversion
1118 Variable* AsVariable() { return (this == NULL) ? NULL : var_; }
1119
1120 virtual bool IsValidLeftHandSide() { 1105 virtual bool IsValidLeftHandSide() {
1121 return var_ == NULL ? true : var_->IsValidLeftHandSide(); 1106 return var_ == NULL ? true : var_->IsValidLeftHandSide();
1122 } 1107 }
1123 1108
1124 virtual bool IsTrivial() { 1109 virtual bool IsTrivial() {
1125 // Reading from a mutable variable is a side effect, but the 1110 // Reading from a mutable variable is a side effect, but the
1126 // variable for 'this' is immutable. 1111 // variable for 'this' is immutable.
1127 return is_this_ || is_trivial_; 1112 return is_this_ || is_trivial_;
1128 } 1113 }
1129 1114
1130 virtual bool IsInlineable() const; 1115 virtual bool IsInlineable() const;
1131 1116
1132 bool IsVariable(Handle<String> n) { 1117 bool IsVariable(Handle<String> n) {
1133 return !is_this() && name().is_identical_to(n); 1118 return !is_this() && name().is_identical_to(n);
1134 } 1119 }
1135 1120
1136 bool IsArguments() { 1121 bool IsArguments() { return var_ != NULL && var_->is_arguments(); }
1137 Variable* variable = AsVariable();
1138 return (variable == NULL) ? false : variable->is_arguments();
1139 }
1140 1122
1141 Handle<String> name() const { return name_; } 1123 Handle<String> name() const { return name_; }
1142 Variable* var() const { return var_; } 1124 Variable* var() const { return var_; }
1143 bool is_this() const { return is_this_; } 1125 bool is_this() const { return is_this_; }
1144 bool inside_with() const { return inside_with_; } 1126 bool inside_with() const { return inside_with_; }
1145 int position() const { return position_; } 1127 int position() const { return position_; }
1146 1128
1147 void MarkAsTrivial() { is_trivial_ = true; } 1129 void MarkAsTrivial() { is_trivial_ = true; }
1148 1130
1149 // Bind this proxy to the variable var. 1131 // Bind this proxy to the variable var.
1150 void BindTo(Variable* var); 1132 void BindTo(Variable* var);
1151 1133
1152 protected: 1134 protected:
1153 Handle<String> name_; 1135 Handle<String> name_;
1154 Variable* var_; // resolved variable, or NULL 1136 Variable* var_; // resolved variable, or NULL
1155 bool is_this_; 1137 bool is_this_;
1156 bool inside_with_; 1138 bool inside_with_;
1157 bool is_trivial_; 1139 bool is_trivial_;
1158 int position_; 1140 int position_;
1159 1141
1160 VariableProxy(Isolate* isolate, 1142 VariableProxy(Isolate* isolate,
1161 Handle<String> name, 1143 Handle<String> name,
1162 bool is_this, 1144 bool is_this,
1163 bool inside_with, 1145 bool inside_with,
1164 int position = RelocInfo::kNoPosition); 1146 int position = RelocInfo::kNoPosition);
1165 VariableProxy(Isolate* isolate, bool is_this);
1166 1147
1167 friend class Scope; 1148 friend class Scope;
1168 }; 1149 };
1169 1150
1170 1151
1171 class VariableProxySentinel: public VariableProxy {
1172 public:
1173 virtual bool IsValidLeftHandSide() { return !is_this(); }
1174
1175 private:
1176 VariableProxySentinel(Isolate* isolate, bool is_this)
1177 : VariableProxy(isolate, is_this) { }
1178
1179 friend class AstSentinels;
1180 };
1181
1182
1183 class Slot: public Expression {
1184 public:
1185 enum Type {
1186 // A slot in the parameter section on the stack. index() is
1187 // the parameter index, counting left-to-right, starting at 0.
1188 PARAMETER,
1189
1190 // A slot in the local section on the stack. index() is
1191 // the variable index in the stack frame, starting at 0.
1192 LOCAL,
1193
1194 // An indexed slot in a heap context. index() is the
1195 // variable index in the context object on the heap,
1196 // starting at 0. var()->scope() is the corresponding
1197 // scope.
1198 CONTEXT,
1199
1200 // A named slot in a heap context. var()->name() is the
1201 // variable name in the context object on the heap,
1202 // with lookup starting at the current context. index()
1203 // is invalid.
1204 LOOKUP
1205 };
1206
1207 Slot(Isolate* isolate, Variable* var, Type type, int index)
1208 : Expression(isolate), var_(var), type_(type), index_(index) {
1209 ASSERT(var != NULL);
1210 }
1211
1212 virtual void Accept(AstVisitor* v);
1213
1214 virtual Slot* AsSlot() { return this; }
1215
1216 bool IsStackAllocated() { return type_ == PARAMETER || type_ == LOCAL; }
1217
1218 // Accessors
1219 Variable* var() const { return var_; }
1220 Type type() const { return type_; }
1221 int index() const { return index_; }
1222 bool is_arguments() const { return var_->is_arguments(); }
1223 virtual bool IsInlineable() const;
1224
1225 private:
1226 Variable* var_;
1227 Type type_;
1228 int index_;
1229 };
1230
1231
1232 class Property: public Expression { 1152 class Property: public Expression {
1233 public: 1153 public:
1234 // Synthetic properties are property lookups introduced by the system,
1235 // to objects that aren't visible to the user. Function calls to synthetic
1236 // properties should use the global object as receiver, not the base object
1237 // of the resolved Reference.
1238 enum Type { NORMAL, SYNTHETIC };
1239 Property(Isolate* isolate, 1154 Property(Isolate* isolate,
1240 Expression* obj, 1155 Expression* obj,
1241 Expression* key, 1156 Expression* key,
1242 int pos, 1157 int pos)
1243 Type type = NORMAL)
1244 : Expression(isolate), 1158 : Expression(isolate),
1245 obj_(obj), 1159 obj_(obj),
1246 key_(key), 1160 key_(key),
1247 pos_(pos), 1161 pos_(pos),
1248 type_(type),
1249 is_monomorphic_(false), 1162 is_monomorphic_(false),
1250 is_array_length_(false), 1163 is_array_length_(false),
1251 is_string_length_(false), 1164 is_string_length_(false),
1252 is_string_access_(false), 1165 is_string_access_(false),
1253 is_function_prototype_(false) { } 1166 is_function_prototype_(false) { }
1254 1167
1255 DECLARE_NODE_TYPE(Property) 1168 DECLARE_NODE_TYPE(Property)
1256 1169
1257 virtual bool IsValidLeftHandSide() { return true; } 1170 virtual bool IsValidLeftHandSide() { return true; }
1258 virtual bool IsInlineable() const; 1171 virtual bool IsInlineable() const;
1259 1172
1260 Expression* obj() const { return obj_; } 1173 Expression* obj() const { return obj_; }
1261 Expression* key() const { return key_; } 1174 Expression* key() const { return key_; }
1262 virtual int position() const { return pos_; } 1175 virtual int position() const { return pos_; }
1263 bool is_synthetic() const { return type_ == SYNTHETIC; }
1264 1176
1265 bool IsStringLength() const { return is_string_length_; } 1177 bool IsStringLength() const { return is_string_length_; }
1266 bool IsStringAccess() const { return is_string_access_; } 1178 bool IsStringAccess() const { return is_string_access_; }
1267 bool IsFunctionPrototype() const { return is_function_prototype_; } 1179 bool IsFunctionPrototype() const { return is_function_prototype_; }
1268 1180
1269 // Type feedback information. 1181 // Type feedback information.
1270 void RecordTypeFeedback(TypeFeedbackOracle* oracle); 1182 void RecordTypeFeedback(TypeFeedbackOracle* oracle);
1271 virtual bool IsMonomorphic() { return is_monomorphic_; } 1183 virtual bool IsMonomorphic() { return is_monomorphic_; }
1272 virtual SmallMapList* GetReceiverTypes() { return &receiver_types_; } 1184 virtual SmallMapList* GetReceiverTypes() { return &receiver_types_; }
1273 virtual bool IsArrayLength() { return is_array_length_; } 1185 virtual bool IsArrayLength() { return is_array_length_; }
1274 1186
1275 private: 1187 private:
1276 Expression* obj_; 1188 Expression* obj_;
1277 Expression* key_; 1189 Expression* key_;
1278 int pos_; 1190 int pos_;
1279 Type type_;
1280 1191
1281 SmallMapList receiver_types_; 1192 SmallMapList receiver_types_;
1282 bool is_monomorphic_ : 1; 1193 bool is_monomorphic_ : 1;
1283 bool is_array_length_ : 1; 1194 bool is_array_length_ : 1;
1284 bool is_string_length_ : 1; 1195 bool is_string_length_ : 1;
1285 bool is_string_access_ : 1; 1196 bool is_string_access_ : 1;
1286 bool is_function_prototype_ : 1; 1197 bool is_function_prototype_ : 1;
1287 }; 1198 };
1288 1199
1289 1200
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
1339 CheckType check_type_; 1250 CheckType check_type_;
1340 SmallMapList receiver_types_; 1251 SmallMapList receiver_types_;
1341 Handle<JSFunction> target_; 1252 Handle<JSFunction> target_;
1342 Handle<JSObject> holder_; 1253 Handle<JSObject> holder_;
1343 Handle<JSGlobalPropertyCell> cell_; 1254 Handle<JSGlobalPropertyCell> cell_;
1344 1255
1345 int return_id_; 1256 int return_id_;
1346 }; 1257 };
1347 1258
1348 1259
1349 class AstSentinels {
1350 public:
1351 ~AstSentinels() { }
1352
1353 // Returns a property singleton property access on 'this'. Used
1354 // during preparsing.
1355 Property* this_property() { return &this_property_; }
1356 VariableProxySentinel* this_proxy() { return &this_proxy_; }
1357 VariableProxySentinel* identifier_proxy() { return &identifier_proxy_; }
1358 ValidLeftHandSideSentinel* valid_left_hand_side_sentinel() {
1359 return &valid_left_hand_side_sentinel_;
1360 }
1361 Call* call_sentinel() { return &call_sentinel_; }
1362 EmptyStatement* empty_statement() { return &empty_statement_; }
1363
1364 private:
1365 AstSentinels();
1366 VariableProxySentinel this_proxy_;
1367 VariableProxySentinel identifier_proxy_;
1368 ValidLeftHandSideSentinel valid_left_hand_side_sentinel_;
1369 Property this_property_;
1370 Call call_sentinel_;
1371 EmptyStatement empty_statement_;
1372
1373 friend class Isolate;
1374
1375 DISALLOW_COPY_AND_ASSIGN(AstSentinels);
1376 };
1377
1378
1379 class CallNew: public Expression { 1260 class CallNew: public Expression {
1380 public: 1261 public:
1381 CallNew(Isolate* isolate, 1262 CallNew(Isolate* isolate,
1382 Expression* expression, 1263 Expression* expression,
1383 ZoneList<Expression*>* arguments, 1264 ZoneList<Expression*>* arguments,
1384 int pos) 1265 int pos)
1385 : Expression(isolate), 1266 : Expression(isolate),
1386 expression_(expression), 1267 expression_(expression),
1387 arguments_(arguments), 1268 arguments_(arguments),
1388 pos_(pos) { } 1269 pos_(pos) { }
(...skipping 852 matching lines...) Expand 10 before | Expand all | Expand 10 after
2241 // Stack overflow tracking support. 2122 // Stack overflow tracking support.
2242 bool HasStackOverflow() const { return stack_overflow_; } 2123 bool HasStackOverflow() const { return stack_overflow_; }
2243 bool CheckStackOverflow(); 2124 bool CheckStackOverflow();
2244 2125
2245 // If a stack-overflow exception is encountered when visiting a 2126 // If a stack-overflow exception is encountered when visiting a
2246 // node, calling SetStackOverflow will make sure that the visitor 2127 // node, calling SetStackOverflow will make sure that the visitor
2247 // bails out without visiting more nodes. 2128 // bails out without visiting more nodes.
2248 void SetStackOverflow() { stack_overflow_ = true; } 2129 void SetStackOverflow() { stack_overflow_ = true; }
2249 void ClearStackOverflow() { stack_overflow_ = false; } 2130 void ClearStackOverflow() { stack_overflow_ = false; }
2250 2131
2251 // Nodes not appearing in the AST, including slots.
2252 virtual void VisitSlot(Slot* node) { UNREACHABLE(); }
2253
2254 // Individual AST nodes. 2132 // Individual AST nodes.
2255 #define DEF_VISIT(type) \ 2133 #define DEF_VISIT(type) \
2256 virtual void Visit##type(type* node) = 0; 2134 virtual void Visit##type(type* node) = 0;
2257 AST_NODE_LIST(DEF_VISIT) 2135 AST_NODE_LIST(DEF_VISIT)
2258 #undef DEF_VISIT 2136 #undef DEF_VISIT
2259 2137
2260 protected: 2138 protected:
2261 Isolate* isolate() { return isolate_; } 2139 Isolate* isolate() { return isolate_; }
2262 2140
2263 private: 2141 private:
2264 Isolate* isolate_; 2142 Isolate* isolate_;
2265 bool stack_overflow_; 2143 bool stack_overflow_;
2266 }; 2144 };
2267 2145
2268 2146
2269 } } // namespace v8::internal 2147 } } // namespace v8::internal
2270 2148
2271 #endif // V8_AST_H_ 2149 #endif // V8_AST_H_
OLDNEW
« no previous file with comments | « src/array.js ('k') | src/ast.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698