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

Side by Side Diff: src/arm/builtins-arm.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 | « no previous file | src/arm/macro-assembler-arm.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_ARM 5 #if V8_TARGET_ARCH_ARM
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 1935 matching lines...) Expand 10 before | Expand all | Expand 10 after
1946 { 1946 {
1947 Label no_interpreter_frame; 1947 Label no_interpreter_frame;
1948 __ ldr(scratch3, MemOperand(fp, StandardFrameConstants::kMarkerOffset)); 1948 __ ldr(scratch3, MemOperand(fp, StandardFrameConstants::kMarkerOffset));
1949 __ cmp(scratch3, Operand(Smi::FromInt(StackFrame::STUB))); 1949 __ cmp(scratch3, Operand(Smi::FromInt(StackFrame::STUB)));
1950 __ b(ne, &no_interpreter_frame); 1950 __ b(ne, &no_interpreter_frame);
1951 __ ldr(fp, MemOperand(fp, StandardFrameConstants::kCallerFPOffset)); 1951 __ ldr(fp, MemOperand(fp, StandardFrameConstants::kCallerFPOffset));
1952 __ bind(&no_interpreter_frame); 1952 __ bind(&no_interpreter_frame);
1953 } 1953 }
1954 1954
1955 // Check if next frame is an arguments adaptor frame. 1955 // Check if next frame is an arguments adaptor frame.
1956 Register caller_args_count_reg = scratch1;
1956 Label no_arguments_adaptor, formal_parameter_count_loaded; 1957 Label no_arguments_adaptor, formal_parameter_count_loaded;
1957 __ ldr(scratch2, MemOperand(fp, StandardFrameConstants::kCallerFPOffset)); 1958 __ ldr(scratch2, MemOperand(fp, StandardFrameConstants::kCallerFPOffset));
1958 __ ldr(scratch3, 1959 __ ldr(scratch3,
1959 MemOperand(scratch2, StandardFrameConstants::kContextOffset)); 1960 MemOperand(scratch2, StandardFrameConstants::kContextOffset));
1960 __ cmp(scratch3, Operand(Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR))); 1961 __ cmp(scratch3, Operand(Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR)));
1961 __ b(ne, &no_arguments_adaptor); 1962 __ b(ne, &no_arguments_adaptor);
1962 1963
1963 // Drop arguments adaptor frame and load arguments count. 1964 // Drop current frame and load arguments count from arguments adaptor frame.
1964 __ mov(fp, scratch2); 1965 __ mov(fp, scratch2);
1965 __ ldr(scratch1, 1966 __ ldr(caller_args_count_reg,
1966 MemOperand(fp, ArgumentsAdaptorFrameConstants::kLengthOffset)); 1967 MemOperand(fp, ArgumentsAdaptorFrameConstants::kLengthOffset));
1967 __ SmiUntag(scratch1); 1968 __ SmiUntag(caller_args_count_reg);
1968 __ b(&formal_parameter_count_loaded); 1969 __ b(&formal_parameter_count_loaded);
1969 1970
1970 __ bind(&no_arguments_adaptor); 1971 __ bind(&no_arguments_adaptor);
1971 // Load caller's formal parameter count 1972 // Load caller's formal parameter count
1972 __ ldr(scratch1, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset)); 1973 __ ldr(scratch1, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset));
1973 __ ldr(scratch1, 1974 __ ldr(scratch1,
1974 FieldMemOperand(scratch1, JSFunction::kSharedFunctionInfoOffset)); 1975 FieldMemOperand(scratch1, JSFunction::kSharedFunctionInfoOffset));
1975 __ ldr(scratch1, 1976 __ ldr(caller_args_count_reg,
1976 FieldMemOperand(scratch1, 1977 FieldMemOperand(scratch1,
1977 SharedFunctionInfo::kFormalParameterCountOffset)); 1978 SharedFunctionInfo::kFormalParameterCountOffset));
1978 __ SmiUntag(scratch1); 1979 __ SmiUntag(caller_args_count_reg);
1979 1980
1980 __ bind(&formal_parameter_count_loaded); 1981 __ bind(&formal_parameter_count_loaded);
1981 1982
1982 // Calculate the end of destination area where we will put the arguments 1983 ParameterCount callee_args_count(args_reg);
1983 // after we drop current frame. We add kPointerSize to count the receiver 1984 __ PrepareForTailCall(callee_args_count, caller_args_count_reg, scratch2,
1984 // argument which is not included into formal parameters count. 1985 scratch3);
1985 Register dst_reg = scratch2;
1986 __ add(dst_reg, fp, Operand(scratch1, LSL, kPointerSizeLog2));
1987 __ add(dst_reg, dst_reg,
1988 Operand(StandardFrameConstants::kCallerSPOffset + kPointerSize));
1989
1990 Register src_reg = scratch1;
1991 __ add(src_reg, sp, Operand(args_reg, LSL, kPointerSizeLog2));
1992 // Count receiver argument as well (not included in args_reg).
1993 __ add(src_reg, src_reg, Operand(kPointerSize));
1994
1995 if (FLAG_debug_code) {
1996 __ cmp(src_reg, dst_reg);
1997 __ Check(lo, kStackAccessBelowStackPointer);
1998 }
1999
2000 // Restore caller's frame pointer and return address now as they will be
2001 // overwritten by the copying loop.
2002 __ ldr(lr, MemOperand(fp, StandardFrameConstants::kCallerPCOffset));
2003 __ ldr(fp, MemOperand(fp, StandardFrameConstants::kCallerFPOffset));
2004
2005 // Now copy callee arguments to the caller frame going backwards to avoid
2006 // callee arguments corruption (source and destination areas could overlap).
2007
2008 // Both src_reg and dst_reg are pointing to the word after the one to copy,
2009 // so they must be pre-decremented in the loop.
2010 Register tmp_reg = scratch3;
2011 Label loop, entry;
2012 __ b(&entry);
2013 __ bind(&loop);
2014 __ ldr(tmp_reg, MemOperand(src_reg, -kPointerSize, PreIndex));
2015 __ str(tmp_reg, MemOperand(dst_reg, -kPointerSize, PreIndex));
2016 __ bind(&entry);
2017 __ cmp(sp, src_reg);
2018 __ b(ne, &loop);
2019
2020 // Leave current frame.
2021 __ mov(sp, dst_reg);
2022
2023 __ bind(&done); 1986 __ bind(&done);
2024 } 1987 }
2025 } // namespace 1988 } // namespace
2026 1989
2027 // static 1990 // static
2028 void Builtins::Generate_CallFunction(MacroAssembler* masm, 1991 void Builtins::Generate_CallFunction(MacroAssembler* masm,
2029 ConvertReceiverMode mode, 1992 ConvertReceiverMode mode,
2030 TailCallMode tail_call_mode) { 1993 TailCallMode tail_call_mode) {
2031 // ----------- S t a t e ------------- 1994 // ----------- S t a t e -------------
2032 // -- r0 : the number of arguments (not including the receiver) 1995 // -- r0 : the number of arguments (not including the receiver)
(...skipping 534 matching lines...) Expand 10 before | Expand all | Expand 10 after
2567 } 2530 }
2568 } 2531 }
2569 2532
2570 2533
2571 #undef __ 2534 #undef __
2572 2535
2573 } // namespace internal 2536 } // namespace internal
2574 } // namespace v8 2537 } // namespace v8
2575 2538
2576 #endif // V8_TARGET_ARCH_ARM 2539 #endif // V8_TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « no previous file | src/arm/macro-assembler-arm.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698