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