| Index: src/arm/full-codegen-arm.cc
|
| diff --git a/src/arm/full-codegen-arm.cc b/src/arm/full-codegen-arm.cc
|
| index 1ee612b5325e2a51e55ba6ed398b9d1ab14b6184..28d818456d8fb18b5c3f51996b11b82c085d8b4d 100644
|
| --- a/src/arm/full-codegen-arm.cc
|
| +++ b/src/arm/full-codegen-arm.cc
|
| @@ -1634,6 +1634,9 @@ void FullCodeGenerator::EmitAccessor(Expression* expression) {
|
|
|
| void FullCodeGenerator::VisitObjectLiteral(ObjectLiteral* expr) {
|
| Comment cmnt(masm_, "[ ObjectLiteral");
|
| +
|
| + int depth = 1;
|
| + expr->BuildConstantProperties(isolate(), &depth);
|
| Handle<FixedArray> constant_properties = expr->constant_properties();
|
| __ ldr(r3, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset));
|
| __ ldr(r3, FieldMemOperand(r3, JSFunction::kLiteralsOffset));
|
| @@ -1648,7 +1651,7 @@ void FullCodeGenerator::VisitObjectLiteral(ObjectLiteral* expr) {
|
| __ mov(r0, Operand(Smi::FromInt(flags)));
|
| int properties_count = constant_properties->length() / 2;
|
| if ((FLAG_track_double_fields && expr->may_store_doubles()) ||
|
| - expr->depth() > 1 || Serializer::enabled() ||
|
| + depth > 1 || Serializer::enabled() ||
|
| flags != ObjectLiteral::kFastElements ||
|
| properties_count > FastCloneShallowObjectStub::kMaximumClonedProperties) {
|
| __ Push(r3, r2, r1, r0);
|
| @@ -1767,6 +1770,8 @@ void FullCodeGenerator::VisitObjectLiteral(ObjectLiteral* expr) {
|
| void FullCodeGenerator::VisitArrayLiteral(ArrayLiteral* expr) {
|
| Comment cmnt(masm_, "[ ArrayLiteral");
|
|
|
| + int depth = 1;
|
| + expr->BuildConstantElements(isolate(), &depth);
|
| ZoneList<Expression*>* subexprs = expr->values();
|
| int length = subexprs->length();
|
| Handle<FixedArray> constant_elements = expr->constant_elements();
|
| @@ -1790,8 +1795,7 @@ void FullCodeGenerator::VisitArrayLiteral(ArrayLiteral* expr) {
|
| __ CallStub(&stub);
|
| __ IncrementCounter(
|
| isolate()->counters()->cow_arrays_created_stub(), 1, r1, r2);
|
| - } else if (expr->depth() > 1 ||
|
| - Serializer::enabled() ||
|
| + } else if (depth > 1 || Serializer::enabled() ||
|
| length > FastCloneShallowArrayStub::kMaximumClonedLength) {
|
| __ Push(r3, r2, r1);
|
| __ CallRuntime(Runtime::kCreateArrayLiteral, 3);
|
| @@ -3701,11 +3705,21 @@ void FullCodeGenerator::EmitStringCharAt(CallRuntime* expr) {
|
| void FullCodeGenerator::EmitStringAdd(CallRuntime* expr) {
|
| ZoneList<Expression*>* args = expr->arguments();
|
| ASSERT_EQ(2, args->length());
|
| - VisitForStackValue(args->at(0));
|
| - VisitForStackValue(args->at(1));
|
|
|
| - StringAddStub stub(STRING_ADD_CHECK_BOTH);
|
| - __ CallStub(&stub);
|
| + if (FLAG_new_string_add) {
|
| + VisitForStackValue(args->at(0));
|
| + VisitForAccumulatorValue(args->at(1));
|
| +
|
| + __ pop(r1);
|
| + NewStringAddStub stub(STRING_ADD_CHECK_BOTH, NOT_TENURED);
|
| + __ CallStub(&stub);
|
| + } else {
|
| + VisitForStackValue(args->at(0));
|
| + VisitForStackValue(args->at(1));
|
| +
|
| + StringAddStub stub(STRING_ADD_CHECK_BOTH);
|
| + __ CallStub(&stub);
|
| + }
|
| context()->Plug(r0);
|
| }
|
|
|
| @@ -4394,14 +4408,44 @@ void FullCodeGenerator::VisitCountOperation(CountOperation* expr) {
|
| PrepareForBailoutForId(prop->LoadId(), TOS_REG);
|
| }
|
|
|
| - // Call ToNumber only if operand is not a smi.
|
| - Label no_conversion;
|
| + // Inline smi case if we are in a loop.
|
| + Label stub_call, done;
|
| + JumpPatchSite patch_site(masm_);
|
| +
|
| + int count_value = expr->op() == Token::INC ? 1 : -1;
|
| if (ShouldInlineSmiCase(expr->op())) {
|
| - __ JumpIfSmi(r0, &no_conversion);
|
| + Label slow;
|
| + patch_site.EmitJumpIfNotSmi(r0, &slow);
|
| +
|
| + // Save result for postfix expressions.
|
| + if (expr->is_postfix()) {
|
| + if (!context()->IsEffect()) {
|
| + // Save the result on the stack. If we have a named or keyed property
|
| + // we store the result under the receiver that is currently on top
|
| + // of the stack.
|
| + switch (assign_type) {
|
| + case VARIABLE:
|
| + __ push(r0);
|
| + break;
|
| + case NAMED_PROPERTY:
|
| + __ str(r0, MemOperand(sp, kPointerSize));
|
| + break;
|
| + case KEYED_PROPERTY:
|
| + __ str(r0, MemOperand(sp, 2 * kPointerSize));
|
| + break;
|
| + }
|
| + }
|
| + }
|
| +
|
| + __ add(r0, r0, Operand(Smi::FromInt(count_value)), SetCC);
|
| + __ b(vc, &done);
|
| + // Call stub. Undo operation first.
|
| + __ sub(r0, r0, Operand(Smi::FromInt(count_value)));
|
| + __ jmp(&stub_call);
|
| + __ bind(&slow);
|
| }
|
| ToNumberStub convert_stub;
|
| __ CallStub(&convert_stub);
|
| - __ bind(&no_conversion);
|
|
|
| // Save result for postfix expressions.
|
| if (expr->is_postfix()) {
|
| @@ -4424,22 +4468,7 @@ void FullCodeGenerator::VisitCountOperation(CountOperation* expr) {
|
| }
|
|
|
|
|
| - // Inline smi case if we are in a loop.
|
| - Label stub_call, done;
|
| - JumpPatchSite patch_site(masm_);
|
| -
|
| - int count_value = expr->op() == Token::INC ? 1 : -1;
|
| - if (ShouldInlineSmiCase(expr->op())) {
|
| - __ add(r0, r0, Operand(Smi::FromInt(count_value)), SetCC);
|
| - __ b(vs, &stub_call);
|
| - // We could eliminate this smi check if we split the code at
|
| - // the first smi check before calling ToNumber.
|
| - patch_site.EmitJumpIfSmi(r0, &done);
|
| -
|
| - __ bind(&stub_call);
|
| - // Call stub. Undo operation first.
|
| - __ sub(r0, r0, Operand(Smi::FromInt(count_value)));
|
| - }
|
| + __ bind(&stub_call);
|
| __ mov(r1, r0);
|
| __ mov(r0, Operand(Smi::FromInt(count_value)));
|
|
|
|
|