Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(171)

Unified Diff: src/mips/code-stubs-mips.cc

Issue 2832193002: Revert of [regexp] Remove remainder of native RegExpExecStub (Closed)
Patch Set: Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/interface-descriptors.cc ('k') | src/mips/interface-descriptors-mips.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/mips/code-stubs-mips.cc
diff --git a/src/mips/code-stubs-mips.cc b/src/mips/code-stubs-mips.cc
index 8dbf1844f9d040e73b0a887adae5a14ad9a611a0..2f5fa2cec1db8f5cfb839ecceae5bc83e0ac6e5e 100644
--- a/src/mips/code-stubs-mips.cc
+++ b/src/mips/code-stubs-mips.cc
@@ -1271,6 +1271,87 @@
__ 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 = 4;
+ __ 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):
+ // [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.
+ // CFunctionArgumentOperand handles MIPS stack argument slots.
+ __ li(t1, Operand(ExternalReference::isolate_address(isolate())));
+ __ sw(t1, MemOperand(sp, 5 * kPointerSize));
+
+ // Argument 8: Indicate that this is a direct call from JavaScript.
+ __ li(t1, Operand(1));
+ __ sw(t1, MemOperand(sp, 4 * kPointerSize));
+
+ // 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));
+ __ lw(t1, MemOperand(t1, 0));
+ __ li(t2, Operand(address_of_regexp_stack_memory_size));
+ __ lw(t2, MemOperand(t2, 0));
+ __ addu(t1, t1, t2);
+ __ sw(t1, MemOperand(sp, 3 * kPointerSize));
+
+ // 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(t1, zero_reg);
+ __ sw(t1, MemOperand(sp, 2 * kPointerSize));
+
+ // Argument 5: static offsets vector buffer.
+ __ li(
+ t1,
+ Operand(ExternalReference::address_of_static_offsets_vector(isolate())));
+ __ sw(t1, MemOperand(sp, 1 * kPointerSize));
+
+ // 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();
+ __ Addu(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
« no previous file with comments | « src/interface-descriptors.cc ('k') | src/mips/interface-descriptors-mips.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698