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 } | |
1012 | 972 |
1013 // static | 973 // static |
1014 void Builtins::Generate_InterpreterPushArgsAndCallImpl( | 974 void Builtins::Generate_InterpreterPushArgsAndCallImpl( |
1015 MacroAssembler* masm, TailCallMode tail_call_mode) { | 975 MacroAssembler* masm, TailCallMode tail_call_mode) { |
1016 // ----------- S t a t e ------------- | 976 // ----------- S t a t e ------------- |
1017 // -- r0 : the number of arguments (not including the receiver) | 977 // -- r0 : the number of arguments (not including the receiver) |
1018 // -- r2 : the address of the first argument to be pushed. Subsequent | 978 // -- r2 : the address of the first argument to be pushed. Subsequent |
1019 // arguments should be consecutive above this, in the same order as | 979 // arguments should be consecutive above this, in the same order as |
1020 // they are to be pushed onto the stack. | 980 // they are to be pushed onto the stack. |
1021 // -- r1 : the target to call (can be any Object). | 981 // -- r1 : the target to call (can be any Object). |
1022 // ----------------------------------- | 982 // ----------------------------------- |
1023 | 983 |
1024 // Find the address of the last argument. | 984 // Find the address of the last argument. |
1025 Generate_InterpreterComputeLastArgumentAddress(masm, r0, r2, r3); | 985 __ add(r3, r0, Operand(1)); // Add one for receiver. |
| 986 __ mov(r3, Operand(r3, LSL, kPointerSizeLog2)); |
| 987 __ sub(r3, r2, r3); |
1026 | 988 |
1027 // Push the arguments. | 989 // Push the arguments. |
1028 Generate_InterpreterPushArgs(masm, r2, r3, r4); | 990 Generate_InterpreterPushArgs(masm, r2, r3, r4); |
1029 | 991 |
1030 // Call the target. | 992 // Call the target. |
1031 __ Jump(masm->isolate()->builtins()->Call(ConvertReceiverMode::kAny, | 993 __ Jump(masm->isolate()->builtins()->Call(ConvertReceiverMode::kAny, |
1032 tail_call_mode), | 994 tail_call_mode), |
1033 RelocInfo::CODE_TARGET); | 995 RelocInfo::CODE_TARGET); |
1034 } | 996 } |
1035 | 997 |
(...skipping 930 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1966 | 1928 |
1967 // Prepare for tail call only if the debugger is not active. | 1929 // Prepare for tail call only if the debugger is not active. |
1968 Label done; | 1930 Label done; |
1969 ExternalReference debug_is_active = | 1931 ExternalReference debug_is_active = |
1970 ExternalReference::debug_is_active_address(masm->isolate()); | 1932 ExternalReference::debug_is_active_address(masm->isolate()); |
1971 __ mov(scratch1, Operand(debug_is_active)); | 1933 __ mov(scratch1, Operand(debug_is_active)); |
1972 __ ldrb(scratch1, MemOperand(scratch1)); | 1934 __ ldrb(scratch1, MemOperand(scratch1)); |
1973 __ cmp(scratch1, Operand(0)); | 1935 __ cmp(scratch1, Operand(0)); |
1974 __ b(ne, &done); | 1936 __ b(ne, &done); |
1975 | 1937 |
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 | |
1987 // Drop possible interpreter handler/stub frame. | 1938 // Drop possible interpreter handler/stub frame. |
1988 { | 1939 { |
1989 Label no_interpreter_frame; | 1940 Label no_interpreter_frame; |
1990 __ ldr(scratch3, MemOperand(fp, StandardFrameConstants::kMarkerOffset)); | 1941 __ ldr(scratch3, MemOperand(fp, StandardFrameConstants::kMarkerOffset)); |
1991 __ cmp(scratch3, Operand(Smi::FromInt(StackFrame::STUB))); | 1942 __ cmp(scratch3, Operand(Smi::FromInt(StackFrame::STUB))); |
1992 __ b(ne, &no_interpreter_frame); | 1943 __ b(ne, &no_interpreter_frame); |
1993 __ ldr(fp, MemOperand(fp, StandardFrameConstants::kCallerFPOffset)); | 1944 __ ldr(fp, MemOperand(fp, StandardFrameConstants::kCallerFPOffset)); |
1994 __ bind(&no_interpreter_frame); | 1945 __ bind(&no_interpreter_frame); |
1995 } | 1946 } |
1996 | 1947 |
(...skipping 610 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2607 } | 2558 } |
2608 } | 2559 } |
2609 | 2560 |
2610 | 2561 |
2611 #undef __ | 2562 #undef __ |
2612 | 2563 |
2613 } // namespace internal | 2564 } // namespace internal |
2614 } // namespace v8 | 2565 } // namespace v8 |
2615 | 2566 |
2616 #endif // V8_TARGET_ARCH_ARM | 2567 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |