| OLD | NEW |
| 1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 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/ppc/codegen-ppc.h" | 5 #include "src/ppc/codegen-ppc.h" |
| 6 | 6 |
| 7 #if V8_TARGET_ARCH_PPC | 7 #if V8_TARGET_ARCH_PPC |
| 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 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 178 __ CompareRoot(elements, Heap::kEmptyFixedArrayRootIndex); | 178 __ CompareRoot(elements, Heap::kEmptyFixedArrayRootIndex); |
| 179 __ beq(&only_change_map); | 179 __ beq(&only_change_map); |
| 180 | 180 |
| 181 __ LoadP(length, FieldMemOperand(elements, FixedArray::kLengthOffset)); | 181 __ LoadP(length, FieldMemOperand(elements, FixedArray::kLengthOffset)); |
| 182 // length: number of elements (smi-tagged) | 182 // length: number of elements (smi-tagged) |
| 183 | 183 |
| 184 // Allocate new FixedDoubleArray. | 184 // Allocate new FixedDoubleArray. |
| 185 __ SmiToDoubleArrayOffset(scratch3, length); | 185 __ SmiToDoubleArrayOffset(scratch3, length); |
| 186 __ addi(scratch3, scratch3, Operand(FixedDoubleArray::kHeaderSize)); | 186 __ addi(scratch3, scratch3, Operand(FixedDoubleArray::kHeaderSize)); |
| 187 __ Allocate(scratch3, array, scratch4, scratch2, fail, DOUBLE_ALIGNMENT); | 187 __ Allocate(scratch3, array, scratch4, scratch2, fail, DOUBLE_ALIGNMENT); |
| 188 __ subi(array, array, Operand(kHeapObjectTag)); |
| 188 // array: destination FixedDoubleArray, not tagged as heap object. | 189 // array: destination FixedDoubleArray, not tagged as heap object. |
| 189 // elements: source FixedArray. | 190 // elements: source FixedArray. |
| 190 | 191 |
| 191 // Set destination FixedDoubleArray's length and map. | 192 // Set destination FixedDoubleArray's length and map. |
| 192 __ LoadRoot(scratch2, Heap::kFixedDoubleArrayMapRootIndex); | 193 __ LoadRoot(scratch2, Heap::kFixedDoubleArrayMapRootIndex); |
| 193 __ StoreP(length, MemOperand(array, FixedDoubleArray::kLengthOffset)); | 194 __ StoreP(length, MemOperand(array, FixedDoubleArray::kLengthOffset)); |
| 194 // Update receiver's map. | 195 // Update receiver's map. |
| 195 __ StoreP(scratch2, MemOperand(array, HeapObject::kMapOffset)); | 196 __ StoreP(scratch2, MemOperand(array, HeapObject::kMapOffset)); |
| 196 | 197 |
| 197 __ StoreP(target_map, FieldMemOperand(receiver, HeapObject::kMapOffset), r0); | 198 __ StoreP(target_map, FieldMemOperand(receiver, HeapObject::kMapOffset), r0); |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 306 // Allocate new FixedArray. | 307 // Allocate new FixedArray. |
| 307 // Re-use value and target_map registers, as they have been saved on the | 308 // Re-use value and target_map registers, as they have been saved on the |
| 308 // stack. | 309 // stack. |
| 309 Register array_size = value; | 310 Register array_size = value; |
| 310 Register allocate_scratch = target_map; | 311 Register allocate_scratch = target_map; |
| 311 __ li(array_size, Operand(FixedDoubleArray::kHeaderSize)); | 312 __ li(array_size, Operand(FixedDoubleArray::kHeaderSize)); |
| 312 __ SmiToPtrArrayOffset(r0, length); | 313 __ SmiToPtrArrayOffset(r0, length); |
| 313 __ add(array_size, array_size, r0); | 314 __ add(array_size, array_size, r0); |
| 314 __ Allocate(array_size, array, allocate_scratch, scratch, &gc_required, | 315 __ Allocate(array_size, array, allocate_scratch, scratch, &gc_required, |
| 315 NO_ALLOCATION_FLAGS); | 316 NO_ALLOCATION_FLAGS); |
| 316 // array: destination FixedArray, not tagged as heap object | 317 // array: destination FixedArray, tagged as heap object |
| 317 // Set destination FixedDoubleArray's length and map. | 318 // Set destination FixedDoubleArray's length and map. |
| 318 __ LoadRoot(scratch, Heap::kFixedArrayMapRootIndex); | 319 __ LoadRoot(scratch, Heap::kFixedArrayMapRootIndex); |
| 319 __ StoreP(length, MemOperand(array, FixedDoubleArray::kLengthOffset)); | 320 __ StoreP(length, FieldMemOperand(array, |
| 320 __ StoreP(scratch, MemOperand(array, HeapObject::kMapOffset)); | 321 FixedDoubleArray::kLengthOffset), r0); |
| 321 __ addi(array, array, Operand(kHeapObjectTag)); | 322 __ StoreP(scratch, FieldMemOperand(array, HeapObject::kMapOffset), r0); |
| 322 | 323 |
| 323 // Prepare for conversion loop. | 324 // Prepare for conversion loop. |
| 324 Register src_elements = elements; | 325 Register src_elements = elements; |
| 325 Register dst_elements = target_map; | 326 Register dst_elements = target_map; |
| 326 Register dst_end = length; | 327 Register dst_end = length; |
| 327 Register heap_number_map = scratch; | 328 Register heap_number_map = scratch; |
| 328 __ addi(src_elements, elements, | 329 __ addi(src_elements, elements, |
| 329 Operand(FixedDoubleArray::kHeaderSize - kHeapObjectTag)); | 330 Operand(FixedDoubleArray::kHeaderSize - kHeapObjectTag)); |
| 330 __ SmiToPtrArrayOffset(length, length); | 331 __ SmiToPtrArrayOffset(length, length); |
| 331 __ LoadRoot(hole_value, Heap::kTheHoleValueRootIndex); | 332 __ LoadRoot(hole_value, Heap::kTheHoleValueRootIndex); |
| (...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 672 patcher.masm()->Jump(r3); | 673 patcher.masm()->Jump(r3); |
| 673 for (int i = 0; i < kCodeAgingSequenceNops; i++) { | 674 for (int i = 0; i < kCodeAgingSequenceNops; i++) { |
| 674 patcher.masm()->nop(); | 675 patcher.masm()->nop(); |
| 675 } | 676 } |
| 676 } | 677 } |
| 677 } | 678 } |
| 678 } // namespace internal | 679 } // namespace internal |
| 679 } // namespace v8 | 680 } // namespace v8 |
| 680 | 681 |
| 681 #endif // V8_TARGET_ARCH_PPC | 682 #endif // V8_TARGET_ARCH_PPC |
| OLD | NEW |