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 <limits.h> // For LONG_MIN, LONG_MAX. | 5 #include <limits.h> // For LONG_MIN, LONG_MAX. |
6 | 6 |
7 #if V8_TARGET_ARCH_ARM | 7 #if V8_TARGET_ARCH_ARM |
8 | 8 |
9 #include "src/base/bits.h" | 9 #include "src/base/bits.h" |
10 #include "src/base/division-by-constant.h" | 10 #include "src/base/division-by-constant.h" |
(...skipping 1282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1293 vmov(dst, r0, r1); | 1293 vmov(dst, r0, r1); |
1294 } | 1294 } |
1295 } | 1295 } |
1296 | 1296 |
1297 | 1297 |
1298 // On ARM this is just a synonym to make the purpose clear. | 1298 // On ARM this is just a synonym to make the purpose clear. |
1299 void MacroAssembler::MovFromFloatParameter(DwVfpRegister dst) { | 1299 void MacroAssembler::MovFromFloatParameter(DwVfpRegister dst) { |
1300 MovFromFloatResult(dst); | 1300 MovFromFloatResult(dst); |
1301 } | 1301 } |
1302 | 1302 |
| 1303 void MacroAssembler::PrepareForTailCall(const ParameterCount& callee_args_count, |
| 1304 Register caller_args_count_reg, |
| 1305 Register scratch0, Register scratch1) { |
| 1306 #if DEBUG |
| 1307 if (callee_args_count.is_reg()) { |
| 1308 DCHECK(!AreAliased(callee_args_count.reg(), caller_args_count_reg, scratch0, |
| 1309 scratch1)); |
| 1310 } else { |
| 1311 DCHECK(!AreAliased(caller_args_count_reg, scratch0, scratch1)); |
| 1312 } |
| 1313 #endif |
| 1314 |
| 1315 // Calculate the end of destination area where we will put the arguments |
| 1316 // after we drop current frame. We add kPointerSize to count the receiver |
| 1317 // argument which is not included into formal parameters count. |
| 1318 Register dst_reg = scratch0; |
| 1319 add(dst_reg, fp, Operand(caller_args_count_reg, LSL, kPointerSizeLog2)); |
| 1320 add(dst_reg, dst_reg, |
| 1321 Operand(StandardFrameConstants::kCallerSPOffset + kPointerSize)); |
| 1322 |
| 1323 Register src_reg = caller_args_count_reg; |
| 1324 // Calculate the end of source area. +kPointerSize is for the receiver. |
| 1325 if (callee_args_count.is_reg()) { |
| 1326 add(src_reg, sp, Operand(callee_args_count.reg(), LSL, kPointerSizeLog2)); |
| 1327 add(src_reg, src_reg, Operand(kPointerSize)); |
| 1328 } else { |
| 1329 add(src_reg, sp, |
| 1330 Operand((callee_args_count.immediate() + 1) * kPointerSize)); |
| 1331 } |
| 1332 |
| 1333 if (FLAG_debug_code) { |
| 1334 cmp(src_reg, dst_reg); |
| 1335 Check(lo, kStackAccessBelowStackPointer); |
| 1336 } |
| 1337 |
| 1338 // Restore caller's frame pointer and return address now as they will be |
| 1339 // overwritten by the copying loop. |
| 1340 ldr(lr, MemOperand(fp, StandardFrameConstants::kCallerPCOffset)); |
| 1341 ldr(fp, MemOperand(fp, StandardFrameConstants::kCallerFPOffset)); |
| 1342 |
| 1343 // Now copy callee arguments to the caller frame going backwards to avoid |
| 1344 // callee arguments corruption (source and destination areas could overlap). |
| 1345 |
| 1346 // Both src_reg and dst_reg are pointing to the word after the one to copy, |
| 1347 // so they must be pre-decremented in the loop. |
| 1348 Register tmp_reg = scratch1; |
| 1349 Label loop, entry; |
| 1350 b(&entry); |
| 1351 bind(&loop); |
| 1352 ldr(tmp_reg, MemOperand(src_reg, -kPointerSize, PreIndex)); |
| 1353 str(tmp_reg, MemOperand(dst_reg, -kPointerSize, PreIndex)); |
| 1354 bind(&entry); |
| 1355 cmp(sp, src_reg); |
| 1356 b(ne, &loop); |
| 1357 |
| 1358 // Leave current frame. |
| 1359 mov(sp, dst_reg); |
| 1360 } |
1303 | 1361 |
1304 void MacroAssembler::InvokePrologue(const ParameterCount& expected, | 1362 void MacroAssembler::InvokePrologue(const ParameterCount& expected, |
1305 const ParameterCount& actual, | 1363 const ParameterCount& actual, |
1306 Label* done, | 1364 Label* done, |
1307 bool* definitely_mismatches, | 1365 bool* definitely_mismatches, |
1308 InvokeFlag flag, | 1366 InvokeFlag flag, |
1309 const CallWrapper& call_wrapper) { | 1367 const CallWrapper& call_wrapper) { |
1310 bool definitely_matches = false; | 1368 bool definitely_matches = false; |
1311 *definitely_mismatches = false; | 1369 *definitely_mismatches = false; |
1312 Label regular_invoke; | 1370 Label regular_invoke; |
(...skipping 2375 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3688 } | 3746 } |
3689 } | 3747 } |
3690 if (mag.shift > 0) mov(result, Operand(result, ASR, mag.shift)); | 3748 if (mag.shift > 0) mov(result, Operand(result, ASR, mag.shift)); |
3691 add(result, result, Operand(dividend, LSR, 31)); | 3749 add(result, result, Operand(dividend, LSR, 31)); |
3692 } | 3750 } |
3693 | 3751 |
3694 } // namespace internal | 3752 } // namespace internal |
3695 } // namespace v8 | 3753 } // namespace v8 |
3696 | 3754 |
3697 #endif // V8_TARGET_ARCH_ARM | 3755 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |