Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(977)

Unified Diff: runtime/vm/intrinsifier_ia32.cc

Issue 539153002: Port and integrate the irregexp engine from V8 (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Explicitly null IC-Data, whitespace fixes in tests. Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: runtime/vm/intrinsifier_ia32.cc
diff --git a/runtime/vm/intrinsifier_ia32.cc b/runtime/vm/intrinsifier_ia32.cc
index 458d911b6f011fdffb7756129e6d60fc5d311734..05ff34f16d60261de552c8403bfd51f12fd31909 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 {
@@ -2063,6 +2064,43 @@ void Intrinsifier::TwoByteString_equality(Assembler* assembler) {
}
+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)));
+ __ movl(ECX, Immediate(reinterpret_cast<intptr_t>(Object::null())));
Florian Schneider 2014/10/07 12:49:36 Alternatively, just store smi 0: __ xorl(ECX, ECX
jgruber1 2014/10/07 15:00:25 Done.
+
+ // 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();

Powered by Google App Engine
This is Rietveld 408576698