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

Unified Diff: src/ast/ast.h

Issue 2620943002: [ESnext] Implement Object Rest (Closed)
Patch Set: fix nits Created 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | src/bootstrapper.cc » ('j') | no next file with comments »
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 af561e0a3f99124542c9010b589ddaa37fe324d7..9a87328a7b98ad1cb1fc62a9da26d03d1fdfc5cd 100644
--- a/src/ast/ast.h
+++ b/src/ast/ast.h
@@ -1399,6 +1399,9 @@ class ObjectLiteral final : public MaterializedLiteral {
bool has_shallow_properties() const {
return depth() == 1 && !has_elements() && !may_store_doubles();
}
+ bool has_rest_property() const {
+ return HasRestPropertyField::decode(bit_field_);
+ }
// Decide if a property should be in the object boilerplate.
static bool IsBoilerplateProperty(Property* property);
@@ -1441,7 +1444,8 @@ class ObjectLiteral final : public MaterializedLiteral {
kNoFlags = 0,
kFastElements = 1,
kShallowProperties = 1 << 1,
- kDisableMementos = 1 << 2
+ kDisableMementos = 1 << 2,
+ kHasRestProperty = 1 << 3,
};
struct Accessors: public ZoneObject {
@@ -1469,13 +1473,15 @@ class ObjectLiteral final : public MaterializedLiteral {
friend class AstNodeFactory;
ObjectLiteral(ZoneList<Property*>* properties, int literal_index,
- uint32_t boilerplate_properties, int pos)
+ uint32_t boilerplate_properties, int pos,
+ bool has_rest_property)
: MaterializedLiteral(literal_index, pos, kObjectLiteral),
boilerplate_properties_(boilerplate_properties),
properties_(properties) {
bit_field_ |= FastElementsField::encode(false) |
HasElementsField::encode(false) |
- MayStoreDoublesField::encode(false);
+ MayStoreDoublesField::encode(false) |
+ HasRestPropertyField::encode(has_rest_property);
}
static int parent_num_ids() { return MaterializedLiteral::num_ids(); }
@@ -1491,6 +1497,8 @@ class ObjectLiteral final : public MaterializedLiteral {
};
class MayStoreDoublesField
: public BitField<bool, HasElementsField::kNext, 1> {};
+ class HasRestPropertyField
+ : public BitField<bool, MayStoreDoublesField::kNext, 1> {};
};
@@ -3329,9 +3337,10 @@ class AstNodeFactory final BASE_EMBEDDED {
ObjectLiteral* NewObjectLiteral(
ZoneList<ObjectLiteral::Property*>* properties, int literal_index,
- uint32_t boilerplate_properties, int pos) {
+ uint32_t boilerplate_properties, int pos, bool has_rest_property) {
return new (zone_)
- ObjectLiteral(properties, literal_index, boilerplate_properties, pos);
+ ObjectLiteral(properties, literal_index, boilerplate_properties, pos,
+ has_rest_property);
}
ObjectLiteral::Property* NewObjectLiteralProperty(
« no previous file with comments | « no previous file | src/bootstrapper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698