Index: runtime/vm/intrinsifier_x64.cc |
diff --git a/runtime/vm/intrinsifier_x64.cc b/runtime/vm/intrinsifier_x64.cc |
index 320f9b87692aa6abe38af92ff47145c89df27213..2cb9d36d92c51c1b19641e71a7a31c5c111d06da 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 { |
@@ -1917,6 +1919,40 @@ void Intrinsifier::TwoByteString_equality(Assembler* assembler) { |
} |
+void Intrinsifier::JSRegExp_ExecuteMatch(Assembler* assembler) { |
+ if (FLAG_use_jscre) { |
+ return; |
+ } |
+ static const intptr_t kRegExpParamOffset = 3 * kWordSize; |
+ static const intptr_t kStringParamOffset = 2 * kWordSize; |
+ // start_index smi is located at offset 1. |
+ |
+ // Incoming registers: |
+ // RAX: Function. (Will be loaded with the specialized matcher function.) |
+ // RCX: IC-Data. (Will be preserved.) |
+ // R10: Arguments descriptor. (Will be preserved.) |
+ |
+ // Load the specialized function pointer into RAX. Leverage the fact the |
+ // string CIDs as well as stored function pointers are in sequence. |
+ __ movq(RBX, Address(RSP, kRegExpParamOffset)); |
+ __ movq(RDI, Address(RSP, kStringParamOffset)); |
+ __ LoadClassId(RDI, RDI); |
+ __ SubImmediate(RDI, Immediate(kOneByteStringCid), PP); |
+ __ movq(RAX, FieldAddress(RBX, RDI, TIMES_8, |
+ JSRegExp::function_offset(kOneByteStringCid))); |
+ |
+ // Registers are now set up for the lazy compile stub. It expects the function |
+ // in RAX, the argument descriptor in R10, and IC-Data in RCX. |
+ static const intptr_t arg_count = RegExpMacroAssembler::kParamCount; |
+ __ LoadObject(R10, Array::Handle(ArgumentsDescriptor::New(arg_count)), PP); |
+ |
+ // Tail-call the function. |
+ __ movq(RDI, FieldAddress(RAX, Function::instructions_offset())); |
+ __ addq(RDI, Immediate(Instructions::HeaderSize() - kHeapObjectTag)); |
+ __ jmp(RDI); |
+} |
+ |
+ |
// On stack: user tag (+1), return-address (+0). |
void Intrinsifier::UserTag_makeCurrent(Assembler* assembler) { |
// RBX: Isolate. |