OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 13 matching lines...) Expand all Loading... |
24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
27 | 27 |
28 // Flags: --allow-natives-syntax | 28 // Flags: --allow-natives-syntax |
29 | 29 |
30 f(); | 30 f(); |
31 f(); | 31 f(); |
32 %OptimizeFunctionOnNextCall(f); | 32 %OptimizeFunctionOnNextCall(f); |
33 var start = (new Date()).getTime(); | 33 var start = (new Date()).getTime(); |
34 f(); | 34 var array = f(); |
35 var end = (new Date()).getTime(); | 35 var end = (new Date()).getTime(); |
36 | 36 |
37 // Assert that recompiling and executing f() takes less than a second. | 37 // Assert that recompiling and executing f() takes less than a second. |
38 assertTrue((end - start) < 1000); | 38 assertTrue((end - start) < 1000); |
39 | 39 |
| 40 for (var i = 0; i < 5000; i++) assertEquals(0, array[i]); |
| 41 |
40 function f() { | 42 function f() { |
41 var a = new Array(5000); | 43 var a = new Array(5000); |
42 a[0]=0; | 44 a[0]=0; |
43 a[1]=0; | 45 a[1]=0; |
44 a[2]=0; | 46 a[2]=0; |
45 a[3]=0; | 47 a[3]=0; |
46 a[4]=0; | 48 a[4]=0; |
47 a[5]=0; | 49 a[5]=0; |
48 a[6]=0; | 50 a[6]=0; |
49 a[7]=0; | 51 a[7]=0; |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
155 a[113]=0; | 157 a[113]=0; |
156 a[114]=0; | 158 a[114]=0; |
157 a[115]=0; | 159 a[115]=0; |
158 a[116]=0; | 160 a[116]=0; |
159 a[117]=0; | 161 a[117]=0; |
160 a[118]=0; | 162 a[118]=0; |
161 a[119]=0; | 163 a[119]=0; |
162 a[120]=0; | 164 a[120]=0; |
163 a[121]=0; | 165 a[121]=0; |
164 a[122]=0; | 166 a[122]=0; |
165 a[0]=0; | 167 a[123]=0; |
166 a[124]=0; | 168 a[124]=0; |
167 a[125]=0; | 169 a[125]=0; |
168 a[126]=0; | 170 a[126]=0; |
169 a[127]=0; | 171 a[127]=0; |
170 a[128]=0; | 172 a[128]=0; |
171 a[129]=0; | 173 a[129]=0; |
172 a[130]=0; | 174 a[130]=0; |
173 a[131]=0; | 175 a[131]=0; |
174 a[132]=0; | 176 a[132]=0; |
175 a[133]=0; | 177 a[133]=0; |
(...skipping 979 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1155 a[1113]=0; | 1157 a[1113]=0; |
1156 a[1114]=0; | 1158 a[1114]=0; |
1157 a[1115]=0; | 1159 a[1115]=0; |
1158 a[1116]=0; | 1160 a[1116]=0; |
1159 a[1117]=0; | 1161 a[1117]=0; |
1160 a[1118]=0; | 1162 a[1118]=0; |
1161 a[1119]=0; | 1163 a[1119]=0; |
1162 a[1120]=0; | 1164 a[1120]=0; |
1163 a[1121]=0; | 1165 a[1121]=0; |
1164 a[1122]=0; | 1166 a[1122]=0; |
1165 a[10]=0; | 1167 a[1123]=0; |
1166 a[1124]=0; | 1168 a[1124]=0; |
1167 a[1125]=0; | 1169 a[1125]=0; |
1168 a[1126]=0; | 1170 a[1126]=0; |
1169 a[1127]=0; | 1171 a[1127]=0; |
1170 a[1128]=0; | 1172 a[1128]=0; |
1171 a[1129]=0; | 1173 a[1129]=0; |
1172 a[1130]=0; | 1174 a[1130]=0; |
1173 a[1131]=0; | 1175 a[1131]=0; |
1174 a[1132]=0; | 1176 a[1132]=0; |
1175 a[1133]=0; | 1177 a[1133]=0; |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1262 a[1220]=0; | 1264 a[1220]=0; |
1263 a[1221]=0; | 1265 a[1221]=0; |
1264 a[1222]=0; | 1266 a[1222]=0; |
1265 a[1223]=0; | 1267 a[1223]=0; |
1266 a[1224]=0; | 1268 a[1224]=0; |
1267 a[1225]=0; | 1269 a[1225]=0; |
1268 a[1226]=0; | 1270 a[1226]=0; |
1269 a[1227]=0; | 1271 a[1227]=0; |
1270 a[1228]=0; | 1272 a[1228]=0; |
1271 a[1229]=0; | 1273 a[1229]=0; |
1272 a[00]=0; | 1274 a[1230]=0; |
1273 a[01]=0; | 1275 a[1231]=0; |
1274 a[02]=0; | 1276 a[1232]=0; |
1275 a[03]=0; | 1277 a[1233]=0; |
1276 a[04]=0; | 1278 a[1234]=0; |
1277 a[05]=0; | 1279 a[1235]=0; |
1278 a[06]=0; | 1280 a[1236]=0; |
1279 a[07]=0; | 1281 a[1237]=0; |
1280 a[08]=0; | 1282 a[1238]=0; |
1281 a[09]=0; | 1283 a[1239]=0; |
1282 a[1240]=0; | 1284 a[1240]=0; |
1283 a[1241]=0; | 1285 a[1241]=0; |
1284 a[1242]=0; | 1286 a[1242]=0; |
1285 a[1243]=0; | 1287 a[1243]=0; |
1286 a[1244]=0; | 1288 a[1244]=0; |
1287 a[1245]=0; | 1289 a[1245]=0; |
1288 a[1246]=0; | 1290 a[1246]=0; |
1289 a[1247]=0; | 1291 a[1247]=0; |
1290 a[1248]=0; | 1292 a[1248]=0; |
1291 a[1249]=0; | 1293 a[1249]=0; |
(...skipping 863 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2155 a[2113]=0; | 2157 a[2113]=0; |
2156 a[2114]=0; | 2158 a[2114]=0; |
2157 a[2115]=0; | 2159 a[2115]=0; |
2158 a[2116]=0; | 2160 a[2116]=0; |
2159 a[2117]=0; | 2161 a[2117]=0; |
2160 a[2118]=0; | 2162 a[2118]=0; |
2161 a[2119]=0; | 2163 a[2119]=0; |
2162 a[2120]=0; | 2164 a[2120]=0; |
2163 a[2121]=0; | 2165 a[2121]=0; |
2164 a[2122]=0; | 2166 a[2122]=0; |
2165 a[20]=0; | 2167 a[2123]=0; |
2166 a[2124]=0; | 2168 a[2124]=0; |
2167 a[2125]=0; | 2169 a[2125]=0; |
2168 a[2126]=0; | 2170 a[2126]=0; |
2169 a[2127]=0; | 2171 a[2127]=0; |
2170 a[2128]=0; | 2172 a[2128]=0; |
2171 a[2129]=0; | 2173 a[2129]=0; |
2172 a[2130]=0; | 2174 a[2130]=0; |
2173 a[2131]=0; | 2175 a[2131]=0; |
2174 a[2132]=0; | 2176 a[2132]=0; |
2175 a[2133]=0; | 2177 a[2133]=0; |
(...skipping 979 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3155 a[3113]=0; | 3157 a[3113]=0; |
3156 a[3114]=0; | 3158 a[3114]=0; |
3157 a[3115]=0; | 3159 a[3115]=0; |
3158 a[3116]=0; | 3160 a[3116]=0; |
3159 a[3117]=0; | 3161 a[3117]=0; |
3160 a[3118]=0; | 3162 a[3118]=0; |
3161 a[3119]=0; | 3163 a[3119]=0; |
3162 a[3120]=0; | 3164 a[3120]=0; |
3163 a[3121]=0; | 3165 a[3121]=0; |
3164 a[3122]=0; | 3166 a[3122]=0; |
3165 a[30]=0; | 3167 a[3123]=0; |
3166 a[3124]=0; | 3168 a[3124]=0; |
3167 a[3125]=0; | 3169 a[3125]=0; |
3168 a[3126]=0; | 3170 a[3126]=0; |
3169 a[3127]=0; | 3171 a[3127]=0; |
3170 a[3128]=0; | 3172 a[3128]=0; |
3171 a[3129]=0; | 3173 a[3129]=0; |
3172 a[3130]=0; | 3174 a[3130]=0; |
3173 a[3131]=0; | 3175 a[3131]=0; |
3174 a[3132]=0; | 3176 a[3132]=0; |
3175 a[3133]=0; | 3177 a[3133]=0; |
(...skipping 979 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4155 a[4113]=0; | 4157 a[4113]=0; |
4156 a[4114]=0; | 4158 a[4114]=0; |
4157 a[4115]=0; | 4159 a[4115]=0; |
4158 a[4116]=0; | 4160 a[4116]=0; |
4159 a[4117]=0; | 4161 a[4117]=0; |
4160 a[4118]=0; | 4162 a[4118]=0; |
4161 a[4119]=0; | 4163 a[4119]=0; |
4162 a[4120]=0; | 4164 a[4120]=0; |
4163 a[4121]=0; | 4165 a[4121]=0; |
4164 a[4122]=0; | 4166 a[4122]=0; |
4165 a[40]=0; | 4167 a[4123]=0; |
4166 a[4124]=0; | 4168 a[4124]=0; |
4167 a[4125]=0; | 4169 a[4125]=0; |
4168 a[4126]=0; | 4170 a[4126]=0; |
4169 a[4127]=0; | 4171 a[4127]=0; |
4170 a[4128]=0; | 4172 a[4128]=0; |
4171 a[4129]=0; | 4173 a[4129]=0; |
4172 a[4130]=0; | 4174 a[4130]=0; |
4173 a[4131]=0; | 4175 a[4131]=0; |
4174 a[4132]=0; | 4176 a[4132]=0; |
4175 a[4133]=0; | 4177 a[4133]=0; |
(...skipping 856 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5032 a[4990]=0; | 5034 a[4990]=0; |
5033 a[4991]=0; | 5035 a[4991]=0; |
5034 a[4992]=0; | 5036 a[4992]=0; |
5035 a[4993]=0; | 5037 a[4993]=0; |
5036 a[4994]=0; | 5038 a[4994]=0; |
5037 a[4995]=0; | 5039 a[4995]=0; |
5038 a[4996]=0; | 5040 a[4996]=0; |
5039 a[4997]=0; | 5041 a[4997]=0; |
5040 a[4998]=0; | 5042 a[4998]=0; |
5041 a[4999]=0; | 5043 a[4999]=0; |
| 5044 return a; |
5042 } | 5045 } |
OLD | NEW |