OLD | NEW |
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 1959 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1970 // | f()'s arg 1 | 1970 // | f()'s arg 1 |
1971 // | f()'s receiver arg <- sp (f()'s caller pc is not on the stack yet!) | 1971 // | f()'s receiver arg <- sp (f()'s caller pc is not on the stack yet!) |
1972 // ---------------------- | 1972 // ---------------------- |
1973 // | 1973 // |
1974 void PrepareForTailCall(MacroAssembler* masm, Register args_reg, | 1974 void PrepareForTailCall(MacroAssembler* masm, Register args_reg, |
1975 Register scratch1, Register scratch2, | 1975 Register scratch1, Register scratch2, |
1976 Register scratch3) { | 1976 Register scratch3) { |
1977 DCHECK(!AreAliased(args_reg, scratch1, scratch2, scratch3)); | 1977 DCHECK(!AreAliased(args_reg, scratch1, scratch2, scratch3)); |
1978 Comment cmnt(masm, "[ PrepareForTailCall"); | 1978 Comment cmnt(masm, "[ PrepareForTailCall"); |
1979 | 1979 |
| 1980 // Prepare for tail call only if ES2015 tail call elimination is enabled. |
| 1981 Label done; |
| 1982 ExternalReference is_tail_call_elimination_enabled = |
| 1983 ExternalReference::is_tail_call_elimination_enabled_address( |
| 1984 masm->isolate()); |
| 1985 __ Mov(scratch1, Operand(is_tail_call_elimination_enabled)); |
| 1986 __ Ldrb(scratch1, MemOperand(scratch1)); |
| 1987 __ Cmp(scratch1, Operand(0)); |
| 1988 __ B(eq, &done); |
| 1989 |
1980 // Drop possible interpreter handler/stub frame. | 1990 // Drop possible interpreter handler/stub frame. |
1981 { | 1991 { |
1982 Label no_interpreter_frame; | 1992 Label no_interpreter_frame; |
1983 __ Ldr(scratch3, | 1993 __ Ldr(scratch3, |
1984 MemOperand(fp, CommonFrameConstants::kContextOrFrameTypeOffset)); | 1994 MemOperand(fp, CommonFrameConstants::kContextOrFrameTypeOffset)); |
1985 __ Cmp(scratch3, Operand(Smi::FromInt(StackFrame::STUB))); | 1995 __ Cmp(scratch3, Operand(Smi::FromInt(StackFrame::STUB))); |
1986 __ B(ne, &no_interpreter_frame); | 1996 __ B(ne, &no_interpreter_frame); |
1987 __ Ldr(fp, MemOperand(fp, StandardFrameConstants::kCallerFPOffset)); | 1997 __ Ldr(fp, MemOperand(fp, StandardFrameConstants::kCallerFPOffset)); |
1988 __ bind(&no_interpreter_frame); | 1998 __ bind(&no_interpreter_frame); |
1989 } | 1999 } |
(...skipping 20 matching lines...) Expand all Loading... |
2010 __ Ldr(scratch1, | 2020 __ Ldr(scratch1, |
2011 FieldMemOperand(scratch1, JSFunction::kSharedFunctionInfoOffset)); | 2021 FieldMemOperand(scratch1, JSFunction::kSharedFunctionInfoOffset)); |
2012 __ Ldrsw(caller_args_count_reg, | 2022 __ Ldrsw(caller_args_count_reg, |
2013 FieldMemOperand(scratch1, | 2023 FieldMemOperand(scratch1, |
2014 SharedFunctionInfo::kFormalParameterCountOffset)); | 2024 SharedFunctionInfo::kFormalParameterCountOffset)); |
2015 __ bind(&formal_parameter_count_loaded); | 2025 __ bind(&formal_parameter_count_loaded); |
2016 | 2026 |
2017 ParameterCount callee_args_count(args_reg); | 2027 ParameterCount callee_args_count(args_reg); |
2018 __ PrepareForTailCall(callee_args_count, caller_args_count_reg, scratch2, | 2028 __ PrepareForTailCall(callee_args_count, caller_args_count_reg, scratch2, |
2019 scratch3); | 2029 scratch3); |
| 2030 __ bind(&done); |
2020 } | 2031 } |
2021 } // namespace | 2032 } // namespace |
2022 | 2033 |
2023 // static | 2034 // static |
2024 void Builtins::Generate_CallFunction(MacroAssembler* masm, | 2035 void Builtins::Generate_CallFunction(MacroAssembler* masm, |
2025 ConvertReceiverMode mode, | 2036 ConvertReceiverMode mode, |
2026 TailCallMode tail_call_mode) { | 2037 TailCallMode tail_call_mode) { |
2027 ASM_LOCATION("Builtins::Generate_CallFunction"); | 2038 ASM_LOCATION("Builtins::Generate_CallFunction"); |
2028 // ----------- S t a t e ------------- | 2039 // ----------- S t a t e ------------- |
2029 // -- x0 : the number of arguments (not including the receiver) | 2040 // -- x0 : the number of arguments (not including the receiver) |
(...skipping 612 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2642 } | 2653 } |
2643 } | 2654 } |
2644 | 2655 |
2645 | 2656 |
2646 #undef __ | 2657 #undef __ |
2647 | 2658 |
2648 } // namespace internal | 2659 } // namespace internal |
2649 } // namespace v8 | 2660 } // namespace v8 |
2650 | 2661 |
2651 #endif // V8_TARGET_ARCH_ARM | 2662 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |