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_S390 | 8 #if V8_TARGET_ARCH_S390 |
9 | 9 |
10 #include "src/base/bits.h" | 10 #include "src/base/bits.h" |
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
198 LoadRR(dst, src); | 198 LoadRR(dst, src); |
199 } | 199 } |
200 } | 200 } |
201 | 201 |
202 void MacroAssembler::Move(DoubleRegister dst, DoubleRegister src) { | 202 void MacroAssembler::Move(DoubleRegister dst, DoubleRegister src) { |
203 if (!dst.is(src)) { | 203 if (!dst.is(src)) { |
204 ldr(dst, src); | 204 ldr(dst, src); |
205 } | 205 } |
206 } | 206 } |
207 | 207 |
208 void MacroAssembler::InsertDoubleLow(DoubleRegister dst, Register src) { | |
209 StoreDouble(dst, MemOperand(sp, -kDoubleSize)); | |
210 #if V8_TARGET_LITTLE_ENDIAN | |
211 StoreW(src, MemOperand(sp, -kDoubleSize)); | |
212 #else | |
213 StoreW(src, MemOperand(sp, -kDoubleSize / 2)); | |
214 #endif | |
215 ldy(dst, MemOperand(sp, -kDoubleSize)); | |
216 } | |
217 | |
218 void MacroAssembler::InsertDoubleHigh(DoubleRegister dst, Register src) { | |
219 StoreDouble(dst, MemOperand(sp, -kDoubleSize)); | |
220 #if V8_TARGET_LITTLE_ENDIAN | |
221 StoreW(src, MemOperand(sp, -kDoubleSize / 2)); | |
222 #else | |
223 StoreW(src, MemOperand(sp, -kDoubleSize)); | |
224 #endif | |
225 ldy(dst, MemOperand(sp, -kDoubleSize)); | |
226 } | |
227 | |
228 void MacroAssembler::MultiPush(RegList regs, Register location) { | 208 void MacroAssembler::MultiPush(RegList regs, Register location) { |
229 int16_t num_to_push = NumberOfBitsSet(regs); | 209 int16_t num_to_push = NumberOfBitsSet(regs); |
230 int16_t stack_offset = num_to_push * kPointerSize; | 210 int16_t stack_offset = num_to_push * kPointerSize; |
231 | 211 |
232 SubP(location, location, Operand(stack_offset)); | 212 SubP(location, location, Operand(stack_offset)); |
233 for (int16_t i = Register::kNumRegisters - 1; i >= 0; i--) { | 213 for (int16_t i = Register::kNumRegisters - 1; i >= 0; i--) { |
234 if ((regs & (1 << i)) != 0) { | 214 if ((regs & (1 << i)) != 0) { |
235 stack_offset -= kPointerSize; | 215 stack_offset -= kPointerSize; |
236 StoreP(ToRegister(i), MemOperand(location, stack_offset)); | 216 StoreP(ToRegister(i), MemOperand(location, stack_offset)); |
237 } | 217 } |
(...skipping 868 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1106 lay(sp, MemOperand(sp, -stack_space * kPointerSize)); | 1086 lay(sp, MemOperand(sp, -stack_space * kPointerSize)); |
1107 | 1087 |
1108 // Allocate and align the frame preparing for calling the runtime | 1088 // Allocate and align the frame preparing for calling the runtime |
1109 // function. | 1089 // function. |
1110 const int frame_alignment = MacroAssembler::ActivationFrameAlignment(); | 1090 const int frame_alignment = MacroAssembler::ActivationFrameAlignment(); |
1111 if (frame_alignment > 0) { | 1091 if (frame_alignment > 0) { |
1112 DCHECK(frame_alignment == 8); | 1092 DCHECK(frame_alignment == 8); |
1113 ClearRightImm(sp, sp, Operand(3)); // equivalent to &= -8 | 1093 ClearRightImm(sp, sp, Operand(3)); // equivalent to &= -8 |
1114 } | 1094 } |
1115 | 1095 |
1116 StoreP(MemOperand(sp, -kNumRequiredStackFrameSlots * kPointerSize), | |
1117 Operand::Zero(), r0); | |
1118 lay(sp, MemOperand(sp, -kNumRequiredStackFrameSlots * kPointerSize)); | 1096 lay(sp, MemOperand(sp, -kNumRequiredStackFrameSlots * kPointerSize)); |
| 1097 StoreP(MemOperand(sp), Operand::Zero(), r0); |
1119 // Set the exit frame sp value to point just before the return address | 1098 // Set the exit frame sp value to point just before the return address |
1120 // location. | 1099 // location. |
1121 lay(r1, MemOperand(sp, kStackFrameSPSlot * kPointerSize)); | 1100 lay(r1, MemOperand(sp, kStackFrameSPSlot * kPointerSize)); |
1122 StoreP(r1, MemOperand(fp, ExitFrameConstants::kSPOffset)); | 1101 StoreP(r1, MemOperand(fp, ExitFrameConstants::kSPOffset)); |
1123 } | 1102 } |
1124 | 1103 |
1125 void MacroAssembler::InitializeNewString(Register string, Register length, | 1104 void MacroAssembler::InitializeNewString(Register string, Register length, |
1126 Heap::RootListIndex map_index, | 1105 Heap::RootListIndex map_index, |
1127 Register scratch1, Register scratch2) { | 1106 Register scratch1, Register scratch2) { |
1128 SmiTag(scratch1, length); | 1107 SmiTag(scratch1, length); |
(...skipping 1194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2323 CmpP(scratch1, Operand::Zero()); | 2302 CmpP(scratch1, Operand::Zero()); |
2324 bne(&done, Label::kNear); | 2303 bne(&done, Label::kNear); |
2325 | 2304 |
2326 srlg(scratch1, scratch1, Operand(32)); | 2305 srlg(scratch1, scratch1, Operand(32)); |
2327 CmpP(scratch1, Operand(HeapNumber::kSignMask)); | 2306 CmpP(scratch1, Operand(HeapNumber::kSignMask)); |
2328 bind(&done); | 2307 bind(&done); |
2329 #endif | 2308 #endif |
2330 } | 2309 } |
2331 | 2310 |
2332 void MacroAssembler::TestDoubleSign(DoubleRegister input, Register scratch) { | 2311 void MacroAssembler::TestDoubleSign(DoubleRegister input, Register scratch) { |
2333 stdy(input, MemOperand(sp, -kDoubleSize)); | 2312 lgdr(scratch, input); |
2334 LoadlW(scratch, MemOperand(sp, -kDoubleSize + Register::kExponentOffset)); | 2313 cgfi(scratch, Operand::Zero()); |
2335 Cmp32(scratch, Operand::Zero()); | |
2336 } | 2314 } |
2337 | 2315 |
2338 void MacroAssembler::TestHeapNumberSign(Register input, Register scratch) { | 2316 void MacroAssembler::TestHeapNumberSign(Register input, Register scratch) { |
2339 LoadlW(scratch, FieldMemOperand(input, HeapNumber::kValueOffset + | 2317 LoadlW(scratch, FieldMemOperand(input, HeapNumber::kValueOffset + |
2340 Register::kExponentOffset)); | 2318 Register::kExponentOffset)); |
2341 Cmp32(scratch, Operand::Zero()); | 2319 Cmp32(scratch, Operand::Zero()); |
2342 } | 2320 } |
2343 | 2321 |
2344 void MacroAssembler::TryDoubleToInt32Exact(Register result, | 2322 void MacroAssembler::TryDoubleToInt32Exact(Register result, |
2345 DoubleRegister double_input, | 2323 DoubleRegister double_input, |
(...skipping 24 matching lines...) Expand all Loading... |
2370 | 2348 |
2371 void MacroAssembler::TryInt32Floor(Register result, DoubleRegister double_input, | 2349 void MacroAssembler::TryInt32Floor(Register result, DoubleRegister double_input, |
2372 Register input_high, Register scratch, | 2350 Register input_high, Register scratch, |
2373 DoubleRegister double_scratch, Label* done, | 2351 DoubleRegister double_scratch, Label* done, |
2374 Label* exact) { | 2352 Label* exact) { |
2375 DCHECK(!result.is(input_high)); | 2353 DCHECK(!result.is(input_high)); |
2376 DCHECK(!double_input.is(double_scratch)); | 2354 DCHECK(!double_input.is(double_scratch)); |
2377 Label exception; | 2355 Label exception; |
2378 | 2356 |
2379 // Move high word into input_high | 2357 // Move high word into input_high |
2380 StoreDouble(double_input, MemOperand(sp, -kDoubleSize)); | |
2381 lay(sp, MemOperand(sp, -kDoubleSize)); | 2358 lay(sp, MemOperand(sp, -kDoubleSize)); |
| 2359 StoreDouble(double_input, MemOperand(sp)); |
2382 LoadlW(input_high, MemOperand(sp, Register::kExponentOffset)); | 2360 LoadlW(input_high, MemOperand(sp, Register::kExponentOffset)); |
2383 la(sp, MemOperand(sp, kDoubleSize)); | 2361 la(sp, MemOperand(sp, kDoubleSize)); |
2384 | 2362 |
2385 // Test for NaN/Inf | 2363 // Test for NaN/Inf |
2386 ExtractBitMask(result, input_high, HeapNumber::kExponentMask); | 2364 ExtractBitMask(result, input_high, HeapNumber::kExponentMask); |
2387 CmpLogicalP(result, Operand(0x7ff)); | 2365 CmpLogicalP(result, Operand(0x7ff)); |
2388 beq(&exception); | 2366 beq(&exception); |
2389 | 2367 |
2390 // Convert (rounding to -Inf) | 2368 // Convert (rounding to -Inf) |
2391 ConvertDoubleToInt64(double_input, | 2369 ConvertDoubleToInt64(double_input, |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2437 | 2415 |
2438 void MacroAssembler::TruncateDoubleToI(Register result, | 2416 void MacroAssembler::TruncateDoubleToI(Register result, |
2439 DoubleRegister double_input) { | 2417 DoubleRegister double_input) { |
2440 Label done; | 2418 Label done; |
2441 | 2419 |
2442 TryInlineTruncateDoubleToI(result, double_input, &done); | 2420 TryInlineTruncateDoubleToI(result, double_input, &done); |
2443 | 2421 |
2444 // If we fell through then inline version didn't succeed - call stub instead. | 2422 // If we fell through then inline version didn't succeed - call stub instead. |
2445 push(r14); | 2423 push(r14); |
2446 // Put input on stack. | 2424 // Put input on stack. |
2447 StoreDouble(double_input, MemOperand(sp, -kDoubleSize)); | |
2448 lay(sp, MemOperand(sp, -kDoubleSize)); | 2425 lay(sp, MemOperand(sp, -kDoubleSize)); |
| 2426 StoreDouble(double_input, MemOperand(sp)); |
2449 | 2427 |
2450 DoubleToIStub stub(isolate(), sp, result, 0, true, true); | 2428 DoubleToIStub stub(isolate(), sp, result, 0, true, true); |
2451 CallStub(&stub); | 2429 CallStub(&stub); |
2452 | 2430 |
2453 la(sp, MemOperand(sp, kDoubleSize)); | 2431 la(sp, MemOperand(sp, kDoubleSize)); |
2454 pop(r14); | 2432 pop(r14); |
2455 | 2433 |
2456 bind(&done); | 2434 bind(&done); |
2457 } | 2435 } |
2458 | 2436 |
(...skipping 2959 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5418 } | 5396 } |
5419 if (mag.shift > 0) ShiftRightArith(result, result, Operand(mag.shift)); | 5397 if (mag.shift > 0) ShiftRightArith(result, result, Operand(mag.shift)); |
5420 ExtractBit(r0, dividend, 31); | 5398 ExtractBit(r0, dividend, 31); |
5421 AddP(result, r0); | 5399 AddP(result, r0); |
5422 } | 5400 } |
5423 | 5401 |
5424 } // namespace internal | 5402 } // namespace internal |
5425 } // namespace v8 | 5403 } // namespace v8 |
5426 | 5404 |
5427 #endif // V8_TARGET_ARCH_S390 | 5405 #endif // V8_TARGET_ARCH_S390 |
OLD | NEW |