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 <assert.h> // For assert | 5 #include <assert.h> // For assert |
6 #include <limits.h> // For LONG_MIN, LONG_MAX. | 6 #include <limits.h> // For LONG_MIN, LONG_MAX. |
7 | 7 |
8 #if V8_TARGET_ARCH_PPC | 8 #if V8_TARGET_ARCH_PPC |
9 | 9 |
10 #include "src/base/bits.h" | 10 #include "src/base/bits.h" |
(...skipping 2736 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2747 | 2747 |
2748 | 2748 |
2749 void MacroAssembler::AllocateHeapNumberWithValue( | 2749 void MacroAssembler::AllocateHeapNumberWithValue( |
2750 Register result, DoubleRegister value, Register scratch1, Register scratch2, | 2750 Register result, DoubleRegister value, Register scratch1, Register scratch2, |
2751 Register heap_number_map, Label* gc_required) { | 2751 Register heap_number_map, Label* gc_required) { |
2752 AllocateHeapNumber(result, scratch1, scratch2, heap_number_map, gc_required); | 2752 AllocateHeapNumber(result, scratch1, scratch2, heap_number_map, gc_required); |
2753 stfd(value, FieldMemOperand(result, HeapNumber::kValueOffset)); | 2753 stfd(value, FieldMemOperand(result, HeapNumber::kValueOffset)); |
2754 } | 2754 } |
2755 | 2755 |
2756 | 2756 |
2757 // Copies a fixed number of fields of heap objects from src to dst. | |
2758 void MacroAssembler::CopyFields(Register dst, Register src, RegList temps, | |
2759 int field_count) { | |
2760 // At least one bit set in the first 15 registers. | |
2761 DCHECK((temps & ((1 << 15) - 1)) != 0); | |
2762 DCHECK((temps & dst.bit()) == 0); | |
2763 DCHECK((temps & src.bit()) == 0); | |
2764 // Primitive implementation using only one temporary register. | |
2765 | |
2766 Register tmp = no_reg; | |
2767 // Find a temp register in temps list. | |
2768 for (int i = 0; i < 15; i++) { | |
2769 if ((temps & (1 << i)) != 0) { | |
2770 tmp.set_code(i); | |
2771 break; | |
2772 } | |
2773 } | |
2774 DCHECK(!tmp.is(no_reg)); | |
2775 | |
2776 for (int i = 0; i < field_count; i++) { | |
2777 LoadP(tmp, FieldMemOperand(src, i * kPointerSize), r0); | |
2778 StoreP(tmp, FieldMemOperand(dst, i * kPointerSize), r0); | |
2779 } | |
2780 } | |
2781 | |
2782 | |
2783 void MacroAssembler::CopyBytes(Register src, Register dst, Register length, | 2757 void MacroAssembler::CopyBytes(Register src, Register dst, Register length, |
2784 Register scratch) { | 2758 Register scratch) { |
2785 Label align_loop, aligned, word_loop, byte_loop, byte_loop_1, done; | 2759 Label align_loop, aligned, word_loop, byte_loop, byte_loop_1, done; |
2786 | 2760 |
2787 DCHECK(!scratch.is(r0)); | 2761 DCHECK(!scratch.is(r0)); |
2788 | 2762 |
2789 cmpi(length, Operand::Zero()); | 2763 cmpi(length, Operand::Zero()); |
2790 beq(&done); | 2764 beq(&done); |
2791 | 2765 |
2792 // Check src alignment and length to see whether word_loop is possible | 2766 // Check src alignment and length to see whether word_loop is possible |
(...skipping 1635 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4428 } | 4402 } |
4429 if (mag.shift > 0) srawi(result, result, mag.shift); | 4403 if (mag.shift > 0) srawi(result, result, mag.shift); |
4430 ExtractBit(r0, dividend, 31); | 4404 ExtractBit(r0, dividend, 31); |
4431 add(result, result, r0); | 4405 add(result, result, r0); |
4432 } | 4406 } |
4433 | 4407 |
4434 } // namespace internal | 4408 } // namespace internal |
4435 } // namespace v8 | 4409 } // namespace v8 |
4436 | 4410 |
4437 #endif // V8_TARGET_ARCH_PPC | 4411 #endif // V8_TARGET_ARCH_PPC |
OLD | NEW |