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 | |
992 // static | 979 // static |
993 void Builtins::Generate_InterpreterPushArgsAndCall(MacroAssembler* masm) { | 980 void Builtins::Generate_InterpreterPushArgsAndCall(MacroAssembler* masm) { |
994 // ----------- S t a t e ------------- | 981 // ----------- S t a t e ------------- |
995 // -- r0 : the number of arguments (not including the receiver) | 982 // -- r0 : the number of arguments (not including the receiver) |
996 // -- r2 : the address of the first argument to be pushed. Subsequent | 983 // -- r2 : the address of the first argument to be pushed. Subsequent |
997 // arguments should be consecutive above this, in the same order as | 984 // arguments should be consecutive above this, in the same order as |
998 // they are to be pushed onto the stack. | 985 // they are to be pushed onto the stack. |
999 // -- r1 : the target to call (can be any Object). | 986 // -- r1 : the target to call (can be any Object). |
1000 // ----------------------------------- | |
1001 | 987 |
1002 // Find the address of the last argument. | 988 // Find the address of the last argument. |
1003 __ add(r3, r0, Operand(1)); // Add one for receiver. | 989 __ add(r3, r0, Operand(1)); // Add one for receiver. |
1004 __ mov(r3, Operand(r3, LSL, kPointerSizeLog2)); | 990 __ mov(r3, Operand(r3, LSL, kPointerSizeLog2)); |
1005 __ sub(r3, r2, r3); | 991 __ sub(r3, r2, r3); |
1006 | 992 |
1007 Generate_InterpreterPushArgs(masm, r2, r3, r4); | 993 // Push the arguments. |
| 994 Label loop_header, loop_check; |
| 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); |
1008 | 1002 |
1009 // Call the target. | 1003 // Call the target. |
1010 __ Jump(masm->isolate()->builtins()->Call(), RelocInfo::CODE_TARGET); | 1004 __ Jump(masm->isolate()->builtins()->Call(), RelocInfo::CODE_TARGET); |
1011 } | 1005 } |
1012 | 1006 |
1013 | 1007 |
1014 // static | |
1015 void Builtins::Generate_InterpreterPushArgsAndConstruct(MacroAssembler* masm) { | |
1016 // ----------- S t a t e ------------- | |
1017 // -- r0 : argument count (not including receiver) | |
1018 // -- r3 : original constructor | |
1019 // -- r1 : constructor to call | |
1020 // -- r2 : address of the first argument | |
1021 // ----------------------------------- | |
1022 | |
1023 // Find the address of the last argument. | |
1024 __ mov(r4, Operand(r0, LSL, kPointerSizeLog2)); | |
1025 __ sub(r4, r2, r4); | |
1026 | |
1027 Generate_InterpreterPushArgs(masm, r2, r4, r5); | |
1028 | |
1029 // Call the constructor with r0, r1, and r3 unmodified. | |
1030 __ Jump(masm->isolate()->builtins()->Construct(), RelocInfo::CONSTRUCT_CALL); | |
1031 } | |
1032 | |
1033 | |
1034 void Builtins::Generate_CompileLazy(MacroAssembler* masm) { | 1008 void Builtins::Generate_CompileLazy(MacroAssembler* masm) { |
1035 CallRuntimePassFunction(masm, Runtime::kCompileLazy); | 1009 CallRuntimePassFunction(masm, Runtime::kCompileLazy); |
1036 GenerateTailCallToReturnedCode(masm); | 1010 GenerateTailCallToReturnedCode(masm); |
1037 } | 1011 } |
1038 | 1012 |
1039 | 1013 |
1040 static void CallCompileOptimized(MacroAssembler* masm, bool concurrent) { | 1014 static void CallCompileOptimized(MacroAssembler* masm, bool concurrent) { |
1041 FrameAndConstantPoolScope scope(masm, StackFrame::INTERNAL); | 1015 FrameAndConstantPoolScope scope(masm, StackFrame::INTERNAL); |
1042 // Push a copy of the function onto the stack. | 1016 // Push a copy of the function onto the stack. |
1043 __ push(r1); | 1017 __ push(r1); |
(...skipping 860 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1904 } | 1878 } |
1905 } | 1879 } |
1906 | 1880 |
1907 | 1881 |
1908 #undef __ | 1882 #undef __ |
1909 | 1883 |
1910 } // namespace internal | 1884 } // namespace internal |
1911 } // namespace v8 | 1885 } // namespace v8 |
1912 | 1886 |
1913 #endif // V8_TARGET_ARCH_ARM | 1887 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |