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

Unified Diff: runtime/vm/intrinsifier_x64.cc

Issue 683433003: Integrate the Irregexp Regular Expression Engine. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: byte-order assert & context-var Created 6 years, 1 month 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_x64.cc
diff --git a/runtime/vm/intrinsifier_x64.cc b/runtime/vm/intrinsifier_x64.cc
index 0ee068a8d45dee1d05519634efcdeaffb8467857..06f71b06151178c1c878c7c0c613ec4dfd85ad00 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 {
@@ -1914,6 +1916,42 @@ 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:
+ // RAX: The appropriate specialized matcher function.
+ // RBX: The regexp object.
+ // RDI: Temp, Pointer to the function's code which we then tail-call.
+
+ __ movq(RBX, Address(RSP, kRegExpParamOffset));
+ __ movq(RDI, Address(RSP, kStringParamOffset));
+
+ // Load the specialized function pointer into RAX. Leverage the fact the
+ // string CIDs as well as stored function pointers are in sequence.
+
+ __ LoadClassId(RDI, RDI);
+ __ SubImmediate(RDI, Immediate(kOneByteStringCid), PP);
+ __ movq(RAX, FieldAddress(RBX, RDI, TIMES_8,
+ JSRegExp::function_offset(kOneByteStringCid)));
+
+ // Registers have been set up for the lazy compile stub at this point.
+ // It expects the function in RAX, the argument descriptor in R10, and
+ // IC-Data in RCX. Explicitly null out IC-Data to ensure its validity.
+
+ static const intptr_t arg_count = RegExpMacroAssembler::kParamCount;
+ __ LoadObject(R10, Array::Handle(ArgumentsDescriptor::New(arg_count)), PP);
+ __ xorq(RCX, RCX);
+
+ // 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.

Powered by Google App Engine
This is Rietveld 408576698