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

Unified Diff: src/regexp/jsregexp.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
« no previous file with comments | « no previous file | src/regexp/regexp-macro-assembler.h » ('j') | src/regexp/regexp-macro-assembler.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/regexp/jsregexp.cc
diff --git a/src/regexp/jsregexp.cc b/src/regexp/jsregexp.cc
index 6235c25c7762f05ef399fc31838e64a10e2b2a39..777ee610e4b5eb4f9bc308e41985d5ba9c83e17c 100644
--- a/src/regexp/jsregexp.cc
+++ b/src/regexp/jsregexp.cc
@@ -3587,12 +3587,6 @@ class AlternativeGenerationList {
};
-static const uc32 kLeadSurrogateStart = 0xd800;
-static const uc32 kLeadSurrogateEnd = 0xdbff;
-static const uc32 kTrailSurrogateStart = 0xdc00;
-static const uc32 kTrailSurrogateEnd = 0xdfff;
-static const uc32 kNonBmpStart = 0x10000;
-static const uc32 kNonBmpEnd = 0x10ffff;
static const uc32 kRangeEndMarker = 0x110000;
// The '2' variant is has inclusive from and exclusive to.
@@ -4393,6 +4387,11 @@ void BackReferenceNode::Emit(RegExpCompiler* compiler, Trace* trace) {
RecursionCheck rc(compiler);
+ bool surrogate_check = compiler->unicode() && !compiler->one_byte();
+ if (surrogate_check) {
+ assembler->CheckNotInSurrogatePair(trace->cp_offset(), trace->backtrack());
+ }
erikcorry 2016/01/26 16:25:06 You don't need this check (and thus you don't need
Yang 2016/01/27 09:06:06 Done. Thanks.
+
DCHECK_EQ(start_reg_ + 1, end_reg_);
if (compiler->ignore_case()) {
assembler->CheckNotBackReferenceIgnoreCase(start_reg_, read_backward(),
@@ -4403,6 +4402,10 @@ void BackReferenceNode::Emit(RegExpCompiler* compiler, Trace* trace) {
}
// We are going to advance backward, so we may end up at the start.
if (read_backward()) trace->set_at_start(Trace::UNKNOWN);
+
+ if (surrogate_check) {
+ assembler->CheckNotInSurrogatePair(trace->cp_offset(), trace->backtrack());
+ }
on_success()->Emit(compiler, trace);
}
« no previous file with comments | « no previous file | src/regexp/regexp-macro-assembler.h » ('j') | src/regexp/regexp-macro-assembler.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698