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

Side by Side Diff: src/arm64/builtins-arm64.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/arm/macro-assembler-arm.cc ('k') | src/arm64/macro-assembler-arm64.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 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 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_ARM64 5 #if V8_TARGET_ARCH_ARM64
6 6
7 #include "src/arm64/frames-arm64.h" 7 #include "src/arm64/frames-arm64.h"
8 #include "src/codegen.h" 8 #include "src/codegen.h"
9 #include "src/debug/debug.h" 9 #include "src/debug/debug.h"
10 #include "src/deoptimizer.h" 10 #include "src/deoptimizer.h"
(...skipping 1974 matching lines...) Expand 10 before | Expand all | Expand 10 after
1985 { 1985 {
1986 Label no_interpreter_frame; 1986 Label no_interpreter_frame;
1987 __ Ldr(scratch3, MemOperand(fp, StandardFrameConstants::kMarkerOffset)); 1987 __ Ldr(scratch3, MemOperand(fp, StandardFrameConstants::kMarkerOffset));
1988 __ Cmp(scratch3, Operand(Smi::FromInt(StackFrame::STUB))); 1988 __ Cmp(scratch3, Operand(Smi::FromInt(StackFrame::STUB)));
1989 __ B(ne, &no_interpreter_frame); 1989 __ B(ne, &no_interpreter_frame);
1990 __ Ldr(fp, MemOperand(fp, StandardFrameConstants::kCallerFPOffset)); 1990 __ Ldr(fp, MemOperand(fp, StandardFrameConstants::kCallerFPOffset));
1991 __ bind(&no_interpreter_frame); 1991 __ bind(&no_interpreter_frame);
1992 } 1992 }
1993 1993
1994 // Check if next frame is an arguments adaptor frame. 1994 // Check if next frame is an arguments adaptor frame.
1995 Register caller_args_count_reg = scratch1;
1995 Label no_arguments_adaptor, formal_parameter_count_loaded; 1996 Label no_arguments_adaptor, formal_parameter_count_loaded;
1996 __ Ldr(scratch2, MemOperand(fp, StandardFrameConstants::kCallerFPOffset)); 1997 __ Ldr(scratch2, MemOperand(fp, StandardFrameConstants::kCallerFPOffset));
1997 __ Ldr(scratch3, 1998 __ Ldr(scratch3,
1998 MemOperand(scratch2, StandardFrameConstants::kContextOffset)); 1999 MemOperand(scratch2, StandardFrameConstants::kContextOffset));
1999 __ Cmp(scratch3, Operand(Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR))); 2000 __ Cmp(scratch3, Operand(Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR)));
2000 __ B(ne, &no_arguments_adaptor); 2001 __ B(ne, &no_arguments_adaptor);
2001 2002
2002 // Drop arguments adaptor frame and load arguments count. 2003 // Drop current frame and load arguments count from arguments adaptor frame.
2003 __ mov(fp, scratch2); 2004 __ mov(fp, scratch2);
2004 __ Ldr(scratch1, 2005 __ Ldr(caller_args_count_reg,
2005 MemOperand(fp, ArgumentsAdaptorFrameConstants::kLengthOffset)); 2006 MemOperand(fp, ArgumentsAdaptorFrameConstants::kLengthOffset));
2006 __ SmiUntag(scratch1); 2007 __ SmiUntag(caller_args_count_reg);
2007 __ B(&formal_parameter_count_loaded); 2008 __ B(&formal_parameter_count_loaded);
2008 2009
2009 __ bind(&no_arguments_adaptor); 2010 __ bind(&no_arguments_adaptor);
2010 // Load caller's formal parameter count 2011 // Load caller's formal parameter count
2011 __ Ldr(scratch1, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset)); 2012 __ Ldr(scratch1, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset));
2012 __ Ldr(scratch1, 2013 __ Ldr(scratch1,
2013 FieldMemOperand(scratch1, JSFunction::kSharedFunctionInfoOffset)); 2014 FieldMemOperand(scratch1, JSFunction::kSharedFunctionInfoOffset));
2014 __ Ldrsw(scratch1, 2015 __ Ldrsw(caller_args_count_reg,
2015 FieldMemOperand(scratch1, 2016 FieldMemOperand(scratch1,
2016 SharedFunctionInfo::kFormalParameterCountOffset)); 2017 SharedFunctionInfo::kFormalParameterCountOffset));
2017 __ bind(&formal_parameter_count_loaded); 2018 __ bind(&formal_parameter_count_loaded);
2018 2019
2019 // Calculate the end of destination area where we will put the arguments 2020 ParameterCount callee_args_count(args_reg);
2020 // after we drop current frame. We add kPointerSize to count the receiver 2021 __ PrepareForTailCall(callee_args_count, caller_args_count_reg, scratch2,
2021 // argument which is not included into formal parameters count. 2022 scratch3);
2022 Register dst_reg = scratch2;
2023 __ add(dst_reg, fp, Operand(scratch1, LSL, kPointerSizeLog2));
2024 __ add(dst_reg, dst_reg,
2025 Operand(StandardFrameConstants::kCallerSPOffset + kPointerSize));
2026
2027 Register src_reg = scratch1;
2028 __ add(src_reg, jssp, Operand(args_reg, LSL, kPointerSizeLog2));
2029 // Count receiver argument as well (not included in args_reg).
2030 __ add(src_reg, src_reg, Operand(kPointerSize));
2031
2032 if (FLAG_debug_code) {
2033 __ Cmp(src_reg, dst_reg);
2034 __ Check(lo, kStackAccessBelowStackPointer);
2035 }
2036
2037 // Restore caller's frame pointer and return address now as they will be
2038 // overwritten by the copying loop.
2039 __ Ldr(lr, MemOperand(fp, StandardFrameConstants::kCallerPCOffset));
2040 __ Ldr(fp, MemOperand(fp, StandardFrameConstants::kCallerFPOffset));
2041
2042 // Now copy callee arguments to the caller frame going backwards to avoid
2043 // callee arguments corruption (source and destination areas could overlap).
2044
2045 // Both src_reg and dst_reg are pointing to the word after the one to copy,
2046 // so they must be pre-decremented in the loop.
2047 Register tmp_reg = scratch3;
2048 Label loop, entry;
2049 __ B(&entry);
2050 __ bind(&loop);
2051 __ Ldr(tmp_reg, MemOperand(src_reg, -kPointerSize, PreIndex));
2052 __ Str(tmp_reg, MemOperand(dst_reg, -kPointerSize, PreIndex));
2053 __ bind(&entry);
2054 __ Cmp(jssp, src_reg);
2055 __ B(ne, &loop);
2056
2057 // Leave current frame.
2058 __ Mov(jssp, dst_reg);
2059 __ SetStackPointer(jssp);
2060 __ AssertStackConsistency();
2061
2062 __ bind(&done); 2023 __ bind(&done);
2063 } 2024 }
2064 } // namespace 2025 } // namespace
2065 2026
2066 // static 2027 // static
2067 void Builtins::Generate_CallFunction(MacroAssembler* masm, 2028 void Builtins::Generate_CallFunction(MacroAssembler* masm,
2068 ConvertReceiverMode mode, 2029 ConvertReceiverMode mode,
2069 TailCallMode tail_call_mode) { 2030 TailCallMode tail_call_mode) {
2070 ASM_LOCATION("Builtins::Generate_CallFunction"); 2031 ASM_LOCATION("Builtins::Generate_CallFunction");
2071 // ----------- S t a t e ------------- 2032 // ----------- S t a t e -------------
(...skipping 637 matching lines...) Expand 10 before | Expand all | Expand 10 after
2709 } 2670 }
2710 } 2671 }
2711 2672
2712 2673
2713 #undef __ 2674 #undef __
2714 2675
2715 } // namespace internal 2676 } // namespace internal
2716 } // namespace v8 2677 } // namespace v8
2717 2678
2718 #endif // V8_TARGET_ARCH_ARM 2679 #endif // V8_TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « src/arm/macro-assembler-arm.cc ('k') | src/arm64/macro-assembler-arm64.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698