| 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 3158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3169 // Initialize the JSValue. | 3169 // Initialize the JSValue. |
| 3170 LoadGlobalFunctionInitialMap(constructor, scratch1, scratch2); | 3170 LoadGlobalFunctionInitialMap(constructor, scratch1, scratch2); |
| 3171 StoreP(scratch1, FieldMemOperand(result, HeapObject::kMapOffset), r0); | 3171 StoreP(scratch1, FieldMemOperand(result, HeapObject::kMapOffset), r0); |
| 3172 LoadRoot(scratch1, Heap::kEmptyFixedArrayRootIndex); | 3172 LoadRoot(scratch1, Heap::kEmptyFixedArrayRootIndex); |
| 3173 StoreP(scratch1, FieldMemOperand(result, JSObject::kPropertiesOffset), r0); | 3173 StoreP(scratch1, FieldMemOperand(result, JSObject::kPropertiesOffset), r0); |
| 3174 StoreP(scratch1, FieldMemOperand(result, JSObject::kElementsOffset), r0); | 3174 StoreP(scratch1, FieldMemOperand(result, JSObject::kElementsOffset), r0); |
| 3175 StoreP(value, FieldMemOperand(result, JSValue::kValueOffset), r0); | 3175 StoreP(value, FieldMemOperand(result, JSValue::kValueOffset), r0); |
| 3176 STATIC_ASSERT(JSValue::kSize == 4 * kPointerSize); | 3176 STATIC_ASSERT(JSValue::kSize == 4 * kPointerSize); |
| 3177 } | 3177 } |
| 3178 | 3178 |
| 3179 | |
| 3180 void MacroAssembler::CopyBytes(Register src, Register dst, Register length, | |
| 3181 Register scratch) { | |
| 3182 Label align_loop, aligned, word_loop, byte_loop, byte_loop_1, done; | |
| 3183 | |
| 3184 DCHECK(!scratch.is(r0)); | |
| 3185 | |
| 3186 cmpi(length, Operand::Zero()); | |
| 3187 beq(&done); | |
| 3188 | |
| 3189 // Check src alignment and length to see whether word_loop is possible | |
| 3190 andi(scratch, src, Operand(kPointerSize - 1)); | |
| 3191 beq(&aligned, cr0); | |
| 3192 subfic(scratch, scratch, Operand(kPointerSize * 2)); | |
| 3193 cmp(length, scratch); | |
| 3194 blt(&byte_loop); | |
| 3195 | |
| 3196 // Align src before copying in word size chunks. | |
| 3197 subi(scratch, scratch, Operand(kPointerSize)); | |
| 3198 mtctr(scratch); | |
| 3199 bind(&align_loop); | |
| 3200 lbz(scratch, MemOperand(src)); | |
| 3201 addi(src, src, Operand(1)); | |
| 3202 subi(length, length, Operand(1)); | |
| 3203 stb(scratch, MemOperand(dst)); | |
| 3204 addi(dst, dst, Operand(1)); | |
| 3205 bdnz(&align_loop); | |
| 3206 | |
| 3207 bind(&aligned); | |
| 3208 | |
| 3209 // Copy bytes in word size chunks. | |
| 3210 if (emit_debug_code()) { | |
| 3211 andi(r0, src, Operand(kPointerSize - 1)); | |
| 3212 Assert(eq, kExpectingAlignmentForCopyBytes, cr0); | |
| 3213 } | |
| 3214 | |
| 3215 ShiftRightImm(scratch, length, Operand(kPointerSizeLog2)); | |
| 3216 cmpi(scratch, Operand::Zero()); | |
| 3217 beq(&byte_loop); | |
| 3218 | |
| 3219 mtctr(scratch); | |
| 3220 bind(&word_loop); | |
| 3221 LoadP(scratch, MemOperand(src)); | |
| 3222 addi(src, src, Operand(kPointerSize)); | |
| 3223 subi(length, length, Operand(kPointerSize)); | |
| 3224 | |
| 3225 StoreP(scratch, MemOperand(dst)); | |
| 3226 addi(dst, dst, Operand(kPointerSize)); | |
| 3227 bdnz(&word_loop); | |
| 3228 | |
| 3229 // Copy the last bytes if any left. | |
| 3230 cmpi(length, Operand::Zero()); | |
| 3231 beq(&done); | |
| 3232 | |
| 3233 bind(&byte_loop); | |
| 3234 mtctr(length); | |
| 3235 bind(&byte_loop_1); | |
| 3236 lbz(scratch, MemOperand(src)); | |
| 3237 addi(src, src, Operand(1)); | |
| 3238 stb(scratch, MemOperand(dst)); | |
| 3239 addi(dst, dst, Operand(1)); | |
| 3240 bdnz(&byte_loop_1); | |
| 3241 | |
| 3242 bind(&done); | |
| 3243 } | |
| 3244 | |
| 3245 | |
| 3246 void MacroAssembler::InitializeNFieldsWithFiller(Register current_address, | 3179 void MacroAssembler::InitializeNFieldsWithFiller(Register current_address, |
| 3247 Register count, | 3180 Register count, |
| 3248 Register filler) { | 3181 Register filler) { |
| 3249 Label loop; | 3182 Label loop; |
| 3250 mtctr(count); | 3183 mtctr(count); |
| 3251 bind(&loop); | 3184 bind(&loop); |
| 3252 StoreP(filler, MemOperand(current_address)); | 3185 StoreP(filler, MemOperand(current_address)); |
| 3253 addi(current_address, current_address, Operand(kPointerSize)); | 3186 addi(current_address, current_address, Operand(kPointerSize)); |
| 3254 bdnz(&loop); | 3187 bdnz(&loop); |
| 3255 } | 3188 } |
| (...skipping 1513 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4769 } | 4702 } |
| 4770 if (mag.shift > 0) srawi(result, result, mag.shift); | 4703 if (mag.shift > 0) srawi(result, result, mag.shift); |
| 4771 ExtractBit(r0, dividend, 31); | 4704 ExtractBit(r0, dividend, 31); |
| 4772 add(result, result, r0); | 4705 add(result, result, r0); |
| 4773 } | 4706 } |
| 4774 | 4707 |
| 4775 } // namespace internal | 4708 } // namespace internal |
| 4776 } // namespace v8 | 4709 } // namespace v8 |
| 4777 | 4710 |
| 4778 #endif // V8_TARGET_ARCH_PPC | 4711 #endif // V8_TARGET_ARCH_PPC |
| OLD | NEW |