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 1205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1216 scope_(scope), | 1216 scope_(scope), |
1217 body_(body), | 1217 body_(body), |
1218 materialized_literal_count_(materialized_literal_count), | 1218 materialized_literal_count_(materialized_literal_count), |
1219 contains_array_literal_(contains_array_literal), | 1219 contains_array_literal_(contains_array_literal), |
1220 expected_property_count_(expected_property_count), | 1220 expected_property_count_(expected_property_count), |
1221 num_parameters_(num_parameters), | 1221 num_parameters_(num_parameters), |
1222 start_position_(start_position), | 1222 start_position_(start_position), |
1223 end_position_(end_position), | 1223 end_position_(end_position), |
1224 is_expression_(is_expression), | 1224 is_expression_(is_expression), |
1225 loop_nesting_(0), | 1225 loop_nesting_(0), |
1226 function_token_position_(RelocInfo::kNoPosition) { | 1226 function_token_position_(RelocInfo::kNoPosition), |
| 1227 inferred_name_(Heap::empty_string()) { |
1227 #ifdef DEBUG | 1228 #ifdef DEBUG |
1228 already_compiled_ = false; | 1229 already_compiled_ = false; |
1229 #endif | 1230 #endif |
1230 } | 1231 } |
1231 | 1232 |
1232 virtual void Accept(AstVisitor* v); | 1233 virtual void Accept(AstVisitor* v); |
1233 | 1234 |
1234 // Type testing & conversion | 1235 // Type testing & conversion |
1235 virtual FunctionLiteral* AsFunctionLiteral() { return this; } | 1236 virtual FunctionLiteral* AsFunctionLiteral() { return this; } |
1236 | 1237 |
1237 Handle<String> name() const { return name_; } | 1238 Handle<String> name() const { return name_; } |
1238 Scope* scope() const { return scope_; } | 1239 Scope* scope() const { return scope_; } |
1239 ZoneList<Statement*>* body() const { return body_; } | 1240 ZoneList<Statement*>* body() const { return body_; } |
1240 void set_function_token_position(int pos) { function_token_position_ = pos; } | 1241 void set_function_token_position(int pos) { function_token_position_ = pos; } |
1241 int function_token_position() const { return function_token_position_; } | 1242 int function_token_position() const { return function_token_position_; } |
1242 int start_position() const { return start_position_; } | 1243 int start_position() const { return start_position_; } |
1243 int end_position() const { return end_position_; } | 1244 int end_position() const { return end_position_; } |
1244 bool is_expression() const { return is_expression_; } | 1245 bool is_expression() const { return is_expression_; } |
1245 | 1246 |
1246 int materialized_literal_count() { return materialized_literal_count_; } | 1247 int materialized_literal_count() { return materialized_literal_count_; } |
1247 bool contains_array_literal() { return contains_array_literal_; } | 1248 bool contains_array_literal() { return contains_array_literal_; } |
1248 int expected_property_count() { return expected_property_count_; } | 1249 int expected_property_count() { return expected_property_count_; } |
1249 int num_parameters() { return num_parameters_; } | 1250 int num_parameters() { return num_parameters_; } |
1250 | 1251 |
1251 bool AllowsLazyCompilation(); | 1252 bool AllowsLazyCompilation(); |
1252 | 1253 |
1253 bool loop_nesting() const { return loop_nesting_; } | 1254 bool loop_nesting() const { return loop_nesting_; } |
1254 void set_loop_nesting(int nesting) { loop_nesting_ = nesting; } | 1255 void set_loop_nesting(int nesting) { loop_nesting_ = nesting; } |
1255 | 1256 |
| 1257 Handle<String> inferred_name() const { return inferred_name_; } |
| 1258 void set_inferred_name(Handle<String> inferred_name) { |
| 1259 inferred_name_ = inferred_name; |
| 1260 } |
| 1261 |
1256 #ifdef DEBUG | 1262 #ifdef DEBUG |
1257 void mark_as_compiled() { | 1263 void mark_as_compiled() { |
1258 ASSERT(!already_compiled_); | 1264 ASSERT(!already_compiled_); |
1259 already_compiled_ = true; | 1265 already_compiled_ = true; |
1260 } | 1266 } |
1261 #endif | 1267 #endif |
1262 | 1268 |
1263 private: | 1269 private: |
1264 Handle<String> name_; | 1270 Handle<String> name_; |
1265 Scope* scope_; | 1271 Scope* scope_; |
1266 ZoneList<Statement*>* body_; | 1272 ZoneList<Statement*>* body_; |
1267 int materialized_literal_count_; | 1273 int materialized_literal_count_; |
1268 bool contains_array_literal_; | 1274 bool contains_array_literal_; |
1269 int expected_property_count_; | 1275 int expected_property_count_; |
1270 int num_parameters_; | 1276 int num_parameters_; |
1271 int start_position_; | 1277 int start_position_; |
1272 int end_position_; | 1278 int end_position_; |
1273 bool is_expression_; | 1279 bool is_expression_; |
1274 int loop_nesting_; | 1280 int loop_nesting_; |
1275 int function_token_position_; | 1281 int function_token_position_; |
| 1282 Handle<String> inferred_name_; |
1276 #ifdef DEBUG | 1283 #ifdef DEBUG |
1277 bool already_compiled_; | 1284 bool already_compiled_; |
1278 #endif | 1285 #endif |
1279 }; | 1286 }; |
1280 | 1287 |
1281 | 1288 |
1282 class FunctionBoilerplateLiteral: public Expression { | 1289 class FunctionBoilerplateLiteral: public Expression { |
1283 public: | 1290 public: |
1284 explicit FunctionBoilerplateLiteral(Handle<JSFunction> boilerplate) | 1291 explicit FunctionBoilerplateLiteral(Handle<JSFunction> boilerplate) |
1285 : boilerplate_(boilerplate) { | 1292 : boilerplate_(boilerplate) { |
(...skipping 408 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1694 #undef DEF_VISIT | 1701 #undef DEF_VISIT |
1695 | 1702 |
1696 private: | 1703 private: |
1697 bool stack_overflow_; | 1704 bool stack_overflow_; |
1698 }; | 1705 }; |
1699 | 1706 |
1700 | 1707 |
1701 } } // namespace v8::internal | 1708 } } // namespace v8::internal |
1702 | 1709 |
1703 #endif // V8_AST_H_ | 1710 #endif // V8_AST_H_ |
OLD | NEW |