| Index: src/regexp/jsregexp.cc
|
| diff --git a/src/regexp/jsregexp.cc b/src/regexp/jsregexp.cc
|
| index 720a60aa94e41702f5871ab08c1a259f025aba79..31fcec6b9237c691fbd353205957321af4a38611 100644
|
| --- a/src/regexp/jsregexp.cc
|
| +++ b/src/regexp/jsregexp.cc
|
| @@ -4899,16 +4899,18 @@ UnicodeRangeSplitter::UnicodeRangeSplitter(Zone* zone,
|
| table_.AddRange(base->at(i), kBase, zone_);
|
| }
|
| // Add overlay ranges.
|
| - table_.AddRange(CharacterRange(0, kLeadSurrogateStart - 1), kBmpCodePoints,
|
| - zone_);
|
| - table_.AddRange(CharacterRange(kLeadSurrogateStart, kLeadSurrogateEnd),
|
| - kLeadSurrogates, zone_);
|
| - table_.AddRange(CharacterRange(kTrailSurrogateStart, kTrailSurrogateEnd),
|
| - kTrailSurrogates, zone_);
|
| - table_.AddRange(CharacterRange(kTrailSurrogateEnd + 1, kNonBmpStart - 1),
|
| + table_.AddRange(CharacterRange::Range(0, kLeadSurrogateStart - 1),
|
| kBmpCodePoints, zone_);
|
| - table_.AddRange(CharacterRange(kNonBmpStart, kNonBmpEnd), kNonBmpCodePoints,
|
| - zone_);
|
| + table_.AddRange(CharacterRange::Range(kLeadSurrogateStart, kLeadSurrogateEnd),
|
| + kLeadSurrogates, zone_);
|
| + table_.AddRange(
|
| + CharacterRange::Range(kTrailSurrogateStart, kTrailSurrogateEnd),
|
| + kTrailSurrogates, zone_);
|
| + table_.AddRange(
|
| + CharacterRange::Range(kTrailSurrogateEnd + 1, kNonBmpStart - 1),
|
| + kBmpCodePoints, zone_);
|
| + table_.AddRange(CharacterRange::Range(kNonBmpStart, kNonBmpEnd),
|
| + kNonBmpCodePoints, zone_);
|
| table_.ForEach(this);
|
| }
|
|
|
| @@ -5795,7 +5797,7 @@ static void AddClass(const int* elmv,
|
| DCHECK(elmv[elmc] == kRangeEndMarker);
|
| for (int i = 0; i < elmc; i += 2) {
|
| DCHECK(elmv[i] < elmv[i + 1]);
|
| - ranges->Add(CharacterRange(elmv[i], elmv[i + 1] - 1), zone);
|
| + ranges->Add(CharacterRange::Range(elmv[i], elmv[i + 1] - 1), zone);
|
| }
|
| }
|
|
|
| @@ -5812,10 +5814,10 @@ static void AddClassNegated(const int *elmv,
|
| for (int i = 0; i < elmc; i += 2) {
|
| DCHECK(last <= elmv[i] - 1);
|
| DCHECK(elmv[i] < elmv[i + 1]);
|
| - ranges->Add(CharacterRange(last, elmv[i] - 1), zone);
|
| + ranges->Add(CharacterRange::Range(last, elmv[i] - 1), zone);
|
| last = elmv[i + 1];
|
| }
|
| - ranges->Add(CharacterRange(last, String::kMaxCodePoint), zone);
|
| + ranges->Add(CharacterRange::Range(last, String::kMaxCodePoint), zone);
|
| }
|
|
|
|
|
| @@ -5933,7 +5935,7 @@ void CharacterRange::AddCaseEquivalents(Isolate* isolate, Zone* zone,
|
| uc32 range_from = c - (block_end - pos);
|
| uc32 range_to = c - (block_end - end);
|
| if (!(bottom <= range_from && range_to <= top)) {
|
| - ranges->Add(CharacterRange(range_from, range_to), zone);
|
| + ranges->Add(CharacterRange::Range(range_from, range_to), zone);
|
| }
|
| }
|
| pos = end + 1;
|
| @@ -6027,7 +6029,7 @@ static int InsertRangeInCanonicalList(ZoneList<CharacterRange>* list,
|
| CharacterRange to_replace = list->at(start_pos);
|
| int new_from = Min(to_replace.from(), from);
|
| int new_to = Max(to_replace.to(), to);
|
| - list->at(start_pos) = CharacterRange(new_from, new_to);
|
| + list->at(start_pos) = CharacterRange::Range(new_from, new_to);
|
| return count;
|
| }
|
| // Replace a number of existing ranges from start_pos to end_pos - 1.
|
| @@ -6038,7 +6040,7 @@ static int InsertRangeInCanonicalList(ZoneList<CharacterRange>* list,
|
| if (end_pos < count) {
|
| MoveRanges(list, end_pos, start_pos + 1, count - end_pos);
|
| }
|
| - list->at(start_pos) = CharacterRange(new_from, new_to);
|
| + list->at(start_pos) = CharacterRange::Range(new_from, new_to);
|
| return count - (end_pos - start_pos) + 1;
|
| }
|
|
|
| @@ -6097,17 +6099,18 @@ void CharacterRange::Negate(ZoneList<CharacterRange>* ranges,
|
| uc32 from = 0;
|
| int i = 0;
|
| if (range_count > 0 && ranges->at(0).from() == 0) {
|
| - from = ranges->at(0).to();
|
| + from = ranges->at(0).to() + 1;
|
| i = 1;
|
| }
|
| while (i < range_count) {
|
| CharacterRange range = ranges->at(i);
|
| - negated_ranges->Add(CharacterRange(from + 1, range.from() - 1), zone);
|
| - from = range.to();
|
| + negated_ranges->Add(CharacterRange::Range(from, range.from() - 1), zone);
|
| + from = range.to() + 1;
|
| i++;
|
| }
|
| if (from < String::kMaxCodePoint) {
|
| - negated_ranges->Add(CharacterRange(from + 1, String::kMaxCodePoint), zone);
|
| + negated_ranges->Add(CharacterRange::Range(from, String::kMaxCodePoint),
|
| + zone);
|
| }
|
| }
|
|
|
| @@ -6186,8 +6189,9 @@ void DispatchTable::AddRange(CharacterRange full_range, int value,
|
| if (entry->from() < current.from() && entry->to() >= current.from()) {
|
| // Snap the overlapping range in half around the start point of
|
| // the range we're adding.
|
| - CharacterRange left(entry->from(), current.from() - 1);
|
| - CharacterRange right(current.from(), entry->to());
|
| + CharacterRange left =
|
| + CharacterRange::Range(entry->from(), current.from() - 1);
|
| + CharacterRange right = CharacterRange::Range(current.from(), entry->to());
|
| // The left part of the overlapping range doesn't overlap.
|
| // Truncate the whole entry to be just the left part.
|
| entry->set_to(left.to());
|
| @@ -6493,8 +6497,7 @@ class AddDispatchRange {
|
|
|
|
|
| void AddDispatchRange::Call(uc32 from, DispatchTable::Entry entry) {
|
| - CharacterRange range(from, entry.to());
|
| - constructor_->AddRange(range);
|
| + constructor_->AddRange(CharacterRange::Range(from, entry.to()));
|
| }
|
|
|
|
|
| @@ -6532,7 +6535,7 @@ void DispatchTableConstructor::AddInverse(ZoneList<CharacterRange>* ranges) {
|
| for (int i = 0; i < ranges->length(); i++) {
|
| CharacterRange range = ranges->at(i);
|
| if (last < range.from())
|
| - AddRange(CharacterRange(last, range.from() - 1));
|
| + AddRange(CharacterRange::Range(last, range.from() - 1));
|
| if (range.to() >= last) {
|
| if (range.to() == String::kMaxUtf16CodeUnit) {
|
| return;
|
| @@ -6541,7 +6544,7 @@ void DispatchTableConstructor::AddInverse(ZoneList<CharacterRange>* ranges) {
|
| }
|
| }
|
| }
|
| - AddRange(CharacterRange(last, String::kMaxUtf16CodeUnit));
|
| + AddRange(CharacterRange::Range(last, String::kMaxUtf16CodeUnit));
|
| }
|
|
|
|
|
| @@ -6550,7 +6553,7 @@ void DispatchTableConstructor::VisitText(TextNode* that) {
|
| switch (elm.text_type()) {
|
| case TextElement::ATOM: {
|
| uc16 c = elm.atom()->data()[0];
|
| - AddRange(CharacterRange(c, c));
|
| + AddRange(CharacterRange::Range(c, c));
|
| break;
|
| }
|
| case TextElement::CHAR_CLASS: {
|
|
|