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 SimpleSearch() { |
| 11 str.search(re); |
| 12 } |
| 13 |
| 14 function Search1Setup() { |
| 15 re = /[Cz]/; |
| 16 str = createHaystack(); |
| 17 } |
| 18 |
| 19 function Search2Setup() { |
| 20 re = /[Cz]/; |
| 21 re.lastIndex = 42; // Force lastIndex restoration. |
| 22 str = createHaystack(); |
| 23 } |
| 24 |
| 25 function Search3Setup() { |
| 26 re = /[cZ]/; // Not found. |
| 27 str = createHaystack(); |
| 28 } |
| 29 |
| 30 var benchmarks = [ [SimpleSearch, Search1Setup], |
| 31 [SimpleSearch, Search2Setup], |
| 32 [SimpleSearch, Search3Setup], |
| 33 ]; |
OLD | NEW |