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

Side by Side Diff: src/ast.h

Issue 798243004: ES6 computed property names (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Disable test on windows Created 5 years, 11 months 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 1860 matching lines...) Expand 10 before | Expand all | Expand 10 after
3372 ObjectLiteral* NewObjectLiteral( 3375 ObjectLiteral* NewObjectLiteral(
3373 ZoneList<ObjectLiteral::Property*>* properties, 3376 ZoneList<ObjectLiteral::Property*>* properties,
3374 int literal_index, 3377 int literal_index,
3375 int boilerplate_properties, 3378 int boilerplate_properties,
3376 bool has_function, 3379 bool has_function,
3377 int pos) { 3380 int pos) {
3378 return new (zone_) ObjectLiteral(zone_, properties, literal_index, 3381 return new (zone_) ObjectLiteral(zone_, properties, literal_index,
3379 boilerplate_properties, has_function, pos); 3382 boilerplate_properties, has_function, pos);
3380 } 3383 }
3381 3384
3382 ObjectLiteral::Property* NewObjectLiteralProperty(Literal* key, 3385 ObjectLiteral::Property* NewObjectLiteralProperty(Expression* key,
3383 Expression* value, 3386 Expression* value,
3384 bool is_static) { 3387 bool is_static,
3385 return new (zone_) ObjectLiteral::Property(zone_, ast_value_factory_, key, 3388 bool is_computed_name) {
3386 value, is_static); 3389 return new (zone_) ObjectLiteral::Property(
3390 zone_, ast_value_factory_, key, value, is_static, is_computed_name);
3387 } 3391 }
3388 3392
3389 ObjectLiteral::Property* NewObjectLiteralProperty(bool is_getter, 3393 ObjectLiteral::Property* NewObjectLiteralProperty(bool is_getter,
3394 Expression* key,
3390 FunctionLiteral* value, 3395 FunctionLiteral* value,
3391 int pos, bool is_static) { 3396 int pos, bool is_static,
3392 ObjectLiteral::Property* prop = 3397 bool is_computed_name) {
3393 new (zone_) ObjectLiteral::Property(zone_, is_getter, value, is_static); 3398 return new (zone_) ObjectLiteral::Property(zone_, is_getter, key, value,
3394 prop->set_key(NewStringLiteral(value->raw_name(), pos)); 3399 is_static, is_computed_name);
3395 return prop;
3396 } 3400 }
3397 3401
3398 RegExpLiteral* NewRegExpLiteral(const AstRawString* pattern, 3402 RegExpLiteral* NewRegExpLiteral(const AstRawString* pattern,
3399 const AstRawString* flags, 3403 const AstRawString* flags,
3400 int literal_index, 3404 int literal_index,
3401 int pos) { 3405 int pos) {
3402 return new (zone_) RegExpLiteral(zone_, pattern, flags, literal_index, pos); 3406 return new (zone_) RegExpLiteral(zone_, pattern, flags, literal_index, pos);
3403 } 3407 }
3404 3408
3405 ArrayLiteral* NewArrayLiteral(ZoneList<Expression*>* values, 3409 ArrayLiteral* NewArrayLiteral(ZoneList<Expression*>* values,
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
3547 3551
3548 private: 3552 private:
3549 Zone* zone_; 3553 Zone* zone_;
3550 AstValueFactory* ast_value_factory_; 3554 AstValueFactory* ast_value_factory_;
3551 }; 3555 };
3552 3556
3553 3557
3554 } } // namespace v8::internal 3558 } } // namespace v8::internal
3555 3559
3556 #endif // V8_AST_H_ 3560 #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