| 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 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 104 class MaterializedLiteral; | 104 class MaterializedLiteral; |
| 105 | 105 |
| 106 #define DEF_FORWARD_DECLARATION(type) class type; | 106 #define DEF_FORWARD_DECLARATION(type) class type; |
| 107 AST_NODE_LIST(DEF_FORWARD_DECLARATION) | 107 AST_NODE_LIST(DEF_FORWARD_DECLARATION) |
| 108 #undef DEF_FORWARD_DECLARATION | 108 #undef DEF_FORWARD_DECLARATION |
| 109 | 109 |
| 110 | 110 |
| 111 // Typedef only introduced to avoid unreadable code. | 111 // Typedef only introduced to avoid unreadable code. |
| 112 // Please do appreciate the required space in "> >". | 112 // Please do appreciate the required space in "> >". |
| 113 typedef ZoneList<Handle<String> > ZoneStringList; | 113 typedef ZoneList<Handle<String> > ZoneStringList; |
| 114 typedef ZoneList<Handle<Object> > ZoneObjectList; |
| 114 | 115 |
| 115 | 116 |
| 116 class AstNode: public ZoneObject { | 117 class AstNode: public ZoneObject { |
| 117 public: | 118 public: |
| 118 AstNode(): statement_pos_(RelocInfo::kNoPosition) { } | 119 AstNode(): statement_pos_(RelocInfo::kNoPosition) { } |
| 119 virtual ~AstNode() { } | 120 virtual ~AstNode() { } |
| 120 virtual void Accept(AstVisitor* v) = 0; | 121 virtual void Accept(AstVisitor* v) = 0; |
| 121 | 122 |
| 122 // Type testing & conversion. | 123 // Type testing & conversion. |
| 123 virtual Statement* AsStatement() { return NULL; } | 124 virtual Statement* AsStatement() { return NULL; } |
| (...skipping 1095 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1219 | 1220 |
| 1220 | 1221 |
| 1221 class FunctionLiteral: public Expression { | 1222 class FunctionLiteral: public Expression { |
| 1222 public: | 1223 public: |
| 1223 FunctionLiteral(Handle<String> name, | 1224 FunctionLiteral(Handle<String> name, |
| 1224 Scope* scope, | 1225 Scope* scope, |
| 1225 ZoneList<Statement*>* body, | 1226 ZoneList<Statement*>* body, |
| 1226 int materialized_literal_count, | 1227 int materialized_literal_count, |
| 1227 bool contains_array_literal, | 1228 bool contains_array_literal, |
| 1228 int expected_property_count, | 1229 int expected_property_count, |
| 1230 bool has_only_this_property_assignments, |
| 1231 bool has_only_simple_this_property_assignments, |
| 1232 Handle<FixedArray> this_property_assignments, |
| 1229 int num_parameters, | 1233 int num_parameters, |
| 1230 int start_position, | 1234 int start_position, |
| 1231 int end_position, | 1235 int end_position, |
| 1232 bool is_expression) | 1236 bool is_expression) |
| 1233 : name_(name), | 1237 : name_(name), |
| 1234 scope_(scope), | 1238 scope_(scope), |
| 1235 body_(body), | 1239 body_(body), |
| 1236 materialized_literal_count_(materialized_literal_count), | 1240 materialized_literal_count_(materialized_literal_count), |
| 1237 contains_array_literal_(contains_array_literal), | 1241 contains_array_literal_(contains_array_literal), |
| 1238 expected_property_count_(expected_property_count), | 1242 expected_property_count_(expected_property_count), |
| 1243 has_only_this_property_assignments_(has_only_this_property_assignments), |
| 1244 has_only_simple_this_property_assignments_( |
| 1245 has_only_simple_this_property_assignments), |
| 1246 this_property_assignments_(this_property_assignments), |
| 1239 num_parameters_(num_parameters), | 1247 num_parameters_(num_parameters), |
| 1240 start_position_(start_position), | 1248 start_position_(start_position), |
| 1241 end_position_(end_position), | 1249 end_position_(end_position), |
| 1242 is_expression_(is_expression), | 1250 is_expression_(is_expression), |
| 1243 loop_nesting_(0), | 1251 loop_nesting_(0), |
| 1244 function_token_position_(RelocInfo::kNoPosition), | 1252 function_token_position_(RelocInfo::kNoPosition), |
| 1245 inferred_name_(Heap::empty_string()) { | 1253 inferred_name_(Heap::empty_string()) { |
| 1246 #ifdef DEBUG | 1254 #ifdef DEBUG |
| 1247 already_compiled_ = false; | 1255 already_compiled_ = false; |
| 1248 #endif | 1256 #endif |
| 1249 } | 1257 } |
| 1250 | 1258 |
| 1251 virtual void Accept(AstVisitor* v); | 1259 virtual void Accept(AstVisitor* v); |
| 1252 | 1260 |
| 1253 // Type testing & conversion | 1261 // Type testing & conversion |
| 1254 virtual FunctionLiteral* AsFunctionLiteral() { return this; } | 1262 virtual FunctionLiteral* AsFunctionLiteral() { return this; } |
| 1255 | 1263 |
| 1256 Handle<String> name() const { return name_; } | 1264 Handle<String> name() const { return name_; } |
| 1257 Scope* scope() const { return scope_; } | 1265 Scope* scope() const { return scope_; } |
| 1258 ZoneList<Statement*>* body() const { return body_; } | 1266 ZoneList<Statement*>* body() const { return body_; } |
| 1259 void set_function_token_position(int pos) { function_token_position_ = pos; } | 1267 void set_function_token_position(int pos) { function_token_position_ = pos; } |
| 1260 int function_token_position() const { return function_token_position_; } | 1268 int function_token_position() const { return function_token_position_; } |
| 1261 int start_position() const { return start_position_; } | 1269 int start_position() const { return start_position_; } |
| 1262 int end_position() const { return end_position_; } | 1270 int end_position() const { return end_position_; } |
| 1263 bool is_expression() const { return is_expression_; } | 1271 bool is_expression() const { return is_expression_; } |
| 1264 | 1272 |
| 1265 int materialized_literal_count() { return materialized_literal_count_; } | 1273 int materialized_literal_count() { return materialized_literal_count_; } |
| 1266 bool contains_array_literal() { return contains_array_literal_; } | 1274 bool contains_array_literal() { return contains_array_literal_; } |
| 1267 int expected_property_count() { return expected_property_count_; } | 1275 int expected_property_count() { return expected_property_count_; } |
| 1276 bool has_only_this_property_assignments() { |
| 1277 return has_only_this_property_assignments_; |
| 1278 } |
| 1279 bool has_only_simple_this_property_assignments() { |
| 1280 return has_only_simple_this_property_assignments_; |
| 1281 } |
| 1282 Handle<FixedArray> this_property_assignments() { |
| 1283 return this_property_assignments_; |
| 1284 } |
| 1268 int num_parameters() { return num_parameters_; } | 1285 int num_parameters() { return num_parameters_; } |
| 1269 | 1286 |
| 1270 bool AllowsLazyCompilation(); | 1287 bool AllowsLazyCompilation(); |
| 1271 | 1288 |
| 1272 bool loop_nesting() const { return loop_nesting_; } | 1289 bool loop_nesting() const { return loop_nesting_; } |
| 1273 void set_loop_nesting(int nesting) { loop_nesting_ = nesting; } | 1290 void set_loop_nesting(int nesting) { loop_nesting_ = nesting; } |
| 1274 | 1291 |
| 1275 Handle<String> inferred_name() const { return inferred_name_; } | 1292 Handle<String> inferred_name() const { return inferred_name_; } |
| 1276 void set_inferred_name(Handle<String> inferred_name) { | 1293 void set_inferred_name(Handle<String> inferred_name) { |
| 1277 inferred_name_ = inferred_name; | 1294 inferred_name_ = inferred_name; |
| 1278 } | 1295 } |
| 1279 | 1296 |
| 1280 #ifdef DEBUG | 1297 #ifdef DEBUG |
| 1281 void mark_as_compiled() { | 1298 void mark_as_compiled() { |
| 1282 ASSERT(!already_compiled_); | 1299 ASSERT(!already_compiled_); |
| 1283 already_compiled_ = true; | 1300 already_compiled_ = true; |
| 1284 } | 1301 } |
| 1285 #endif | 1302 #endif |
| 1286 | 1303 |
| 1287 private: | 1304 private: |
| 1288 Handle<String> name_; | 1305 Handle<String> name_; |
| 1289 Scope* scope_; | 1306 Scope* scope_; |
| 1290 ZoneList<Statement*>* body_; | 1307 ZoneList<Statement*>* body_; |
| 1291 int materialized_literal_count_; | 1308 int materialized_literal_count_; |
| 1292 bool contains_array_literal_; | 1309 bool contains_array_literal_; |
| 1293 int expected_property_count_; | 1310 int expected_property_count_; |
| 1311 bool has_only_this_property_assignments_; |
| 1312 bool has_only_simple_this_property_assignments_; |
| 1313 Handle<FixedArray> this_property_assignments_; |
| 1294 int num_parameters_; | 1314 int num_parameters_; |
| 1295 int start_position_; | 1315 int start_position_; |
| 1296 int end_position_; | 1316 int end_position_; |
| 1297 bool is_expression_; | 1317 bool is_expression_; |
| 1298 int loop_nesting_; | 1318 int loop_nesting_; |
| 1299 int function_token_position_; | 1319 int function_token_position_; |
| 1300 Handle<String> inferred_name_; | 1320 Handle<String> inferred_name_; |
| 1301 #ifdef DEBUG | 1321 #ifdef DEBUG |
| 1302 bool already_compiled_; | 1322 bool already_compiled_; |
| 1303 #endif | 1323 #endif |
| (...skipping 404 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1708 #undef DEF_VISIT | 1728 #undef DEF_VISIT |
| 1709 | 1729 |
| 1710 private: | 1730 private: |
| 1711 bool stack_overflow_; | 1731 bool stack_overflow_; |
| 1712 }; | 1732 }; |
| 1713 | 1733 |
| 1714 | 1734 |
| 1715 } } // namespace v8::internal | 1735 } } // namespace v8::internal |
| 1716 | 1736 |
| 1717 #endif // V8_AST_H_ | 1737 #endif // V8_AST_H_ |
| OLD | NEW |