| Index: src/ast/ast.h
|
| diff --git a/src/ast/ast.h b/src/ast/ast.h
|
| index 9d7b4de82c5363cab8f17c42d414acd6a19ecefe..ee18c2af3f6840a6f5688fc983bb5112bddee884 100644
|
| --- a/src/ast/ast.h
|
| +++ b/src/ast/ast.h
|
| @@ -1238,9 +1238,9 @@ class Literal final : public Expression {
|
| // Base class for literals that need space in the type feedback vector.
|
| class MaterializedLiteral : public Expression {
|
| public:
|
| + bool is_initialized() const { return 0 < depth_; }
|
| int depth() const {
|
| - // only callable after initialization.
|
| - DCHECK(depth_ >= 1);
|
| + DCHECK(is_initialized());
|
| return depth_;
|
| }
|
|
|
| @@ -1270,10 +1270,11 @@ class MaterializedLiteral : public Expression {
|
| void set_is_simple(bool is_simple) {
|
| bit_field_ = IsSimpleField::update(bit_field_, is_simple);
|
| }
|
| +
|
| friend class CompileTimeValue;
|
|
|
| void set_depth(int depth) {
|
| - DCHECK_LE(1, depth);
|
| + DCHECK(!is_initialized());
|
| depth_ = depth;
|
| }
|
|
|
| @@ -1359,6 +1360,11 @@ class ObjectLiteralProperty final : public LiteralProperty {
|
|
|
| void set_receiver_type(Handle<Map> map) { receiver_type_ = map; }
|
|
|
| + bool IsNullPrototype() const {
|
| + return IsPrototype() && value()->IsNullLiteral();
|
| + }
|
| + bool IsPrototype() const { return kind() == PROTOTYPE; }
|
| +
|
| private:
|
| friend class AstNodeFactory;
|
|
|
| @@ -1396,9 +1402,9 @@ class ObjectLiteral final : public MaterializedLiteral {
|
| 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);
|
| + bool has_null_prototype() const {
|
| + return HasNullPrototypeField::decode(bit_field_);
|
| + }
|
|
|
| // Populate the depth field and flags.
|
| void InitDepthAndFlags();
|
| @@ -1426,12 +1432,16 @@ class ObjectLiteral final : public MaterializedLiteral {
|
| // Assemble bitfield of flags for the CreateObjectLiteral helper.
|
| int ComputeFlags(bool disable_mementos = false) const {
|
| int flags = fast_elements() ? kFastElements : kNoFlags;
|
| - if (has_shallow_properties()) {
|
| - flags |= kShallowProperties;
|
| - }
|
| - if (disable_mementos) {
|
| - flags |= kDisableMementos;
|
| - }
|
| + if (has_shallow_properties()) flags |= kShallowProperties;
|
| + if (disable_mementos) flags |= kDisableMementos;
|
| + if (has_null_prototype()) flags |= kHasNullPrototype;
|
| + return flags;
|
| + }
|
| +
|
| + int EncodeLiteralType() {
|
| + int flags = fast_elements() ? kFastElements : kNoFlags;
|
| + if (has_shallow_properties()) flags |= kShallowProperties;
|
| + if (has_null_prototype()) flags |= kHasNullPrototype;
|
| return flags;
|
| }
|
|
|
| @@ -1440,7 +1450,7 @@ class ObjectLiteral final : public MaterializedLiteral {
|
| kFastElements = 1,
|
| kShallowProperties = 1 << 1,
|
| kDisableMementos = 1 << 2,
|
| - kHasRestProperty = 1 << 3,
|
| + kHasNullPrototype = 1 << 3,
|
| };
|
|
|
| struct Accessors: public ZoneObject {
|
| @@ -1476,12 +1486,25 @@ class ObjectLiteral final : public MaterializedLiteral {
|
| bit_field_ |= FastElementsField::encode(false) |
|
| HasElementsField::encode(false) |
|
| MayStoreDoublesField::encode(false) |
|
| - HasRestPropertyField::encode(has_rest_property);
|
| + HasRestPropertyField::encode(has_rest_property) |
|
| + HasNullPrototypeField::encode(false);
|
| }
|
|
|
| static int parent_num_ids() { return MaterializedLiteral::num_ids(); }
|
| int local_id(int n) const { return base_id() + parent_num_ids() + n; }
|
|
|
| + void InitFlagsForPendingNullPrototype(int i);
|
| +
|
| + void set_fast_elements(bool fast_elements) {
|
| + bit_field_ = FastElementsField::update(bit_field_, fast_elements);
|
| + }
|
| + void set_has_elements(bool has_elements) {
|
| + bit_field_ = HasElementsField::update(bit_field_, has_elements);
|
| + }
|
| + void set_has_null_protoype(bool has_null_prototype) {
|
| + bit_field_ = HasNullPrototypeField::update(bit_field_, has_null_prototype);
|
| + }
|
| +
|
| uint32_t boilerplate_properties_;
|
| Handle<BoilerplateDescription> constant_properties_;
|
| ZoneList<Property*>* properties_;
|
| @@ -1494,6 +1517,8 @@ class ObjectLiteral final : public MaterializedLiteral {
|
| : public BitField<bool, HasElementsField::kNext, 1> {};
|
| class HasRestPropertyField
|
| : public BitField<bool, MayStoreDoublesField::kNext, 1> {};
|
| + class HasNullPrototypeField
|
| + : public BitField<bool, HasRestPropertyField::kNext, 1> {};
|
| };
|
|
|
|
|
| @@ -1582,9 +1607,7 @@ class ArrayLiteral final : public MaterializedLiteral {
|
| // Assemble bitfield of flags for the CreateArrayLiteral helper.
|
| int ComputeFlags(bool disable_mementos = false) const {
|
| int flags = depth() == 1 ? kShallowElements : kNoFlags;
|
| - if (disable_mementos) {
|
| - flags |= kDisableMementos;
|
| - }
|
| + if (disable_mementos) flags |= kDisableMementos;
|
| return flags;
|
| }
|
|
|
|
|