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