Index: src/ppc/full-codegen-ppc.cc |
diff --git a/src/ppc/full-codegen-ppc.cc b/src/ppc/full-codegen-ppc.cc |
index 213756e875bc2f2cab90f052442bf1125afb49cd..26503c8cd57e0d9594964d8b10b8b523a793c5b4 100644 |
--- a/src/ppc/full-codegen-ppc.cc |
+++ b/src/ppc/full-codegen-ppc.cc |
@@ -1619,19 +1619,13 @@ void FullCodeGenerator::VisitObjectLiteral(ObjectLiteral* expr) { |
__ LoadP(r6, FieldMemOperand(r6, JSFunction::kLiteralsOffset)); |
__ LoadSmiLiteral(r5, Smi::FromInt(expr->literal_index())); |
__ mov(r4, Operand(constant_properties)); |
- int flags = expr->fast_elements() ? ObjectLiteral::kFastElements |
- : ObjectLiteral::kNoFlags; |
- flags |= expr->has_function() ? ObjectLiteral::kHasFunction |
- : ObjectLiteral::kNoFlags; |
+ int flags = expr->ComputeFlags(); |
__ LoadSmiLiteral(r3, Smi::FromInt(flags)); |
- int properties_count = constant_properties->length() / 2; |
- if (expr->may_store_doubles() || expr->depth() > 1 || |
- masm()->serializer_enabled() || flags != ObjectLiteral::kFastElements || |
- properties_count > FastCloneShallowObjectStub::kMaximumClonedProperties) { |
+ if (MustCreateObjectLiteralWithRuntime(expr)) { |
__ Push(r6, r5, r4, r3); |
__ CallRuntime(Runtime::kCreateObjectLiteral, 4); |
} else { |
- FastCloneShallowObjectStub stub(isolate(), properties_count); |
+ FastCloneShallowObjectStub stub(isolate(), expr->properties_count()); |
__ CallStub(&stub); |
} |
PrepareForBailoutForId(expr->CreateLiteralId(), TOS_REG); |
@@ -1821,16 +1815,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); |
+ bool has_fast_elements = |
+ IsFastObjectElementsKind(expr->constant_elements_kind()); |
Handle<FixedArrayBase> constant_elements_values( |
FixedArrayBase::cast(constant_elements->get(1))); |
@@ -1845,8 +1832,8 @@ void FullCodeGenerator::VisitArrayLiteral(ArrayLiteral* expr) { |
__ LoadP(r6, FieldMemOperand(r6, JSFunction::kLiteralsOffset)); |
__ LoadSmiLiteral(r5, Smi::FromInt(expr->literal_index())); |
__ mov(r4, Operand(constant_elements)); |
- if (expr->depth() > 1 || length > JSObject::kInitialMaxFastElementArray) { |
- __ LoadSmiLiteral(r3, Smi::FromInt(flags)); |
+ if (MustCreateArrayLiteralWithRuntime(expr)) { |
+ __ LoadSmiLiteral(r3, Smi::FromInt(expr->ComputeFlags())); |
__ Push(r6, r5, r4, r3); |
__ CallRuntime(Runtime::kCreateArrayLiteral, 4); |
} else { |
@@ -1856,6 +1843,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. |
@@ -1872,7 +1861,7 @@ void FullCodeGenerator::VisitArrayLiteral(ArrayLiteral* expr) { |
} |
VisitForAccumulatorValue(subexpr); |
- if (IsFastObjectElementsKind(constant_elements_kind)) { |
+ if (has_fast_elements) { |
int offset = FixedArray::kHeaderSize + (i * kPointerSize); |
__ LoadP(r8, MemOperand(sp, kPointerSize)); // Copy of array literal. |
__ LoadP(r4, FieldMemOperand(r8, JSObject::kElementsOffset)); |