| OLD | NEW |
| 1 // Copyright (c) 2014, the Dart project authors. All rights reserved. | 1 // Copyright (c) 2014, the Dart project authors. All rights reserved. |
| 2 // Copyright 2011 the V8 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 | 3 // Redistribution and use in source and binary forms, with or without |
| 4 // modification, are permitted provided that the following conditions are | 4 // modification, are permitted provided that the following conditions are |
| 5 // met: | 5 // met: |
| 6 // | 6 // |
| 7 // * Redistributions of source code must retain the above copyright | 7 // * Redistributions of source code must retain the above copyright |
| 8 // notice, this list of conditions and the following disclaimer. | 8 // notice, this list of conditions and the following disclaimer. |
| 9 // * Redistributions in binary form must reproduce the above | 9 // * Redistributions in binary form must reproduce the above |
| 10 // copyright notice, this list of conditions and the following | 10 // copyright notice, this list of conditions and the following |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 import 'v8_regexp_utils.dart'; | 29 import 'v8_regexp_utils.dart'; |
| 30 import 'package:expect/expect.dart'; | 30 import 'package:expect/expect.dart'; |
| 31 | 31 |
| 32 void main() { | 32 void main() { |
| 33 // Flags: --gc_global | 33 // Flags: --gc_global |
| 34 | 34 |
| 35 // Regression test for regexp that has multiple matches and which | 35 // Regression test for regexp that has multiple matches and which |
| 36 // internally calls RegExpImpl::IrregexpExecOnce more than once without | 36 // internally calls RegExpImpl::IrregexpExecOnce more than once without |
| 37 // ensuring that the regexp is compiled. | 37 // ensuring that the regexp is compiled. |
| 38 // This can create a crash if the code was exchanged with the sweep | 38 // This can create a crash if the code was exchanged with the sweep |
| 39 // generation (for code flushing support) in GC durring the matching. | 39 // generation (for code flushing support) in GC during the matching. |
| 40 | 40 |
| 41 var re = new RegExp('(s)'); | 41 var re = new RegExp('(s)'); |
| 42 | 42 |
| 43 dynamic foo(Match m) { | 43 dynamic foo(Match m) { |
| 44 return "42"; | 44 return "42"; |
| 45 } | 45 } |
| 46 | 46 |
| 47 // Run enough times to get a number of GC's (all mark sweep because of the | 47 // Run enough times to get a number of GC's (all mark sweep because of the |
| 48 // --gc_global) flag. | 48 // --gc_global) flag. |
| 49 for (var i = 0; i < 10; i++) { | 49 for (var i = 0; i < 10; i++) { |
| 50 // Make a long string with plenty of matches for re. | 50 // Make a long string with plenty of matches for re. |
| 51 var x = "s foo s bar s foo s bar s"; | 51 var x = "s foo s bar s foo s bar s"; |
| 52 x = x + x; | 52 x = x + x; |
| 53 x = x + x; | 53 x = x + x; |
| 54 x = x + x; | 54 x = x + x; |
| 55 x = x + x; | 55 x = x + x; |
| 56 x = x + x; | 56 x = x + x; |
| 57 x = x + x; | 57 x = x + x; |
| 58 x = x + x; | 58 x = x + x; |
| 59 x.replaceAllMapped(re, foo); | 59 x.replaceAllMapped(re, foo); |
| 60 } | 60 } |
| 61 } | 61 } |
| OLD | NEW |