Index: src/ast/ast.h |
diff --git a/src/ast/ast.h b/src/ast/ast.h |
index 2d9833aee1eb2b8f7aa3b8e3de1acf2fb2967720..df59db8f562bcbff4842de01c9033f80745f63c1 100644 |
--- a/src/ast/ast.h |
+++ b/src/ast/ast.h |
@@ -1264,6 +1264,7 @@ 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) { |
@@ -1353,6 +1354,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; |
@@ -1390,7 +1396,9 @@ class ObjectLiteral final : public MaterializedLiteral { |
bool has_rest_property() const { |
return HasRestPropertyField::decode(bit_field_); |
} |
- |
+ bool has_null_prototype() const { |
+ return HasNullPrototypeField::decode(bit_field_); |
+ } |
// Decide if a property should be in the object boilerplate. |
static bool IsBoilerplateProperty(Property* property); |
@@ -1420,12 +1428,9 @@ 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; |
} |
@@ -1434,7 +1439,7 @@ class ObjectLiteral final : public MaterializedLiteral { |
kFastElements = 1, |
kShallowProperties = 1 << 1, |
kDisableMementos = 1 << 2, |
- kHasRestProperty = 1 << 3, |
+ kHasNullPrototype = 1 << 3, |
}; |
struct Accessors: public ZoneObject { |
@@ -1470,12 +1475,23 @@ 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 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_; |
@@ -1488,6 +1504,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> {}; |
}; |