Bug 449371 Firefox/Thunderbird crashes at exit [@ gdk_display_x11_finalize], p=Brian...
[wine-gecko.git] / testing / performance / talos / page_load_test / jss / object-regexp-112.html
blobcb11b883598e99215c51a4c5df89b029f7bcc47b
1 <html><head>
2 <!-- MOZ_INSERT_CONTENT_HOOK -->
3 <script src = runner.js></script>
4 <script>
5 var onlyName = 'Compiled Variable 12 Char Replace', onlyNum = 131072;
6 function thisTest() {
8 startTest("object-regexp");
10 // Try to force real results
11 var str = "", tmp, ret, re;
13 for ( var i = 0; i < 16384; i++ )
14 str += String.fromCharCode( (25 * Math.random()) + 97 );
16 for ( var i = 16384; i <= 131072; i *= 2 ) (function(i){
18 // TESTS: split
19 // Note: These tests are really slow, so we're running them for smaller
20 // test sets only.
22 if ( i <= 32768 ) {
23 re = //;
24 tmp = str;
26 test( "Compiled Object Empty Split", i, function(){
27 ret = tmp.split( re );
28 });
30 re = /a/;
31 tmp = str;
33 test( "Compiled Object Char Split", i, function(){
34 ret = tmp.split( re );
35 });
37 re = /.*/;
38 tmp = str;
40 test( "Compiled Object Variable Split", i, function(){
41 ret = tmp.split( re );
42 });
45 // TESTS: Compiled RegExps
47 re = /aaaaaaaaaa/g;
49 tmp = str;
51 test( "Compiled Match", i, function(){
52 ret = tmp.match( re );
53 });
55 tmp = str;
57 test( "Compiled Test", i, function(){
58 ret = re.test( tmp );
59 });
61 tmp = str;
63 test( "Compiled Empty Replace", i, function(){
64 ret = tmp.replace( re, "" );
65 });
67 tmp = str;
69 test( "Compiled 12 Char Replace", i, function(){
70 ret = tmp.replace( re, "asdfasdfasdf" );
71 });
73 re = new RegExp("aaaaaaaaaa", "g");
75 tmp = str;
77 test( "Compiled Object Match", i, function(){
78 ret = tmp.match( re );
79 });
81 tmp = str;
83 test( "Compiled Object Test", i, function(){
84 ret = re.test( tmp );
85 });
87 tmp = str;
89 test( "Compiled Object Empty Replace", i, function(){
90 ret = tmp.replace( re, "" );
91 });
93 tmp = str;
95 test( "Compiled Object 12 Char Replace", i, function(){
96 ret = tmp.replace( re, "asdfasdfasdf" );
97 });
99 tmp = str;
101 test( "Compiled Object 12 Char Replace Function", i, function(){
102 ret = tmp.replace( re, function(all){
103 return "asdfasdfasdf";
107 // TESTS: Variable Length
109 re = /a.*a/;
111 tmp = str;
113 test( "Compiled Variable Match", i, function(){
114 ret = tmp.match( re );
117 tmp = str;
119 test( "Compiled Variable Test", i, function(){
120 ret = re.test( tmp );
123 tmp = str;
125 test( "Compiled Variable Empty Replace", i, function(){
126 ret = tmp.replace( re, "" );
129 tmp = str;
131 test( "Compiled Variable 12 Char Replace", i, function(){
132 ret = tmp.replace( re, "asdfasdfasdf" );
135 re = new RegExp("aaaaaaaaaa", "g");
137 tmp = str;
139 test( "Compiled Variable Object Match", i, function(){
140 ret = tmp.match( re );
143 tmp = str;
145 test( "Compiled Variable Object Test", i, function(){
146 ret = re.test( tmp );
149 tmp = str;
151 test( "Compiled Variable Object Empty Replace", i, function(){
152 ret = tmp.replace( re, "" );
155 tmp = str;
157 test( "Compiled Variable Object 12 Char Replace", i, function(){
158 ret = tmp.replace( re, "asdfasdfasdf" );
161 tmp = str;
163 test( "Compiled Variable Object 12 Char Replace Function", i, function(){
164 ret = tmp.replace( re, function(all){
165 return "asdfasdfasdf";
169 // TESTS: Capturing
171 re = /aa(b)aa/g;
173 tmp = str;
175 test( "Compiled Capture Match", i, function(){
176 ret = tmp.match( re );
179 tmp = str;
181 test( "Compiled Capture Replace", i, function(){
182 ret = tmp.replace( re, "asdfasdfasdf" );
185 tmp = str;
187 test( "Compiled Capture Replace with Capture", i, function(){
188 ret = tmp.replace( re, "asdf\\1asdfasdf" );
191 tmp = str;
193 test( "Compiled Capture Replace with Capture Function", i, function(){
194 ret = tmp.replace( re, function(all,capture){
195 return "asdf" + capture + "asdfasdf";
199 tmp = str;
201 test( "Compiled Capture Replace with Upperase Capture Function", i, function(){
202 ret = tmp.replace( re, function(all,capture){
203 return capture.toUpperCase();
207 // TESTS: Uncompiled RegExps
209 tmp = str;
211 test( "Uncompiled Match", i, function(){
212 ret = tmp.match( /aaaaaaaaaa/g );
215 tmp = str;
217 test( "Uncompiled Test", i, function(){
218 ret = (/aaaaaaaaaa/g).test( tmp );
221 tmp = str;
223 test( "Uncompiled Empty Replace", i, function(){
224 ret = tmp.replace( /aaaaaaaaaa/g, "" );
227 tmp = str;
229 test( "Uncompiled 12 Char Replace", i, function(){
230 ret = tmp.replace( /aaaaaaaaaa/g, "asdfasdfasdf" );
233 tmp = str;
235 test( "Uncompiled Object Match", i, function(){
236 ret = tmp.match( new RegExp("aaaaaaaaaa", "g") );
239 tmp = str;
241 test( "Uncompiled Object Test", i, function(){
242 ret = (new RegExp("aaaaaaaaaa", "g")).test( tmp );
245 tmp = str;
247 test( "Uncompiled Object Empty Replace", i, function(){
248 ret = tmp.replace( new RegExp("aaaaaaaaaa", "g"), "" );
251 tmp = str;
253 test( "Uncompiled Object 12 Char Replace", i, function(){
254 ret = tmp.replace( new RegExp("aaaaaaaaaa", "g"), "asdfasdfasdf" );
257 // Double the length of the string
258 str += str;
259 })(i);
261 endTest();
263 </script>
264 <body onload="thisTest()"></body></html>