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

Unified Diff: src/ast/ast.cc

Issue 2302643002: Split the AST representation of class properties from object properties (Closed)
Patch Set: remove spurious classliteralproperty typedef Created 4 years, 3 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 side-by-side diff with in-line comments
Download patch
Index: src/ast/ast.cc
diff --git a/src/ast/ast.cc b/src/ast/ast.cc
index ae2cd2955f75526bd3b386b50227f8d2c9559020..7e646e7410aff7b5594eb2af7370c14b6e479e8c 100644
--- a/src/ast/ast.cc
+++ b/src/ast/ast.cc
@@ -323,27 +323,16 @@ bool FunctionLiteral::NeedsHomeObject(Expression* expr) {
return expr->AsFunctionLiteral()->scope()->NeedsHomeObject();
}
-
ObjectLiteralProperty::ObjectLiteralProperty(Expression* key, Expression* value,
- Kind kind, bool is_static,
- bool is_computed_name)
- : key_(key),
- value_(value),
+ Kind kind, bool is_computed_name)
+ : LiteralProperty(key, value, is_computed_name),
kind_(kind),
- emit_store_(true),
- is_static_(is_static),
- is_computed_name_(is_computed_name) {}
-
+ emit_store_(true) {}
ObjectLiteralProperty::ObjectLiteralProperty(AstValueFactory* ast_value_factory,
Expression* key, Expression* value,
- bool is_static,
bool is_computed_name)
- : key_(key),
- value_(value),
- emit_store_(true),
- is_static_(is_static),
- is_computed_name_(is_computed_name) {
+ : LiteralProperty(key, value, is_computed_name), emit_store_(true) {
if (!is_computed_name &&
key->AsLiteral()->raw_value()->EqualsString(
ast_value_factory->proto_string())) {
@@ -357,13 +346,20 @@ ObjectLiteralProperty::ObjectLiteralProperty(AstValueFactory* ast_value_factory,
}
}
-bool ObjectLiteralProperty::NeedsSetFunctionName() const {
+bool LiteralProperty::NeedsSetFunctionName() const {
return is_computed_name_ &&
(value_->IsAnonymousFunctionDefinition() ||
(value_->IsFunctionLiteral() &&
IsConciseMethod(value_->AsFunctionLiteral()->kind())));
}
+ClassLiteralProperty::ClassLiteralProperty(Expression* key, Expression* value,
+ Kind kind, bool is_static,
+ bool is_computed_name)
+ : LiteralProperty(key, value, is_computed_name),
+ kind_(kind),
+ is_static_(is_static) {}
+
void ClassLiteral::AssignFeedbackVectorSlots(Isolate* isolate,
FeedbackVectorSpec* spec,
FeedbackVectorSlotCache* cache) {
@@ -375,7 +371,7 @@ void ClassLiteral::AssignFeedbackVectorSlots(Isolate* isolate,
}
for (int i = 0; i < properties()->length(); i++) {
- ObjectLiteral::Property* property = properties()->at(i);
+ ClassLiteral::Property* property = properties()->at(i);
Expression* value = property->value();
if (FunctionLiteral::NeedsHomeObject(value)) {
property->SetSlot(spec->AddStoreICSlot());

Powered by Google App Engine
This is Rietveld 408576698