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

Unified Diff: src/regexp/regexp-macro-assembler.cc

Issue 1601653006: [regexp] back refs must not start/end in the middle of a surrogate pair (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@unicodeclass
Patch Set: rebase Created 4 years, 11 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: src/regexp/regexp-macro-assembler.cc
diff --git a/src/regexp/regexp-macro-assembler.cc b/src/regexp/regexp-macro-assembler.cc
index caf8b51fe548d6a9e68365654110473ddbdea9b5..89e162a802ef08a4dbb452e1be51c8aedfbd5f6f 100644
--- a/src/regexp/regexp-macro-assembler.cc
+++ b/src/regexp/regexp-macro-assembler.cc
@@ -23,6 +23,21 @@ RegExpMacroAssembler::~RegExpMacroAssembler() {
}
+void RegExpMacroAssembler::CheckNotInSurrogatePair(int cp_offset,
+ Label* on_failure) {
+ Label ok;
+ // Check that current character is not a trail surrogate.
+ LoadCurrentCharacter(cp_offset, &ok, true, 1);
erikcorry 2016/01/26 16:25:06 True, 1 are default args and not needed.
Yang 2016/01/27 09:06:06 Done.
+ CheckCharacterNotInRange(kTrailSurrogateStart, kTrailSurrogateEnd, &ok);
+ // Check that previous character is not a lead surrogate.
+ LoadCurrentCharacter(cp_offset - 1, &ok, true, 1);
+ CheckCharacterNotInRange(kLeadSurrogateStart, kLeadSurrogateEnd, &ok);
erikcorry 2016/01/26 16:25:06 CheckCharacterInRange(on_failure) ?
Yang 2016/01/27 09:06:06 Done.
+ // Looks like we are right in between a lead and a trail surrogate.
+ GoTo(on_failure);
+ Bind(&ok);
+}
+
+
#ifndef V8_INTERPRETED_REGEXP // Avoid unused code, e.g., on ARM.
NativeRegExpMacroAssembler::NativeRegExpMacroAssembler(Isolate* isolate,

Powered by Google App Engine
This is Rietveld 408576698