Index: src/arm64/full-codegen-arm64.cc |
diff --git a/src/arm64/full-codegen-arm64.cc b/src/arm64/full-codegen-arm64.cc |
index 015ec188cd8164f4a2f5d2544f462f11f7d11caa..9feac938b5320c7d3e14b52e47d0f7aae9c5a9cd 100644 |
--- a/src/arm64/full-codegen-arm64.cc |
+++ b/src/arm64/full-codegen-arm64.cc |
@@ -1677,23 +1677,13 @@ void FullCodeGenerator::VisitObjectLiteral(ObjectLiteral* expr) { |
__ Ldr(x3, FieldMemOperand(x3, JSFunction::kLiteralsOffset)); |
__ Mov(x2, Smi::FromInt(expr->literal_index())); |
__ Mov(x1, Operand(constant_properties)); |
- int flags = expr->fast_elements() |
- ? ObjectLiteral::kFastElements |
- : ObjectLiteral::kNoFlags; |
- flags |= expr->has_function() |
- ? ObjectLiteral::kHasFunction |
- : ObjectLiteral::kNoFlags; |
+ int flags = expr->ComputeFlags(); |
__ Mov(x0, Smi::FromInt(flags)); |
- int properties_count = constant_properties->length() / 2; |
- const int max_cloned_properties = |
- FastCloneShallowObjectStub::kMaximumClonedProperties; |
- if (expr->may_store_doubles() || expr->depth() > 1 || |
- masm()->serializer_enabled() || flags != ObjectLiteral::kFastElements || |
- properties_count > max_cloned_properties) { |
+ if (MustCreateObjectLiteralWithRuntime(expr)) { |
__ Push(x3, x2, x1, x0); |
__ CallRuntime(Runtime::kCreateObjectLiteral, 4); |
} else { |
- FastCloneShallowObjectStub stub(isolate(), properties_count); |
+ FastCloneShallowObjectStub stub(isolate(), expr->properties_count()); |
__ CallStub(&stub); |
} |
PrepareForBailoutForId(expr->CreateLiteralId(), TOS_REG); |
@@ -1885,18 +1875,9 @@ void FullCodeGenerator::VisitArrayLiteral(ArrayLiteral* expr) { |
Comment cmnt(masm_, "[ ArrayLiteral"); |
expr->BuildConstantElements(isolate()); |
- int flags = (expr->depth() == 1) ? ArrayLiteral::kShallowElements |
- : ArrayLiteral::kNoFlags; |
- |
- ZoneList<Expression*>* subexprs = expr->values(); |
- int length = subexprs->length(); |
Handle<FixedArray> constant_elements = expr->constant_elements(); |
- DCHECK_EQ(2, constant_elements->length()); |
- ElementsKind constant_elements_kind = |
- static_cast<ElementsKind>(Smi::cast(constant_elements->get(0))->value()); |
- bool has_fast_elements = IsFastObjectElementsKind(constant_elements_kind); |
- Handle<FixedArrayBase> constant_elements_values( |
- FixedArrayBase::cast(constant_elements->get(1))); |
+ bool has_fast_elements = |
+ IsFastObjectElementsKind(expr->constant_elements_kind()); |
AllocationSiteMode allocation_site_mode = TRACK_ALLOCATION_SITE; |
if (has_fast_elements && !FLAG_allocation_site_pretenuring) { |
@@ -1909,8 +1890,8 @@ void FullCodeGenerator::VisitArrayLiteral(ArrayLiteral* expr) { |
__ Ldr(x3, FieldMemOperand(x3, JSFunction::kLiteralsOffset)); |
__ Mov(x2, Smi::FromInt(expr->literal_index())); |
__ Mov(x1, Operand(constant_elements)); |
- if (expr->depth() > 1 || length > JSObject::kInitialMaxFastElementArray) { |
- __ Mov(x0, Smi::FromInt(flags)); |
+ if (MustCreateArrayLiteralWithRuntime(expr)) { |
+ __ Mov(x0, Smi::FromInt(expr->ComputeFlags())); |
__ Push(x3, x2, x1, x0); |
__ CallRuntime(Runtime::kCreateArrayLiteral, 4); |
} else { |
@@ -1920,6 +1901,8 @@ void FullCodeGenerator::VisitArrayLiteral(ArrayLiteral* expr) { |
PrepareForBailoutForId(expr->CreateLiteralId(), TOS_REG); |
bool result_saved = false; // Is the result saved to the stack? |
+ ZoneList<Expression*>* subexprs = expr->values(); |
+ int length = subexprs->length(); |
// Emit code to evaluate all the non-constant subexpressions and to store |
// them into the newly cloned array. |
@@ -1936,7 +1919,7 @@ void FullCodeGenerator::VisitArrayLiteral(ArrayLiteral* expr) { |
} |
VisitForAccumulatorValue(subexpr); |
- if (IsFastObjectElementsKind(constant_elements_kind)) { |
+ if (has_fast_elements) { |
int offset = FixedArray::kHeaderSize + (i * kPointerSize); |
__ Peek(x6, kPointerSize); // Copy of array literal. |
__ Ldr(x1, FieldMemOperand(x6, JSObject::kElementsOffset)); |