Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 19 matching lines...) Expand all Loading... | |
| 30 support_smi_only_arrays = %HasFastSmiOnlyElements([]); | 30 support_smi_only_arrays = %HasFastSmiOnlyElements([]); |
| 31 | 31 |
| 32 if (support_smi_only_arrays) { | 32 if (support_smi_only_arrays) { |
| 33 function test(test_double, test_object, set, length) { | 33 function test(test_double, test_object, set, length) { |
| 34 // We apply the same operations to two identical arrays. The first array | 34 // We apply the same operations to two identical arrays. The first array |
| 35 // triggers an IC miss, upon which the conversion stub is generated, but the | 35 // triggers an IC miss, upon which the conversion stub is generated, but the |
| 36 // actual conversion is done in runtime. The second array, arriving at | 36 // actual conversion is done in runtime. The second array, arriving at |
| 37 // the previously patched IC, is then converted using the conversion stub. | 37 // the previously patched IC, is then converted using the conversion stub. |
| 38 var array_1 = new Array(length); | 38 var array_1 = new Array(length); |
| 39 var array_2 = new Array(length); | 39 var array_2 = new Array(length); |
| 40 | |
| 41 print("smi->double [" + test_double + | |
|
Jakob Kummerow
2011/10/19 18:36:31
Unintentional debugging leftover?
| |
| 42 "]\tsmi->object [" + (test_object && !test_double) + | |
| 43 "]\tdouble->object [" + (test_object && test_double) + | |
| 44 "]\tlength " + length); | |
| 40 | 45 |
| 41 assertTrue(%HasFastSmiOnlyElements(array_1)); | 46 assertTrue(%HasFastSmiOnlyElements(array_1)); |
| 42 assertTrue(%HasFastSmiOnlyElements(array_2)); | 47 assertTrue(%HasFastSmiOnlyElements(array_2)); |
| 43 for (var i = 0; i < length; i++) { | 48 for (var i = 0; i < length; i++) { |
| 44 if (i == length - 5 && test_double) { | 49 if (i == length - 5 && test_double) { |
| 45 // Trigger conversion to fast double elements at length-5. | 50 // Trigger conversion to fast double elements at length-5. |
| 46 set(array_1, i, 0.5); | 51 set(array_1, i, 0.5); |
| 47 set(array_2, i, 0.5); | 52 set(array_2, i, 0.5); |
| 48 assertTrue(%HasFastDoubleElements(array_1)); | 53 assertTrue(%HasFastDoubleElements(array_1)); |
| 49 assertTrue(%HasFastDoubleElements(array_2)); | 54 assertTrue(%HasFastDoubleElements(array_2)); |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 85 test(false, true, function(a,i,v){ a[i] = v; }, 20); | 90 test(false, true, function(a,i,v){ a[i] = v; }, 20); |
| 86 test(true, true, function(a,i,v){ a[i] = v; }, 20); | 91 test(true, true, function(a,i,v){ a[i] = v; }, 20); |
| 87 | 92 |
| 88 test(false, false, function(a,i,v){ a[i] = v; }, 10000); | 93 test(false, false, function(a,i,v){ a[i] = v; }, 10000); |
| 89 test(true, false, function(a,i,v){ a[i] = v; }, 10000); | 94 test(true, false, function(a,i,v){ a[i] = v; }, 10000); |
| 90 test(false, true, function(a,i,v){ a[i] = v; }, 10000); | 95 test(false, true, function(a,i,v){ a[i] = v; }, 10000); |
| 91 test(true, true, function(a,i,v){ a[i] = v; }, 10000); | 96 test(true, true, function(a,i,v){ a[i] = v; }, 10000); |
| 92 } else { | 97 } else { |
| 93 print("Test skipped because smi only arrays are not supported."); | 98 print("Test skipped because smi only arrays are not supported."); |
| 94 } | 99 } |
| OLD | NEW |