Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(72)

Side by Side Diff: test/js-perf-test/RegExp/base_ctor.js

Issue 2521263003: [js-perf-test] Add RegExp microbenchmarks (Closed)
Patch Set: Move to own test suite Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(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 ];
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698