MIPS: Ensure double arrays are filled with holes when extended from variations of empty arrays.

Port r13056 (9b2c1725)

BUG=
TEST=

Review URL: https://chromiumcodereview.appspot.com/11411253
Patch from Akos Palfi <palfia@homejinni.com>.

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@13083 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
verwaest@chromium.org 2012-11-29 08:37:41 +00:00
parent 7553f0d68e
commit 7ceeb471f7

View File

@ -4843,14 +4843,31 @@ void KeyedStoreStubCompiler::GenerateStoreFastDoubleElement(
__ AllocateInNewSpace(size, elements_reg, scratch1, scratch2, &slow, __ AllocateInNewSpace(size, elements_reg, scratch1, scratch2, &slow,
TAG_OBJECT); TAG_OBJECT);
// Initialize the new FixedDoubleArray. Leave elements unitialized for // Initialize the new FixedDoubleArray.
// efficiency, they are guaranteed to be initialized before use.
__ LoadRoot(scratch1, Heap::kFixedDoubleArrayMapRootIndex); __ LoadRoot(scratch1, Heap::kFixedDoubleArrayMapRootIndex);
__ sw(scratch1, FieldMemOperand(elements_reg, JSObject::kMapOffset)); __ sw(scratch1, FieldMemOperand(elements_reg, JSObject::kMapOffset));
__ li(scratch1, Operand(Smi::FromInt(JSArray::kPreallocatedArrayElements))); __ li(scratch1, Operand(Smi::FromInt(JSArray::kPreallocatedArrayElements)));
__ sw(scratch1, __ sw(scratch1,
FieldMemOperand(elements_reg, FixedDoubleArray::kLengthOffset)); FieldMemOperand(elements_reg, FixedDoubleArray::kLengthOffset));
__ li(scratch1, Operand(kHoleNanLower32));
__ li(scratch2, Operand(kHoleNanUpper32));
for (int i = 1; i < JSArray::kPreallocatedArrayElements; i++) {
int offset = FixedDoubleArray::OffsetOfElementAt(i);
__ sw(scratch1, FieldMemOperand(elements_reg, offset));
__ sw(scratch2, FieldMemOperand(elements_reg, offset + kPointerSize));
}
__ StoreNumberToDoubleElements(value_reg,
key_reg,
// All registers after this are overwritten.
elements_reg,
scratch1,
scratch2,
scratch3,
scratch4,
&transition_elements_kind);
// Install the new backing store in the JSArray. // Install the new backing store in the JSArray.
__ sw(elements_reg, __ sw(elements_reg,
FieldMemOperand(receiver_reg, JSObject::kElementsOffset)); FieldMemOperand(receiver_reg, JSObject::kElementsOffset));
@ -4863,7 +4880,7 @@ void KeyedStoreStubCompiler::GenerateStoreFastDoubleElement(
__ sw(length_reg, FieldMemOperand(receiver_reg, JSArray::kLengthOffset)); __ sw(length_reg, FieldMemOperand(receiver_reg, JSArray::kLengthOffset));
__ lw(elements_reg, __ lw(elements_reg,
FieldMemOperand(receiver_reg, JSObject::kElementsOffset)); FieldMemOperand(receiver_reg, JSObject::kElementsOffset));
__ jmp(&finish_store); __ Ret();
__ bind(&check_capacity); __ bind(&check_capacity);
// Make sure that the backing store can hold additional elements. // Make sure that the backing store can hold additional elements.