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 3570 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3581 AlternativeGeneration* at(int i) { | 3581 AlternativeGeneration* at(int i) { |
3582 return alt_gens_[i]; | 3582 return alt_gens_[i]; |
3583 } | 3583 } |
3584 | 3584 |
3585 private: | 3585 private: |
3586 static const int kAFew = 10; | 3586 static const int kAFew = 10; |
3587 ZoneList<AlternativeGeneration*> alt_gens_; | 3587 ZoneList<AlternativeGeneration*> alt_gens_; |
3588 AlternativeGeneration a_few_alt_gens_[kAFew]; | 3588 AlternativeGeneration a_few_alt_gens_[kAFew]; |
3589 }; | 3589 }; |
3590 | 3590 |
| 3591 |
3591 static const uc32 kRangeEndMarker = 0x110000; | 3592 static const uc32 kRangeEndMarker = 0x110000; |
3592 | 3593 |
3593 // The '2' variant is has inclusive from and exclusive to. | 3594 // The '2' variant is has inclusive from and exclusive to. |
3594 // This covers \s as defined in ECMA-262 5.1, 15.10.2.12, | 3595 // This covers \s as defined in ECMA-262 5.1, 15.10.2.12, |
3595 // which include WhiteSpace (7.2) or LineTerminator (7.3) values. | 3596 // which include WhiteSpace (7.2) or LineTerminator (7.3) values. |
3596 static const int kSpaceRanges[] = { | 3597 static const int kSpaceRanges[] = { |
3597 '\t', '\r' + 1, ' ', ' ' + 1, 0x00A0, 0x00A1, 0x1680, 0x1681, | 3598 '\t', '\r' + 1, ' ', ' ' + 1, 0x00A0, 0x00A1, 0x1680, 0x1681, |
3598 0x180E, 0x180F, 0x2000, 0x200B, 0x2028, 0x202A, 0x202F, 0x2030, | 3599 0x180E, 0x180F, 0x2000, 0x200B, 0x2028, 0x202A, 0x202F, 0x2030, |
3599 0x205F, 0x2060, 0x3000, 0x3001, 0xFEFF, 0xFF00, kRangeEndMarker}; | 3600 0x205F, 0x2060, 0x3000, 0x3001, 0xFEFF, 0xFF00, kRangeEndMarker}; |
3600 static const int kSpaceRangeCount = arraysize(kSpaceRanges); | 3601 static const int kSpaceRangeCount = arraysize(kSpaceRanges); |
(...skipping 790 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4391 DCHECK_EQ(start_reg_ + 1, end_reg_); | 4392 DCHECK_EQ(start_reg_ + 1, end_reg_); |
4392 if (compiler->ignore_case()) { | 4393 if (compiler->ignore_case()) { |
4393 assembler->CheckNotBackReferenceIgnoreCase( | 4394 assembler->CheckNotBackReferenceIgnoreCase( |
4394 start_reg_, read_backward(), compiler->unicode(), trace->backtrack()); | 4395 start_reg_, read_backward(), compiler->unicode(), trace->backtrack()); |
4395 } else { | 4396 } else { |
4396 assembler->CheckNotBackReference(start_reg_, read_backward(), | 4397 assembler->CheckNotBackReference(start_reg_, read_backward(), |
4397 trace->backtrack()); | 4398 trace->backtrack()); |
4398 } | 4399 } |
4399 // We are going to advance backward, so we may end up at the start. | 4400 // We are going to advance backward, so we may end up at the start. |
4400 if (read_backward()) trace->set_at_start(Trace::UNKNOWN); | 4401 if (read_backward()) trace->set_at_start(Trace::UNKNOWN); |
| 4402 |
| 4403 // Check that the back reference does not end inside a surrogate pair. |
| 4404 if (compiler->unicode() && !compiler->one_byte()) { |
| 4405 assembler->CheckNotInSurrogatePair(trace->cp_offset(), trace->backtrack()); |
| 4406 } |
4401 on_success()->Emit(compiler, trace); | 4407 on_success()->Emit(compiler, trace); |
4402 } | 4408 } |
4403 | 4409 |
4404 | 4410 |
4405 // ------------------------------------------------------------------- | 4411 // ------------------------------------------------------------------- |
4406 // Dot/dotty output | 4412 // Dot/dotty output |
4407 | 4413 |
4408 | 4414 |
4409 #ifdef DEBUG | 4415 #ifdef DEBUG |
4410 | 4416 |
(...skipping 2444 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6855 | 6861 |
6856 | 6862 |
6857 void RegExpResultsCache::Clear(FixedArray* cache) { | 6863 void RegExpResultsCache::Clear(FixedArray* cache) { |
6858 for (int i = 0; i < kRegExpResultsCacheSize; i++) { | 6864 for (int i = 0; i < kRegExpResultsCacheSize; i++) { |
6859 cache->set(i, Smi::FromInt(0)); | 6865 cache->set(i, Smi::FromInt(0)); |
6860 } | 6866 } |
6861 } | 6867 } |
6862 | 6868 |
6863 } // namespace internal | 6869 } // namespace internal |
6864 } // namespace v8 | 6870 } // namespace v8 |
OLD | NEW |