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

Side by Side Diff: src/ast.h

Issue 795573005: ES6 computed property names (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Cleanup tests a bit Created 6 years 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
« no previous file with comments | « src/arm64/full-codegen-arm64.cc ('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 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 1449 matching lines...) Expand 10 before | Expand all | Expand 10 after
1460 class ObjectLiteralProperty FINAL : public ZoneObject { 1460 class ObjectLiteralProperty FINAL : public ZoneObject {
1461 public: 1461 public:
1462 enum Kind { 1462 enum Kind {
1463 CONSTANT, // Property with constant value (compile time). 1463 CONSTANT, // Property with constant value (compile time).
1464 COMPUTED, // Property with computed value (execution time). 1464 COMPUTED, // Property with computed value (execution time).
1465 MATERIALIZED_LITERAL, // Property value is a materialized literal. 1465 MATERIALIZED_LITERAL, // Property value is a materialized literal.
1466 GETTER, SETTER, // Property is an accessor function. 1466 GETTER, SETTER, // Property is an accessor function.
1467 PROTOTYPE // Property is __proto__. 1467 PROTOTYPE // Property is __proto__.
1468 }; 1468 };
1469 1469
1470 ObjectLiteralProperty(Zone* zone, AstValueFactory* ast_value_factory, 1470 Expression* key() { return key_; }
1471 Literal* key, Expression* value, bool is_static);
1472
1473 Literal* key() { return key_; }
1474 Expression* value() { return value_; } 1471 Expression* value() { return value_; }
1475 Kind kind() { return kind_; } 1472 Kind kind() { return kind_; }
1476 1473
1477 // Type feedback information. 1474 // Type feedback information.
1478 void RecordTypeFeedback(TypeFeedbackOracle* oracle); 1475 void RecordTypeFeedback(TypeFeedbackOracle* oracle);
1479 bool IsMonomorphic() { return !receiver_type_.is_null(); } 1476 bool IsMonomorphic() { return !receiver_type_.is_null(); }
1480 Handle<Map> GetReceiverType() { return receiver_type_; } 1477 Handle<Map> GetReceiverType() { return receiver_type_; }
1481 1478
1482 bool IsCompileTimeValue(); 1479 bool IsCompileTimeValue();
1483 1480
1484 void set_emit_store(bool emit_store); 1481 void set_emit_store(bool emit_store);
1485 bool emit_store(); 1482 bool emit_store();
1486 1483
1487 bool is_static() const { return is_static_; } 1484 bool is_static() const { return is_static_; }
1485 bool is_computed_name() const { return is_computed_name_; }
1488 1486
1489 protected: 1487 protected:
1490 friend class AstNodeFactory; 1488 friend class AstNodeFactory;
1491 1489
1492 ObjectLiteralProperty(Zone* zone, bool is_getter, FunctionLiteral* value, 1490 ObjectLiteralProperty(Zone* zone, AstValueFactory* ast_value_factory,
1493 bool is_static); 1491 Expression* key, Expression* value, bool is_static,
1494 void set_key(Literal* key) { key_ = key; } 1492 bool is_computed_name);
1493
1494 ObjectLiteralProperty(Zone* zone, bool is_getter, Expression* key,
1495 FunctionLiteral* value, bool is_static,
1496 bool is_computed_name);
1495 1497
1496 private: 1498 private:
1497 Literal* key_; 1499 Expression* key_;
1498 Expression* value_; 1500 Expression* value_;
1499 Kind kind_; 1501 Kind kind_;
1500 bool emit_store_; 1502 bool emit_store_;
1501 bool is_static_; 1503 bool is_static_;
1504 bool is_computed_name_;
1502 Handle<Map> receiver_type_; 1505 Handle<Map> receiver_type_;
1503 }; 1506 };
1504 1507
1505 1508
1506 // An object literal has a boilerplate object that is used 1509 // An object literal has a boilerplate object that is used
1507 // for minimizing the work when constructing it at runtime. 1510 // for minimizing the work when constructing it at runtime.
1508 class ObjectLiteral FINAL : public MaterializedLiteral { 1511 class ObjectLiteral FINAL : public MaterializedLiteral {
1509 public: 1512 public:
1510 typedef ObjectLiteralProperty Property; 1513 typedef ObjectLiteralProperty Property;
1511 1514
(...skipping 1855 matching lines...) Expand 10 before | Expand all | Expand 10 after
3367 ObjectLiteral* NewObjectLiteral( 3370 ObjectLiteral* NewObjectLiteral(
3368 ZoneList<ObjectLiteral::Property*>* properties, 3371 ZoneList<ObjectLiteral::Property*>* properties,
3369 int literal_index, 3372 int literal_index,
3370 int boilerplate_properties, 3373 int boilerplate_properties,
3371 bool has_function, 3374 bool has_function,
3372 int pos) { 3375 int pos) {
3373 return new (zone_) ObjectLiteral(zone_, properties, literal_index, 3376 return new (zone_) ObjectLiteral(zone_, properties, literal_index,
3374 boilerplate_properties, has_function, pos); 3377 boilerplate_properties, has_function, pos);
3375 } 3378 }
3376 3379
3377 ObjectLiteral::Property* NewObjectLiteralProperty(Literal* key, 3380 ObjectLiteral::Property* NewObjectLiteralProperty(Expression* key,
3378 Expression* value, 3381 Expression* value,
3379 bool is_static) { 3382 bool is_static,
3380 return new (zone_) ObjectLiteral::Property(zone_, ast_value_factory_, key, 3383 bool is_computed_name) {
3381 value, is_static); 3384 return new (zone_) ObjectLiteral::Property(
3385 zone_, ast_value_factory_, key, value, is_static, is_computed_name);
3382 } 3386 }
3383 3387
3384 ObjectLiteral::Property* NewObjectLiteralProperty(bool is_getter, 3388 ObjectLiteral::Property* NewObjectLiteralProperty(bool is_getter,
3389 Expression* key,
3385 FunctionLiteral* value, 3390 FunctionLiteral* value,
3386 int pos, bool is_static) { 3391 int pos, bool is_static,
3387 ObjectLiteral::Property* prop = 3392 bool is_computed_name) {
3388 new (zone_) ObjectLiteral::Property(zone_, is_getter, value, is_static); 3393 return new (zone_) ObjectLiteral::Property(zone_, is_getter, key, value,
3389 prop->set_key(NewStringLiteral(value->raw_name(), pos)); 3394 is_static, is_computed_name);
3390 return prop;
3391 } 3395 }
3392 3396
3393 RegExpLiteral* NewRegExpLiteral(const AstRawString* pattern, 3397 RegExpLiteral* NewRegExpLiteral(const AstRawString* pattern,
3394 const AstRawString* flags, 3398 const AstRawString* flags,
3395 int literal_index, 3399 int literal_index,
3396 int pos) { 3400 int pos) {
3397 return new (zone_) RegExpLiteral(zone_, pattern, flags, literal_index, pos); 3401 return new (zone_) RegExpLiteral(zone_, pattern, flags, literal_index, pos);
3398 } 3402 }
3399 3403
3400 ArrayLiteral* NewArrayLiteral(ZoneList<Expression*>* values, 3404 ArrayLiteral* NewArrayLiteral(ZoneList<Expression*>* values,
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
3542 3546
3543 private: 3547 private:
3544 Zone* zone_; 3548 Zone* zone_;
3545 AstValueFactory* ast_value_factory_; 3549 AstValueFactory* ast_value_factory_;
3546 }; 3550 };
3547 3551
3548 3552
3549 } } // namespace v8::internal 3553 } } // namespace v8::internal
3550 3554
3551 #endif // V8_AST_H_ 3555 #endif // V8_AST_H_
OLDNEW
« no previous file with comments | « src/arm64/full-codegen-arm64.cc ('k') | src/ast.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698