Chromium Code Reviews| Index: runtime/vm/intrinsifier_ia32.cc |
| diff --git a/runtime/vm/intrinsifier_ia32.cc b/runtime/vm/intrinsifier_ia32.cc |
| index 5945dbd62bb06410470d21ad9a143aa22bb27cca..e98e4c8d1a46b80c906c52cd3cb0454e985a7fd4 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 { |
| @@ -2052,6 +2053,43 @@ void Intrinsifier::TwoByteString_equality(Assembler* assembler) { |
| } |
| +void Intrinsifier::JSRegExp_ExecuteMatch(Assembler* assembler) { |
|
Ivan Posva
2014/11/14 08:42:50
ditto
stub_code_ia32.cc can also serve as a good
zerny-google
2014/11/14 12:18:57
Done.
|
| + 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); |
| +} |
| + |
| + |
| // On stack: user tag (+1), return-address (+0). |
| void Intrinsifier::UserTag_makeCurrent(Assembler* assembler) { |
| Isolate* isolate = Isolate::Current(); |