OLD | NEW |
(Empty) | |
| 1 // Copyright 2016 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 load("base.js"); |
| 6 |
| 7 var str; |
| 8 var re; |
| 9 |
| 10 function SimpleMatch() { |
| 11 str.match(re); |
| 12 } |
| 13 |
| 14 function Match1Setup() { |
| 15 re = /[Cz]/; |
| 16 str = createHaystack(); |
| 17 } |
| 18 |
| 19 function Match2Setup() { |
| 20 re = /[Cz]/g; |
| 21 str = createHaystack(); |
| 22 } |
| 23 |
| 24 function Match3Setup() { |
| 25 re = /[cZ]/; // Not found. |
| 26 str = createHaystack(); |
| 27 } |
| 28 |
| 29 var benchmarks = [ [SimpleMatch, Match1Setup], |
| 30 [SimpleMatch, Match2Setup], |
| 31 [SimpleMatch, Match3Setup], |
| 32 ]; |
OLD | NEW |