Index: runtime/vm/intrinsifier_mips.cc |
diff --git a/runtime/vm/intrinsifier_mips.cc b/runtime/vm/intrinsifier_mips.cc |
index e312650237dad0aef3e1890dc03645d815bf2110..016487b5bf6df6c6598c44c10f2b348ce0790861 100644 |
--- a/runtime/vm/intrinsifier_mips.cc |
+++ b/runtime/vm/intrinsifier_mips.cc |
@@ -8,9 +8,11 @@ |
#include "vm/intrinsifier.h" |
#include "vm/assembler.h" |
+#include "vm/dart_entry.h" |
#include "vm/flow_graph_compiler.h" |
#include "vm/object.h" |
#include "vm/object_store.h" |
+#include "vm/regexp_assembler.h" |
#include "vm/symbols.h" |
namespace dart { |
@@ -1669,6 +1671,45 @@ void Intrinsifier::TwoByteString_equality(Assembler* assembler) { |
StringEquality(assembler, kTwoByteStringCid); |
} |
+ |
+void Intrinsifier::JSRegExp_ExecuteMatch(Assembler* assembler) { |
+ static const intptr_t kRegExpParamOffset = + 2 * kWordSize; |
+ static const intptr_t kStringParamOffset = + 1 * kWordSize; |
+ // const Smi& start_index is located at (+ 0 * kWordSize). |
+ |
+ // Register assignments are as follows: |
+ // T0: The appropriate specialized matcher function. |
+ // T1: The regexp object. |
+ // T2: Temp. |
+ // T3: Temp, Pointer to the function's code which we then tail-call. |
+ |
+ __ lw(T1, Address(SP, kRegExpParamOffset)); |
+ __ lw(T3, Address(SP, kStringParamOffset)); |
+ |
+ // Load the specialized function pointer into T0. Leverage the fact the |
+ // string CIDs as well as stored function pointers are in sequence. |
+ |
+ __ LoadClassId(T2, T3); |
+ __ AddImmediate(T2, -kOneByteStringCid); |
+ __ sll(T2, T2, kWordSizeLog2); |
+ __ addu(T2, T2, T1); |
+ __ lw(T0, FieldAddress(T2, JSRegExp::function_offset(kOneByteStringCid))); |
+ |
+ // Registers have been set up for the lazy compile stub at this point. |
+ // It expects the function in T0, the argument descriptor in S4, and |
+ // IC-Data in S5. Explicitly null out IC-Data to ensure its validity. |
+ |
+ static const intptr_t arg_count = RegExpMacroAssembler::kParamCount; |
+ __ LoadObject(S4, Array::Handle(ArgumentsDescriptor::New(arg_count))); |
+ __ xor_(S5, S5, S5); |
+ |
+ // Tail-call the function. |
+ __ lw(T3, FieldAddress(T0, Function::instructions_offset())); |
+ __ AddImmediate(T3, Instructions::HeaderSize() - kHeapObjectTag); |
+ __ jr(T3); |
+} |
+ |
+ |
// On stack: user tag (+0). |
void Intrinsifier::UserTag_makeCurrent(Assembler* assembler) { |
// T1: Isolate. |