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

Unified Diff: src/ast/ast.h

Issue 2423053002: Install the 'name' property in classes at runtime (Closed)
Patch Set: Move computed property names check to parser and runtime function Created 4 years, 1 month 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
« no previous file with comments | « no previous file | src/ast/ast-value-factory.h » ('j') | src/compiler/ast-graph-builder.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/ast/ast.h
diff --git a/src/ast/ast.h b/src/ast/ast.h
index e6e2a368631409e5c14143d4752477afc2a1fc7c..05f8de5a63ba5c641dd906d7a534f2bfc5bf6584 100644
--- a/src/ast/ast.h
+++ b/src/ast/ast.h
@@ -2800,6 +2800,12 @@ class ClassLiteral final : public Expression {
ZoneList<Property*>* properties() const { return properties_; }
int start_position() const { return position(); }
int end_position() const { return end_position_; }
+ bool has_name_static_property() const {
+ return HasNameStaticProperty::decode(bit_field_);
+ }
+ bool has_static_computed_names() const {
+ return HasStaticComputedNames::decode(bit_field_);
+ }
VariableProxy* static_initializer_proxy() const {
return static_initializer_proxy_;
@@ -2836,14 +2842,19 @@ class ClassLiteral final : public Expression {
ClassLiteral(VariableProxy* class_variable_proxy, Expression* extends,
FunctionLiteral* constructor, ZoneList<Property*>* properties,
- int start_position, int end_position)
+ int start_position, int end_position,
+ bool has_name_static_property, bool has_static_computed_names)
: Expression(start_position, kClassLiteral),
end_position_(end_position),
class_variable_proxy_(class_variable_proxy),
extends_(extends),
constructor_(constructor),
properties_(properties),
- static_initializer_proxy_(nullptr) {}
+ static_initializer_proxy_(nullptr) {
+ bit_field_ |=
+ HasNameStaticProperty::update(bit_field_, has_name_static_property) |
Toon Verwaest 2016/11/29 12:27:47 HasNameStaticProperty::encode(has_name_static_prop
+ HasStaticComputedNames::update(bit_field_, has_static_computed_names);
+ }
static int parent_num_ids() { return Expression::num_ids(); }
int local_id(int n) const { return base_id() + parent_num_ids() + n; }
@@ -2856,6 +2867,11 @@ class ClassLiteral final : public Expression {
FunctionLiteral* constructor_;
ZoneList<Property*>* properties_;
VariableProxy* static_initializer_proxy_;
+
+ class HasNameStaticProperty
+ : public BitField<bool, Expression::kNextBitFieldIndex, 1> {};
+ class HasStaticComputedNames
+ : public BitField<bool, HasNameStaticProperty::kNext, 1> {};
};
@@ -3492,9 +3508,12 @@ class AstNodeFactory final BASE_EMBEDDED {
ClassLiteral* NewClassLiteral(VariableProxy* proxy, Expression* extends,
FunctionLiteral* constructor,
ZoneList<ClassLiteral::Property*>* properties,
- int start_position, int end_position) {
- return new (zone_) ClassLiteral(proxy, extends, constructor, properties,
- start_position, end_position);
+ int start_position, int end_position,
+ bool has_name_static_property,
+ bool has_static_computed_names) {
+ return new (zone_) ClassLiteral(
+ proxy, extends, constructor, properties, start_position, end_position,
+ has_name_static_property, has_static_computed_names);
}
NativeFunctionLiteral* NewNativeFunctionLiteral(const AstRawString* name,
« no previous file with comments | « no previous file | src/ast/ast-value-factory.h » ('j') | src/compiler/ast-graph-builder.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698