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

Unified Diff: runtime/lib/regexp.cc

Issue 1201383002: Port irregexp bytecode compiler and interpreter from V8 r24065. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 5 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
« no previous file with comments | « no previous file | runtime/vm/compiler.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/lib/regexp.cc
diff --git a/runtime/lib/regexp.cc b/runtime/lib/regexp.cc
index 6ffeb6d031cc520e075f9f40526f347c5f107efa..6fd9d6f1ccd0d2af02f123dfe5c6dce1de908b93 100644
--- a/runtime/lib/regexp.cc
+++ b/runtime/lib/regexp.cc
@@ -8,11 +8,14 @@
#include "vm/native_entry.h"
#include "vm/object.h"
#include "vm/regexp_parser.h"
+#include "vm/regexp_assembler_ir.h"
+#include "vm/regexp_assembler_bytecode.h"
#include "vm/thread.h"
namespace dart {
DECLARE_FLAG(bool, trace_irregexp);
+DECLARE_FLAG(bool, interpret_irregexp);
DEFINE_NATIVE_ENTRY(JSSyntaxRegExp_factory, 4) {
@@ -82,18 +85,23 @@ DEFINE_NATIVE_ENTRY(JSSyntaxRegExp_getGroupCount, 1) {
DEFINE_NATIVE_ENTRY(JSSyntaxRegExp_ExecuteMatch, 3) {
const JSRegExp& regexp = JSRegExp::CheckedHandle(arguments->NativeArgAt(0));
ASSERT(!regexp.IsNull());
- GET_NON_NULL_NATIVE_ARGUMENT(String, str, arguments->NativeArgAt(1));
+ GET_NON_NULL_NATIVE_ARGUMENT(String, subject, arguments->NativeArgAt(1));
GET_NON_NULL_NATIVE_ARGUMENT(Smi, start_index, arguments->NativeArgAt(2));
+ if (FLAG_interpret_irregexp) {
+ return BytecodeRegExpMacroAssembler::Interpret(regexp, subject, start_index,
+ zone);
+ }
+
// This function is intrinsified. See Intrinsifier::JSRegExp_ExecuteMatch.
- const intptr_t cid = str.GetClassId();
+ const intptr_t cid = subject.GetClassId();
// Retrieve the cached function.
const Function& fn = Function::Handle(regexp.function(cid));
ASSERT(!fn.IsNull());
// And finally call the generated code.
- return IRRegExpMacroAssembler::Execute(fn, str, start_index, zone);
+ return IRRegExpMacroAssembler::Execute(fn, subject, start_index, zone);
}
} // namespace dart
« no previous file with comments | « no previous file | runtime/vm/compiler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698