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

Unified Diff: runtime/vm/intrinsifier_arm64.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_arm64.cc
diff --git a/runtime/vm/intrinsifier_arm64.cc b/runtime/vm/intrinsifier_arm64.cc
index 65229be8c865f594a0649ca088ca6f62d560b1cb..03d3875eebc681a47d80af0935017ec9825b3a65 100644
--- a/runtime/vm/intrinsifier_arm64.cc
+++ b/runtime/vm/intrinsifier_arm64.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/object.h"
#include "vm/object_store.h"
+#include "vm/regexp_assembler.h"
#include "vm/symbols.h"
namespace dart {
@@ -1517,6 +1519,44 @@ void Intrinsifier::TwoByteString_equality(Assembler* assembler) {
}
+void Intrinsifier::JSRegExp_ExecuteMatch(Assembler* assembler) {
+ static const intptr_t kRegExpParamOffset = + 2 * kWordSize;
+ static const intptr_t kStringParamOffset = + 1 * kWordSize;
+ // const Smi& start_index is located at (+ 0 * kWordSize).
+
+ // Register assignments are as follows:
+ // R0: The appropriate specialized matcher function.
+ // R2: The regexp object.
+ // R4: Temp.
+ // R5: Temp.
+ // R1: Temp, Pointer to the function's code which we then tail-call.
+
+ __ ldr(R2, Address(SP, kRegExpParamOffset));
+ __ ldr(R1, Address(SP, kStringParamOffset));
+
+ // Load the specialized function pointer into R0. Leverage the fact the
+ // string CIDs as well as stored function pointers are in sequence.
+
+ __ LoadClassId(R1, R1, PP);
Florian Schneider 2014/10/07 12:49:37 I don't think you can use PP here, since the pool
jgruber1 2014/10/07 15:00:25 Done.
+ __ AddImmediate(R1, R1, -kOneByteStringCid, PP);
Florian Schneider 2014/10/07 12:49:37 kNoPP here and below as well.
jgruber1 2014/10/07 15:00:25 Done.
+ __ add(R1, R2, Operand(R1, LSL, kWordSizeLog2));
+ __ ldr(R0, FieldAddress(R1, JSRegExp::function_offset(kOneByteStringCid)));
+
+ // Registers have been set up for the lazy compile stub at this point.
+ // It expects the function in R0, the argument descriptor in R4, and
+ // IC-Data in R5. Explicitly null out IC-Data to ensure its validity.
+
+ static const intptr_t arg_count = RegExpMacroAssembler::kParamCount;
+ __ LoadObject(R4, Array::Handle(ArgumentsDescriptor::New(arg_count)), PP);
+ __ LoadImmediate(R5, reinterpret_cast<intptr_t>(Object::null()), PP);
+
+ // Tail-call the function.
+ __ ldr(R1, FieldAddress(R0, Function::instructions_offset()));
+ __ AddImmediate(R1, R1, Instructions::HeaderSize() - kHeapObjectTag, PP);
+ __ br(R1);
+}
+
+
// On stack: user tag (+0).
void Intrinsifier::UserTag_makeCurrent(Assembler* assembler) {
// R1: Isolate.

Powered by Google App Engine
This is Rietveld 408576698