| 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_ARM | 5 #if V8_TARGET_ARCH_ARM |
| 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 1915 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1926 // | f()'s arg 1 | 1926 // | f()'s arg 1 |
| 1927 // | f()'s receiver arg <- sp (f()'s caller pc is not on the stack yet!) | 1927 // | f()'s receiver arg <- sp (f()'s caller pc is not on the stack yet!) |
| 1928 // ---------------------- | 1928 // ---------------------- |
| 1929 // | 1929 // |
| 1930 void PrepareForTailCall(MacroAssembler* masm, Register args_reg, | 1930 void PrepareForTailCall(MacroAssembler* masm, Register args_reg, |
| 1931 Register scratch1, Register scratch2, | 1931 Register scratch1, Register scratch2, |
| 1932 Register scratch3) { | 1932 Register scratch3) { |
| 1933 DCHECK(!AreAliased(args_reg, scratch1, scratch2, scratch3)); | 1933 DCHECK(!AreAliased(args_reg, scratch1, scratch2, scratch3)); |
| 1934 Comment cmnt(masm, "[ PrepareForTailCall"); | 1934 Comment cmnt(masm, "[ PrepareForTailCall"); |
| 1935 | 1935 |
| 1936 // Prepare for tail call only if the debugger is not active. | |
| 1937 Label done; | |
| 1938 ExternalReference debug_is_active = | |
| 1939 ExternalReference::debug_is_active_address(masm->isolate()); | |
| 1940 __ mov(scratch1, Operand(debug_is_active)); | |
| 1941 __ ldrb(scratch1, MemOperand(scratch1)); | |
| 1942 __ cmp(scratch1, Operand(0)); | |
| 1943 __ b(ne, &done); | |
| 1944 | |
| 1945 // Drop possible interpreter handler/stub frame. | 1936 // Drop possible interpreter handler/stub frame. |
| 1946 { | 1937 { |
| 1947 Label no_interpreter_frame; | 1938 Label no_interpreter_frame; |
| 1948 __ ldr(scratch3, | 1939 __ ldr(scratch3, |
| 1949 MemOperand(fp, CommonFrameConstants::kContextOrFrameTypeOffset)); | 1940 MemOperand(fp, CommonFrameConstants::kContextOrFrameTypeOffset)); |
| 1950 __ cmp(scratch3, Operand(Smi::FromInt(StackFrame::STUB))); | 1941 __ cmp(scratch3, Operand(Smi::FromInt(StackFrame::STUB))); |
| 1951 __ b(ne, &no_interpreter_frame); | 1942 __ b(ne, &no_interpreter_frame); |
| 1952 __ ldr(fp, MemOperand(fp, StandardFrameConstants::kCallerFPOffset)); | 1943 __ ldr(fp, MemOperand(fp, StandardFrameConstants::kCallerFPOffset)); |
| 1953 __ bind(&no_interpreter_frame); | 1944 __ bind(&no_interpreter_frame); |
| 1954 } | 1945 } |
| (...skipping 23 matching lines...) Expand all Loading... |
| 1978 __ ldr(caller_args_count_reg, | 1969 __ ldr(caller_args_count_reg, |
| 1979 FieldMemOperand(scratch1, | 1970 FieldMemOperand(scratch1, |
| 1980 SharedFunctionInfo::kFormalParameterCountOffset)); | 1971 SharedFunctionInfo::kFormalParameterCountOffset)); |
| 1981 __ SmiUntag(caller_args_count_reg); | 1972 __ SmiUntag(caller_args_count_reg); |
| 1982 | 1973 |
| 1983 __ bind(&formal_parameter_count_loaded); | 1974 __ bind(&formal_parameter_count_loaded); |
| 1984 | 1975 |
| 1985 ParameterCount callee_args_count(args_reg); | 1976 ParameterCount callee_args_count(args_reg); |
| 1986 __ PrepareForTailCall(callee_args_count, caller_args_count_reg, scratch2, | 1977 __ PrepareForTailCall(callee_args_count, caller_args_count_reg, scratch2, |
| 1987 scratch3); | 1978 scratch3); |
| 1988 __ bind(&done); | |
| 1989 } | 1979 } |
| 1990 } // namespace | 1980 } // namespace |
| 1991 | 1981 |
| 1992 // static | 1982 // static |
| 1993 void Builtins::Generate_CallFunction(MacroAssembler* masm, | 1983 void Builtins::Generate_CallFunction(MacroAssembler* masm, |
| 1994 ConvertReceiverMode mode, | 1984 ConvertReceiverMode mode, |
| 1995 TailCallMode tail_call_mode) { | 1985 TailCallMode tail_call_mode) { |
| 1996 // ----------- S t a t e ------------- | 1986 // ----------- S t a t e ------------- |
| 1997 // -- r0 : the number of arguments (not including the receiver) | 1987 // -- r0 : the number of arguments (not including the receiver) |
| 1998 // -- r1 : the function to call (checked to be a JSFunction) | 1988 // -- r1 : the function to call (checked to be a JSFunction) |
| (...skipping 512 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2511 } | 2501 } |
| 2512 } | 2502 } |
| 2513 | 2503 |
| 2514 | 2504 |
| 2515 #undef __ | 2505 #undef __ |
| 2516 | 2506 |
| 2517 } // namespace internal | 2507 } // namespace internal |
| 2518 } // namespace v8 | 2508 } // namespace v8 |
| 2519 | 2509 |
| 2520 #endif // V8_TARGET_ARCH_ARM | 2510 #endif // V8_TARGET_ARCH_ARM |
| OLD | NEW |