OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef V8_AST_H_ | 5 #ifndef V8_AST_H_ |
6 #define V8_AST_H_ | 6 #define V8_AST_H_ |
7 | 7 |
8 #include "src/v8.h" | 8 #include "src/v8.h" |
9 | 9 |
10 #include "src/assembler.h" | 10 #include "src/assembler.h" |
(...skipping 1280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1291 : Expression(zone, position), value_(value) {} | 1291 : Expression(zone, position), value_(value) {} |
1292 static int parent_num_ids() { return Expression::num_ids(); } | 1292 static int parent_num_ids() { return Expression::num_ids(); } |
1293 | 1293 |
1294 private: | 1294 private: |
1295 int local_id(int n) const { return base_id() + parent_num_ids() + n; } | 1295 int local_id(int n) const { return base_id() + parent_num_ids() + n; } |
1296 | 1296 |
1297 const AstValue* value_; | 1297 const AstValue* value_; |
1298 }; | 1298 }; |
1299 | 1299 |
1300 | 1300 |
| 1301 class AstLiteralReindexer; |
| 1302 |
1301 // Base class for literals that needs space in the corresponding JSFunction. | 1303 // Base class for literals that needs space in the corresponding JSFunction. |
1302 class MaterializedLiteral : public Expression { | 1304 class MaterializedLiteral : public Expression { |
1303 public: | 1305 public: |
1304 virtual MaterializedLiteral* AsMaterializedLiteral() { return this; } | 1306 virtual MaterializedLiteral* AsMaterializedLiteral() { return this; } |
1305 | 1307 |
1306 int literal_index() { return literal_index_; } | 1308 int literal_index() { return literal_index_; } |
1307 | 1309 |
1308 int depth() const { | 1310 int depth() const { |
1309 // only callable after initialization. | 1311 // only callable after initialization. |
1310 DCHECK(depth_ >= 1); | 1312 DCHECK(depth_ >= 1); |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1342 // compile time value as encoded by CompileTimeValue::GetValue(). | 1344 // compile time value as encoded by CompileTimeValue::GetValue(). |
1343 // Otherwise, return undefined literal as the placeholder | 1345 // Otherwise, return undefined literal as the placeholder |
1344 // in the object literal boilerplate. | 1346 // in the object literal boilerplate. |
1345 Handle<Object> GetBoilerplateValue(Expression* expression, Isolate* isolate); | 1347 Handle<Object> GetBoilerplateValue(Expression* expression, Isolate* isolate); |
1346 | 1348 |
1347 private: | 1349 private: |
1348 int literal_index_; | 1350 int literal_index_; |
1349 bool is_simple_; | 1351 bool is_simple_; |
1350 bool is_strong_; | 1352 bool is_strong_; |
1351 int depth_; | 1353 int depth_; |
| 1354 |
| 1355 friend class AstLiteralReindexer; |
1352 }; | 1356 }; |
1353 | 1357 |
1354 | 1358 |
1355 // Property is used for passing information | 1359 // Property is used for passing information |
1356 // about an object literal's properties from the parser | 1360 // about an object literal's properties from the parser |
1357 // to the code generator. | 1361 // to the code generator. |
1358 class ObjectLiteralProperty final : public ZoneObject { | 1362 class ObjectLiteralProperty final : public ZoneObject { |
1359 public: | 1363 public: |
1360 enum Kind { | 1364 enum Kind { |
1361 CONSTANT, // Property with constant value (compile time). | 1365 CONSTANT, // Property with constant value (compile time). |
(...skipping 2240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3602 | 3606 |
3603 private: | 3607 private: |
3604 Zone* zone_; | 3608 Zone* zone_; |
3605 AstValueFactory* ast_value_factory_; | 3609 AstValueFactory* ast_value_factory_; |
3606 }; | 3610 }; |
3607 | 3611 |
3608 | 3612 |
3609 } } // namespace v8::internal | 3613 } } // namespace v8::internal |
3610 | 3614 |
3611 #endif // V8_AST_H_ | 3615 #endif // V8_AST_H_ |
OLD | NEW |