OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 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_PPC | 5 #if V8_TARGET_ARCH_PPC |
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 1016 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1027 } | 1027 } |
1028 | 1028 |
1029 | 1029 |
1030 void CEntryStub::Generate(MacroAssembler* masm) { | 1030 void CEntryStub::Generate(MacroAssembler* masm) { |
1031 // Called from JavaScript; parameters are on stack as if calling JS function. | 1031 // Called from JavaScript; parameters are on stack as if calling JS function. |
1032 // r3: number of arguments including receiver | 1032 // r3: number of arguments including receiver |
1033 // r4: pointer to builtin function | 1033 // r4: pointer to builtin function |
1034 // fp: frame pointer (restored after C call) | 1034 // fp: frame pointer (restored after C call) |
1035 // sp: stack pointer (restored as callee's sp after C call) | 1035 // sp: stack pointer (restored as callee's sp after C call) |
1036 // cp: current context (C callee-saved) | 1036 // cp: current context (C callee-saved) |
1037 | 1037 // |
| 1038 // If argv_in_register(): |
| 1039 // r5: pointer to the first argument |
1038 ProfileEntryHookStub::MaybeCallEntryHook(masm); | 1040 ProfileEntryHookStub::MaybeCallEntryHook(masm); |
1039 | 1041 |
1040 __ mr(r15, r4); | 1042 __ mr(r15, r4); |
1041 | 1043 |
1042 // Compute the argv pointer. | 1044 if (argv_in_register()) { |
1043 __ ShiftLeftImm(r4, r3, Operand(kPointerSizeLog2)); | 1045 // Move argv into the correct register. |
1044 __ add(r4, r4, sp); | 1046 __ mr(r4, r5); |
1045 __ subi(r4, r4, Operand(kPointerSize)); | 1047 } else { |
| 1048 // Compute the argv pointer. |
| 1049 __ ShiftLeftImm(r4, r3, Operand(kPointerSizeLog2)); |
| 1050 __ add(r4, r4, sp); |
| 1051 __ subi(r4, r4, Operand(kPointerSize)); |
| 1052 } |
1046 | 1053 |
1047 // Enter the exit frame that transitions from JavaScript to C++. | 1054 // Enter the exit frame that transitions from JavaScript to C++. |
1048 FrameScope scope(masm, StackFrame::MANUAL); | 1055 FrameScope scope(masm, StackFrame::MANUAL); |
1049 | 1056 |
1050 // Need at least one extra slot for return address location. | 1057 // Need at least one extra slot for return address location. |
1051 int arg_stack_space = 1; | 1058 int arg_stack_space = 1; |
1052 | 1059 |
1053 // PPC LINUX ABI: | 1060 // PPC LINUX ABI: |
1054 #if !ABI_RETURNS_OBJECT_PAIRS_IN_REGS | 1061 #if !ABI_RETURNS_OBJECT_PAIRS_IN_REGS |
1055 // Pass buffer for return value on stack if necessary | 1062 // Pass buffer for return value on stack if necessary |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1134 // Cannot use check here as it attempts to generate call into runtime. | 1141 // Cannot use check here as it attempts to generate call into runtime. |
1135 __ beq(&okay); | 1142 __ beq(&okay); |
1136 __ stop("Unexpected pending exception"); | 1143 __ stop("Unexpected pending exception"); |
1137 __ bind(&okay); | 1144 __ bind(&okay); |
1138 } | 1145 } |
1139 | 1146 |
1140 // Exit C frame and return. | 1147 // Exit C frame and return. |
1141 // r3:r4: result | 1148 // r3:r4: result |
1142 // sp: stack pointer | 1149 // sp: stack pointer |
1143 // fp: frame pointer | 1150 // fp: frame pointer |
1144 // r14: still holds argc (callee-saved). | 1151 Register argc; |
1145 __ LeaveExitFrame(save_doubles(), r14, true); | 1152 if (argv_in_register()) { |
| 1153 // We don't want to pop arguments so set argc to no_reg. |
| 1154 argc = no_reg; |
| 1155 } else { |
| 1156 // r14: still holds argc (callee-saved). |
| 1157 argc = r14; |
| 1158 } |
| 1159 __ LeaveExitFrame(save_doubles(), argc, true); |
1146 __ blr(); | 1160 __ blr(); |
1147 | 1161 |
1148 // Handling of exception. | 1162 // Handling of exception. |
1149 __ bind(&exception_returned); | 1163 __ bind(&exception_returned); |
1150 | 1164 |
1151 ExternalReference pending_handler_context_address( | 1165 ExternalReference pending_handler_context_address( |
1152 Isolate::kPendingHandlerContextAddress, isolate()); | 1166 Isolate::kPendingHandlerContextAddress, isolate()); |
1153 ExternalReference pending_handler_code_address( | 1167 ExternalReference pending_handler_code_address( |
1154 Isolate::kPendingHandlerCodeAddress, isolate()); | 1168 Isolate::kPendingHandlerCodeAddress, isolate()); |
1155 ExternalReference pending_handler_offset_address( | 1169 ExternalReference pending_handler_offset_address( |
(...skipping 4671 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5827 kStackUnwindSpace, NULL, | 5841 kStackUnwindSpace, NULL, |
5828 MemOperand(fp, 6 * kPointerSize), NULL); | 5842 MemOperand(fp, 6 * kPointerSize), NULL); |
5829 } | 5843 } |
5830 | 5844 |
5831 | 5845 |
5832 #undef __ | 5846 #undef __ |
5833 } // namespace internal | 5847 } // namespace internal |
5834 } // namespace v8 | 5848 } // namespace v8 |
5835 | 5849 |
5836 #endif // V8_TARGET_ARCH_PPC | 5850 #endif // V8_TARGET_ARCH_PPC |
OLD | NEW |