| 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_MIPS64 | 5 #if V8_TARGET_ARCH_MIPS64 |
| 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/bootstrapper.h" | 9 #include "src/bootstrapper.h" |
| 10 #include "src/codegen.h" | 10 #include "src/codegen.h" |
| (...skipping 1248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1259 | 1259 |
| 1260 // Restore callee-saved fpu registers. | 1260 // Restore callee-saved fpu registers. |
| 1261 __ MultiPopFPU(kCalleeSavedFPU); | 1261 __ MultiPopFPU(kCalleeSavedFPU); |
| 1262 | 1262 |
| 1263 // Restore callee saved registers from the stack. | 1263 // Restore callee saved registers from the stack. |
| 1264 __ MultiPop(kCalleeSaved | ra.bit()); | 1264 __ MultiPop(kCalleeSaved | ra.bit()); |
| 1265 // Return. | 1265 // Return. |
| 1266 __ Jump(ra); | 1266 __ Jump(ra); |
| 1267 } | 1267 } |
| 1268 | 1268 |
| 1269 void RegExpExecStub::Generate(MacroAssembler* masm) { | |
| 1270 #ifdef V8_INTERPRETED_REGEXP | |
| 1271 // This case is handled prior to the RegExpExecStub call. | |
| 1272 __ Abort(kUnexpectedRegExpExecCall); | |
| 1273 #else // V8_INTERPRETED_REGEXP | |
| 1274 // Isolates: note we add an additional parameter here (isolate pointer). | |
| 1275 const int kRegExpExecuteArguments = 9; | |
| 1276 const int kParameterRegisters = 8; | |
| 1277 __ EnterExitFrame(false, kRegExpExecuteArguments - kParameterRegisters); | |
| 1278 | |
| 1279 // Stack pointer now points to cell where return address is to be written. | |
| 1280 // Arguments are before that on the stack or in registers, meaning we | |
| 1281 // treat the return address as argument 5. Thus every argument after that | |
| 1282 // needs to be shifted back by 1. Since DirectCEntryStub will handle | |
| 1283 // allocating space for the c argument slots, we don't need to calculate | |
| 1284 // that into the argument positions on the stack. This is how the stack will | |
| 1285 // look (sp meaning the value of sp at this moment): | |
| 1286 // Abi n64: | |
| 1287 // [sp + 1] - Argument 9 | |
| 1288 // [sp + 0] - saved ra | |
| 1289 // Abi O32: | |
| 1290 // [sp + 5] - Argument 9 | |
| 1291 // [sp + 4] - Argument 8 | |
| 1292 // [sp + 3] - Argument 7 | |
| 1293 // [sp + 2] - Argument 6 | |
| 1294 // [sp + 1] - Argument 5 | |
| 1295 // [sp + 0] - saved ra | |
| 1296 | |
| 1297 // Argument 9: Pass current isolate address. | |
| 1298 __ li(t1, Operand(ExternalReference::isolate_address(isolate()))); | |
| 1299 __ sd(t1, MemOperand(sp, 1 * kPointerSize)); | |
| 1300 | |
| 1301 // Argument 8: Indicate that this is a direct call from JavaScript. | |
| 1302 __ li(a7, Operand(1)); | |
| 1303 | |
| 1304 // Argument 7: Start (high end) of backtracking stack memory area. | |
| 1305 ExternalReference address_of_regexp_stack_memory_address = | |
| 1306 ExternalReference::address_of_regexp_stack_memory_address(isolate()); | |
| 1307 ExternalReference address_of_regexp_stack_memory_size = | |
| 1308 ExternalReference::address_of_regexp_stack_memory_size(isolate()); | |
| 1309 __ li(t1, Operand(address_of_regexp_stack_memory_address)); | |
| 1310 __ ld(t1, MemOperand(t1, 0)); | |
| 1311 __ li(t2, Operand(address_of_regexp_stack_memory_size)); | |
| 1312 __ ld(t2, MemOperand(t2, 0)); | |
| 1313 __ daddu(a6, t1, t2); | |
| 1314 | |
| 1315 // Argument 6: Set the number of capture registers to zero to force global | |
| 1316 // regexps to behave as non-global. This does not affect non-global regexps. | |
| 1317 __ mov(a5, zero_reg); | |
| 1318 | |
| 1319 // Argument 5: static offsets vector buffer. | |
| 1320 __ li( | |
| 1321 a4, | |
| 1322 Operand(ExternalReference::address_of_static_offsets_vector(isolate()))); | |
| 1323 | |
| 1324 // Argument 4, a3: End of string data | |
| 1325 // Argument 3, a2: Start of string data | |
| 1326 CHECK(a3.is(RegExpExecDescriptor::StringEndRegister())); | |
| 1327 CHECK(a2.is(RegExpExecDescriptor::StringStartRegister())); | |
| 1328 | |
| 1329 // Argument 2 (a1): Previous index. | |
| 1330 CHECK(a1.is(RegExpExecDescriptor::LastIndexRegister())); | |
| 1331 | |
| 1332 // Argument 1 (a0): Subject string. | |
| 1333 CHECK(a0.is(RegExpExecDescriptor::StringRegister())); | |
| 1334 | |
| 1335 // Locate the code entry and call it. | |
| 1336 Register code_reg = RegExpExecDescriptor::CodeRegister(); | |
| 1337 __ Daddu(code_reg, code_reg, Operand(Code::kHeaderSize - kHeapObjectTag)); | |
| 1338 DirectCEntryStub stub(isolate()); | |
| 1339 stub.GenerateCall(masm, code_reg); | |
| 1340 | |
| 1341 __ LeaveExitFrame(false, no_reg, true); | |
| 1342 | |
| 1343 // Return the smi-tagged result. | |
| 1344 __ SmiTag(v0); | |
| 1345 __ Ret(); | |
| 1346 #endif // V8_INTERPRETED_REGEXP | |
| 1347 } | |
| 1348 | |
| 1349 | 1269 |
| 1350 static void CallStubInRecordCallTarget(MacroAssembler* masm, CodeStub* stub) { | 1270 static void CallStubInRecordCallTarget(MacroAssembler* masm, CodeStub* stub) { |
| 1351 // a0 : number of arguments to the construct function | 1271 // a0 : number of arguments to the construct function |
| 1352 // a2 : feedback vector | 1272 // a2 : feedback vector |
| 1353 // a3 : slot in feedback vector (Smi) | 1273 // a3 : slot in feedback vector (Smi) |
| 1354 // a1 : the function to call | 1274 // a1 : the function to call |
| 1355 FrameScope scope(masm, StackFrame::INTERNAL); | 1275 FrameScope scope(masm, StackFrame::INTERNAL); |
| 1356 const RegList kSavedRegs = 1 << 4 | // a0 | 1276 const RegList kSavedRegs = 1 << 4 | // a0 |
| 1357 1 << 5 | // a1 | 1277 1 << 5 | // a1 |
| 1358 1 << 6 | // a2 | 1278 1 << 6 | // a2 |
| (...skipping 1832 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3191 kStackUnwindSpace, kInvalidStackOffset, | 3111 kStackUnwindSpace, kInvalidStackOffset, |
| 3192 return_value_operand, NULL); | 3112 return_value_operand, NULL); |
| 3193 } | 3113 } |
| 3194 | 3114 |
| 3195 #undef __ | 3115 #undef __ |
| 3196 | 3116 |
| 3197 } // namespace internal | 3117 } // namespace internal |
| 3198 } // namespace v8 | 3118 } // namespace v8 |
| 3199 | 3119 |
| 3200 #endif // V8_TARGET_ARCH_MIPS64 | 3120 #endif // V8_TARGET_ARCH_MIPS64 |
| OLD | NEW |