| 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 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 222 } | 222 } |
| 223 doubles = construct_doubles(); | 223 doubles = construct_doubles(); |
| 224 for (var i = 0; i < 3; i++) { | 224 for (var i = 0; i < 3; i++) { |
| 225 convert_mixed(doubles, "three", elements_kind.fast); | 225 convert_mixed(doubles, "three", elements_kind.fast); |
| 226 } | 226 } |
| 227 convert_mixed(construct_smis(), "three", elements_kind.fast); | 227 convert_mixed(construct_smis(), "three", elements_kind.fast); |
| 228 convert_mixed(construct_doubles(), "three", elements_kind.fast); | 228 convert_mixed(construct_doubles(), "three", elements_kind.fast); |
| 229 %OptimizeFunctionOnNextCall(convert_mixed); | 229 %OptimizeFunctionOnNextCall(convert_mixed); |
| 230 smis = construct_smis(); | 230 smis = construct_smis(); |
| 231 doubles = construct_doubles(); | 231 doubles = construct_doubles(); |
| 232 convert_mixed(smis, 1, elements_kind.fast); | 232 if (getKind(smis) == elements_kind.fast_smi_only) { |
| 233 convert_mixed(doubles, 1, elements_kind.fast); | 233 convert_mixed(smis, 1, elements_kind.fast); |
| 234 // Test failure here. My change must have broken the assumption above, that |
| 235 // the crankshafted convert_mixed() function will transition the doubles |
| 236 // array to fast. |
| 237 convert_mixed(doubles, 1, elements_kind.fast); |
| 238 } else { |
| 239 convert_mixed(smis, 1, elements_kind.fast); |
| 240 convert_mixed(doubles, 1, elements_kind.fast); |
| 241 } |
| 234 assertTrue(%HaveSameMap(smis, doubles)); | 242 assertTrue(%HaveSameMap(smis, doubles)); |
| 235 } | 243 } |
| 236 | 244 |
| 237 // Crankshaft support for smi-only elements in dynamic array literals. | 245 // Crankshaft support for smi-only elements in dynamic array literals. |
| 238 function get(foo) { return foo; } // Used to generate dynamic values. | 246 function get(foo) { return foo; } // Used to generate dynamic values. |
| 239 | 247 |
| 240 function crankshaft_test() { | 248 function crankshaft_test() { |
| 241 if (support_smi_only_arrays) { | 249 if (support_smi_only_arrays) { |
| 242 var a1 = [get(1), get(2), get(3)]; | 250 var a1 = [get(1), get(2), get(3)]; |
| 243 assertKind(elements_kind.fast_smi_only, a1); | 251 assertKind(elements_kind.fast_smi_only, a1); |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 336 // Test that Array.splice() and Array.slice() return correct ElementsKinds. | 344 // Test that Array.splice() and Array.slice() return correct ElementsKinds. |
| 337 if (support_smi_only_arrays) { | 345 if (support_smi_only_arrays) { |
| 338 var a = ["foo", "bar"]; | 346 var a = ["foo", "bar"]; |
| 339 assertKind(elements_kind.fast, a); | 347 assertKind(elements_kind.fast, a); |
| 340 var b = a.splice(0, 1); | 348 var b = a.splice(0, 1); |
| 341 assertKind(elements_kind.fast, b); | 349 assertKind(elements_kind.fast, b); |
| 342 var c = a.slice(0, 1); | 350 var c = a.slice(0, 1); |
| 343 assertKind(elements_kind.fast, c); | 351 assertKind(elements_kind.fast, c); |
| 344 } | 352 } |
| 345 | 353 |
| 354 /* |
| 355 if (support_smi_only_arrays) { |
| 356 function create_array() { |
| 357 var ar = [1,2,3]; |
| 358 return ar; |
| 359 } |
| 360 |
| 361 var a = create_array(); |
| 362 assertKind(elements_kind.fast_smi_only, a); |
| 363 a[1] = 1; |
| 364 assertKind(elements_kind.fast_smi_only, a); |
| 365 a[1] = 1.5; |
| 366 assertKind(elements_kind.fast_double, a); |
| 367 |
| 368 // The boilerplate should have been pre-transitioned now. |
| 369 var b = create_array(); |
| 370 assertKind(elements_kind.fast_double, b); |
| 371 } |
| 372 */ |
| 373 |
| 346 // Throw away type information in the ICs for next stress run. | 374 // Throw away type information in the ICs for next stress run. |
| 347 gc(); | 375 gc(); |
| OLD | NEW |