Index: src/mips/codegen-mips.cc |
diff --git a/src/mips/codegen-mips.cc b/src/mips/codegen-mips.cc |
index 0ecac19b49219ffa2b06d1604b04746fe2b14fe3..599aace2ee67a2879b39d62f9f3eee91f3e48c7b 100644 |
--- a/src/mips/codegen-mips.cc |
+++ b/src/mips/codegen-mips.cc |
@@ -896,9 +896,23 @@ void ElementsTransitionGenerator::GenerateDoubleToObject( |
FixedDoubleArray::kHeaderSize - kHeapObjectTag |
+ Register::kExponentOffset)); |
__ Addu(dst_elements, array, Operand(FixedArray::kHeaderSize)); |
- __ Addu(array, array, Operand(kHeapObjectTag)); |
__ sll(dst_end, dst_end, 1); |
__ Addu(dst_end, dst_elements, dst_end); |
+ |
+ // Allocating heap numbers in the loop below can fail and cause a jump to |
+ // gc_required. We can't leave a partly initialized FixedArray behind, |
+ // so pessimistically fill it with holes now. |
+ Label initialization_loop, initialization_loop_entry; |
+ __ LoadRoot(scratch, Heap::kTheHoleValueRootIndex); |
+ __ Branch(&initialization_loop_entry); |
+ __ bind(&initialization_loop); |
+ __ sw(scratch, MemOperand(dst_elements)); |
+ __ Addu(dst_elements, dst_elements, Operand(kPointerSize)); |
+ __ bind(&initialization_loop_entry); |
+ __ Branch(&initialization_loop, lt, dst_elements, Operand(dst_end)); |
+ |
+ __ Addu(dst_elements, array, Operand(FixedArray::kHeaderSize)); |
+ __ Addu(array, array, Operand(kHeapObjectTag)); |
__ LoadRoot(heap_number_map, Heap::kHeapNumberMapRootIndex); |
// Using offsetted addresses. |
// dst_elements: begin of destination FixedArray element fields, not tagged |