Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(255)

Side by Side Diff: test/mjsunit/elements-kind.js

Issue 397253002: Remove experimental flags that are now required (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Review feedback Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « test/mjsunit/array-natives-elements.js ('k') | test/mjsunit/elements-kind-depends.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
11 // with the distribution. 11 // with the distribution.
12 // * Neither the name of Google Inc. nor the names of its 12 // * Neither the name of Google Inc. nor the names of its
13 // contributors may be used to endorse or promote products derived 13 // contributors may be used to endorse or promote products derived
14 // from this software without specific prior written permission. 14 // from this software without specific prior written permission.
15 // 15 //
16 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 16 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 17 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 18 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 19 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 20 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
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 --smi-only-arrays --expose-gc --nostress-opt -- typed-array-max_size_in-heap=2048 28 // Flags: --allow-natives-syntax --expose-gc --nostress-opt --typed-array-max_si ze_in-heap=2048
29
30 // Test element kind of objects.
31 // Since --smi-only-arrays affects builtins, its default setting at compile
32 // time sticks if built with snapshot. If --smi-only-arrays is deactivated
33 // by default, only a no-snapshot build actually has smi-only arrays enabled
34 // in this test case. Depending on whether smi-only arrays are actually
35 // enabled, this test takes the appropriate code path to check smi-only arrays.
36
37 support_smi_only_arrays = %HasFastSmiElements(new Array(1,2,3,4,5,6,7,8));
38
39 if (support_smi_only_arrays) {
40 print("Tests include smi-only arrays.");
41 } else {
42 print("Tests do NOT include smi-only arrays.");
43 }
44 29
45 var elements_kind = { 30 var elements_kind = {
46 fast_smi_only : 'fast smi only elements', 31 fast_smi_only : 'fast smi only elements',
47 fast : 'fast elements', 32 fast : 'fast elements',
48 fast_double : 'fast double elements', 33 fast_double : 'fast double elements',
49 dictionary : 'dictionary elements', 34 dictionary : 'dictionary elements',
50 external_int32 : 'external int8 elements', 35 external_int32 : 'external int8 elements',
51 external_uint8 : 'external uint8 elements', 36 external_uint8 : 'external uint8 elements',
52 external_int16 : 'external int16 elements', 37 external_int16 : 'external int16 elements',
53 external_uint16 : 'external uint16 elements', 38 external_uint16 : 'external uint16 elements',
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 } 109 }
125 if (%HasFixedFloat64Elements(obj)) { 110 if (%HasFixedFloat64Elements(obj)) {
126 return elements_kind.fixed_float64; 111 return elements_kind.fixed_float64;
127 } 112 }
128 if (%HasFixedUint8ClampedElements(obj)) { 113 if (%HasFixedUint8ClampedElements(obj)) {
129 return elements_kind.fixed_uint8_clamped; 114 return elements_kind.fixed_uint8_clamped;
130 } 115 }
131 } 116 }
132 117
133 function assertKind(expected, obj, name_opt) { 118 function assertKind(expected, obj, name_opt) {
134 if (!support_smi_only_arrays &&
135 expected == elements_kind.fast_smi_only) {
136 expected = elements_kind.fast;
137 }
138 assertEquals(expected, getKind(obj), name_opt); 119 assertEquals(expected, getKind(obj), name_opt);
139 } 120 }
140 121
141 var me = {}; 122 var me = {};
142 assertKind(elements_kind.fast, me); 123 assertKind(elements_kind.fast, me);
143 me.dance = 0xD15C0; 124 me.dance = 0xD15C0;
144 me.drink = 0xC0C0A; 125 me.drink = 0xC0C0A;
145 assertKind(elements_kind.fast, me); 126 assertKind(elements_kind.fast, me);
146 127
147 if (support_smi_only_arrays) { 128 var too = [1,2,3];
148 var too = [1,2,3]; 129 assertKind(elements_kind.fast_smi_only, too);
149 assertKind(elements_kind.fast_smi_only, too); 130 too.dance = 0xD15C0;
150 too.dance = 0xD15C0; 131 too.drink = 0xC0C0A;
151 too.drink = 0xC0C0A; 132 assertKind(elements_kind.fast_smi_only, too);
152 assertKind(elements_kind.fast_smi_only, too);
153 }
154 133
155 // Make sure the element kind transitions from smi when a non-smi is stored. 134 // Make sure the element kind transitions from smi when a non-smi is stored.
156 function test_wrapper() { 135 function test_wrapper() {
157 var you = new Array(); 136 var you = new Array();
158 assertKind(elements_kind.fast_smi_only, you); 137 assertKind(elements_kind.fast_smi_only, you);
159 for (var i = 0; i < 1337; i++) { 138 for (var i = 0; i < 1337; i++) {
160 var val = i; 139 var val = i;
161 if (i == 1336) { 140 if (i == 1336) {
162 assertKind(elements_kind.fast_smi_only, you); 141 assertKind(elements_kind.fast_smi_only, you);
163 val = new Object(); 142 val = new Object();
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
210 for (var i = 0; i < 3; i++) monomorphic(smi_only); 189 for (var i = 0; i < 3; i++) monomorphic(smi_only);
211 %OptimizeFunctionOnNextCall(monomorphic); 190 %OptimizeFunctionOnNextCall(monomorphic);
212 monomorphic(smi_only); 191 monomorphic(smi_only);
213 } 192 }
214 193
215 // The test is called in a wrapper function to eliminate the transition learning 194 // The test is called in a wrapper function to eliminate the transition learning
216 // feedback of AllocationSites. 195 // feedback of AllocationSites.
217 test_wrapper(); 196 test_wrapper();
218 %ClearFunctionTypeFeedback(test_wrapper); 197 %ClearFunctionTypeFeedback(test_wrapper);
219 198
220 if (support_smi_only_arrays) { 199 %NeverOptimizeFunction(construct_smis);
221 %NeverOptimizeFunction(construct_smis);
222 200
223 // This code exists to eliminate the learning influence of AllocationSites 201 // This code exists to eliminate the learning influence of AllocationSites
224 // on the following tests. 202 // on the following tests.
225 var __sequence = 0; 203 var __sequence = 0;
226 function make_array_string() { 204 function make_array_string() {
227 this.__sequence = this.__sequence + 1; 205 this.__sequence = this.__sequence + 1;
228 return "/* " + this.__sequence + " */ [0, 0, 0];" 206 return "/* " + this.__sequence + " */ [0, 0, 0];"
229 } 207 }
230 function make_array() { 208 function make_array() {
231 return eval(make_array_string()); 209 return eval(make_array_string());
232 } 210 }
233 211
234 function construct_smis() { 212 function construct_smis() {
235 var a = make_array(); 213 var a = make_array();
236 a[0] = 0; // Send the COW array map to the steak house. 214 a[0] = 0; // Send the COW array map to the steak house.
237 assertKind(elements_kind.fast_smi_only, a); 215 assertKind(elements_kind.fast_smi_only, a);
238 return a; 216 return a;
239 } 217 }
240 %NeverOptimizeFunction(construct_doubles); 218 %NeverOptimizeFunction(construct_doubles);
241 function construct_doubles() { 219 function construct_doubles() {
242 var a = construct_smis(); 220 var a = construct_smis();
243 a[0] = 1.5; 221 a[0] = 1.5;
244 assertKind(elements_kind.fast_double, a); 222 assertKind(elements_kind.fast_double, a);
245 return a; 223 return a;
246 } 224 }
247 %NeverOptimizeFunction(construct_objects); 225 %NeverOptimizeFunction(construct_objects);
248 function construct_objects() { 226 function construct_objects() {
249 var a = construct_smis(); 227 var a = construct_smis();
250 a[0] = "one"; 228 a[0] = "one";
251 assertKind(elements_kind.fast, a); 229 assertKind(elements_kind.fast, a);
252 return a; 230 return a;
253 } 231 }
254 232
255 // Test crankshafted transition SMI->DOUBLE. 233 // Test crankshafted transition SMI->DOUBLE.
256 %NeverOptimizeFunction(convert_to_double); 234 %NeverOptimizeFunction(convert_to_double);
257 function convert_to_double(array) { 235 function convert_to_double(array) {
258 array[1] = 2.5; 236 array[1] = 2.5;
259 assertKind(elements_kind.fast_double, array); 237 assertKind(elements_kind.fast_double, array);
260 assertEquals(2.5, array[1]); 238 assertEquals(2.5, array[1]);
261 } 239 }
262 var smis = construct_smis(); 240 var smis = construct_smis();
263 for (var i = 0; i < 3; i++) convert_to_double(smis); 241 for (var i = 0; i < 3; i++) convert_to_double(smis);
264 %OptimizeFunctionOnNextCall(convert_to_double); 242 %OptimizeFunctionOnNextCall(convert_to_double);
265 smis = construct_smis(); 243 smis = construct_smis();
266 convert_to_double(smis); 244 convert_to_double(smis);
267 // Test crankshafted transitions SMI->FAST and DOUBLE->FAST. 245 // Test crankshafted transitions SMI->FAST and DOUBLE->FAST.
268 %NeverOptimizeFunction(convert_to_fast); 246 %NeverOptimizeFunction(convert_to_fast);
269 function convert_to_fast(array) { 247 function convert_to_fast(array) {
270 array[1] = "two"; 248 array[1] = "two";
271 assertKind(elements_kind.fast, array); 249 assertKind(elements_kind.fast, array);
272 assertEquals("two", array[1]); 250 assertEquals("two", array[1]);
273 } 251 }
274 smis = construct_smis(); 252 smis = construct_smis();
275 for (var i = 0; i < 3; i++) convert_to_fast(smis); 253 for (var i = 0; i < 3; i++) convert_to_fast(smis);
276 var doubles = construct_doubles(); 254 var doubles = construct_doubles();
277 for (var i = 0; i < 3; i++) convert_to_fast(doubles); 255 for (var i = 0; i < 3; i++) convert_to_fast(doubles);
278 smis = construct_smis(); 256 smis = construct_smis();
279 doubles = construct_doubles(); 257 doubles = construct_doubles();
280 %OptimizeFunctionOnNextCall(convert_to_fast); 258 %OptimizeFunctionOnNextCall(convert_to_fast);
281 convert_to_fast(smis); 259 convert_to_fast(smis);
282 convert_to_fast(doubles); 260 convert_to_fast(doubles);
283 // Test transition chain SMI->DOUBLE->FAST (crankshafted function will 261 // Test transition chain SMI->DOUBLE->FAST (crankshafted function will
284 // transition to FAST directly). 262 // transition to FAST directly).
285 %NeverOptimizeFunction(convert_mixed); 263 %NeverOptimizeFunction(convert_mixed);
286 function convert_mixed(array, value, kind) { 264 function convert_mixed(array, value, kind) {
287 array[1] = value; 265 array[1] = value;
288 assertKind(kind, array); 266 assertKind(kind, array);
289 assertEquals(value, array[1]); 267 assertEquals(value, array[1]);
290 } 268 }
291 smis = construct_smis(); 269 smis = construct_smis();
292 for (var i = 0; i < 3; i++) { 270 for (var i = 0; i < 3; i++) {
293 convert_mixed(smis, 1.5, elements_kind.fast_double); 271 convert_mixed(smis, 1.5, elements_kind.fast_double);
294 } 272 }
295 doubles = construct_doubles(); 273 doubles = construct_doubles();
296 for (var i = 0; i < 3; i++) { 274 for (var i = 0; i < 3; i++) {
297 convert_mixed(doubles, "three", elements_kind.fast); 275 convert_mixed(doubles, "three", elements_kind.fast);
298 } 276 }
299 convert_mixed(construct_smis(), "three", elements_kind.fast); 277 convert_mixed(construct_smis(), "three", elements_kind.fast);
300 convert_mixed(construct_doubles(), "three", elements_kind.fast); 278 convert_mixed(construct_doubles(), "three", elements_kind.fast);
301 %OptimizeFunctionOnNextCall(convert_mixed); 279 %OptimizeFunctionOnNextCall(convert_mixed);
302 smis = construct_smis(); 280 smis = construct_smis();
303 doubles = construct_doubles(); 281 doubles = construct_doubles();
304 convert_mixed(smis, 1, elements_kind.fast); 282 convert_mixed(smis, 1, elements_kind.fast);
305 convert_mixed(doubles, 1, elements_kind.fast); 283 convert_mixed(doubles, 1, elements_kind.fast);
306 assertTrue(%HaveSameMap(smis, doubles)); 284 assertTrue(%HaveSameMap(smis, doubles));
307 }
308 285
309 // Crankshaft support for smi-only elements in dynamic array literals. 286 // Crankshaft support for smi-only elements in dynamic array literals.
310 function get(foo) { return foo; } // Used to generate dynamic values. 287 function get(foo) { return foo; } // Used to generate dynamic values.
311 288
312 function crankshaft_test() { 289 function crankshaft_test() {
313 if (support_smi_only_arrays) { 290 var a1 = [get(1), get(2), get(3)];
314 var a1 = [get(1), get(2), get(3)]; 291 assertKind(elements_kind.fast_smi_only, a1);
315 assertKind(elements_kind.fast_smi_only, a1); 292
316 }
317 var a2 = new Array(get(1), get(2), get(3)); 293 var a2 = new Array(get(1), get(2), get(3));
318 assertKind(elements_kind.fast_smi_only, a2); 294 assertKind(elements_kind.fast_smi_only, a2);
319 var b = [get(1), get(2), get("three")]; 295 var b = [get(1), get(2), get("three")];
320 assertKind(elements_kind.fast, b); 296 assertKind(elements_kind.fast, b);
321 var c = [get(1), get(2), get(3.5)]; 297 var c = [get(1), get(2), get(3.5)];
322 if (support_smi_only_arrays) { 298 assertKind(elements_kind.fast_double, c);
323 assertKind(elements_kind.fast_double, c);
324 }
325 } 299 }
326 for (var i = 0; i < 3; i++) { 300 for (var i = 0; i < 3; i++) {
327 crankshaft_test(); 301 crankshaft_test();
328 } 302 }
329 %OptimizeFunctionOnNextCall(crankshaft_test); 303 %OptimizeFunctionOnNextCall(crankshaft_test);
330 crankshaft_test(); 304 crankshaft_test();
331 305
332 // Elements_kind transitions for arrays. 306 // Elements_kind transitions for arrays.
333 307
334 // A map can have three different elements_kind transitions: SMI->DOUBLE, 308 // A map can have three different elements_kind transitions: SMI->DOUBLE,
335 // DOUBLE->OBJECT, and SMI->OBJECT. No matter in which order these three are 309 // DOUBLE->OBJECT, and SMI->OBJECT. No matter in which order these three are
336 // created, they must always end up with the same FAST map. 310 // created, they must always end up with the same FAST map.
337 311
338 // This test is meaningless without FAST_SMI_ONLY_ELEMENTS. 312 // Preparation: create one pair of identical objects for each case.
339 if (support_smi_only_arrays) { 313 var a = [1, 2, 3];
340 // Preparation: create one pair of identical objects for each case. 314 var b = [1, 2, 3];
341 var a = [1, 2, 3]; 315 assertTrue(%HaveSameMap(a, b));
342 var b = [1, 2, 3]; 316 assertKind(elements_kind.fast_smi_only, a);
343 assertTrue(%HaveSameMap(a, b)); 317 var c = [1, 2, 3];
344 assertKind(elements_kind.fast_smi_only, a); 318 c["case2"] = true;
345 var c = [1, 2, 3]; 319 var d = [1, 2, 3];
346 c["case2"] = true; 320 d["case2"] = true;
347 var d = [1, 2, 3]; 321 assertTrue(%HaveSameMap(c, d));
348 d["case2"] = true; 322 assertFalse(%HaveSameMap(a, c));
349 assertTrue(%HaveSameMap(c, d)); 323 assertKind(elements_kind.fast_smi_only, c);
350 assertFalse(%HaveSameMap(a, c)); 324 var e = [1, 2, 3];
351 assertKind(elements_kind.fast_smi_only, c); 325 e["case3"] = true;
352 var e = [1, 2, 3]; 326 var f = [1, 2, 3];
353 e["case3"] = true; 327 f["case3"] = true;
354 var f = [1, 2, 3]; 328 assertTrue(%HaveSameMap(e, f));
355 f["case3"] = true; 329 assertFalse(%HaveSameMap(a, e));
356 assertTrue(%HaveSameMap(e, f)); 330 assertFalse(%HaveSameMap(c, e));
357 assertFalse(%HaveSameMap(a, e)); 331 assertKind(elements_kind.fast_smi_only, e);
358 assertFalse(%HaveSameMap(c, e)); 332 // Case 1: SMI->DOUBLE, DOUBLE->OBJECT, SMI->OBJECT.
359 assertKind(elements_kind.fast_smi_only, e); 333 a[0] = 1.5;
360 // Case 1: SMI->DOUBLE, DOUBLE->OBJECT, SMI->OBJECT. 334 assertKind(elements_kind.fast_double, a);
361 a[0] = 1.5; 335 a[0] = "foo";
362 assertKind(elements_kind.fast_double, a); 336 assertKind(elements_kind.fast, a);
363 a[0] = "foo"; 337 b[0] = "bar";
364 assertKind(elements_kind.fast, a); 338 assertTrue(%HaveSameMap(a, b));
365 b[0] = "bar"; 339 // Case 2: SMI->DOUBLE, SMI->OBJECT, DOUBLE->OBJECT.
366 assertTrue(%HaveSameMap(a, b)); 340 c[0] = 1.5;
367 // Case 2: SMI->DOUBLE, SMI->OBJECT, DOUBLE->OBJECT. 341 assertKind(elements_kind.fast_double, c);
368 c[0] = 1.5; 342 assertFalse(%HaveSameMap(c, d));
369 assertKind(elements_kind.fast_double, c); 343 d[0] = "foo";
370 assertFalse(%HaveSameMap(c, d)); 344 assertKind(elements_kind.fast, d);
371 d[0] = "foo"; 345 assertFalse(%HaveSameMap(c, d));
372 assertKind(elements_kind.fast, d); 346 c[0] = "bar";
373 assertFalse(%HaveSameMap(c, d)); 347 assertTrue(%HaveSameMap(c, d));
374 c[0] = "bar"; 348 // Case 3: SMI->OBJECT, SMI->DOUBLE, DOUBLE->OBJECT.
375 assertTrue(%HaveSameMap(c, d)); 349 e[0] = "foo";
376 // Case 3: SMI->OBJECT, SMI->DOUBLE, DOUBLE->OBJECT. 350 assertKind(elements_kind.fast, e);
377 e[0] = "foo"; 351 assertFalse(%HaveSameMap(e, f));
378 assertKind(elements_kind.fast, e); 352 f[0] = 1.5;
379 assertFalse(%HaveSameMap(e, f)); 353 assertKind(elements_kind.fast_double, f);
380 f[0] = 1.5; 354 assertFalse(%HaveSameMap(e, f));
381 assertKind(elements_kind.fast_double, f); 355 f[0] = "bar";
382 assertFalse(%HaveSameMap(e, f)); 356 assertKind(elements_kind.fast, f);
383 f[0] = "bar"; 357 assertTrue(%HaveSameMap(e, f));
384 assertKind(elements_kind.fast, f);
385 assertTrue(%HaveSameMap(e, f));
386 }
387 358
388 // Test if Array.concat() works correctly with DOUBLE elements. 359 // Test if Array.concat() works correctly with DOUBLE elements.
389 if (support_smi_only_arrays) { 360 var a = [1, 2];
390 var a = [1, 2]; 361 assertKind(elements_kind.fast_smi_only, a);
391 assertKind(elements_kind.fast_smi_only, a); 362 var b = [4.5, 5.5];
392 var b = [4.5, 5.5]; 363 assertKind(elements_kind.fast_double, b);
393 assertKind(elements_kind.fast_double, b); 364 var c = a.concat(b);
394 var c = a.concat(b); 365 assertEquals([1, 2, 4.5, 5.5], c);
395 assertEquals([1, 2, 4.5, 5.5], c); 366 assertKind(elements_kind.fast_double, c);
396 assertKind(elements_kind.fast_double, c);
397 }
398 367
399 // Test that Array.push() correctly handles SMI elements. 368 // Test that Array.push() correctly handles SMI elements.
400 if (support_smi_only_arrays) { 369 var a = [1, 2];
401 var a = [1, 2]; 370 assertKind(elements_kind.fast_smi_only, a);
402 assertKind(elements_kind.fast_smi_only, a); 371 a.push(3, 4, 5);
403 a.push(3, 4, 5); 372 assertKind(elements_kind.fast_smi_only, a);
404 assertKind(elements_kind.fast_smi_only, a); 373 assertEquals([1, 2, 3, 4, 5], a);
405 assertEquals([1, 2, 3, 4, 5], a);
406 }
407 374
408 // Test that Array.splice() and Array.slice() return correct ElementsKinds. 375 // Test that Array.splice() and Array.slice() return correct ElementsKinds.
409 if (support_smi_only_arrays) { 376 var a = ["foo", "bar"];
410 var a = ["foo", "bar"]; 377 assertKind(elements_kind.fast, a);
411 assertKind(elements_kind.fast, a); 378 var b = a.splice(0, 1);
412 var b = a.splice(0, 1); 379 assertKind(elements_kind.fast, b);
413 assertKind(elements_kind.fast, b); 380 var c = a.slice(0, 1);
414 var c = a.slice(0, 1); 381 assertKind(elements_kind.fast, c);
415 assertKind(elements_kind.fast, c);
416 }
417 382
418 // Throw away type information in the ICs for next stress run. 383 // Throw away type information in the ICs for next stress run.
419 gc(); 384 gc();
OLDNEW
« no previous file with comments | « test/mjsunit/array-natives-elements.js ('k') | test/mjsunit/elements-kind-depends.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698