| Index: src/ia32/full-codegen-ia32.cc
|
| diff --git a/src/ia32/full-codegen-ia32.cc b/src/ia32/full-codegen-ia32.cc
|
| index 72021b4a9d4eeef30ff8f8f818754442ed589061..7fb7cc3215239810232cf8e9cf2e3eb24c474311 100644
|
| --- a/src/ia32/full-codegen-ia32.cc
|
| +++ b/src/ia32/full-codegen-ia32.cc
|
| @@ -2139,15 +2139,37 @@ 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());
|
| + __ push(Operand(esp, kPointerSize)); // Receiver is now under value.
|
| + __ CallRuntime(Runtime::kToSlowProperties, 1);
|
| + __ pop(result_register());
|
| + }
|
| +
|
| // Record source code position before IC call.
|
| SetSourcePosition(expr->position());
|
| __ mov(ecx, prop->key()->AsLiteral()->handle());
|
| - __ pop(edx);
|
| + if (expr->ends_initialization_block()) {
|
| + __ mov(edx, Operand(esp, 0));
|
| + } else {
|
| + __ pop(edx);
|
| + }
|
| 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(eax); // Result of assignment, saved even if not needed.
|
| + __ push(Operand(esp, kPointerSize)); // Receiver is under value.
|
| + __ CallRuntime(Runtime::kToFastProperties, 1);
|
| + __ pop(eax);
|
| + __ Drop(1);
|
| + }
|
| PrepareForBailoutForId(expr->AssignmentId(), TOS_REG);
|
| context()->Plug(eax);
|
| }
|
| @@ -2159,8 +2181,23 @@ void FullCodeGenerator::EmitKeyedPropertyAssignment(Assignment* expr) {
|
| // esp[0] : key
|
| // esp[kPointerSize] : receiver
|
|
|
| + // 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.
|
| + __ push(Operand(esp, 2 * kPointerSize));
|
| + __ CallRuntime(Runtime::kToSlowProperties, 1);
|
| + __ pop(result_register());
|
| + }
|
| +
|
| __ pop(ecx); // Key.
|
| - __ pop(edx);
|
| + if (expr->ends_initialization_block()) {
|
| + __ mov(edx, Operand(esp, 0)); // Leave receiver on the stack for later.
|
| + } else {
|
| + __ pop(edx);
|
| + }
|
| // Record source code position before IC call.
|
| SetSourcePosition(expr->position());
|
| Handle<Code> ic = is_classic_mode()
|
| @@ -2168,6 +2205,15 @@ void FullCodeGenerator::EmitKeyedPropertyAssignment(Assignment* expr) {
|
| : 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()) {
|
| + __ pop(edx);
|
| + __ push(eax); // Result of assignment, saved even if not needed.
|
| + __ push(edx);
|
| + __ CallRuntime(Runtime::kToFastProperties, 1);
|
| + __ pop(eax);
|
| + }
|
| +
|
| PrepareForBailoutForId(expr->AssignmentId(), TOS_REG);
|
| context()->Plug(eax);
|
| }
|
| @@ -2623,28 +2669,22 @@ void FullCodeGenerator::EmitIsStringWrapperSafeForDefaultValueOf(
|
| __ j(equal, if_false);
|
|
|
| // Look for valueOf symbol in the descriptor array, and indicate false if
|
| - // found. Since we omit an enumeration index check, if it is added via a
|
| - // transition that shares its descriptor array, this is a false positive.
|
| - Label entry, loop, done;
|
| -
|
| - // Skip loop if no descriptors are valid.
|
| - __ NumberOfOwnDescriptors(ecx, ebx);
|
| - __ cmp(ecx, 0);
|
| - __ j(equal, &done);
|
| -
|
| + // found. The type is not checked, so if it is a transition it is a false
|
| + // negative.
|
| __ LoadInstanceDescriptors(ebx, ebx);
|
| - // ebx: descriptor array.
|
| - // ecx: valid entries in the descriptor array.
|
| + __ mov(ecx, FieldOperand(ebx, FixedArray::kLengthOffset));
|
| + // ebx: descriptor array
|
| + // ecx: length of descriptor array
|
| // Calculate the end of the descriptor array.
|
| STATIC_ASSERT(kSmiTag == 0);
|
| STATIC_ASSERT(kSmiTagSize == 1);
|
| STATIC_ASSERT(kPointerSize == 4);
|
| - __ imul(ecx, ecx, DescriptorArray::kDescriptorSize);
|
| - __ lea(ecx, Operand(ebx, ecx, times_2, DescriptorArray::kFirstOffset));
|
| + __ lea(ecx, Operand(ebx, ecx, times_2, FixedArray::kHeaderSize));
|
| // Calculate location of the first key name.
|
| __ add(ebx, Immediate(DescriptorArray::kFirstOffset));
|
| // Loop through all the keys in the descriptor array. If one of these is the
|
| // symbol valueOf the result is false.
|
| + Label entry, loop;
|
| __ jmp(&entry);
|
| __ bind(&loop);
|
| __ mov(edx, FieldOperand(ebx, 0));
|
| @@ -2655,12 +2695,10 @@ void FullCodeGenerator::EmitIsStringWrapperSafeForDefaultValueOf(
|
| __ cmp(ebx, ecx);
|
| __ j(not_equal, &loop);
|
|
|
| - __ bind(&done);
|
| -
|
| // Reload map as register ebx was used as temporary above.
|
| __ mov(ebx, FieldOperand(eax, HeapObject::kMapOffset));
|
|
|
| - // If a valueOf property is not found on the object check that its
|
| + // If a valueOf property is not found on the object check that it's
|
| // prototype is the un-modified String prototype. If not result is false.
|
| __ mov(ecx, FieldOperand(ebx, Map::kPrototypeOffset));
|
| __ JumpIfSmi(ecx, if_false);
|
|
|