Index: runtime/vm/intrinsifier_ia32.cc |
diff --git a/runtime/vm/intrinsifier_ia32.cc b/runtime/vm/intrinsifier_ia32.cc |
index 5c1b1df9c05d6155be396be8f001d1c06aaa66a6..713282a339076628770ab103785589c13e68705f 100644 |
--- a/runtime/vm/intrinsifier_ia32.cc |
+++ b/runtime/vm/intrinsifier_ia32.cc |
@@ -14,11 +14,12 @@ |
#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/os.h" |
-#include "vm/stub_code.h" |
+#include "vm/regexp_assembler.h" |
#include "vm/symbols.h" |
namespace dart { |
@@ -2049,6 +2050,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: |
+ // EAX: Function. (Will be loaded with the specialized matcher function.) |
+ // ECX: IC-Data. (Will be preserved.) |
+ // EDX: Arguments descriptor. (Will be preserved.) |
+ |
+ // Load the specialized function pointer into EAX. Leverage the fact the |
+ // string CIDs as well as stored function pointers are in sequence. |
+ __ movl(EBX, Address(ESP, kRegExpParamOffset)); |
+ __ movl(EDI, Address(ESP, kStringParamOffset)); |
+ __ LoadClassId(EDI, EDI); |
+ __ SubImmediate(EDI, Immediate(kOneByteStringCid)); |
+ __ movl(EAX, FieldAddress(EBX, EDI, TIMES_4, |
+ JSRegExp::function_offset(kOneByteStringCid))); |
+ |
+ // Registers are now set up for the lazy compile stub. It expects the function |
+ // in EAX, the argument descriptor in EDX, and IC-Data in ECX. |
+ static const intptr_t arg_count = RegExpMacroAssembler::kParamCount; |
+ __ LoadObject(EDX, Array::Handle(ArgumentsDescriptor::New(arg_count))); |
+ |
+ // Tail-call the function. |
+ __ movl(EDI, FieldAddress(EAX, Function::instructions_offset())); |
+ __ addl(EDI, Immediate(Instructions::HeaderSize() - kHeapObjectTag)); |
+ __ jmp(EDI); |
+} |
+ |
+ |
// On stack: user tag (+1), return-address (+0). |
void Intrinsifier::UserTag_makeCurrent(Assembler* assembler) { |
Isolate* isolate = Isolate::Current(); |