Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(199)

Side by Side Diff: src/mips64/macro-assembler-mips64.cc

Issue 1760253003: [crankshaft] Support ES6 tail call elimination. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@tco-crank-2
Patch Set: Addressing comments Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/mips64/macro-assembler-mips64.h ('k') | src/x64/builtins-x64.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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_MIPS64 7 #if V8_TARGET_ARCH_MIPS64
8 8
9 #include "src/base/division-by-constant.h" 9 #include "src/base/division-by-constant.h"
10 #include "src/bootstrapper.h" 10 #include "src/bootstrapper.h"
(...skipping 4533 matching lines...) Expand 10 before | Expand all | Expand 10 after
4544 Move(a1, a0, src1); 4544 Move(a1, a0, src1);
4545 Move(a3, a2, src2); 4545 Move(a3, a2, src2);
4546 } 4546 }
4547 } 4547 }
4548 } 4548 }
4549 4549
4550 4550
4551 // ----------------------------------------------------------------------------- 4551 // -----------------------------------------------------------------------------
4552 // JavaScript invokes. 4552 // JavaScript invokes.
4553 4553
4554 void MacroAssembler::PrepareForTailCall(const ParameterCount& callee_args_count,
4555 Register caller_args_count_reg,
4556 Register scratch0, Register scratch1) {
4557 #if DEBUG
4558 if (callee_args_count.is_reg()) {
4559 DCHECK(!AreAliased(callee_args_count.reg(), caller_args_count_reg, scratch0,
4560 scratch1));
4561 } else {
4562 DCHECK(!AreAliased(caller_args_count_reg, scratch0, scratch1));
4563 }
4564 #endif
4565
4566 // Calculate the end of destination area where we will put the arguments
4567 // after we drop current frame. We add kPointerSize to count the receiver
4568 // argument which is not included into formal parameters count.
4569 Register dst_reg = scratch0;
4570 Dlsa(dst_reg, fp, caller_args_count_reg, kPointerSizeLog2);
4571 Daddu(dst_reg, dst_reg,
4572 Operand(StandardFrameConstants::kCallerSPOffset + kPointerSize));
4573
4574 Register src_reg = caller_args_count_reg;
4575 // Calculate the end of source area. +kPointerSize is for the receiver.
4576 if (callee_args_count.is_reg()) {
4577 Dlsa(src_reg, sp, callee_args_count.reg(), kPointerSizeLog2);
4578 Daddu(src_reg, src_reg, Operand(kPointerSize));
4579 } else {
4580 Daddu(src_reg, sp,
4581 Operand((callee_args_count.immediate() + 1) * kPointerSize));
4582 }
4583
4584 if (FLAG_debug_code) {
4585 Check(lo, kStackAccessBelowStackPointer, src_reg, Operand(dst_reg));
4586 }
4587
4588 // Restore caller's frame pointer and return address now as they will be
4589 // overwritten by the copying loop.
4590 ld(ra, MemOperand(fp, StandardFrameConstants::kCallerPCOffset));
4591 ld(fp, MemOperand(fp, StandardFrameConstants::kCallerFPOffset));
4592
4593 // Now copy callee arguments to the caller frame going backwards to avoid
4594 // callee arguments corruption (source and destination areas could overlap).
4595
4596 // Both src_reg and dst_reg are pointing to the word after the one to copy,
4597 // so they must be pre-decremented in the loop.
4598 Register tmp_reg = scratch1;
4599 Label loop, entry;
4600 Branch(&entry);
4601 bind(&loop);
4602 Dsubu(src_reg, src_reg, Operand(kPointerSize));
4603 Dsubu(dst_reg, dst_reg, Operand(kPointerSize));
4604 ld(tmp_reg, MemOperand(src_reg));
4605 sd(tmp_reg, MemOperand(dst_reg));
4606 bind(&entry);
4607 Branch(&loop, ne, sp, Operand(src_reg));
4608
4609 // Leave current frame.
4610 mov(sp, dst_reg);
4611 }
4612
4554 void MacroAssembler::InvokePrologue(const ParameterCount& expected, 4613 void MacroAssembler::InvokePrologue(const ParameterCount& expected,
4555 const ParameterCount& actual, 4614 const ParameterCount& actual,
4556 Label* done, 4615 Label* done,
4557 bool* definitely_mismatches, 4616 bool* definitely_mismatches,
4558 InvokeFlag flag, 4617 InvokeFlag flag,
4559 const CallWrapper& call_wrapper) { 4618 const CallWrapper& call_wrapper) {
4560 bool definitely_matches = false; 4619 bool definitely_matches = false;
4561 *definitely_mismatches = false; 4620 *definitely_mismatches = false;
4562 Label regular_invoke; 4621 Label regular_invoke;
4563 4622
(...skipping 2101 matching lines...) Expand 10 before | Expand all | Expand 10 after
6665 if (mag.shift > 0) sra(result, result, mag.shift); 6724 if (mag.shift > 0) sra(result, result, mag.shift);
6666 srl(at, dividend, 31); 6725 srl(at, dividend, 31);
6667 Addu(result, result, Operand(at)); 6726 Addu(result, result, Operand(at));
6668 } 6727 }
6669 6728
6670 6729
6671 } // namespace internal 6730 } // namespace internal
6672 } // namespace v8 6731 } // namespace v8
6673 6732
6674 #endif // V8_TARGET_ARCH_MIPS64 6733 #endif // V8_TARGET_ARCH_MIPS64
OLDNEW
« no previous file with comments | « src/mips64/macro-assembler-mips64.h ('k') | src/x64/builtins-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698