Index: src/mips64/code-stubs-mips64.cc |
diff --git a/src/mips64/code-stubs-mips64.cc b/src/mips64/code-stubs-mips64.cc |
index 4a0e51a1d45ceb17888284ce0e534828024accbc..7ea89d2ba9c08074937c248942ba2b60e59c9aa6 100644 |
--- a/src/mips64/code-stubs-mips64.cc |
+++ b/src/mips64/code-stubs-mips64.cc |
@@ -1266,6 +1266,86 @@ |
__ Jump(ra); |
} |
+void RegExpExecStub::Generate(MacroAssembler* masm) { |
+#ifdef V8_INTERPRETED_REGEXP |
+ // This case is handled prior to the RegExpExecStub call. |
+ __ Abort(kUnexpectedRegExpExecCall); |
+#else // V8_INTERPRETED_REGEXP |
+ // Isolates: note we add an additional parameter here (isolate pointer). |
+ const int kRegExpExecuteArguments = 9; |
+ const int kParameterRegisters = 8; |
+ __ EnterExitFrame(false, kRegExpExecuteArguments - kParameterRegisters); |
+ |
+ // Stack pointer now points to cell where return address is to be written. |
+ // Arguments are before that on the stack or in registers, meaning we |
+ // treat the return address as argument 5. Thus every argument after that |
+ // needs to be shifted back by 1. Since DirectCEntryStub will handle |
+ // allocating space for the c argument slots, we don't need to calculate |
+ // that into the argument positions on the stack. This is how the stack will |
+ // look (sp meaning the value of sp at this moment): |
+ // Abi n64: |
+ // [sp + 1] - Argument 9 |
+ // [sp + 0] - saved ra |
+ // Abi O32: |
+ // [sp + 5] - Argument 9 |
+ // [sp + 4] - Argument 8 |
+ // [sp + 3] - Argument 7 |
+ // [sp + 2] - Argument 6 |
+ // [sp + 1] - Argument 5 |
+ // [sp + 0] - saved ra |
+ |
+ // Argument 9: Pass current isolate address. |
+ __ li(t1, Operand(ExternalReference::isolate_address(isolate()))); |
+ __ Sd(t1, MemOperand(sp, 1 * kPointerSize)); |
+ |
+ // Argument 8: Indicate that this is a direct call from JavaScript. |
+ __ li(a7, Operand(1)); |
+ |
+ // Argument 7: Start (high end) of backtracking stack memory area. |
+ ExternalReference address_of_regexp_stack_memory_address = |
+ ExternalReference::address_of_regexp_stack_memory_address(isolate()); |
+ ExternalReference address_of_regexp_stack_memory_size = |
+ ExternalReference::address_of_regexp_stack_memory_size(isolate()); |
+ __ li(t1, Operand(address_of_regexp_stack_memory_address)); |
+ __ Ld(t1, MemOperand(t1, 0)); |
+ __ li(t2, Operand(address_of_regexp_stack_memory_size)); |
+ __ Ld(t2, MemOperand(t2, 0)); |
+ __ daddu(a6, t1, t2); |
+ |
+ // Argument 6: Set the number of capture registers to zero to force global |
+ // regexps to behave as non-global. This does not affect non-global regexps. |
+ __ mov(a5, zero_reg); |
+ |
+ // Argument 5: static offsets vector buffer. |
+ __ li( |
+ a4, |
+ Operand(ExternalReference::address_of_static_offsets_vector(isolate()))); |
+ |
+ // Argument 4, a3: End of string data |
+ // Argument 3, a2: Start of string data |
+ CHECK(a3.is(RegExpExecDescriptor::StringEndRegister())); |
+ CHECK(a2.is(RegExpExecDescriptor::StringStartRegister())); |
+ |
+ // Argument 2 (a1): Previous index. |
+ CHECK(a1.is(RegExpExecDescriptor::LastIndexRegister())); |
+ |
+ // Argument 1 (a0): Subject string. |
+ CHECK(a0.is(RegExpExecDescriptor::StringRegister())); |
+ |
+ // Locate the code entry and call it. |
+ Register code_reg = RegExpExecDescriptor::CodeRegister(); |
+ __ Daddu(code_reg, code_reg, Operand(Code::kHeaderSize - kHeapObjectTag)); |
+ DirectCEntryStub stub(isolate()); |
+ stub.GenerateCall(masm, code_reg); |
+ |
+ __ LeaveExitFrame(false, no_reg, true); |
+ |
+ // Return the smi-tagged result. |
+ __ SmiTag(v0); |
+ __ Ret(); |
+#endif // V8_INTERPRETED_REGEXP |
+} |
+ |
static void CallStubInRecordCallTarget(MacroAssembler* masm, CodeStub* stub) { |
// a0 : number of arguments to the construct function |