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 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
164 } | 164 } |
165 } | 165 } |
166 var smi_only = new Array(1, 2, 3); | 166 var smi_only = new Array(1, 2, 3); |
167 assertKind(elements_kind.fast_smi_only, smi_only); | 167 assertKind(elements_kind.fast_smi_only, smi_only); |
168 for (var i = 0; i < 3; i++) monomorphic(smi_only); | 168 for (var i = 0; i < 3; i++) monomorphic(smi_only); |
169 %OptimizeFunctionOnNextCall(monomorphic); | 169 %OptimizeFunctionOnNextCall(monomorphic); |
170 monomorphic(smi_only); | 170 monomorphic(smi_only); |
171 | 171 |
172 if (support_smi_only_arrays) { | 172 if (support_smi_only_arrays) { |
173 function construct_smis() { | 173 function construct_smis() { |
174 try {} catch (e) {} // TODO(titzer): DisableOptimization | |
174 var a = [0, 0, 0]; | 175 var a = [0, 0, 0]; |
175 a[0] = 0; // Send the COW array map to the steak house. | 176 a[0] = 0; // Send the COW array map to the steak house. |
176 assertKind(elements_kind.fast_smi_only, a); | 177 assertKind(elements_kind.fast_smi_only, a); |
177 return a; | 178 return a; |
178 } | 179 } |
179 function construct_doubles() { | 180 function construct_doubles() { |
181 try {} catch (e) {} // TODO(titzer): DisableOptimization | |
180 var a = construct_smis(); | 182 var a = construct_smis(); |
181 a[0] = 1.5; | 183 a[0] = 1.5; |
182 assertKind(elements_kind.fast_double, a); | 184 assertKind(elements_kind.fast_double, a); |
183 return a; | 185 return a; |
184 } | 186 } |
185 function construct_objects() { | 187 function construct_objects() { |
188 try {} catch (e) {} // TODO(titzer): DisableOptimization | |
186 var a = construct_smis(); | 189 var a = construct_smis(); |
187 a[0] = "one"; | 190 a[0] = "one"; |
188 assertKind(elements_kind.fast, a); | 191 assertKind(elements_kind.fast, a); |
189 return a; | 192 return a; |
190 } | 193 } |
191 | 194 |
192 // Test crankshafted transition SMI->DOUBLE. | 195 // Test crankshafted transition SMI->DOUBLE. |
193 function convert_to_double(array) { | 196 function convert_to_double(array) { |
197 try {} catch (e) {} // TODO(titzer): DisableOptimization | |
194 array[1] = 2.5; | 198 array[1] = 2.5; |
195 assertKind(elements_kind.fast_double, array); | 199 assertKind(elements_kind.fast_double, array); |
196 assertEquals(2.5, array[1]); | 200 assertEquals(2.5, array[1]); |
197 } | 201 } |
198 var smis = construct_smis(); | 202 var smis = construct_smis(); |
199 for (var i = 0; i < 3; i++) convert_to_double(smis); | 203 for (var i = 0; i < 3; i++) convert_to_double(smis); |
200 %OptimizeFunctionOnNextCall(convert_to_double); | 204 %OptimizeFunctionOnNextCall(convert_to_double); |
201 smis = construct_smis(); | 205 smis = construct_smis(); |
202 convert_to_double(smis); | 206 convert_to_double(smis); |
203 // Test crankshafted transitions SMI->FAST and DOUBLE->FAST. | 207 // Test crankshafted transitions SMI->FAST and DOUBLE->FAST. |
204 function convert_to_fast(array) { | 208 function convert_to_fast(array) { |
209 try {} catch (e) {} // TODO(titzer): DisableOptimization | |
205 array[1] = "two"; | 210 array[1] = "two"; |
206 assertKind(elements_kind.fast, array); | 211 assertKind(elements_kind.fast, array); |
207 assertEquals("two", array[1]); | 212 assertEquals("two", array[1]); |
208 } | 213 } |
209 smis = construct_smis(); | 214 smis = construct_smis(); |
210 for (var i = 0; i < 3; i++) convert_to_fast(smis); | 215 for (var i = 0; i < 3; i++) convert_to_fast(smis); |
211 var doubles = construct_doubles(); | 216 var doubles = construct_doubles(); |
212 for (var i = 0; i < 3; i++) convert_to_fast(doubles); | 217 for (var i = 0; i < 3; i++) convert_to_fast(doubles); |
213 smis = construct_smis(); | 218 smis = construct_smis(); |
214 doubles = construct_doubles(); | 219 doubles = construct_doubles(); |
215 %OptimizeFunctionOnNextCall(convert_to_fast); | 220 %OptimizeFunctionOnNextCall(convert_to_fast); |
216 convert_to_fast(smis); | 221 convert_to_fast(smis); |
217 convert_to_fast(doubles); | 222 convert_to_fast(doubles); |
218 // Test transition chain SMI->DOUBLE->FAST (crankshafted function will | 223 // Test transition chain SMI->DOUBLE->FAST (crankshafted function will |
219 // transition to FAST directly). | 224 // transition to FAST directly). |
220 function convert_mixed(array, value, kind) { | 225 function convert_mixed(array, value, kind) { |
226 try {} catch (e) {} // TODO(titzer): DisableOptimization | |
mvstanton
2013/06/26 13:21:43
What is the timeframe to bring these back to allow
titzer
2013/06/26 17:53:59
As it turns out, what this test does is check the
| |
221 array[1] = value; | 227 array[1] = value; |
222 assertKind(kind, array); | 228 assertKind(kind, array); |
223 assertEquals(value, array[1]); | 229 assertEquals(value, array[1]); |
224 } | 230 } |
225 smis = construct_smis(); | 231 smis = construct_smis(); |
226 for (var i = 0; i < 3; i++) { | 232 for (var i = 0; i < 3; i++) { |
227 convert_mixed(smis, 1.5, elements_kind.fast_double); | 233 convert_mixed(smis, 1.5, elements_kind.fast_double); |
228 } | 234 } |
229 doubles = construct_doubles(); | 235 doubles = construct_doubles(); |
230 for (var i = 0; i < 3; i++) { | 236 for (var i = 0; i < 3; i++) { |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
344 var a = ["foo", "bar"]; | 350 var a = ["foo", "bar"]; |
345 assertKind(elements_kind.fast, a); | 351 assertKind(elements_kind.fast, a); |
346 var b = a.splice(0, 1); | 352 var b = a.splice(0, 1); |
347 assertKind(elements_kind.fast, b); | 353 assertKind(elements_kind.fast, b); |
348 var c = a.slice(0, 1); | 354 var c = a.slice(0, 1); |
349 assertKind(elements_kind.fast, c); | 355 assertKind(elements_kind.fast, c); |
350 } | 356 } |
351 | 357 |
352 // Throw away type information in the ICs for next stress run. | 358 // Throw away type information in the ICs for next stress run. |
353 gc(); | 359 gc(); |
OLD | NEW |