OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 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_PPC | 5 #if V8_TARGET_ARCH_PPC |
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 1969 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1980 // | f()'s arg 1 | 1980 // | f()'s arg 1 |
1981 // | f()'s receiver arg <- sp (f()'s caller pc is not on the stack yet!) | 1981 // | f()'s receiver arg <- sp (f()'s caller pc is not on the stack yet!) |
1982 // ---------------------- | 1982 // ---------------------- |
1983 // | 1983 // |
1984 void PrepareForTailCall(MacroAssembler* masm, Register args_reg, | 1984 void PrepareForTailCall(MacroAssembler* masm, Register args_reg, |
1985 Register scratch1, Register scratch2, | 1985 Register scratch1, Register scratch2, |
1986 Register scratch3) { | 1986 Register scratch3) { |
1987 DCHECK(!AreAliased(args_reg, scratch1, scratch2, scratch3)); | 1987 DCHECK(!AreAliased(args_reg, scratch1, scratch2, scratch3)); |
1988 Comment cmnt(masm, "[ PrepareForTailCall"); | 1988 Comment cmnt(masm, "[ PrepareForTailCall"); |
1989 | 1989 |
| 1990 // Prepare for tail call only if ES2015 tail call elimination is enabled. |
| 1991 Label done; |
| 1992 ExternalReference is_tail_call_elimination_enabled = |
| 1993 ExternalReference::is_tail_call_elimination_enabled_address( |
| 1994 masm->isolate()); |
| 1995 __ mov(scratch1, Operand(is_tail_call_elimination_enabled)); |
| 1996 __ lbz(scratch1, MemOperand(scratch1)); |
| 1997 __ cmpi(scratch1, Operand::Zero()); |
| 1998 __ beq(&done); |
| 1999 |
1990 // Drop possible interpreter handler/stub frame. | 2000 // Drop possible interpreter handler/stub frame. |
1991 { | 2001 { |
1992 Label no_interpreter_frame; | 2002 Label no_interpreter_frame; |
1993 __ LoadP(scratch3, | 2003 __ LoadP(scratch3, |
1994 MemOperand(fp, CommonFrameConstants::kContextOrFrameTypeOffset)); | 2004 MemOperand(fp, CommonFrameConstants::kContextOrFrameTypeOffset)); |
1995 __ CmpSmiLiteral(scratch3, Smi::FromInt(StackFrame::STUB), r0); | 2005 __ CmpSmiLiteral(scratch3, Smi::FromInt(StackFrame::STUB), r0); |
1996 __ bne(&no_interpreter_frame); | 2006 __ bne(&no_interpreter_frame); |
1997 __ LoadP(fp, MemOperand(fp, StandardFrameConstants::kCallerFPOffset)); | 2007 __ LoadP(fp, MemOperand(fp, StandardFrameConstants::kCallerFPOffset)); |
1998 __ bind(&no_interpreter_frame); | 2008 __ bind(&no_interpreter_frame); |
1999 } | 2009 } |
(...skipping 27 matching lines...) Expand all Loading... |
2027 SharedFunctionInfo::kFormalParameterCountOffset)); | 2037 SharedFunctionInfo::kFormalParameterCountOffset)); |
2028 #if !V8_TARGET_ARCH_PPC64 | 2038 #if !V8_TARGET_ARCH_PPC64 |
2029 __ SmiUntag(caller_args_count_reg); | 2039 __ SmiUntag(caller_args_count_reg); |
2030 #endif | 2040 #endif |
2031 | 2041 |
2032 __ bind(&formal_parameter_count_loaded); | 2042 __ bind(&formal_parameter_count_loaded); |
2033 | 2043 |
2034 ParameterCount callee_args_count(args_reg); | 2044 ParameterCount callee_args_count(args_reg); |
2035 __ PrepareForTailCall(callee_args_count, caller_args_count_reg, scratch2, | 2045 __ PrepareForTailCall(callee_args_count, caller_args_count_reg, scratch2, |
2036 scratch3); | 2046 scratch3); |
| 2047 __ bind(&done); |
2037 } | 2048 } |
2038 } // namespace | 2049 } // namespace |
2039 | 2050 |
2040 // static | 2051 // static |
2041 void Builtins::Generate_CallFunction(MacroAssembler* masm, | 2052 void Builtins::Generate_CallFunction(MacroAssembler* masm, |
2042 ConvertReceiverMode mode, | 2053 ConvertReceiverMode mode, |
2043 TailCallMode tail_call_mode) { | 2054 TailCallMode tail_call_mode) { |
2044 // ----------- S t a t e ------------- | 2055 // ----------- S t a t e ------------- |
2045 // -- r3 : the number of arguments (not including the receiver) | 2056 // -- r3 : the number of arguments (not including the receiver) |
2046 // -- r4 : the function to call (checked to be a JSFunction) | 2057 // -- r4 : the function to call (checked to be a JSFunction) |
(...skipping 535 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2582 __ bkpt(0); | 2593 __ bkpt(0); |
2583 } | 2594 } |
2584 } | 2595 } |
2585 | 2596 |
2586 | 2597 |
2587 #undef __ | 2598 #undef __ |
2588 } // namespace internal | 2599 } // namespace internal |
2589 } // namespace v8 | 2600 } // namespace v8 |
2590 | 2601 |
2591 #endif // V8_TARGET_ARCH_PPC | 2602 #endif // V8_TARGET_ARCH_PPC |
OLD | NEW |