OLD | NEW |
| (Empty) |
1 // Copyright (c) 2014, the Dart project authors. All rights reserved. | |
2 // Copyright 2011 the V8 project authors. All rights reserved. | |
3 // Redistribution and use in source and binary forms, with or without | |
4 // modification, are permitted provided that the following conditions are | |
5 // met: | |
6 // | |
7 // * Redistributions of source code must retain the above copyright | |
8 // notice, this list of conditions and the following disclaimer. | |
9 // * Redistributions in binary form must reproduce the above | |
10 // copyright notice, this list of conditions and the following | |
11 // disclaimer in the documentation and/or other materials provided | |
12 // with the distribution. | |
13 // * Neither the name of Google Inc. nor the names of its | |
14 // contributors may be used to endorse or promote products derived | |
15 // from this software without specific prior written permission. | |
16 // | |
17 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | |
18 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | |
19 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | |
20 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | |
21 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | |
22 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | |
23 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | |
24 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | |
25 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |
26 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | |
27 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
28 | |
29 import 'v8_regexp_utils.dart'; | |
30 import 'package:expect/expect.dart'; | |
31 | |
32 void main() { | |
33 // Flags: --gc_global | |
34 | |
35 // Regression test for regexp that has multiple matches and which | |
36 // internally calls RegExpImpl::IrregexpExecOnce more than once without | |
37 // ensuring that the regexp is compiled. | |
38 // This can create a crash if the code was exchanged with the sweep | |
39 // generation (for code flushing support) in GC during the matching. | |
40 | |
41 var re = new RegExp('(s)'); | |
42 | |
43 dynamic foo(Match m) { | |
44 return "42"; | |
45 } | |
46 | |
47 // Run enough times to get a number of GC's (all mark sweep because of the | |
48 // --gc_global) flag. | |
49 for (var i = 0; i < 10; i++) { | |
50 // Make a long string with plenty of matches for re. | |
51 var x = "s foo s bar s foo s bar s"; | |
52 x = x + x; | |
53 x = x + x; | |
54 x = x + x; | |
55 x = x + x; | |
56 x = x + x; | |
57 x = x + x; | |
58 x = x + x; | |
59 x.replaceAllMapped(re, foo); | |
60 } | |
61 } | |
OLD | NEW |