Commit d211cf24 authored by mstarzinger's avatar mstarzinger Committed by Commit bot

[fullcodegen] Cleanup MustCreateObjectLiteralWithRuntime.

This cleans up the aforementioned predicate to not rely on the flags
computed for communication between compiled code and the runtime. The
underlying predicates of the AST are used directly instead.

R=mvstanton@chromium.org

Review URL: https://codereview.chromium.org/1638353002

Cr-Commit-Position: refs/heads/master@{#33559}
parent d11b44ec
...@@ -1517,6 +1517,9 @@ class ObjectLiteral final : public MaterializedLiteral { ...@@ -1517,6 +1517,9 @@ class ObjectLiteral final : public MaterializedLiteral {
bool may_store_doubles() const { return may_store_doubles_; } bool may_store_doubles() const { return may_store_doubles_; }
bool has_function() const { return has_function_; } bool has_function() const { return has_function_; }
bool has_elements() const { return has_elements_; } bool has_elements() const { return has_elements_; }
bool has_shallow_properties() const {
return depth() == 1 && !has_elements() && !may_store_doubles();
}
// Decide if a property should be in the object boilerplate. // Decide if a property should be in the object boilerplate.
static bool IsBoilerplateProperty(Property* property); static bool IsBoilerplateProperty(Property* property);
...@@ -1533,7 +1536,7 @@ class ObjectLiteral final : public MaterializedLiteral { ...@@ -1533,7 +1536,7 @@ class ObjectLiteral final : public MaterializedLiteral {
int ComputeFlags(bool disable_mementos = false) const { int ComputeFlags(bool disable_mementos = false) const {
int flags = fast_elements() ? kFastElements : kNoFlags; int flags = fast_elements() ? kFastElements : kNoFlags;
flags |= has_function() ? kHasFunction : kNoFlags; flags |= has_function() ? kHasFunction : kNoFlags;
if (depth() == 1 && !has_elements() && !may_store_doubles()) { if (has_shallow_properties()) {
flags |= kShallowProperties; flags |= kShallowProperties;
} }
if (disable_mementos) { if (disable_mementos) {
......
...@@ -143,13 +143,11 @@ int FullCodeGenerator::NewHandlerTableEntry() { ...@@ -143,13 +143,11 @@ int FullCodeGenerator::NewHandlerTableEntry() {
bool FullCodeGenerator::MustCreateObjectLiteralWithRuntime( bool FullCodeGenerator::MustCreateObjectLiteralWithRuntime(
ObjectLiteral* expr) const { ObjectLiteral* expr) const {
int literal_flags = expr->ComputeFlags();
// FastCloneShallowObjectStub doesn't copy elements, and object literals don't // FastCloneShallowObjectStub doesn't copy elements, and object literals don't
// support copy-on-write (COW) elements for now. // support copy-on-write (COW) elements for now.
// TODO(mvstanton): make object literals support COW elements. // TODO(mvstanton): make object literals support COW elements.
return masm()->serializer_enabled() || return masm()->serializer_enabled() || !expr->fast_elements() ||
(literal_flags & ObjectLiteral::kShallowProperties) == 0 || !expr->has_shallow_properties() ||
(literal_flags & ObjectLiteral::kFastElements) == 0 ||
expr->properties_count() > expr->properties_count() >
FastCloneShallowObjectStub::kMaximumClonedProperties; FastCloneShallowObjectStub::kMaximumClonedProperties;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment