| Index: src/arm/full-codegen-arm.cc
|
| diff --git a/src/arm/full-codegen-arm.cc b/src/arm/full-codegen-arm.cc
|
| index 8ff3e9330457826f5f202412344bc44e8680934e..de09516cc3580ff73bbd5ceafee0f273d2b96030 100644
|
| --- a/src/arm/full-codegen-arm.cc
|
| +++ b/src/arm/full-codegen-arm.cc
|
| @@ -2183,16 +2183,43 @@ void FullCodeGenerator::EmitNamedPropertyAssignment(Assignment* expr) {
|
| ASSERT(prop != NULL);
|
| ASSERT(prop->key()->AsLiteral() != NULL);
|
|
|
| + // If the assignment starts a block of assignments to the same object,
|
| + // change to slow case to avoid the quadratic behavior of repeatedly
|
| + // adding fast properties.
|
| + if (expr->starts_initialization_block()) {
|
| + __ push(result_register());
|
| + __ ldr(ip, MemOperand(sp, kPointerSize)); // Receiver is now under value.
|
| + __ push(ip);
|
| + __ CallRuntime(Runtime::kToSlowProperties, 1);
|
| + __ pop(result_register());
|
| + }
|
| +
|
| // Record source code position before IC call.
|
| SetSourcePosition(expr->position());
|
| __ mov(r2, Operand(prop->key()->AsLiteral()->handle()));
|
| - __ pop(r1);
|
| + // Load receiver to r1. Leave a copy in the stack if needed for turning the
|
| + // receiver into fast case.
|
| + if (expr->ends_initialization_block()) {
|
| + __ ldr(r1, MemOperand(sp));
|
| + } else {
|
| + __ pop(r1);
|
| + }
|
|
|
| Handle<Code> ic = is_classic_mode()
|
| ? isolate()->builtins()->StoreIC_Initialize()
|
| : isolate()->builtins()->StoreIC_Initialize_Strict();
|
| CallIC(ic, RelocInfo::CODE_TARGET, expr->AssignmentFeedbackId());
|
|
|
| + // If the assignment ends an initialization block, revert to fast case.
|
| + if (expr->ends_initialization_block()) {
|
| + __ push(r0); // Result of assignment, saved even if not needed.
|
| + // Receiver is under the result value.
|
| + __ ldr(ip, MemOperand(sp, kPointerSize));
|
| + __ push(ip);
|
| + __ CallRuntime(Runtime::kToFastProperties, 1);
|
| + __ pop(r0);
|
| + __ Drop(1);
|
| + }
|
| PrepareForBailoutForId(expr->AssignmentId(), TOS_REG);
|
| context()->Plug(r0);
|
| }
|
| @@ -2201,16 +2228,44 @@ void FullCodeGenerator::EmitNamedPropertyAssignment(Assignment* expr) {
|
| void FullCodeGenerator::EmitKeyedPropertyAssignment(Assignment* expr) {
|
| // Assignment to a property, using a keyed store IC.
|
|
|
| + // If the assignment starts a block of assignments to the same object,
|
| + // change to slow case to avoid the quadratic behavior of repeatedly
|
| + // adding fast properties.
|
| + if (expr->starts_initialization_block()) {
|
| + __ push(result_register());
|
| + // Receiver is now under the key and value.
|
| + __ ldr(ip, MemOperand(sp, 2 * kPointerSize));
|
| + __ push(ip);
|
| + __ CallRuntime(Runtime::kToSlowProperties, 1);
|
| + __ pop(result_register());
|
| + }
|
| +
|
| // Record source code position before IC call.
|
| SetSourcePosition(expr->position());
|
| __ pop(r1); // Key.
|
| - __ pop(r2);
|
| + // Load receiver to r2. Leave a copy in the stack if needed for turning the
|
| + // receiver into fast case.
|
| + if (expr->ends_initialization_block()) {
|
| + __ ldr(r2, MemOperand(sp));
|
| + } else {
|
| + __ pop(r2);
|
| + }
|
|
|
| Handle<Code> ic = is_classic_mode()
|
| ? isolate()->builtins()->KeyedStoreIC_Initialize()
|
| : isolate()->builtins()->KeyedStoreIC_Initialize_Strict();
|
| CallIC(ic, RelocInfo::CODE_TARGET, expr->AssignmentFeedbackId());
|
|
|
| + // If the assignment ends an initialization block, revert to fast case.
|
| + if (expr->ends_initialization_block()) {
|
| + __ push(r0); // Result of assignment, saved even if not needed.
|
| + // Receiver is under the result value.
|
| + __ ldr(ip, MemOperand(sp, kPointerSize));
|
| + __ push(ip);
|
| + __ CallRuntime(Runtime::kToFastProperties, 1);
|
| + __ pop(r0);
|
| + __ Drop(1);
|
| + }
|
| PrepareForBailoutForId(expr->AssignmentId(), TOS_REG);
|
| context()->Plug(r0);
|
| }
|
|
|