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_MIPS | 5 #if V8_TARGET_ARCH_MIPS |
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 1942 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1953 // | f()'s arg 1 | 1953 // | f()'s arg 1 |
1954 // | f()'s receiver arg <- sp (f()'s caller pc is not on the stack yet!) | 1954 // | f()'s receiver arg <- sp (f()'s caller pc is not on the stack yet!) |
1955 // ---------------------- | 1955 // ---------------------- |
1956 // | 1956 // |
1957 void PrepareForTailCall(MacroAssembler* masm, Register args_reg, | 1957 void PrepareForTailCall(MacroAssembler* masm, Register args_reg, |
1958 Register scratch1, Register scratch2, | 1958 Register scratch1, Register scratch2, |
1959 Register scratch3) { | 1959 Register scratch3) { |
1960 DCHECK(!AreAliased(args_reg, scratch1, scratch2, scratch3)); | 1960 DCHECK(!AreAliased(args_reg, scratch1, scratch2, scratch3)); |
1961 Comment cmnt(masm, "[ PrepareForTailCall"); | 1961 Comment cmnt(masm, "[ PrepareForTailCall"); |
1962 | 1962 |
| 1963 // Prepare for tail call only if ES2015 tail call elimination is enabled. |
| 1964 Label done; |
| 1965 ExternalReference is_tail_call_elimination_enabled = |
| 1966 ExternalReference::is_tail_call_elimination_enabled_address( |
| 1967 masm->isolate()); |
| 1968 __ li(at, Operand(is_tail_call_elimination_enabled)); |
| 1969 __ lb(scratch1, MemOperand(at)); |
| 1970 __ Branch(&done, eq, scratch1, Operand(zero_reg)); |
| 1971 |
1963 // Drop possible interpreter handler/stub frame. | 1972 // Drop possible interpreter handler/stub frame. |
1964 { | 1973 { |
1965 Label no_interpreter_frame; | 1974 Label no_interpreter_frame; |
1966 __ lw(scratch3, | 1975 __ lw(scratch3, |
1967 MemOperand(fp, CommonFrameConstants::kContextOrFrameTypeOffset)); | 1976 MemOperand(fp, CommonFrameConstants::kContextOrFrameTypeOffset)); |
1968 __ Branch(&no_interpreter_frame, ne, scratch3, | 1977 __ Branch(&no_interpreter_frame, ne, scratch3, |
1969 Operand(Smi::FromInt(StackFrame::STUB))); | 1978 Operand(Smi::FromInt(StackFrame::STUB))); |
1970 __ lw(fp, MemOperand(fp, StandardFrameConstants::kCallerFPOffset)); | 1979 __ lw(fp, MemOperand(fp, StandardFrameConstants::kCallerFPOffset)); |
1971 __ bind(&no_interpreter_frame); | 1980 __ bind(&no_interpreter_frame); |
1972 } | 1981 } |
(...skipping 23 matching lines...) Expand all Loading... |
1996 __ lw(caller_args_count_reg, | 2005 __ lw(caller_args_count_reg, |
1997 FieldMemOperand(scratch1, | 2006 FieldMemOperand(scratch1, |
1998 SharedFunctionInfo::kFormalParameterCountOffset)); | 2007 SharedFunctionInfo::kFormalParameterCountOffset)); |
1999 __ SmiUntag(caller_args_count_reg); | 2008 __ SmiUntag(caller_args_count_reg); |
2000 | 2009 |
2001 __ bind(&formal_parameter_count_loaded); | 2010 __ bind(&formal_parameter_count_loaded); |
2002 | 2011 |
2003 ParameterCount callee_args_count(args_reg); | 2012 ParameterCount callee_args_count(args_reg); |
2004 __ PrepareForTailCall(callee_args_count, caller_args_count_reg, scratch2, | 2013 __ PrepareForTailCall(callee_args_count, caller_args_count_reg, scratch2, |
2005 scratch3); | 2014 scratch3); |
| 2015 __ bind(&done); |
2006 } | 2016 } |
2007 } // namespace | 2017 } // namespace |
2008 | 2018 |
2009 // static | 2019 // static |
2010 void Builtins::Generate_CallFunction(MacroAssembler* masm, | 2020 void Builtins::Generate_CallFunction(MacroAssembler* masm, |
2011 ConvertReceiverMode mode, | 2021 ConvertReceiverMode mode, |
2012 TailCallMode tail_call_mode) { | 2022 TailCallMode tail_call_mode) { |
2013 // ----------- S t a t e ------------- | 2023 // ----------- S t a t e ------------- |
2014 // -- a0 : the number of arguments (not including the receiver) | 2024 // -- a0 : the number of arguments (not including the receiver) |
2015 // -- a1 : the function to call (checked to be a JSFunction) | 2025 // -- a1 : the function to call (checked to be a JSFunction) |
(...skipping 574 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2590 } | 2600 } |
2591 } | 2601 } |
2592 | 2602 |
2593 | 2603 |
2594 #undef __ | 2604 #undef __ |
2595 | 2605 |
2596 } // namespace internal | 2606 } // namespace internal |
2597 } // namespace v8 | 2607 } // namespace v8 |
2598 | 2608 |
2599 #endif // V8_TARGET_ARCH_MIPS | 2609 #endif // V8_TARGET_ARCH_MIPS |
OLD | NEW |