Index: runtime/vm/intrinsifier_x64.cc |
diff --git a/runtime/vm/intrinsifier_x64.cc b/runtime/vm/intrinsifier_x64.cc |
index e816a8ba93d3ec6d88c64baef4fdb1b469bc5877..892681d18b241b103f161b2d3e25f060a724d720 100644 |
--- a/runtime/vm/intrinsifier_x64.cc |
+++ b/runtime/vm/intrinsifier_x64.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/instructions.h" |
#include "vm/object_store.h" |
+#include "vm/regexp_assembler.h" |
#include "vm/symbols.h" |
namespace dart { |
@@ -1535,6 +1537,44 @@ void Intrinsifier::TwoByteString_equality(Assembler* assembler) { |
} |
+#ifndef USE_JSCRE |
+void Intrinsifier::JSRegExp_ExecuteMatch(Assembler* assembler) { |
+ static const intptr_t kRegExpParamOffset = + 3 * kWordSize; |
+ static const intptr_t kStringParamOffset = + 2 * kWordSize; |
+ // const Smi& start_index is located at (+ 1 * kWordSize). |
+ |
+ // Register assignments are as follows: |
+ // RAX: The appropriate specialized matcher function. |
+ // RBX: The regexp object. |
+ // RDI: Temp, Pointer to the function's code which we then tail-call. |
+ |
+ __ movq(RBX, Address(RSP, kRegExpParamOffset)); |
+ __ movq(RDI, Address(RSP, kStringParamOffset)); |
+ |
+ // Load the specialized function pointer into RAX. Leverage the fact the |
+ // string CIDs as well as stored function pointers are in sequence. |
+ |
+ __ LoadClassId(RDI, RDI); |
+ __ SubImmediate(RDI, Immediate(kOneByteStringCid), PP); |
+ __ movq(RAX, FieldAddress(RBX, RDI, TIMES_8, |
+ JSRegExp::function_offset(kOneByteStringCid))); |
+ |
+ // Registers have been set up for the lazy compile stub at this point. |
+ // It expects the function in RAX, the argument descriptor in R10, and |
+ // IC-Data in RCX. Explicitly null out IC-Data to ensure its validity. |
+ |
+ static const intptr_t arg_count = RegExpMacroAssembler::kParamCount; |
+ __ LoadObject(R10, Array::Handle(ArgumentsDescriptor::New(arg_count)), PP); |
+ __ xorq(RCX, RCX); |
+ |
+ // Tail-call the function. |
+ __ movq(RDI, FieldAddress(RAX, Function::instructions_offset())); |
+ __ addq(RDI, Immediate(Instructions::HeaderSize() - kHeapObjectTag)); |
+ __ jmp(RDI); |
+} |
+#endif |
+ |
+ |
// On stack: user tag (+1), return-address (+0). |
void Intrinsifier::UserTag_makeCurrent(Assembler* assembler) { |
// RBX: Isolate. |