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/code-stubs.h" | 7 #include "src/code-stubs.h" |
8 #include "src/api-arguments.h" | 8 #include "src/api-arguments.h" |
9 #include "src/base/bits.h" | 9 #include "src/base/bits.h" |
10 #include "src/bootstrapper.h" | 10 #include "src/bootstrapper.h" |
(...skipping 1196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1207 | 1207 |
1208 // Restore callee-saved registers. | 1208 // Restore callee-saved registers. |
1209 __ MultiPop(kCalleeSaved); | 1209 __ MultiPop(kCalleeSaved); |
1210 | 1210 |
1211 // Return | 1211 // Return |
1212 __ LoadP(r0, MemOperand(sp, kStackFrameLRSlot * kPointerSize)); | 1212 __ LoadP(r0, MemOperand(sp, kStackFrameLRSlot * kPointerSize)); |
1213 __ mtlr(r0); | 1213 __ mtlr(r0); |
1214 __ blr(); | 1214 __ blr(); |
1215 } | 1215 } |
1216 | 1216 |
| 1217 void RegExpExecStub::Generate(MacroAssembler* masm) { |
| 1218 #ifdef V8_INTERPRETED_REGEXP |
| 1219 // This case is handled prior to the RegExpExecStub call. |
| 1220 __ Abort(kUnexpectedRegExpExecCall); |
| 1221 #else // V8_INTERPRETED_REGEXP |
| 1222 // Isolates: note we add an additional parameter here (isolate pointer). |
| 1223 const int kRegExpExecuteArguments = 10; |
| 1224 const int kParameterRegisters = 8; |
| 1225 __ EnterExitFrame(false, kRegExpExecuteArguments - kParameterRegisters); |
| 1226 |
| 1227 // Stack pointer now points to cell where return address is to be written. |
| 1228 // Arguments are before that on the stack or in registers. |
| 1229 |
| 1230 // Argument 10 (in stack parameter area): Pass current isolate address. |
| 1231 __ mov(r11, Operand(ExternalReference::isolate_address(isolate()))); |
| 1232 __ StoreP(r11, |
| 1233 MemOperand(sp, (kStackFrameExtraParamSlot + 1) * kPointerSize)); |
| 1234 |
| 1235 // Argument 9 is a dummy that reserves the space used for |
| 1236 // the return address added by the ExitFrame in native calls. |
| 1237 |
| 1238 // Argument 8 (r10): Indicate that this is a direct call from JavaScript. |
| 1239 __ li(r10, Operand(1)); |
| 1240 |
| 1241 // Argument 7 (r9): Start (high end) of backtracking stack memory area. |
| 1242 ExternalReference address_of_regexp_stack_memory_address = |
| 1243 ExternalReference::address_of_regexp_stack_memory_address(isolate()); |
| 1244 ExternalReference address_of_regexp_stack_memory_size = |
| 1245 ExternalReference::address_of_regexp_stack_memory_size(isolate()); |
| 1246 __ mov(r11, Operand(address_of_regexp_stack_memory_address)); |
| 1247 __ LoadP(r11, MemOperand(r11, 0)); |
| 1248 __ mov(ip, Operand(address_of_regexp_stack_memory_size)); |
| 1249 __ LoadP(ip, MemOperand(ip, 0)); |
| 1250 __ add(r9, r11, ip); |
| 1251 |
| 1252 // Argument 6 (r8): Set the number of capture registers to zero to force |
| 1253 // global egexps to behave as non-global. This does not affect non-global |
| 1254 // regexps. |
| 1255 __ li(r8, Operand::Zero()); |
| 1256 |
| 1257 // Argument 5 (r7): static offsets vector buffer. |
| 1258 __ mov( |
| 1259 r7, |
| 1260 Operand(ExternalReference::address_of_static_offsets_vector(isolate()))); |
| 1261 |
| 1262 // Argument 4, r6: End of string data |
| 1263 // Argument 3, r5: Start of string data |
| 1264 CHECK(r6.is(RegExpExecDescriptor::StringEndRegister())); |
| 1265 CHECK(r5.is(RegExpExecDescriptor::StringStartRegister())); |
| 1266 |
| 1267 // Argument 2 (r4): Previous index. |
| 1268 CHECK(r4.is(RegExpExecDescriptor::LastIndexRegister())); |
| 1269 |
| 1270 // Argument 1 (r3): Subject string. |
| 1271 CHECK(r3.is(RegExpExecDescriptor::StringRegister())); |
| 1272 |
| 1273 // Locate the code entry and call it. |
| 1274 Register code_reg = RegExpExecDescriptor::CodeRegister(); |
| 1275 __ addi(code_reg, code_reg, Operand(Code::kHeaderSize - kHeapObjectTag)); |
| 1276 |
| 1277 DirectCEntryStub stub(isolate()); |
| 1278 stub.GenerateCall(masm, code_reg); |
| 1279 |
| 1280 __ LeaveExitFrame(false, no_reg, true); |
| 1281 |
| 1282 // Return the smi-tagged result. |
| 1283 __ SmiTag(r3); |
| 1284 __ Ret(); |
| 1285 #endif // V8_INTERPRETED_REGEXP |
| 1286 } |
| 1287 |
1217 | 1288 |
1218 static void CallStubInRecordCallTarget(MacroAssembler* masm, CodeStub* stub) { | 1289 static void CallStubInRecordCallTarget(MacroAssembler* masm, CodeStub* stub) { |
1219 // r3 : number of arguments to the construct function | 1290 // r3 : number of arguments to the construct function |
1220 // r4 : the function to call | 1291 // r4 : the function to call |
1221 // r5 : feedback vector | 1292 // r5 : feedback vector |
1222 // r6 : slot in feedback vector (Smi) | 1293 // r6 : slot in feedback vector (Smi) |
1223 FrameAndConstantPoolScope scope(masm, StackFrame::INTERNAL); | 1294 FrameAndConstantPoolScope scope(masm, StackFrame::INTERNAL); |
1224 | 1295 |
1225 // Number-of-arguments register must be smi-tagged to call out. | 1296 // Number-of-arguments register must be smi-tagged to call out. |
1226 __ SmiTag(r3); | 1297 __ SmiTag(r3); |
(...skipping 1878 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3105 fp, (PropertyCallbackArguments::kReturnValueOffset + 3) * kPointerSize); | 3176 fp, (PropertyCallbackArguments::kReturnValueOffset + 3) * kPointerSize); |
3106 CallApiFunctionAndReturn(masm, api_function_address, thunk_ref, | 3177 CallApiFunctionAndReturn(masm, api_function_address, thunk_ref, |
3107 kStackUnwindSpace, NULL, return_value_operand, NULL); | 3178 kStackUnwindSpace, NULL, return_value_operand, NULL); |
3108 } | 3179 } |
3109 | 3180 |
3110 #undef __ | 3181 #undef __ |
3111 } // namespace internal | 3182 } // namespace internal |
3112 } // namespace v8 | 3183 } // namespace v8 |
3113 | 3184 |
3114 #endif // V8_TARGET_ARCH_PPC | 3185 #endif // V8_TARGET_ARCH_PPC |
OLD | NEW |