| Index: src/mips/builtins-mips.cc
|
| ===================================================================
|
| --- src/mips/builtins-mips.cc (revision 9809)
|
| +++ src/mips/builtins-mips.cc (working copy)
|
| @@ -106,7 +106,10 @@
|
|
|
| // Allocate the JSArray object together with space for a fixed array with the
|
| // requested elements.
|
| - int size = JSArray::kSize + FixedArray::SizeFor(initial_capacity);
|
| + int size = JSArray::kSize;
|
| + if (initial_capacity > 0) {
|
| + size += FixedArray::SizeFor(initial_capacity);
|
| + }
|
| __ AllocateInNewSpace(size,
|
| result,
|
| scratch2,
|
| @@ -125,6 +128,11 @@
|
| __ mov(scratch3, zero_reg);
|
| __ sw(scratch3, FieldMemOperand(result, JSArray::kLengthOffset));
|
|
|
| + if (initial_capacity == 0) {
|
| + __ sw(scratch1, FieldMemOperand(result, JSArray::kElementsOffset));
|
| + return;
|
| + }
|
| +
|
| // Calculate the location of the elements array and set elements array member
|
| // of the JSArray.
|
| // result: JSObject
|
| @@ -141,17 +149,16 @@
|
| // scratch1: elements array (untagged)
|
| // scratch2: start of next object
|
| __ LoadRoot(scratch3, Heap::kFixedArrayMapRootIndex);
|
| - ASSERT_EQ(0 * kPointerSize, FixedArray::kMapOffset);
|
| + STATIC_ASSERT(0 * kPointerSize == FixedArray::kMapOffset);
|
| __ sw(scratch3, MemOperand(scratch1));
|
| __ Addu(scratch1, scratch1, kPointerSize);
|
| __ li(scratch3, Operand(Smi::FromInt(initial_capacity)));
|
| - ASSERT_EQ(1 * kPointerSize, FixedArray::kLengthOffset);
|
| + STATIC_ASSERT(1 * kPointerSize == FixedArray::kLengthOffset);
|
| __ sw(scratch3, MemOperand(scratch1));
|
| __ Addu(scratch1, scratch1, kPointerSize);
|
|
|
| // Fill the FixedArray with the hole value. Inline the code if short.
|
| - if (initial_capacity == 0) return;
|
| - ASSERT_EQ(2 * kPointerSize, FixedArray::kHeaderSize);
|
| + STATIC_ASSERT(2 * kPointerSize == FixedArray::kHeaderSize);
|
| __ LoadRoot(scratch3, Heap::kTheHoleValueRootIndex);
|
| static const int kLoopUnfoldLimit = 4;
|
| if (initial_capacity <= kLoopUnfoldLimit) {
|
|
|