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

Side by Side Diff: src/mips64/builtins-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/mips/macro-assembler-mips.cc ('k') | src/mips64/macro-assembler-mips64.h » ('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 #if V8_TARGET_ARCH_MIPS64 5 #if V8_TARGET_ARCH_MIPS64
6 6
7 #include "src/codegen.h" 7 #include "src/codegen.h"
8 #include "src/debug/debug.h" 8 #include "src/debug/debug.h"
9 #include "src/deoptimizer.h" 9 #include "src/deoptimizer.h"
10 #include "src/full-codegen/full-codegen.h" 10 #include "src/full-codegen/full-codegen.h"
(...skipping 1957 matching lines...) Expand 10 before | Expand all | Expand 10 after
1968 { 1968 {
1969 Label no_interpreter_frame; 1969 Label no_interpreter_frame;
1970 __ ld(scratch3, MemOperand(fp, StandardFrameConstants::kMarkerOffset)); 1970 __ ld(scratch3, MemOperand(fp, StandardFrameConstants::kMarkerOffset));
1971 __ Branch(&no_interpreter_frame, ne, scratch3, 1971 __ Branch(&no_interpreter_frame, ne, scratch3,
1972 Operand(Smi::FromInt(StackFrame::STUB))); 1972 Operand(Smi::FromInt(StackFrame::STUB)));
1973 __ ld(fp, MemOperand(fp, StandardFrameConstants::kCallerFPOffset)); 1973 __ ld(fp, MemOperand(fp, StandardFrameConstants::kCallerFPOffset));
1974 __ bind(&no_interpreter_frame); 1974 __ bind(&no_interpreter_frame);
1975 } 1975 }
1976 1976
1977 // Check if next frame is an arguments adaptor frame. 1977 // Check if next frame is an arguments adaptor frame.
1978 Register caller_args_count_reg = scratch1;
1978 Label no_arguments_adaptor, formal_parameter_count_loaded; 1979 Label no_arguments_adaptor, formal_parameter_count_loaded;
1979 __ ld(scratch2, MemOperand(fp, StandardFrameConstants::kCallerFPOffset)); 1980 __ ld(scratch2, MemOperand(fp, StandardFrameConstants::kCallerFPOffset));
1980 __ ld(scratch3, MemOperand(scratch2, StandardFrameConstants::kContextOffset)); 1981 __ ld(scratch3, MemOperand(scratch2, StandardFrameConstants::kContextOffset));
1981 __ Branch(&no_arguments_adaptor, ne, scratch3, 1982 __ Branch(&no_arguments_adaptor, ne, scratch3,
1982 Operand(Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR))); 1983 Operand(Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR)));
1983 1984
1984 // Drop arguments adaptor frame and load arguments count. 1985 // Drop current frame and load arguments count from arguments adaptor frame.
1985 __ mov(fp, scratch2); 1986 __ mov(fp, scratch2);
1986 __ ld(scratch1, 1987 __ ld(caller_args_count_reg,
1987 MemOperand(fp, ArgumentsAdaptorFrameConstants::kLengthOffset)); 1988 MemOperand(fp, ArgumentsAdaptorFrameConstants::kLengthOffset));
1988 __ SmiUntag(scratch1); 1989 __ SmiUntag(caller_args_count_reg);
1989 __ Branch(&formal_parameter_count_loaded); 1990 __ Branch(&formal_parameter_count_loaded);
1990 1991
1991 __ bind(&no_arguments_adaptor); 1992 __ bind(&no_arguments_adaptor);
1992 // Load caller's formal parameter count 1993 // Load caller's formal parameter count
1993 __ ld(scratch1, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset)); 1994 __ ld(scratch1, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset));
1994 __ ld(scratch1, 1995 __ ld(scratch1,
1995 FieldMemOperand(scratch1, JSFunction::kSharedFunctionInfoOffset)); 1996 FieldMemOperand(scratch1, JSFunction::kSharedFunctionInfoOffset));
1996 __ lw(scratch1, 1997 __ lw(caller_args_count_reg,
1997 FieldMemOperand(scratch1, 1998 FieldMemOperand(scratch1,
1998 SharedFunctionInfo::kFormalParameterCountOffset)); 1999 SharedFunctionInfo::kFormalParameterCountOffset));
1999 2000
2000 __ bind(&formal_parameter_count_loaded); 2001 __ bind(&formal_parameter_count_loaded);
2001 2002
2002 // Calculate the end of destination area where we will put the arguments 2003 ParameterCount callee_args_count(args_reg);
2003 // after we drop current frame. We add kPointerSize to count the receiver 2004 __ PrepareForTailCall(callee_args_count, caller_args_count_reg, scratch2,
2004 // argument which is not included into formal parameters count. 2005 scratch3);
2005 Register dst_reg = scratch2;
2006 __ Dlsa(dst_reg, fp, scratch1, kPointerSizeLog2);
2007 __ Daddu(dst_reg, dst_reg,
2008 Operand(StandardFrameConstants::kCallerSPOffset + kPointerSize));
2009
2010 Register src_reg = scratch1;
2011 __ Dlsa(src_reg, sp, args_reg, kPointerSizeLog2);
2012 // Count receiver argument as well (not included in args_reg).
2013 __ Daddu(src_reg, src_reg, Operand(kPointerSize));
2014
2015 if (FLAG_debug_code) {
2016 __ Check(lo, kStackAccessBelowStackPointer, src_reg, Operand(dst_reg));
2017 }
2018
2019 // Restore caller's frame pointer and return address now as they will be
2020 // overwritten by the copying loop.
2021 __ ld(ra, MemOperand(fp, StandardFrameConstants::kCallerPCOffset));
2022 __ ld(fp, MemOperand(fp, StandardFrameConstants::kCallerFPOffset));
2023
2024 // Now copy callee arguments to the caller frame going backwards to avoid
2025 // callee arguments corruption (source and destination areas could overlap).
2026
2027 // Both src_reg and dst_reg are pointing to the word after the one to copy,
2028 // so they must be pre-decremented in the loop.
2029 Register tmp_reg = scratch3;
2030 Label loop, entry;
2031 __ Branch(&entry);
2032 __ bind(&loop);
2033 __ Dsubu(src_reg, src_reg, Operand(kPointerSize));
2034 __ Dsubu(dst_reg, dst_reg, Operand(kPointerSize));
2035 __ ld(tmp_reg, MemOperand(src_reg));
2036 __ sd(tmp_reg, MemOperand(dst_reg));
2037 __ bind(&entry);
2038 __ Branch(&loop, ne, sp, Operand(src_reg));
2039
2040 // Leave current frame.
2041 __ mov(sp, dst_reg);
2042
2043 __ bind(&done); 2006 __ bind(&done);
2044 } 2007 }
2045 } // namespace 2008 } // namespace
2046 2009
2047 // static 2010 // static
2048 void Builtins::Generate_CallFunction(MacroAssembler* masm, 2011 void Builtins::Generate_CallFunction(MacroAssembler* masm,
2049 ConvertReceiverMode mode, 2012 ConvertReceiverMode mode,
2050 TailCallMode tail_call_mode) { 2013 TailCallMode tail_call_mode) {
2051 // ----------- S t a t e ------------- 2014 // ----------- S t a t e -------------
2052 // -- a0 : the number of arguments (not including the receiver) 2015 // -- a0 : the number of arguments (not including the receiver)
(...skipping 596 matching lines...) Expand 10 before | Expand all | Expand 10 after
2649 } 2612 }
2650 } 2613 }
2651 2614
2652 2615
2653 #undef __ 2616 #undef __
2654 2617
2655 } // namespace internal 2618 } // namespace internal
2656 } // namespace v8 2619 } // namespace v8
2657 2620
2658 #endif // V8_TARGET_ARCH_MIPS64 2621 #endif // V8_TARGET_ARCH_MIPS64
OLDNEW
« no previous file with comments | « src/mips/macro-assembler-mips.cc ('k') | src/mips64/macro-assembler-mips64.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698