Index: src/arm64/codegen-arm64.cc |
diff --git a/src/arm64/codegen-arm64.cc b/src/arm64/codegen-arm64.cc |
index 91eaba79571a538ace9f83643f71f1657eac72a2..cda6e5b6c0c8e5ec5ad8b8aa707aa7ebfcbfa635 100644 |
--- a/src/arm64/codegen-arm64.cc |
+++ b/src/arm64/codegen-arm64.cc |
@@ -290,15 +290,28 @@ void ElementsTransitionGenerator::GenerateDoubleToObject( |
Register src_elements = x10; |
Register dst_elements = x11; |
Register dst_end = x12; |
+ Register the_hole = x14; |
+ __ LoadRoot(the_hole, Heap::kTheHoleValueRootIndex); |
__ Add(src_elements, elements, |
FixedDoubleArray::kHeaderSize - kHeapObjectTag); |
__ Add(dst_elements, array, FixedArray::kHeaderSize); |
- __ Add(array, array, kHeapObjectTag); |
__ Add(dst_end, dst_elements, Operand(length, LSL, kPointerSizeLog2)); |
- Register the_hole = x14; |
+ // 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; |
+ __ B(&initialization_loop_entry); |
+ __ bind(&initialization_loop); |
+ __ Str(the_hole, MemOperand(dst_elements, kPointerSize, PostIndex)); |
+ __ bind(&initialization_loop_entry); |
+ __ Cmp(dst_elements, dst_end); |
+ __ B(lt, &initialization_loop); |
+ |
+ __ Add(dst_elements, array, FixedArray::kHeaderSize); |
+ __ Add(array, array, kHeapObjectTag); |
+ |
Register heap_num_map = x15; |
- __ LoadRoot(the_hole, Heap::kTheHoleValueRootIndex); |
__ LoadRoot(heap_num_map, Heap::kHeapNumberMapRootIndex); |
Label entry; |