Index: runtime/vm/intrinsifier_ia32.cc |
diff --git a/runtime/vm/intrinsifier_ia32.cc b/runtime/vm/intrinsifier_ia32.cc |
index 9c1f404b481e097d87ee5cad397e022a9a1cca23..8d3d7aff3eed2e4cb45f6a854f4085fd5acbc857 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 { |
@@ -2046,6 +2047,45 @@ 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: |
+ // EAX: The appropriate specialized matcher function. |
+ // EBX: The regexp object. |
+ // EDI: Temp, Pointer to the function's code which we then tail-call. |
+ |
+ __ movl(EBX, Address(ESP, kRegExpParamOffset)); |
+ __ movl(EDI, Address(ESP, kStringParamOffset)); |
+ |
+ |
+ // Load the specialized function pointer into EAX. Leverage the fact the |
+ // string CIDs as well as stored function pointers are in sequence. |
+ |
+ __ LoadClassId(EDI, EDI); |
+ __ SubImmediate(EDI, Immediate(kOneByteStringCid)); |
+ __ movl(EAX, FieldAddress(EBX, EDI, TIMES_4, |
+ JSRegExp::function_offset(kOneByteStringCid))); |
+ |
+ // Registers have been set up for the lazy compile stub at this point. |
+ // It expects the function in EAX, the argument descriptor in EDX, and |
+ // IC-Data in ECX. Explicitly null out IC-Data to ensure its validity. |
+ |
+ static const intptr_t arg_count = RegExpMacroAssembler::kParamCount; |
+ __ LoadObject(EDX, Array::Handle(ArgumentsDescriptor::New(arg_count))); |
+ __ xorl(ECX, ECX); |
+ |
+ // Tail-call the function. |
+ __ movl(EDI, FieldAddress(EAX, Function::instructions_offset())); |
+ __ addl(EDI, Immediate(Instructions::HeaderSize() - kHeapObjectTag)); |
+ __ jmp(EDI); |
+} |
+#endif |
+ |
+ |
// On stack: user tag (+1), return-address (+0). |
void Intrinsifier::UserTag_makeCurrent(Assembler* assembler) { |
Isolate* isolate = Isolate::Current(); |