Chromium Code Reviews| Index: src/arm/builtins-arm.cc |
| diff --git a/src/arm/builtins-arm.cc b/src/arm/builtins-arm.cc |
| index 29bf19028cb7770963c8e1e76a530ffae05baf08..0422a8a070ea98c002b566d7094c3390d575eb05 100644 |
| --- a/src/arm/builtins-arm.cc |
| +++ b/src/arm/builtins-arm.cc |
| @@ -104,7 +104,10 @@ static void AllocateEmptyJSArray(MacroAssembler* masm, |
| // 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, |
| @@ -124,6 +127,11 @@ static void AllocateEmptyJSArray(MacroAssembler* masm, |
| __ mov(scratch3, Operand(0, RelocInfo::NONE)); |
| __ str(scratch3, FieldMemOperand(result, JSArray::kLengthOffset)); |
| + if (initial_capacity == 0) { |
| + __ str(scratch1, FieldMemOperand(result, JSArray::kElementsOffset)); |
| + return; |
| + } |
| + |
| // Calculate the location of the elements array and set elements array member |
| // of the JSArray. |
| // result: JSObject |
| @@ -148,7 +156,6 @@ static void AllocateEmptyJSArray(MacroAssembler* masm, |
| __ str(scratch3, MemOperand(scratch1, kPointerSize, PostIndex)); |
| // Fill the FixedArray with the hole value. Inline the code if short. |
| - if (initial_capacity == 0) return; |
| ASSERT_EQ(2 * kPointerSize, FixedArray::kHeaderSize); |
|
Kevin Millikin (Chromium)
2011/10/27 10:35:54
This can be a static assert.
|
| __ LoadRoot(scratch3, Heap::kTheHoleValueRootIndex); |
| static const int kLoopUnfoldLimit = 4; |