Chromium Code Reviews| 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 3569 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3580 return alt_gens_[i]; | 3580 return alt_gens_[i]; |
| 3581 } | 3581 } |
| 3582 | 3582 |
| 3583 private: | 3583 private: |
| 3584 static const int kAFew = 10; | 3584 static const int kAFew = 10; |
| 3585 ZoneList<AlternativeGeneration*> alt_gens_; | 3585 ZoneList<AlternativeGeneration*> alt_gens_; |
| 3586 AlternativeGeneration a_few_alt_gens_[kAFew]; | 3586 AlternativeGeneration a_few_alt_gens_[kAFew]; |
| 3587 }; | 3587 }; |
| 3588 | 3588 |
| 3589 | 3589 |
| 3590 static const uc32 kLeadSurrogateStart = 0xd800; | |
| 3591 static const uc32 kLeadSurrogateEnd = 0xdbff; | |
| 3592 static const uc32 kTrailSurrogateStart = 0xdc00; | |
| 3593 static const uc32 kTrailSurrogateEnd = 0xdfff; | |
| 3594 static const uc32 kNonBmpStart = 0x10000; | |
| 3595 static const uc32 kNonBmpEnd = 0x10ffff; | |
| 3596 static const uc32 kRangeEndMarker = 0x110000; | 3590 static const uc32 kRangeEndMarker = 0x110000; |
| 3597 | 3591 |
| 3598 // The '2' variant is has inclusive from and exclusive to. | 3592 // The '2' variant is has inclusive from and exclusive to. |
| 3599 // This covers \s as defined in ECMA-262 5.1, 15.10.2.12, | 3593 // This covers \s as defined in ECMA-262 5.1, 15.10.2.12, |
| 3600 // which include WhiteSpace (7.2) or LineTerminator (7.3) values. | 3594 // which include WhiteSpace (7.2) or LineTerminator (7.3) values. |
| 3601 static const int kSpaceRanges[] = { | 3595 static const int kSpaceRanges[] = { |
| 3602 '\t', '\r' + 1, ' ', ' ' + 1, 0x00A0, 0x00A1, 0x1680, 0x1681, | 3596 '\t', '\r' + 1, ' ', ' ' + 1, 0x00A0, 0x00A1, 0x1680, 0x1681, |
| 3603 0x180E, 0x180F, 0x2000, 0x200B, 0x2028, 0x202A, 0x202F, 0x2030, | 3597 0x180E, 0x180F, 0x2000, 0x200B, 0x2028, 0x202A, 0x202F, 0x2030, |
| 3604 0x205F, 0x2060, 0x3000, 0x3001, 0xFEFF, 0xFF00, kRangeEndMarker}; | 3598 0x205F, 0x2060, 0x3000, 0x3001, 0xFEFF, 0xFF00, kRangeEndMarker}; |
| 3605 static const int kSpaceRangeCount = arraysize(kSpaceRanges); | 3599 static const int kSpaceRangeCount = arraysize(kSpaceRanges); |
| (...skipping 780 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4386 trace->Flush(compiler, this); | 4380 trace->Flush(compiler, this); |
| 4387 return; | 4381 return; |
| 4388 } | 4382 } |
| 4389 | 4383 |
| 4390 LimitResult limit_result = LimitVersions(compiler, trace); | 4384 LimitResult limit_result = LimitVersions(compiler, trace); |
| 4391 if (limit_result == DONE) return; | 4385 if (limit_result == DONE) return; |
| 4392 DCHECK(limit_result == CONTINUE); | 4386 DCHECK(limit_result == CONTINUE); |
| 4393 | 4387 |
| 4394 RecursionCheck rc(compiler); | 4388 RecursionCheck rc(compiler); |
| 4395 | 4389 |
| 4390 bool surrogate_check = compiler->unicode() && !compiler->one_byte(); | |
| 4391 if (surrogate_check) { | |
| 4392 assembler->CheckNotInSurrogatePair(trace->cp_offset(), trace->backtrack()); | |
| 4393 } | |
|
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.
| |
| 4394 | |
| 4396 DCHECK_EQ(start_reg_ + 1, end_reg_); | 4395 DCHECK_EQ(start_reg_ + 1, end_reg_); |
| 4397 if (compiler->ignore_case()) { | 4396 if (compiler->ignore_case()) { |
| 4398 assembler->CheckNotBackReferenceIgnoreCase(start_reg_, read_backward(), | 4397 assembler->CheckNotBackReferenceIgnoreCase(start_reg_, read_backward(), |
| 4399 trace->backtrack()); | 4398 trace->backtrack()); |
| 4400 } else { | 4399 } else { |
| 4401 assembler->CheckNotBackReference(start_reg_, read_backward(), | 4400 assembler->CheckNotBackReference(start_reg_, read_backward(), |
| 4402 trace->backtrack()); | 4401 trace->backtrack()); |
| 4403 } | 4402 } |
| 4404 // We are going to advance backward, so we may end up at the start. | 4403 // We are going to advance backward, so we may end up at the start. |
| 4405 if (read_backward()) trace->set_at_start(Trace::UNKNOWN); | 4404 if (read_backward()) trace->set_at_start(Trace::UNKNOWN); |
| 4405 | |
| 4406 if (surrogate_check) { | |
| 4407 assembler->CheckNotInSurrogatePair(trace->cp_offset(), trace->backtrack()); | |
| 4408 } | |
| 4406 on_success()->Emit(compiler, trace); | 4409 on_success()->Emit(compiler, trace); |
| 4407 } | 4410 } |
| 4408 | 4411 |
| 4409 | 4412 |
| 4410 // ------------------------------------------------------------------- | 4413 // ------------------------------------------------------------------- |
| 4411 // Dot/dotty output | 4414 // Dot/dotty output |
| 4412 | 4415 |
| 4413 | 4416 |
| 4414 #ifdef DEBUG | 4417 #ifdef DEBUG |
| 4415 | 4418 |
| (...skipping 2413 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 6829 | 6832 |
| 6830 | 6833 |
| 6831 void RegExpResultsCache::Clear(FixedArray* cache) { | 6834 void RegExpResultsCache::Clear(FixedArray* cache) { |
| 6832 for (int i = 0; i < kRegExpResultsCacheSize; i++) { | 6835 for (int i = 0; i < kRegExpResultsCacheSize; i++) { |
| 6833 cache->set(i, Smi::FromInt(0)); | 6836 cache->set(i, Smi::FromInt(0)); |
| 6834 } | 6837 } |
| 6835 } | 6838 } |
| 6836 | 6839 |
| 6837 } // namespace internal | 6840 } // namespace internal |
| 6838 } // namespace v8 | 6841 } // namespace v8 |
| OLD | NEW |