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 1179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1190 body_(body), | 1190 body_(body), |
1191 materialized_literal_count_(materialized_literal_count), | 1191 materialized_literal_count_(materialized_literal_count), |
1192 contains_array_literal_(contains_array_literal), | 1192 contains_array_literal_(contains_array_literal), |
1193 expected_property_count_(expected_property_count), | 1193 expected_property_count_(expected_property_count), |
1194 num_parameters_(num_parameters), | 1194 num_parameters_(num_parameters), |
1195 start_position_(start_position), | 1195 start_position_(start_position), |
1196 end_position_(end_position), | 1196 end_position_(end_position), |
1197 is_expression_(is_expression), | 1197 is_expression_(is_expression), |
1198 loop_nesting_(0), | 1198 loop_nesting_(0), |
1199 function_token_position_(RelocInfo::kNoPosition) { | 1199 function_token_position_(RelocInfo::kNoPosition) { |
| 1200 #ifdef DEBUG |
| 1201 already_compiled_ = false; |
| 1202 #endif |
1200 } | 1203 } |
1201 | 1204 |
1202 virtual void Accept(AstVisitor* v); | 1205 virtual void Accept(AstVisitor* v); |
1203 | 1206 |
1204 // Type testing & conversion | 1207 // Type testing & conversion |
1205 virtual FunctionLiteral* AsFunctionLiteral() { return this; } | 1208 virtual FunctionLiteral* AsFunctionLiteral() { return this; } |
1206 | 1209 |
1207 Handle<String> name() const { return name_; } | 1210 Handle<String> name() const { return name_; } |
1208 Scope* scope() const { return scope_; } | 1211 Scope* scope() const { return scope_; } |
1209 ZoneList<Statement*>* body() const { return body_; } | 1212 ZoneList<Statement*>* body() const { return body_; } |
1210 void set_function_token_position(int pos) { function_token_position_ = pos; } | 1213 void set_function_token_position(int pos) { function_token_position_ = pos; } |
1211 int function_token_position() const { return function_token_position_; } | 1214 int function_token_position() const { return function_token_position_; } |
1212 int start_position() const { return start_position_; } | 1215 int start_position() const { return start_position_; } |
1213 int end_position() const { return end_position_; } | 1216 int end_position() const { return end_position_; } |
1214 bool is_expression() const { return is_expression_; } | 1217 bool is_expression() const { return is_expression_; } |
1215 | 1218 |
1216 int materialized_literal_count() { return materialized_literal_count_; } | 1219 int materialized_literal_count() { return materialized_literal_count_; } |
1217 bool contains_array_literal() { return contains_array_literal_; } | 1220 bool contains_array_literal() { return contains_array_literal_; } |
1218 int expected_property_count() { return expected_property_count_; } | 1221 int expected_property_count() { return expected_property_count_; } |
1219 int num_parameters() { return num_parameters_; } | 1222 int num_parameters() { return num_parameters_; } |
1220 | 1223 |
1221 bool AllowsLazyCompilation(); | 1224 bool AllowsLazyCompilation(); |
1222 | 1225 |
1223 bool loop_nesting() const { return loop_nesting_; } | 1226 bool loop_nesting() const { return loop_nesting_; } |
1224 void set_loop_nesting(int nesting) { loop_nesting_ = nesting; } | 1227 void set_loop_nesting(int nesting) { loop_nesting_ = nesting; } |
1225 | 1228 |
| 1229 #ifdef DEBUG |
| 1230 bool already_compiled() const { return already_compiled_; } |
| 1231 void mark_as_compiled() { already_compiled_ = true; } |
| 1232 #endif |
| 1233 |
1226 private: | 1234 private: |
1227 Handle<String> name_; | 1235 Handle<String> name_; |
1228 Scope* scope_; | 1236 Scope* scope_; |
1229 ZoneList<Statement*>* body_; | 1237 ZoneList<Statement*>* body_; |
1230 int materialized_literal_count_; | 1238 int materialized_literal_count_; |
1231 bool contains_array_literal_; | 1239 bool contains_array_literal_; |
1232 int expected_property_count_; | 1240 int expected_property_count_; |
1233 int num_parameters_; | 1241 int num_parameters_; |
1234 int start_position_; | 1242 int start_position_; |
1235 int end_position_; | 1243 int end_position_; |
1236 bool is_expression_; | 1244 bool is_expression_; |
1237 int loop_nesting_; | 1245 int loop_nesting_; |
1238 int function_token_position_; | 1246 int function_token_position_; |
| 1247 #ifdef DEBUG |
| 1248 bool already_compiled_; |
| 1249 #endif |
1239 }; | 1250 }; |
1240 | 1251 |
1241 | 1252 |
1242 class FunctionBoilerplateLiteral: public Expression { | 1253 class FunctionBoilerplateLiteral: public Expression { |
1243 public: | 1254 public: |
1244 explicit FunctionBoilerplateLiteral(Handle<JSFunction> boilerplate) | 1255 explicit FunctionBoilerplateLiteral(Handle<JSFunction> boilerplate) |
1245 : boilerplate_(boilerplate) { | 1256 : boilerplate_(boilerplate) { |
1246 ASSERT(boilerplate->IsBoilerplate()); | 1257 ASSERT(boilerplate->IsBoilerplate()); |
1247 } | 1258 } |
1248 | 1259 |
(...skipping 405 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1654 #undef DEF_VISIT | 1665 #undef DEF_VISIT |
1655 | 1666 |
1656 private: | 1667 private: |
1657 bool stack_overflow_; | 1668 bool stack_overflow_; |
1658 }; | 1669 }; |
1659 | 1670 |
1660 | 1671 |
1661 } } // namespace v8::internal | 1672 } } // namespace v8::internal |
1662 | 1673 |
1663 #endif // V8_AST_H_ | 1674 #endif // V8_AST_H_ |
OLD | NEW |