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 951 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
962 Label loop_header, loop_check; | 962 Label loop_header, loop_check; |
963 __ b(al, &loop_check); | 963 __ b(al, &loop_check); |
964 __ bind(&loop_header); | 964 __ bind(&loop_header); |
965 __ ldr(scratch, MemOperand(index, -kPointerSize, PostIndex)); | 965 __ ldr(scratch, MemOperand(index, -kPointerSize, PostIndex)); |
966 __ push(scratch); | 966 __ push(scratch); |
967 __ bind(&loop_check); | 967 __ bind(&loop_check); |
968 __ cmp(index, limit); | 968 __ cmp(index, limit); |
969 __ b(gt, &loop_header); | 969 __ b(gt, &loop_header); |
970 } | 970 } |
971 | 971 |
| 972 static void Generate_InterpreterComputeLastArgumentAddress( |
| 973 MacroAssembler* masm, Register num_args, Register start_address, |
| 974 Register output_reg) { |
| 975 __ add(output_reg, num_args, Operand(1)); // Add one for receiver. |
| 976 __ mov(output_reg, Operand(output_reg, LSL, kPointerSizeLog2)); |
| 977 __ sub(output_reg, start_address, output_reg); |
| 978 } |
| 979 |
| 980 // static |
| 981 void Builtins::Generate_InterpreterPushArgsAndCallICImpl( |
| 982 MacroAssembler* masm, TailCallMode tail_call_mode) { |
| 983 // ----------- S t a t e ------------- |
| 984 // -- r0 : the number of arguments (not including the receiver) |
| 985 // -- r4 : the address of the first argument to be pushed. Subsequent |
| 986 // arguments should be consecutive above this, in the same order as |
| 987 // they are to be pushed onto the stack. |
| 988 // -- r1 : the target to call (can be any Object). |
| 989 // -- r3 : feedback vector slot id |
| 990 // -- r2 : type feedback vector |
| 991 // ----------------------------------- |
| 992 |
| 993 { |
| 994 FrameScope scope(masm, StackFrame::INTERNAL); |
| 995 |
| 996 // Find the address of the last argument. |
| 997 Generate_InterpreterComputeLastArgumentAddress(masm, r0, r4, r5); |
| 998 |
| 999 // Push the arguments. |
| 1000 Generate_InterpreterPushArgs(masm, r4, r5, r6); |
| 1001 |
| 1002 // Call via the CallIC stub. |
| 1003 CallICState call_ic_state(0, ConvertReceiverMode::kAny, tail_call_mode, |
| 1004 true); |
| 1005 CallICStub stub(masm->isolate(), call_ic_state); |
| 1006 // TODO(mythria): This should be replaced by a TailCallStub, when we |
| 1007 // update the code to find the target IC from jump instructions. |
| 1008 __ CallStub(&stub); |
| 1009 } |
| 1010 __ Ret(); |
| 1011 } |
972 | 1012 |
973 // static | 1013 // static |
974 void Builtins::Generate_InterpreterPushArgsAndCallImpl( | 1014 void Builtins::Generate_InterpreterPushArgsAndCallImpl( |
975 MacroAssembler* masm, TailCallMode tail_call_mode) { | 1015 MacroAssembler* masm, TailCallMode tail_call_mode) { |
976 // ----------- S t a t e ------------- | 1016 // ----------- S t a t e ------------- |
977 // -- r0 : the number of arguments (not including the receiver) | 1017 // -- r0 : the number of arguments (not including the receiver) |
978 // -- r2 : the address of the first argument to be pushed. Subsequent | 1018 // -- r2 : the address of the first argument to be pushed. Subsequent |
979 // arguments should be consecutive above this, in the same order as | 1019 // arguments should be consecutive above this, in the same order as |
980 // they are to be pushed onto the stack. | 1020 // they are to be pushed onto the stack. |
981 // -- r1 : the target to call (can be any Object). | 1021 // -- r1 : the target to call (can be any Object). |
982 // ----------------------------------- | 1022 // ----------------------------------- |
983 | 1023 |
984 // Find the address of the last argument. | 1024 // Find the address of the last argument. |
985 __ add(r3, r0, Operand(1)); // Add one for receiver. | 1025 Generate_InterpreterComputeLastArgumentAddress(masm, r0, r2, r3); |
986 __ mov(r3, Operand(r3, LSL, kPointerSizeLog2)); | |
987 __ sub(r3, r2, r3); | |
988 | 1026 |
989 // Push the arguments. | 1027 // Push the arguments. |
990 Generate_InterpreterPushArgs(masm, r2, r3, r4); | 1028 Generate_InterpreterPushArgs(masm, r2, r3, r4); |
991 | 1029 |
992 // Call the target. | 1030 // Call the target. |
993 __ Jump(masm->isolate()->builtins()->Call(ConvertReceiverMode::kAny, | 1031 __ Jump(masm->isolate()->builtins()->Call(ConvertReceiverMode::kAny, |
994 tail_call_mode), | 1032 tail_call_mode), |
995 RelocInfo::CODE_TARGET); | 1033 RelocInfo::CODE_TARGET); |
996 } | 1034 } |
997 | 1035 |
(...skipping 930 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1928 | 1966 |
1929 // Prepare for tail call only if the debugger is not active. | 1967 // Prepare for tail call only if the debugger is not active. |
1930 Label done; | 1968 Label done; |
1931 ExternalReference debug_is_active = | 1969 ExternalReference debug_is_active = |
1932 ExternalReference::debug_is_active_address(masm->isolate()); | 1970 ExternalReference::debug_is_active_address(masm->isolate()); |
1933 __ mov(scratch1, Operand(debug_is_active)); | 1971 __ mov(scratch1, Operand(debug_is_active)); |
1934 __ ldrb(scratch1, MemOperand(scratch1)); | 1972 __ ldrb(scratch1, MemOperand(scratch1)); |
1935 __ cmp(scratch1, Operand(0)); | 1973 __ cmp(scratch1, Operand(0)); |
1936 __ b(ne, &done); | 1974 __ b(ne, &done); |
1937 | 1975 |
| 1976 // Drop possible internal frame pushed for calling CallICStub. |
| 1977 // TODO(mythria): when we tail call the CallICStub, remove this. |
| 1978 { |
| 1979 Label no_internal_callic_frame; |
| 1980 __ ldr(scratch3, MemOperand(fp, StandardFrameConstants::kMarkerOffset)); |
| 1981 __ cmp(scratch3, Operand(Smi::FromInt(StackFrame::INTERNAL))); |
| 1982 __ b(ne, &no_internal_callic_frame); |
| 1983 __ ldr(fp, MemOperand(fp, StandardFrameConstants::kCallerFPOffset)); |
| 1984 __ bind(&no_internal_callic_frame); |
| 1985 } |
| 1986 |
1938 // Drop possible interpreter handler/stub frame. | 1987 // Drop possible interpreter handler/stub frame. |
1939 { | 1988 { |
1940 Label no_interpreter_frame; | 1989 Label no_interpreter_frame; |
1941 __ ldr(scratch3, MemOperand(fp, StandardFrameConstants::kMarkerOffset)); | 1990 __ ldr(scratch3, MemOperand(fp, StandardFrameConstants::kMarkerOffset)); |
1942 __ cmp(scratch3, Operand(Smi::FromInt(StackFrame::STUB))); | 1991 __ cmp(scratch3, Operand(Smi::FromInt(StackFrame::STUB))); |
1943 __ b(ne, &no_interpreter_frame); | 1992 __ b(ne, &no_interpreter_frame); |
1944 __ ldr(fp, MemOperand(fp, StandardFrameConstants::kCallerFPOffset)); | 1993 __ ldr(fp, MemOperand(fp, StandardFrameConstants::kCallerFPOffset)); |
1945 __ bind(&no_interpreter_frame); | 1994 __ bind(&no_interpreter_frame); |
1946 } | 1995 } |
1947 | 1996 |
(...skipping 610 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2558 } | 2607 } |
2559 } | 2608 } |
2560 | 2609 |
2561 | 2610 |
2562 #undef __ | 2611 #undef __ |
2563 | 2612 |
2564 } // namespace internal | 2613 } // namespace internal |
2565 } // namespace v8 | 2614 } // namespace v8 |
2566 | 2615 |
2567 #endif // V8_TARGET_ARCH_ARM | 2616 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |