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

Unified Diff: src/regexp/regexp-utils.h

Issue 2398413002: [regexp] Extract code to regexp-utils.{h,cc} (Closed)
Patch Set: Move IsRegExp to RegExpUtils as well Created 4 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
« no previous file with comments | « src/objects.cc ('k') | src/regexp/regexp-utils.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/regexp/regexp-utils.h
diff --git a/src/regexp/regexp-utils.h b/src/regexp/regexp-utils.h
new file mode 100644
index 0000000000000000000000000000000000000000..e57bd11f60d2758a8805159eadcee1d3285934dc
--- /dev/null
+++ b/src/regexp/regexp-utils.h
@@ -0,0 +1,65 @@
+// Copyright 2016 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef V8_REGEXP_REGEXP_UTILS_H_
+#define V8_REGEXP_REGEXP_UTILS_H_
+
+#include "src/objects.h"
+
+namespace v8 {
+namespace internal {
+
+// Helper methods for C++ regexp builtins.
+class RegExpUtils : public AllStatic {
+ public:
+ // Last match info accessors.
+ static Handle<Object> GetLastMatchField(Isolate* isolate,
+ Handle<JSObject> match_info,
+ int index);
+ static void SetLastMatchField(Isolate* isolate, Handle<JSObject> match_info,
+ int index, Handle<Object> value);
+ static int GetLastMatchNumberOfCaptures(Isolate* isolate,
+ Handle<JSObject> match_info);
+ static Handle<String> GetLastMatchSubject(Isolate* isolate,
+ Handle<JSObject> match_info);
+ static Handle<Object> GetLastMatchInput(Isolate* isolate,
+ Handle<JSObject> match_info);
+ static int GetLastMatchCapture(Isolate* isolate, Handle<JSObject> match_info,
+ int i);
+ static Handle<String> GenericCaptureGetter(Isolate* isolate,
+ Handle<JSObject> match_info,
+ int capture, bool* ok = nullptr);
+
+ // Last index (RegExp.lastIndex) accessors.
+ static MaybeHandle<Object> SetLastIndex(Isolate* isolate,
+ Handle<JSReceiver> regexp, int value);
+ static MaybeHandle<Object> GetLastIndex(Isolate* isolate,
+ Handle<JSReceiver> recv);
+
+ // ES#sec-regexpexec Runtime Semantics: RegExpExec ( R, S )
+ static MaybeHandle<Object> RegExpExec(Isolate* isolate,
+ Handle<JSReceiver> regexp,
+ Handle<String> string,
+ Handle<Object> exec);
+
+ // ES#sec-isregexp IsRegExp ( argument )
+ // Includes checking of the match property.
+ static Maybe<bool> IsRegExp(Isolate* isolate, Handle<Object> object);
+
+ // Checks whether exec is identical to the initial RegExp.prototype.exec.
+ static bool IsBuiltinExec(Handle<Object> exec);
+
+ // Generic index increment methods respecting unicode surrogate pairs.
+ static int AdvanceStringIndex(Isolate* isolate, Handle<String> string,
+ int index, bool unicode);
+ static MaybeHandle<Object> SetAdvancedStringIndex(Isolate* isolate,
+ Handle<JSReceiver> regexp,
+ Handle<String> string,
+ bool unicode);
+};
+
+} // namespace internal
+} // namespace v8
+
+#endif // V8_REGEXP_REGEXP_UTILS_H_
« no previous file with comments | « src/objects.cc ('k') | src/regexp/regexp-utils.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698