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 958 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
969 __ LeaveFrame(StackFrame::JAVA_SCRIPT); | 969 __ LeaveFrame(StackFrame::JAVA_SCRIPT); |
970 | 970 |
971 // Drop receiver + arguments and return. | 971 // Drop receiver + arguments and return. |
972 __ ldr(ip, FieldMemOperand(kInterpreterBytecodeArrayRegister, | 972 __ ldr(ip, FieldMemOperand(kInterpreterBytecodeArrayRegister, |
973 BytecodeArray::kParameterSizeOffset)); | 973 BytecodeArray::kParameterSizeOffset)); |
974 __ add(sp, sp, ip, LeaveCC); | 974 __ add(sp, sp, ip, LeaveCC); |
975 __ Jump(lr); | 975 __ Jump(lr); |
976 } | 976 } |
977 | 977 |
978 | 978 |
| 979 static void Generate_InterpreterPushArgs(MacroAssembler* masm, Register index, |
| 980 Register limit, Register scratch) { |
| 981 Label loop_header, loop_check; |
| 982 __ b(al, &loop_check); |
| 983 __ bind(&loop_header); |
| 984 __ ldr(scratch, MemOperand(index, -kPointerSize, PostIndex)); |
| 985 __ push(scratch); |
| 986 __ bind(&loop_check); |
| 987 __ cmp(index, limit); |
| 988 __ b(gt, &loop_header); |
| 989 } |
| 990 |
| 991 |
979 // static | 992 // static |
980 void Builtins::Generate_InterpreterPushArgsAndCall(MacroAssembler* masm) { | 993 void Builtins::Generate_InterpreterPushArgsAndCall(MacroAssembler* masm) { |
981 // ----------- S t a t e ------------- | 994 // ----------- S t a t e ------------- |
982 // -- r0 : the number of arguments (not including the receiver) | 995 // -- r0 : the number of arguments (not including the receiver) |
983 // -- r2 : the address of the first argument to be pushed. Subsequent | 996 // -- r2 : the address of the first argument to be pushed. Subsequent |
984 // arguments should be consecutive above this, in the same order as | 997 // arguments should be consecutive above this, in the same order as |
985 // they are to be pushed onto the stack. | 998 // they are to be pushed onto the stack. |
986 // -- r1 : the target to call (can be any Object). | 999 // -- r1 : the target to call (can be any Object). |
| 1000 // ----------------------------------- |
987 | 1001 |
988 // Find the address of the last argument. | 1002 // Find the address of the last argument. |
989 __ add(r3, r0, Operand(1)); // Add one for receiver. | 1003 __ add(r3, r0, Operand(1)); // Add one for receiver. |
990 __ mov(r3, Operand(r3, LSL, kPointerSizeLog2)); | 1004 __ mov(r3, Operand(r3, LSL, kPointerSizeLog2)); |
991 __ sub(r3, r2, r3); | 1005 __ sub(r3, r2, r3); |
992 | 1006 |
993 // Push the arguments. | 1007 // Push the arguments. |
994 Label loop_header, loop_check; | 1008 Generate_InterpreterPushArgs(masm, r2, r3, r4); |
995 __ b(al, &loop_check); | |
996 __ bind(&loop_header); | |
997 __ ldr(r4, MemOperand(r2, -kPointerSize, PostIndex)); | |
998 __ push(r4); | |
999 __ bind(&loop_check); | |
1000 __ cmp(r2, r3); | |
1001 __ b(gt, &loop_header); | |
1002 | 1009 |
1003 // Call the target. | 1010 // Call the target. |
1004 __ Jump(masm->isolate()->builtins()->Call(), RelocInfo::CODE_TARGET); | 1011 __ Jump(masm->isolate()->builtins()->Call(), RelocInfo::CODE_TARGET); |
1005 } | 1012 } |
1006 | 1013 |
1007 | 1014 |
| 1015 // static |
| 1016 void Builtins::Generate_InterpreterPushArgsAndConstruct(MacroAssembler* masm) { |
| 1017 // ----------- S t a t e ------------- |
| 1018 // -- r0 : argument count (not including receiver) |
| 1019 // -- r3 : original constructor |
| 1020 // -- r1 : constructor to call |
| 1021 // -- r2 : address of the first argument |
| 1022 // ----------------------------------- |
| 1023 |
| 1024 // Find the address of the last argument. |
| 1025 __ mov(r4, Operand(r0, LSL, kPointerSizeLog2)); |
| 1026 __ sub(r4, r2, r4); |
| 1027 |
| 1028 // Push a slot for the receiver to be constructed. |
| 1029 __ push(r0); |
| 1030 |
| 1031 // Push the arguments. |
| 1032 Generate_InterpreterPushArgs(masm, r2, r4, r5); |
| 1033 |
| 1034 // Call the constructor with r0, r1, and r3 unmodified. |
| 1035 __ Jump(masm->isolate()->builtins()->Construct(), RelocInfo::CONSTRUCT_CALL); |
| 1036 } |
| 1037 |
| 1038 |
1008 void Builtins::Generate_CompileLazy(MacroAssembler* masm) { | 1039 void Builtins::Generate_CompileLazy(MacroAssembler* masm) { |
1009 CallRuntimePassFunction(masm, Runtime::kCompileLazy); | 1040 CallRuntimePassFunction(masm, Runtime::kCompileLazy); |
1010 GenerateTailCallToReturnedCode(masm); | 1041 GenerateTailCallToReturnedCode(masm); |
1011 } | 1042 } |
1012 | 1043 |
1013 | 1044 |
1014 static void CallCompileOptimized(MacroAssembler* masm, bool concurrent) { | 1045 static void CallCompileOptimized(MacroAssembler* masm, bool concurrent) { |
1015 FrameAndConstantPoolScope scope(masm, StackFrame::INTERNAL); | 1046 FrameAndConstantPoolScope scope(masm, StackFrame::INTERNAL); |
1016 // Push a copy of the function onto the stack. | 1047 // Push a copy of the function onto the stack. |
1017 __ push(r1); | 1048 __ push(r1); |
(...skipping 860 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1878 } | 1909 } |
1879 } | 1910 } |
1880 | 1911 |
1881 | 1912 |
1882 #undef __ | 1913 #undef __ |
1883 | 1914 |
1884 } // namespace internal | 1915 } // namespace internal |
1885 } // namespace v8 | 1916 } // namespace v8 |
1886 | 1917 |
1887 #endif // V8_TARGET_ARCH_ARM | 1918 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |