OLD | NEW |
1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "src/s390/codegen-s390.h" | 5 #include "src/s390/codegen-s390.h" |
6 | 6 |
7 #if V8_TARGET_ARCH_S390 | 7 #if V8_TARGET_ARCH_S390 |
8 | 8 |
9 #include "src/codegen.h" | 9 #include "src/codegen.h" |
10 #include "src/macro-assembler.h" | 10 #include "src/macro-assembler.h" |
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
165 // Preserve lr and use r14 as a temporary register. | 165 // Preserve lr and use r14 as a temporary register. |
166 __ push(r14); | 166 __ push(r14); |
167 | 167 |
168 __ LoadP(length, FieldMemOperand(elements, FixedArray::kLengthOffset)); | 168 __ LoadP(length, FieldMemOperand(elements, FixedArray::kLengthOffset)); |
169 // length: number of elements (smi-tagged) | 169 // length: number of elements (smi-tagged) |
170 | 170 |
171 // Allocate new FixedDoubleArray. | 171 // Allocate new FixedDoubleArray. |
172 __ SmiToDoubleArrayOffset(r14, length); | 172 __ SmiToDoubleArrayOffset(r14, length); |
173 __ AddP(r14, Operand(FixedDoubleArray::kHeaderSize)); | 173 __ AddP(r14, Operand(FixedDoubleArray::kHeaderSize)); |
174 __ Allocate(r14, array, r9, scratch2, &gc_required, DOUBLE_ALIGNMENT); | 174 __ Allocate(r14, array, r9, scratch2, &gc_required, DOUBLE_ALIGNMENT); |
175 | 175 __ SubP(array, array, Operand(kHeapObjectTag)); |
176 // Set destination FixedDoubleArray's length and map. | 176 // Set destination FixedDoubleArray's length and map. |
177 __ LoadRoot(scratch2, Heap::kFixedDoubleArrayMapRootIndex); | 177 __ LoadRoot(scratch2, Heap::kFixedDoubleArrayMapRootIndex); |
178 __ StoreP(length, MemOperand(array, FixedDoubleArray::kLengthOffset)); | 178 __ StoreP(length, MemOperand(array, FixedDoubleArray::kLengthOffset)); |
179 // Update receiver's map. | 179 // Update receiver's map. |
180 __ StoreP(scratch2, MemOperand(array, HeapObject::kMapOffset)); | 180 __ StoreP(scratch2, MemOperand(array, HeapObject::kMapOffset)); |
181 | 181 |
182 __ StoreP(target_map, FieldMemOperand(receiver, HeapObject::kMapOffset)); | 182 __ StoreP(target_map, FieldMemOperand(receiver, HeapObject::kMapOffset)); |
183 __ RecordWriteField(receiver, HeapObject::kMapOffset, target_map, scratch2, | 183 __ RecordWriteField(receiver, HeapObject::kMapOffset, target_map, scratch2, |
184 kLRHasBeenSaved, kDontSaveFPRegs, OMIT_REMEMBERED_SET, | 184 kLRHasBeenSaved, kDontSaveFPRegs, OMIT_REMEMBERED_SET, |
185 OMIT_SMI_CHECK); | 185 OMIT_SMI_CHECK); |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
295 // Allocate new FixedArray. | 295 // Allocate new FixedArray. |
296 // Re-use value and target_map registers, as they have been saved on the | 296 // Re-use value and target_map registers, as they have been saved on the |
297 // stack. | 297 // stack. |
298 Register array_size = value; | 298 Register array_size = value; |
299 Register allocate_scratch = target_map; | 299 Register allocate_scratch = target_map; |
300 __ LoadImmP(array_size, Operand(FixedDoubleArray::kHeaderSize)); | 300 __ LoadImmP(array_size, Operand(FixedDoubleArray::kHeaderSize)); |
301 __ SmiToPtrArrayOffset(r0, length); | 301 __ SmiToPtrArrayOffset(r0, length); |
302 __ AddP(array_size, r0); | 302 __ AddP(array_size, r0); |
303 __ Allocate(array_size, array, allocate_scratch, scratch, &gc_required, | 303 __ Allocate(array_size, array, allocate_scratch, scratch, &gc_required, |
304 NO_ALLOCATION_FLAGS); | 304 NO_ALLOCATION_FLAGS); |
305 // array: destination FixedArray, not tagged as heap object | 305 // array: destination FixedArray, tagged as heap object |
306 // Set destination FixedDoubleArray's length and map. | 306 // Set destination FixedDoubleArray's length and map. |
307 __ LoadRoot(scratch, Heap::kFixedArrayMapRootIndex); | 307 __ LoadRoot(scratch, Heap::kFixedArrayMapRootIndex); |
308 __ StoreP(length, MemOperand(array, FixedDoubleArray::kLengthOffset)); | 308 __ StoreP(length, FieldMemOperand(array, FixedDoubleArray::kLengthOffset), |
309 __ StoreP(scratch, MemOperand(array, HeapObject::kMapOffset)); | 309 r0); |
310 __ AddP(array, Operand(kHeapObjectTag)); | 310 __ StoreP(scratch, FieldMemOperand(array, HeapObject::kMapOffset), r0); |
311 | 311 |
312 // Prepare for conversion loop. | 312 // Prepare for conversion loop. |
313 Register src_elements = elements; | 313 Register src_elements = elements; |
314 Register dst_elements = target_map; | 314 Register dst_elements = target_map; |
315 Register dst_end = length; | 315 Register dst_end = length; |
316 Register heap_number_map = scratch; | 316 Register heap_number_map = scratch; |
317 __ AddP(src_elements, | 317 __ AddP(src_elements, |
318 Operand(FixedDoubleArray::kHeaderSize - kHeapObjectTag)); | 318 Operand(FixedDoubleArray::kHeaderSize - kHeapObjectTag)); |
319 __ SmiToPtrArrayOffset(length, length); | 319 __ SmiToPtrArrayOffset(length, length); |
320 __ LoadRoot(hole_value, Heap::kTheHoleValueRootIndex); | 320 __ LoadRoot(hole_value, Heap::kTheHoleValueRootIndex); |
(...skipping 345 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
666 // (kNoCodeAgeSequenceLength - kCodeAgingSequenceLength) bytes. | 666 // (kNoCodeAgeSequenceLength - kCodeAgingSequenceLength) bytes. |
667 patcher.masm()->nop(); // 2-byte nops(). | 667 patcher.masm()->nop(); // 2-byte nops(). |
668 } | 668 } |
669 } | 669 } |
670 } | 670 } |
671 | 671 |
672 } // namespace internal | 672 } // namespace internal |
673 } // namespace v8 | 673 } // namespace v8 |
674 | 674 |
675 #endif // V8_TARGET_ARCH_S390 | 675 #endif // V8_TARGET_ARCH_S390 |
OLD | NEW |