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 {
bool may_store_doubles() const { return may_store_doubles_; }
bool has_function() const { return has_function_; }
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.
static bool IsBoilerplateProperty(Property* property);
......@@ -1533,7 +1536,7 @@ class ObjectLiteral final : public MaterializedLiteral {
int ComputeFlags(bool disable_mementos = false) const {
int flags = fast_elements() ? kFastElements : kNoFlags;
flags |= has_function() ? kHasFunction : kNoFlags;
if (depth() == 1 && !has_elements() && !may_store_doubles()) {
if (has_shallow_properties()) {
flags |= kShallowProperties;
}
if (disable_mementos) {
......
......@@ -143,13 +143,11 @@ int FullCodeGenerator::NewHandlerTableEntry() {
bool FullCodeGenerator::MustCreateObjectLiteralWithRuntime(
ObjectLiteral* expr) const {
int literal_flags = expr->ComputeFlags();
// FastCloneShallowObjectStub doesn't copy elements, and object literals don't
// support copy-on-write (COW) elements for now.
// TODO(mvstanton): make object literals support COW elements.
return masm()->serializer_enabled() ||
(literal_flags & ObjectLiteral::kShallowProperties) == 0 ||
(literal_flags & ObjectLiteral::kFastElements) == 0 ||
return masm()->serializer_enabled() || !expr->fast_elements() ||
!expr->has_shallow_properties() ||
expr->properties_count() >
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