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/base/bits.h" | 7 #include "src/base/bits.h" |
8 #include "src/bootstrapper.h" | 8 #include "src/bootstrapper.h" |
9 #include "src/code-stubs.h" | 9 #include "src/code-stubs.h" |
10 #include "src/codegen.h" | 10 #include "src/codegen.h" |
(...skipping 956 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
967 } | 967 } |
968 | 968 |
969 | 969 |
970 void CEntryStub::Generate(MacroAssembler* masm) { | 970 void CEntryStub::Generate(MacroAssembler* masm) { |
971 // Called from JavaScript; parameters are on stack as if calling JS function. | 971 // Called from JavaScript; parameters are on stack as if calling JS function. |
972 // r0: number of arguments including receiver | 972 // r0: number of arguments including receiver |
973 // r1: pointer to builtin function | 973 // r1: pointer to builtin function |
974 // fp: frame pointer (restored after C call) | 974 // fp: frame pointer (restored after C call) |
975 // sp: stack pointer (restored as callee's sp after C call) | 975 // sp: stack pointer (restored as callee's sp after C call) |
976 // cp: current context (C callee-saved) | 976 // cp: current context (C callee-saved) |
977 | 977 // |
| 978 // If argv_in_register(): |
| 979 // r2: pointer to the first argument |
978 ProfileEntryHookStub::MaybeCallEntryHook(masm); | 980 ProfileEntryHookStub::MaybeCallEntryHook(masm); |
979 | 981 |
980 __ mov(r5, Operand(r1)); | 982 __ mov(r5, Operand(r1)); |
981 | 983 |
982 // Compute the argv pointer in a callee-saved register. | 984 if (argv_in_register()) { |
983 __ add(r1, sp, Operand(r0, LSL, kPointerSizeLog2)); | 985 // Move argv into the correct register. |
984 __ sub(r1, r1, Operand(kPointerSize)); | 986 __ mov(r1, Operand(r2)); |
| 987 } else { |
| 988 // Compute the argv pointer in a callee-saved register. |
| 989 __ add(r1, sp, Operand(r0, LSL, kPointerSizeLog2)); |
| 990 __ sub(r1, r1, Operand(kPointerSize)); |
| 991 } |
985 | 992 |
986 // Enter the exit frame that transitions from JavaScript to C++. | 993 // Enter the exit frame that transitions from JavaScript to C++. |
987 FrameScope scope(masm, StackFrame::MANUAL); | 994 FrameScope scope(masm, StackFrame::MANUAL); |
988 __ EnterExitFrame(save_doubles()); | 995 __ EnterExitFrame(save_doubles()); |
989 | 996 |
990 // Store a copy of argc in callee-saved registers for later. | 997 // Store a copy of argc in callee-saved registers for later. |
991 __ mov(r4, Operand(r0)); | 998 __ mov(r4, Operand(r0)); |
992 | 999 |
993 // r0, r4: number of arguments including receiver (C callee-saved) | 1000 // r0, r4: number of arguments including receiver (C callee-saved) |
994 // r1: pointer to the first argument (C callee-saved) | 1001 // r1: pointer to the first argument (C callee-saved) |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1050 // Cannot use check here as it attempts to generate call into runtime. | 1057 // Cannot use check here as it attempts to generate call into runtime. |
1051 __ b(eq, &okay); | 1058 __ b(eq, &okay); |
1052 __ stop("Unexpected pending exception"); | 1059 __ stop("Unexpected pending exception"); |
1053 __ bind(&okay); | 1060 __ bind(&okay); |
1054 } | 1061 } |
1055 | 1062 |
1056 // Exit C frame and return. | 1063 // Exit C frame and return. |
1057 // r0:r1: result | 1064 // r0:r1: result |
1058 // sp: stack pointer | 1065 // sp: stack pointer |
1059 // fp: frame pointer | 1066 // fp: frame pointer |
1060 // Callee-saved register r4 still holds argc. | 1067 Register argc; |
1061 __ LeaveExitFrame(save_doubles(), r4, true); | 1068 if (argv_in_register()) { |
| 1069 // We don't want to pop arguments so set argc to no_reg. |
| 1070 argc = no_reg; |
| 1071 } else { |
| 1072 // Callee-saved register r4 still holds argc. |
| 1073 argc = r4; |
| 1074 } |
| 1075 __ LeaveExitFrame(save_doubles(), argc, true); |
1062 __ mov(pc, lr); | 1076 __ mov(pc, lr); |
1063 | 1077 |
1064 // Handling of exception. | 1078 // Handling of exception. |
1065 __ bind(&exception_returned); | 1079 __ bind(&exception_returned); |
1066 | 1080 |
1067 ExternalReference pending_handler_context_address( | 1081 ExternalReference pending_handler_context_address( |
1068 Isolate::kPendingHandlerContextAddress, isolate()); | 1082 Isolate::kPendingHandlerContextAddress, isolate()); |
1069 ExternalReference pending_handler_code_address( | 1083 ExternalReference pending_handler_code_address( |
1070 Isolate::kPendingHandlerCodeAddress, isolate()); | 1084 Isolate::kPendingHandlerCodeAddress, isolate()); |
1071 ExternalReference pending_handler_offset_address( | 1085 ExternalReference pending_handler_offset_address( |
(...skipping 4461 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5533 MemOperand(fp, 6 * kPointerSize), NULL); | 5547 MemOperand(fp, 6 * kPointerSize), NULL); |
5534 } | 5548 } |
5535 | 5549 |
5536 | 5550 |
5537 #undef __ | 5551 #undef __ |
5538 | 5552 |
5539 } // namespace internal | 5553 } // namespace internal |
5540 } // namespace v8 | 5554 } // namespace v8 |
5541 | 5555 |
5542 #endif // V8_TARGET_ARCH_ARM | 5556 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |