Index: src/ast/ast.h |
diff --git a/src/ast/ast.h b/src/ast/ast.h |
index c3790b34b377fe448289a171d066207cdb8e998e..44b865aad180291d4d94669b0f5030dcc7d86fa1 100644 |
--- a/src/ast/ast.h |
+++ b/src/ast/ast.h |
@@ -1353,6 +1353,12 @@ class ObjectLiteralProperty final : public LiteralProperty { |
void set_receiver_type(Handle<Map> map) { receiver_type_ = map; } |
+ bool IsNullPrototype() const { |
+ if (!IsPrototype()) return false; |
+ return value()->IsNullLiteral(); |
adamk
2017/03/13 18:10:44
Nit:
return IsPrototype() && value()->IsNullLiter
Camillo Bruni
2017/03/17 16:40:55
uhm, right, used to be more complex ;)
|
+ } |
+ bool IsPrototype() const { return kind() == PROTOTYPE; } |
+ |
private: |
friend class AstNodeFactory; |
@@ -1390,7 +1396,13 @@ class ObjectLiteral final : public MaterializedLiteral { |
bool has_rest_property() const { |
return HasRestPropertyField::decode(bit_field_); |
} |
- |
+ bool HasNullPrototype() const { |
+ for (int i = 0; i < properties()->length(); i++) { |
+ const ObjectLiteral::Property* property = properties()->at(i); |
+ if (property->IsNullPrototype()) return true; |
+ } |
+ return false; |
+ } |
// Decide if a property should be in the object boilerplate. |
static bool IsBoilerplateProperty(Property* property); |
@@ -1420,12 +1432,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 (HasNullPrototype()) flags |= kHasNullPrototype; |
+ if (has_shallow_properties()) flags |= kShallowProperties; |
+ if (disable_mementos) flags |= kDisableMementos; |
return flags; |
} |
@@ -1435,6 +1444,7 @@ class ObjectLiteral final : public MaterializedLiteral { |
kShallowProperties = 1 << 1, |
kDisableMementos = 1 << 2, |
kHasRestProperty = 1 << 3, |
+ kHasNullPrototype = 1 << 4, |
}; |
struct Accessors: public ZoneObject { |