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 function SimpleCtor() { |
| 6 new RegExp("[Cz]"); |
| 7 } |
| 8 |
| 9 function FlagsCtor() { |
| 10 new RegExp("[Cz]", "guiym"); |
| 11 } |
| 12 |
| 13 function SimpleCtorWithoutNew() { |
| 14 RegExp("[Cz]"); |
| 15 } |
| 16 |
| 17 function FlagsCtorWithoutNew() { |
| 18 RegExp("[Cz]", "guiym"); |
| 19 } |
| 20 |
| 21 function CtorWithRegExpPattern() { |
| 22 new RegExp(/[Cz]/); |
| 23 } |
| 24 |
| 25 function CtorWithRegExpPatternAndFlags() { |
| 26 new RegExp(/[Cz]/, "guiym"); |
| 27 } |
| 28 |
| 29 function CtorWithRegExpSubclassPattern() { |
| 30 class SubRegExp extends RegExp { |
| 31 get source() { return "[Cz]"; } |
| 32 get flags() { return "guiym"; } |
| 33 } |
| 34 new RegExp(new SubRegExp(/[Cz]/)); |
| 35 } |
| 36 |
| 37 function CtorWithUndefinedPattern() { |
| 38 new RegExp(); |
| 39 } |
| 40 |
| 41 function CtorWithFlagsAndUndefinedPattern() { |
| 42 new RegExp(undefined, "guiym"); |
| 43 } |
| 44 |
| 45 var benchmarks = [ [SimpleCtor, undefined], |
| 46 [FlagsCtor, undefined], |
| 47 [SimpleCtorWithoutNew, undefined], |
| 48 [FlagsCtorWithoutNew, undefined], |
| 49 [CtorWithRegExpPattern, undefined], |
| 50 [CtorWithRegExpPatternAndFlags, undefined], |
| 51 [CtorWithRegExpSubclassPattern, undefined], |
| 52 [CtorWithUndefinedPattern, undefined], |
| 53 [CtorWithFlagsAndUndefinedPattern, undefined], |
| 54 ]; |
OLD | NEW |