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 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
140 assertKind(elements_kind.external_short, new Int16Array(666)); | 140 assertKind(elements_kind.external_short, new Int16Array(666)); |
141 assertKind(elements_kind.external_unsigned_short, new Uint16Array(42)); | 141 assertKind(elements_kind.external_unsigned_short, new Uint16Array(42)); |
142 assertKind(elements_kind.external_int, new Int32Array(0xF)); | 142 assertKind(elements_kind.external_int, new Int32Array(0xF)); |
143 assertKind(elements_kind.external_unsigned_int, new Uint32Array(23)); | 143 assertKind(elements_kind.external_unsigned_int, new Uint32Array(23)); |
144 assertKind(elements_kind.external_float, new Float32Array(7)); | 144 assertKind(elements_kind.external_float, new Float32Array(7)); |
145 assertKind(elements_kind.external_double, new Float64Array(0)); | 145 assertKind(elements_kind.external_double, new Float64Array(0)); |
146 assertKind(elements_kind.external_pixel, new PixelArray(512)); | 146 assertKind(elements_kind.external_pixel, new PixelArray(512)); |
147 | 147 |
148 // Crankshaft support for smi-only array elements. | 148 // Crankshaft support for smi-only array elements. |
149 function monomorphic(array) { | 149 function monomorphic(array) { |
| 150 assertKind(elements_kind.fast_smi_only, array); |
150 for (var i = 0; i < 3; i++) { | 151 for (var i = 0; i < 3; i++) { |
151 array[i] = i + 10; | 152 array[i] = i + 10; |
152 } | 153 } |
153 assertKind(elements_kind.fast_smi_only, array); | 154 assertKind(elements_kind.fast_smi_only, array); |
154 for (var i = 0; i < 3; i++) { | 155 for (var i = 0; i < 3; i++) { |
155 var a = array[i]; | 156 var a = array[i]; |
156 assertEquals(i + 10, a); | 157 assertEquals(i + 10, a); |
157 } | 158 } |
158 } | 159 } |
159 var smi_only = new Array(1, 2, 3); | 160 var smi_only = new Array(1, 2, 3); |
| 161 assertKind(elements_kind.fast_smi_only, smi_only); |
160 for (var i = 0; i < 3; i++) monomorphic(smi_only); | 162 for (var i = 0; i < 3; i++) monomorphic(smi_only); |
161 %OptimizeFunctionOnNextCall(monomorphic); | 163 %OptimizeFunctionOnNextCall(monomorphic); |
162 monomorphic(smi_only); | 164 monomorphic(smi_only); |
163 | 165 |
164 if (support_smi_only_arrays) { | 166 if (support_smi_only_arrays) { |
165 function construct_smis() { | 167 function construct_smis() { |
166 var a = [0, 0, 0]; | 168 var a = [0, 0, 0]; |
167 a[0] = 0; // Send the COW array map to the steak house. | 169 a[0] = 0; // Send the COW array map to the steak house. |
168 assertKind(elements_kind.fast_smi_only, a); | 170 assertKind(elements_kind.fast_smi_only, a); |
169 return a; | 171 return a; |
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
335 var a = ["foo", "bar"]; | 337 var a = ["foo", "bar"]; |
336 assertKind(elements_kind.fast, a); | 338 assertKind(elements_kind.fast, a); |
337 var b = a.splice(0, 1); | 339 var b = a.splice(0, 1); |
338 assertKind(elements_kind.fast, b); | 340 assertKind(elements_kind.fast, b); |
339 var c = a.slice(0, 1); | 341 var c = a.slice(0, 1); |
340 assertKind(elements_kind.fast, c); | 342 assertKind(elements_kind.fast, c); |
341 } | 343 } |
342 | 344 |
343 // Throw away type information in the ICs for next stress run. | 345 // Throw away type information in the ICs for next stress run. |
344 gc(); | 346 gc(); |
OLD | NEW |