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 #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 1915 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1926 // | f()'s arg 1 | 1926 // | f()'s arg 1 |
1927 // | f()'s receiver arg <- sp (f()'s caller pc is not on the stack yet!) | 1927 // | f()'s receiver arg <- sp (f()'s caller pc is not on the stack yet!) |
1928 // ---------------------- | 1928 // ---------------------- |
1929 // | 1929 // |
1930 void PrepareForTailCall(MacroAssembler* masm, Register args_reg, | 1930 void PrepareForTailCall(MacroAssembler* masm, Register args_reg, |
1931 Register scratch1, Register scratch2, | 1931 Register scratch1, Register scratch2, |
1932 Register scratch3) { | 1932 Register scratch3) { |
1933 DCHECK(!AreAliased(args_reg, scratch1, scratch2, scratch3)); | 1933 DCHECK(!AreAliased(args_reg, scratch1, scratch2, scratch3)); |
1934 Comment cmnt(masm, "[ PrepareForTailCall"); | 1934 Comment cmnt(masm, "[ PrepareForTailCall"); |
1935 | 1935 |
| 1936 // Prepare for tail call only if ES2015 tail call elimination is enabled. |
| 1937 Label done; |
| 1938 ExternalReference is_tail_call_elimination_enabled = |
| 1939 ExternalReference::is_tail_call_elimination_enabled_address( |
| 1940 masm->isolate()); |
| 1941 __ mov(scratch1, Operand(is_tail_call_elimination_enabled)); |
| 1942 __ ldrb(scratch1, MemOperand(scratch1)); |
| 1943 __ cmp(scratch1, Operand(0)); |
| 1944 __ b(eq, &done); |
| 1945 |
1936 // Drop possible interpreter handler/stub frame. | 1946 // Drop possible interpreter handler/stub frame. |
1937 { | 1947 { |
1938 Label no_interpreter_frame; | 1948 Label no_interpreter_frame; |
1939 __ ldr(scratch3, | 1949 __ ldr(scratch3, |
1940 MemOperand(fp, CommonFrameConstants::kContextOrFrameTypeOffset)); | 1950 MemOperand(fp, CommonFrameConstants::kContextOrFrameTypeOffset)); |
1941 __ cmp(scratch3, Operand(Smi::FromInt(StackFrame::STUB))); | 1951 __ cmp(scratch3, Operand(Smi::FromInt(StackFrame::STUB))); |
1942 __ b(ne, &no_interpreter_frame); | 1952 __ b(ne, &no_interpreter_frame); |
1943 __ ldr(fp, MemOperand(fp, StandardFrameConstants::kCallerFPOffset)); | 1953 __ ldr(fp, MemOperand(fp, StandardFrameConstants::kCallerFPOffset)); |
1944 __ bind(&no_interpreter_frame); | 1954 __ bind(&no_interpreter_frame); |
1945 } | 1955 } |
(...skipping 23 matching lines...) Expand all Loading... |
1969 __ ldr(caller_args_count_reg, | 1979 __ ldr(caller_args_count_reg, |
1970 FieldMemOperand(scratch1, | 1980 FieldMemOperand(scratch1, |
1971 SharedFunctionInfo::kFormalParameterCountOffset)); | 1981 SharedFunctionInfo::kFormalParameterCountOffset)); |
1972 __ SmiUntag(caller_args_count_reg); | 1982 __ SmiUntag(caller_args_count_reg); |
1973 | 1983 |
1974 __ bind(&formal_parameter_count_loaded); | 1984 __ bind(&formal_parameter_count_loaded); |
1975 | 1985 |
1976 ParameterCount callee_args_count(args_reg); | 1986 ParameterCount callee_args_count(args_reg); |
1977 __ PrepareForTailCall(callee_args_count, caller_args_count_reg, scratch2, | 1987 __ PrepareForTailCall(callee_args_count, caller_args_count_reg, scratch2, |
1978 scratch3); | 1988 scratch3); |
| 1989 __ bind(&done); |
1979 } | 1990 } |
1980 } // namespace | 1991 } // namespace |
1981 | 1992 |
1982 // static | 1993 // static |
1983 void Builtins::Generate_CallFunction(MacroAssembler* masm, | 1994 void Builtins::Generate_CallFunction(MacroAssembler* masm, |
1984 ConvertReceiverMode mode, | 1995 ConvertReceiverMode mode, |
1985 TailCallMode tail_call_mode) { | 1996 TailCallMode tail_call_mode) { |
1986 // ----------- S t a t e ------------- | 1997 // ----------- S t a t e ------------- |
1987 // -- r0 : the number of arguments (not including the receiver) | 1998 // -- r0 : the number of arguments (not including the receiver) |
1988 // -- r1 : the function to call (checked to be a JSFunction) | 1999 // -- r1 : the function to call (checked to be a JSFunction) |
(...skipping 512 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2501 } | 2512 } |
2502 } | 2513 } |
2503 | 2514 |
2504 | 2515 |
2505 #undef __ | 2516 #undef __ |
2506 | 2517 |
2507 } // namespace internal | 2518 } // namespace internal |
2508 } // namespace v8 | 2519 } // namespace v8 |
2509 | 2520 |
2510 #endif // V8_TARGET_ARCH_ARM | 2521 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |