OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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/arm/codegen-arm.h" | 5 #include "src/arm/codegen-arm.h" |
6 | 6 |
7 #if V8_TARGET_ARCH_ARM | 7 #if V8_TARGET_ARCH_ARM |
8 | 8 |
9 #include "src/arm/simulator-arm.h" | 9 #include "src/arm/simulator-arm.h" |
10 #include "src/codegen.h" | 10 #include "src/codegen.h" |
(...skipping 432 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
443 | 443 |
444 __ push(lr); | 444 __ push(lr); |
445 __ ldr(length, FieldMemOperand(elements, FixedArray::kLengthOffset)); | 445 __ ldr(length, FieldMemOperand(elements, FixedArray::kLengthOffset)); |
446 // length: number of elements (smi-tagged) | 446 // length: number of elements (smi-tagged) |
447 | 447 |
448 // Allocate new FixedDoubleArray. | 448 // Allocate new FixedDoubleArray. |
449 // Use lr as a temporary register. | 449 // Use lr as a temporary register. |
450 __ mov(lr, Operand(length, LSL, 2)); | 450 __ mov(lr, Operand(length, LSL, 2)); |
451 __ add(lr, lr, Operand(FixedDoubleArray::kHeaderSize)); | 451 __ add(lr, lr, Operand(FixedDoubleArray::kHeaderSize)); |
452 __ Allocate(lr, array, elements, scratch2, &gc_required, DOUBLE_ALIGNMENT); | 452 __ Allocate(lr, array, elements, scratch2, &gc_required, DOUBLE_ALIGNMENT); |
| 453 __ sub(array, array, Operand(kHeapObjectTag)); |
453 // array: destination FixedDoubleArray, not tagged as heap object. | 454 // array: destination FixedDoubleArray, not tagged as heap object. |
454 __ ldr(elements, FieldMemOperand(receiver, JSObject::kElementsOffset)); | 455 __ ldr(elements, FieldMemOperand(receiver, JSObject::kElementsOffset)); |
455 // r4: source FixedArray. | 456 // r4: source FixedArray. |
456 | 457 |
457 // Set destination FixedDoubleArray's length and map. | 458 // Set destination FixedDoubleArray's length and map. |
458 __ LoadRoot(scratch2, Heap::kFixedDoubleArrayMapRootIndex); | 459 __ LoadRoot(scratch2, Heap::kFixedDoubleArrayMapRootIndex); |
459 __ str(length, MemOperand(array, FixedDoubleArray::kLengthOffset)); | 460 __ str(length, MemOperand(array, FixedDoubleArray::kLengthOffset)); |
460 // Update receiver's map. | 461 // Update receiver's map. |
461 __ str(scratch2, MemOperand(array, HeapObject::kMapOffset)); | 462 __ str(scratch2, MemOperand(array, HeapObject::kMapOffset)); |
462 | 463 |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
587 | 588 |
588 // Allocate new FixedArray. | 589 // Allocate new FixedArray. |
589 // Re-use value and target_map registers, as they have been saved on the | 590 // Re-use value and target_map registers, as they have been saved on the |
590 // stack. | 591 // stack. |
591 Register array_size = value; | 592 Register array_size = value; |
592 Register allocate_scratch = target_map; | 593 Register allocate_scratch = target_map; |
593 __ mov(array_size, Operand(FixedDoubleArray::kHeaderSize)); | 594 __ mov(array_size, Operand(FixedDoubleArray::kHeaderSize)); |
594 __ add(array_size, array_size, Operand(length, LSL, 1)); | 595 __ add(array_size, array_size, Operand(length, LSL, 1)); |
595 __ Allocate(array_size, array, allocate_scratch, scratch, &gc_required, | 596 __ Allocate(array_size, array, allocate_scratch, scratch, &gc_required, |
596 NO_ALLOCATION_FLAGS); | 597 NO_ALLOCATION_FLAGS); |
597 // array: destination FixedArray, not tagged as heap object | 598 // array: destination FixedArray, tagged as heap object |
598 // Set destination FixedDoubleArray's length and map. | 599 // Set destination FixedDoubleArray's length and map. |
599 __ LoadRoot(scratch, Heap::kFixedArrayMapRootIndex); | 600 __ LoadRoot(scratch, Heap::kFixedArrayMapRootIndex); |
600 __ str(length, MemOperand(array, FixedDoubleArray::kLengthOffset)); | 601 __ str(length, FieldMemOperand(array, FixedDoubleArray::kLengthOffset)); |
601 __ str(scratch, MemOperand(array, HeapObject::kMapOffset)); | 602 __ str(scratch, FieldMemOperand(array, HeapObject::kMapOffset)); |
| 603 |
| 604 __ sub(array, array, Operand(kHeapObjectTag)); |
602 | 605 |
603 // Prepare for conversion loop. | 606 // Prepare for conversion loop. |
604 Register src_elements = elements; | 607 Register src_elements = elements; |
605 Register dst_elements = target_map; | 608 Register dst_elements = target_map; |
606 Register dst_end = length; | 609 Register dst_end = length; |
607 Register heap_number_map = scratch; | 610 Register heap_number_map = scratch; |
608 __ add(src_elements, elements, | 611 __ add(src_elements, elements, |
609 Operand(FixedDoubleArray::kHeaderSize - kHeapObjectTag + 4)); | 612 Operand(FixedDoubleArray::kHeaderSize - kHeapObjectTag + 4)); |
610 __ add(dst_elements, array, Operand(FixedArray::kHeaderSize)); | 613 __ add(dst_elements, array, Operand(FixedArray::kHeaderSize)); |
611 __ add(dst_end, dst_elements, Operand(length, LSL, 1)); | 614 __ add(dst_end, dst_elements, Operand(length, LSL, 1)); |
(...skipping 335 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
947 patcher.masm()->ldr(pc, MemOperand(pc, -4)); | 950 patcher.masm()->ldr(pc, MemOperand(pc, -4)); |
948 patcher.masm()->emit_code_stub_address(stub); | 951 patcher.masm()->emit_code_stub_address(stub); |
949 } | 952 } |
950 } | 953 } |
951 | 954 |
952 | 955 |
953 } // namespace internal | 956 } // namespace internal |
954 } // namespace v8 | 957 } // namespace v8 |
955 | 958 |
956 #endif // V8_TARGET_ARCH_ARM | 959 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |