| 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 the debugger is not active. | |
| 1981 Label done; | |
| 1982 ExternalReference debug_is_active = | |
| 1983 ExternalReference::debug_is_active_address(masm->isolate()); | |
| 1984 __ Mov(scratch1, Operand(debug_is_active)); | |
| 1985 __ Ldrb(scratch1, MemOperand(scratch1)); | |
| 1986 __ Cmp(scratch1, Operand(0)); | |
| 1987 __ B(ne, &done); | |
| 1988 | |
| 1989 // Drop possible interpreter handler/stub frame. | 1980 // Drop possible interpreter handler/stub frame. |
| 1990 { | 1981 { |
| 1991 Label no_interpreter_frame; | 1982 Label no_interpreter_frame; |
| 1992 __ Ldr(scratch3, | 1983 __ Ldr(scratch3, |
| 1993 MemOperand(fp, CommonFrameConstants::kContextOrFrameTypeOffset)); | 1984 MemOperand(fp, CommonFrameConstants::kContextOrFrameTypeOffset)); |
| 1994 __ Cmp(scratch3, Operand(Smi::FromInt(StackFrame::STUB))); | 1985 __ Cmp(scratch3, Operand(Smi::FromInt(StackFrame::STUB))); |
| 1995 __ B(ne, &no_interpreter_frame); | 1986 __ B(ne, &no_interpreter_frame); |
| 1996 __ Ldr(fp, MemOperand(fp, StandardFrameConstants::kCallerFPOffset)); | 1987 __ Ldr(fp, MemOperand(fp, StandardFrameConstants::kCallerFPOffset)); |
| 1997 __ bind(&no_interpreter_frame); | 1988 __ bind(&no_interpreter_frame); |
| 1998 } | 1989 } |
| (...skipping 20 matching lines...) Expand all Loading... |
| 2019 __ Ldr(scratch1, | 2010 __ Ldr(scratch1, |
| 2020 FieldMemOperand(scratch1, JSFunction::kSharedFunctionInfoOffset)); | 2011 FieldMemOperand(scratch1, JSFunction::kSharedFunctionInfoOffset)); |
| 2021 __ Ldrsw(caller_args_count_reg, | 2012 __ Ldrsw(caller_args_count_reg, |
| 2022 FieldMemOperand(scratch1, | 2013 FieldMemOperand(scratch1, |
| 2023 SharedFunctionInfo::kFormalParameterCountOffset)); | 2014 SharedFunctionInfo::kFormalParameterCountOffset)); |
| 2024 __ bind(&formal_parameter_count_loaded); | 2015 __ bind(&formal_parameter_count_loaded); |
| 2025 | 2016 |
| 2026 ParameterCount callee_args_count(args_reg); | 2017 ParameterCount callee_args_count(args_reg); |
| 2027 __ PrepareForTailCall(callee_args_count, caller_args_count_reg, scratch2, | 2018 __ PrepareForTailCall(callee_args_count, caller_args_count_reg, scratch2, |
| 2028 scratch3); | 2019 scratch3); |
| 2029 __ bind(&done); | |
| 2030 } | 2020 } |
| 2031 } // namespace | 2021 } // namespace |
| 2032 | 2022 |
| 2033 // static | 2023 // static |
| 2034 void Builtins::Generate_CallFunction(MacroAssembler* masm, | 2024 void Builtins::Generate_CallFunction(MacroAssembler* masm, |
| 2035 ConvertReceiverMode mode, | 2025 ConvertReceiverMode mode, |
| 2036 TailCallMode tail_call_mode) { | 2026 TailCallMode tail_call_mode) { |
| 2037 ASM_LOCATION("Builtins::Generate_CallFunction"); | 2027 ASM_LOCATION("Builtins::Generate_CallFunction"); |
| 2038 // ----------- S t a t e ------------- | 2028 // ----------- S t a t e ------------- |
| 2039 // -- x0 : the number of arguments (not including the receiver) | 2029 // -- x0 : the number of arguments (not including the receiver) |
| (...skipping 612 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2652 } | 2642 } |
| 2653 } | 2643 } |
| 2654 | 2644 |
| 2655 | 2645 |
| 2656 #undef __ | 2646 #undef __ |
| 2657 | 2647 |
| 2658 } // namespace internal | 2648 } // namespace internal |
| 2659 } // namespace v8 | 2649 } // namespace v8 |
| 2660 | 2650 |
| 2661 #endif // V8_TARGET_ARCH_ARM | 2651 #endif // V8_TARGET_ARCH_ARM |
| OLD | NEW |