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

Side by Side Diff: src/ast.h

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