| Index: src/ia32/builtins-ia32.cc
|
| diff --git a/src/ia32/builtins-ia32.cc b/src/ia32/builtins-ia32.cc
|
| index 2db21d58ef9efc282c18e832af2b77ec08df90cc..030688a6cdfbc78c3a65c9ab3bc08727e0dfc313 100644
|
| --- a/src/ia32/builtins-ia32.cc
|
| +++ b/src/ia32/builtins-ia32.cc
|
| @@ -806,6 +806,7 @@ static void AllocateJSArray(MacroAssembler* masm,
|
| Label* gc_required) {
|
| ASSERT(scratch.is(edi)); // rep stos destination
|
| ASSERT(!fill_with_hole || array_size.is(ecx)); // rep stos count
|
| + ASSERT(!fill_with_hole || !result.is(eax)); // result is never eax
|
|
|
| // Load the initial map from the array function.
|
| __ mov(elements_array,
|
| @@ -863,15 +864,22 @@ static void AllocateJSArray(MacroAssembler* masm,
|
| if (fill_with_hole) {
|
| __ lea(edi, Operand(elements_array,
|
| FixedArray::kHeaderSize - kHeapObjectTag));
|
| -
|
| - __ push(eax);
|
| __ mov(eax, Factory::the_hole_value());
|
| -
|
| __ cld();
|
| + // Do not use rep stos when filling less than kRepStosThreshold
|
| + // words.
|
| + const int kRepStosThreshold = 16;
|
| + Label loop, entry, done;
|
| + __ cmp(ecx, kRepStosThreshold);
|
| + __ j(below, &loop); // Note: ecx > 0.
|
| __ rep_stos();
|
| -
|
| - // Restore saved registers.
|
| - __ pop(eax);
|
| + __ jmp(&done);
|
| + __ bind(&loop);
|
| + __ stos();
|
| + __ bind(&entry);
|
| + __ cmp(edi, Operand(elements_array_end));
|
| + __ j(below, &loop);
|
| + __ bind(&done);
|
| }
|
| }
|
|
|
| @@ -970,13 +978,14 @@ static void ArrayNativeCode(MacroAssembler* masm,
|
| AllocateJSArray(masm,
|
| edi,
|
| ecx,
|
| - eax,
|
| ebx,
|
| + eax,
|
| edx,
|
| edi,
|
| true,
|
| &prepare_generic_code_call);
|
| __ IncrementCounter(&Counters::array_function_native, 1);
|
| + __ mov(eax, ebx);
|
| __ pop(ebx);
|
| if (construct_call) {
|
| __ pop(edi);
|
|
|