OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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/arm64/codegen-arm64.h" | 5 #include "src/arm64/codegen-arm64.h" |
6 | 6 |
7 #if V8_TARGET_ARCH_ARM64 | 7 #if V8_TARGET_ARCH_ARM64 |
8 | 8 |
9 #include "src/arm64/simulator-arm64.h" | 9 #include "src/arm64/simulator-arm64.h" |
10 #include "src/codegen.h" | 10 #include "src/codegen.h" |
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
168 // Allocate new FixedDoubleArray. | 168 // Allocate new FixedDoubleArray. |
169 __ Lsl(array_size, length, kDoubleSizeLog2); | 169 __ Lsl(array_size, length, kDoubleSizeLog2); |
170 __ Add(array_size, array_size, FixedDoubleArray::kHeaderSize); | 170 __ Add(array_size, array_size, FixedDoubleArray::kHeaderSize); |
171 __ Allocate(array_size, array, x10, x11, &gc_required, DOUBLE_ALIGNMENT); | 171 __ Allocate(array_size, array, x10, x11, &gc_required, DOUBLE_ALIGNMENT); |
172 // Register array is non-tagged heap object. | 172 // Register array is non-tagged heap object. |
173 | 173 |
174 // Set the destination FixedDoubleArray's length and map. | 174 // Set the destination FixedDoubleArray's length and map. |
175 Register map_root = array_size; | 175 Register map_root = array_size; |
176 __ LoadRoot(map_root, Heap::kFixedDoubleArrayMapRootIndex); | 176 __ LoadRoot(map_root, Heap::kFixedDoubleArrayMapRootIndex); |
177 __ SmiTag(x11, length); | 177 __ SmiTag(x11, length); |
178 __ Str(x11, MemOperand(array, FixedDoubleArray::kLengthOffset)); | 178 __ Str(x11, FieldMemOperand(array, FixedDoubleArray::kLengthOffset)); |
179 __ Str(map_root, MemOperand(array, HeapObject::kMapOffset)); | 179 __ Str(map_root, FieldMemOperand(array, HeapObject::kMapOffset)); |
180 | 180 |
181 __ Str(target_map, FieldMemOperand(receiver, HeapObject::kMapOffset)); | 181 __ Str(target_map, FieldMemOperand(receiver, HeapObject::kMapOffset)); |
182 __ RecordWriteField(receiver, HeapObject::kMapOffset, target_map, scratch, | 182 __ RecordWriteField(receiver, HeapObject::kMapOffset, target_map, scratch, |
183 kLRHasBeenSaved, kDontSaveFPRegs, OMIT_REMEMBERED_SET, | 183 kLRHasBeenSaved, kDontSaveFPRegs, OMIT_REMEMBERED_SET, |
184 OMIT_SMI_CHECK); | 184 OMIT_SMI_CHECK); |
185 | 185 |
186 // Replace receiver's backing store with newly created FixedDoubleArray. | 186 // Replace receiver's backing store with newly created FixedDoubleArray. |
187 __ Add(x10, array, kHeapObjectTag); | 187 __ Move(x10, array); |
188 __ Str(x10, FieldMemOperand(receiver, JSObject::kElementsOffset)); | 188 __ Str(array, FieldMemOperand(receiver, JSObject::kElementsOffset)); |
189 __ RecordWriteField(receiver, JSObject::kElementsOffset, x10, | 189 __ RecordWriteField(receiver, JSObject::kElementsOffset, x10, scratch, |
190 scratch, kLRHasBeenSaved, kDontSaveFPRegs, | 190 kLRHasBeenSaved, kDontSaveFPRegs, EMIT_REMEMBERED_SET, |
191 EMIT_REMEMBERED_SET, OMIT_SMI_CHECK); | 191 OMIT_SMI_CHECK); |
192 | 192 |
193 // Prepare for conversion loop. | 193 // Prepare for conversion loop. |
194 Register src_elements = x10; | 194 Register src_elements = x10; |
195 Register dst_elements = x11; | 195 Register dst_elements = x11; |
196 Register dst_end = x12; | 196 Register dst_end = x12; |
197 __ Add(src_elements, elements, FixedArray::kHeaderSize - kHeapObjectTag); | 197 __ Add(src_elements, elements, FixedArray::kHeaderSize - kHeapObjectTag); |
198 __ Add(dst_elements, array, FixedDoubleArray::kHeaderSize); | 198 __ Add(dst_elements, array, FixedDoubleArray::kHeaderSize - kHeapObjectTag); |
199 __ Add(dst_end, dst_elements, Operand(length, LSL, kDoubleSizeLog2)); | 199 __ Add(dst_end, dst_elements, Operand(length, LSL, kDoubleSizeLog2)); |
200 | 200 |
201 FPRegister nan_d = d1; | 201 FPRegister nan_d = d1; |
202 __ Fmov(nan_d, rawbits_to_double(kHoleNanInt64)); | 202 __ Fmov(nan_d, rawbits_to_double(kHoleNanInt64)); |
203 | 203 |
204 Label entry, done; | 204 Label entry, done; |
205 __ B(&entry); | 205 __ B(&entry); |
206 | 206 |
207 __ Bind(&only_change_map); | 207 __ Bind(&only_change_map); |
208 __ Str(target_map, FieldMemOperand(receiver, HeapObject::kMapOffset)); | 208 __ Str(target_map, FieldMemOperand(receiver, HeapObject::kMapOffset)); |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
275 // Allocate new FixedArray. | 275 // Allocate new FixedArray. |
276 Label gc_required; | 276 Label gc_required; |
277 __ Mov(array_size, FixedDoubleArray::kHeaderSize); | 277 __ Mov(array_size, FixedDoubleArray::kHeaderSize); |
278 __ Add(array_size, array_size, Operand(length, LSL, kPointerSizeLog2)); | 278 __ Add(array_size, array_size, Operand(length, LSL, kPointerSizeLog2)); |
279 __ Allocate(array_size, array, x10, x11, &gc_required, NO_ALLOCATION_FLAGS); | 279 __ Allocate(array_size, array, x10, x11, &gc_required, NO_ALLOCATION_FLAGS); |
280 | 280 |
281 // Set destination FixedDoubleArray's length and map. | 281 // Set destination FixedDoubleArray's length and map. |
282 Register map_root = array_size; | 282 Register map_root = array_size; |
283 __ LoadRoot(map_root, Heap::kFixedArrayMapRootIndex); | 283 __ LoadRoot(map_root, Heap::kFixedArrayMapRootIndex); |
284 __ SmiTag(x11, length); | 284 __ SmiTag(x11, length); |
285 __ Str(x11, MemOperand(array, FixedDoubleArray::kLengthOffset)); | 285 __ Str(x11, FieldMemOperand(array, FixedDoubleArray::kLengthOffset)); |
286 __ Str(map_root, MemOperand(array, HeapObject::kMapOffset)); | 286 __ Str(map_root, FieldMemOperand(array, HeapObject::kMapOffset)); |
287 | 287 |
288 // Prepare for conversion loop. | 288 // Prepare for conversion loop. |
289 Register src_elements = x10; | 289 Register src_elements = x10; |
290 Register dst_elements = x11; | 290 Register dst_elements = x11; |
291 Register dst_end = x12; | 291 Register dst_end = x12; |
292 Register the_hole = x14; | 292 Register the_hole = x14; |
293 __ LoadRoot(the_hole, Heap::kTheHoleValueRootIndex); | 293 __ LoadRoot(the_hole, Heap::kTheHoleValueRootIndex); |
294 __ Add(src_elements, elements, | 294 __ Add(src_elements, elements, |
295 FixedDoubleArray::kHeaderSize - kHeapObjectTag); | 295 FixedDoubleArray::kHeaderSize - kHeapObjectTag); |
296 __ Add(dst_elements, array, FixedArray::kHeaderSize); | 296 __ Add(dst_elements, array, FixedArray::kHeaderSize - kHeapObjectTag); |
297 __ Add(dst_end, dst_elements, Operand(length, LSL, kPointerSizeLog2)); | 297 __ Add(dst_end, dst_elements, Operand(length, LSL, kPointerSizeLog2)); |
298 | 298 |
299 // Allocating heap numbers in the loop below can fail and cause a jump to | 299 // Allocating heap numbers in the loop below can fail and cause a jump to |
300 // gc_required. We can't leave a partly initialized FixedArray behind, | 300 // gc_required. We can't leave a partly initialized FixedArray behind, |
301 // so pessimistically fill it with holes now. | 301 // so pessimistically fill it with holes now. |
302 Label initialization_loop, initialization_loop_entry; | 302 Label initialization_loop, initialization_loop_entry; |
303 __ B(&initialization_loop_entry); | 303 __ B(&initialization_loop_entry); |
304 __ bind(&initialization_loop); | 304 __ bind(&initialization_loop); |
305 __ Str(the_hole, MemOperand(dst_elements, kPointerSize, PostIndex)); | 305 __ Str(the_hole, MemOperand(dst_elements, kPointerSize, PostIndex)); |
306 __ bind(&initialization_loop_entry); | 306 __ bind(&initialization_loop_entry); |
307 __ Cmp(dst_elements, dst_end); | 307 __ Cmp(dst_elements, dst_end); |
308 __ B(lt, &initialization_loop); | 308 __ B(lt, &initialization_loop); |
309 | 309 |
310 __ Add(dst_elements, array, FixedArray::kHeaderSize); | 310 __ Add(dst_elements, array, FixedArray::kHeaderSize - kHeapObjectTag); |
311 __ Add(array, array, kHeapObjectTag); | |
312 | 311 |
313 Register heap_num_map = x15; | 312 Register heap_num_map = x15; |
314 __ LoadRoot(heap_num_map, Heap::kHeapNumberMapRootIndex); | 313 __ LoadRoot(heap_num_map, Heap::kHeapNumberMapRootIndex); |
315 | 314 |
316 Label entry; | 315 Label entry; |
317 __ B(&entry); | 316 __ B(&entry); |
318 | 317 |
319 // Call into runtime if GC is required. | 318 // Call into runtime if GC is required. |
320 __ Bind(&gc_required); | 319 __ Bind(&gc_required); |
321 __ Pop(value, key, receiver, target_map); | 320 __ Pop(value, key, receiver, target_map); |
(...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
631 | 630 |
632 __ Bind(&done); | 631 __ Bind(&done); |
633 } | 632 } |
634 | 633 |
635 #undef __ | 634 #undef __ |
636 | 635 |
637 } // namespace internal | 636 } // namespace internal |
638 } // namespace v8 | 637 } // namespace v8 |
639 | 638 |
640 #endif // V8_TARGET_ARCH_ARM64 | 639 #endif // V8_TARGET_ARCH_ARM64 |
OLD | NEW |