OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "src/regexp/jsregexp.h" | 5 #include "src/regexp/jsregexp.h" |
6 | 6 |
7 #include "src/ast/ast.h" | 7 #include "src/ast/ast.h" |
8 #include "src/base/platform/platform.h" | 8 #include "src/base/platform/platform.h" |
9 #include "src/compilation-cache.h" | 9 #include "src/compilation-cache.h" |
10 #include "src/compiler.h" | 10 #include "src/compiler.h" |
(...skipping 6079 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6090 | 6090 |
6091 void CharacterRange::Negate(ZoneList<CharacterRange>* ranges, | 6091 void CharacterRange::Negate(ZoneList<CharacterRange>* ranges, |
6092 ZoneList<CharacterRange>* negated_ranges, | 6092 ZoneList<CharacterRange>* negated_ranges, |
6093 Zone* zone) { | 6093 Zone* zone) { |
6094 DCHECK(CharacterRange::IsCanonical(ranges)); | 6094 DCHECK(CharacterRange::IsCanonical(ranges)); |
6095 DCHECK_EQ(0, negated_ranges->length()); | 6095 DCHECK_EQ(0, negated_ranges->length()); |
6096 int range_count = ranges->length(); | 6096 int range_count = ranges->length(); |
6097 uc32 from = 0; | 6097 uc32 from = 0; |
6098 int i = 0; | 6098 int i = 0; |
6099 if (range_count > 0 && ranges->at(0).from() == 0) { | 6099 if (range_count > 0 && ranges->at(0).from() == 0) { |
6100 from = ranges->at(0).to(); | 6100 from = ranges->at(0).to() + 1; |
6101 i = 1; | 6101 i = 1; |
6102 } | 6102 } |
6103 while (i < range_count) { | 6103 while (i < range_count) { |
6104 CharacterRange range = ranges->at(i); | 6104 CharacterRange range = ranges->at(i); |
6105 negated_ranges->Add(CharacterRange(from + 1, range.from() - 1), zone); | 6105 negated_ranges->Add(CharacterRange(from, range.from() - 1), zone); |
6106 from = range.to(); | 6106 from = range.to() + 1; |
6107 i++; | 6107 i++; |
6108 } | 6108 } |
6109 if (from < String::kMaxCodePoint) { | 6109 if (from < String::kMaxCodePoint) { |
6110 negated_ranges->Add(CharacterRange(from + 1, String::kMaxCodePoint), zone); | 6110 negated_ranges->Add(CharacterRange(from, String::kMaxCodePoint), zone); |
6111 } | 6111 } |
6112 } | 6112 } |
6113 | 6113 |
6114 | 6114 |
6115 // ------------------------------------------------------------------- | 6115 // ------------------------------------------------------------------- |
6116 // Splay tree | 6116 // Splay tree |
6117 | 6117 |
6118 | 6118 |
6119 OutSet* OutSet::Extend(unsigned value, Zone* zone) { | 6119 OutSet* OutSet::Extend(unsigned value, Zone* zone) { |
6120 if (Get(value)) | 6120 if (Get(value)) |
(...skipping 738 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6859 | 6859 |
6860 | 6860 |
6861 void RegExpResultsCache::Clear(FixedArray* cache) { | 6861 void RegExpResultsCache::Clear(FixedArray* cache) { |
6862 for (int i = 0; i < kRegExpResultsCacheSize; i++) { | 6862 for (int i = 0; i < kRegExpResultsCacheSize; i++) { |
6863 cache->set(i, Smi::FromInt(0)); | 6863 cache->set(i, Smi::FromInt(0)); |
6864 } | 6864 } |
6865 } | 6865 } |
6866 | 6866 |
6867 } // namespace internal | 6867 } // namespace internal |
6868 } // namespace v8 | 6868 } // namespace v8 |
OLD | NEW |