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 303 matching lines...) Loading... |
314 } | 314 } |
315 | 315 |
316 // Test if Array.concat() works correctly with DOUBLE elements. | 316 // Test if Array.concat() works correctly with DOUBLE elements. |
317 if (support_smi_only_arrays) { | 317 if (support_smi_only_arrays) { |
318 var a = [1, 2]; | 318 var a = [1, 2]; |
319 assertKind(elements_kind.fast_smi_only, a); | 319 assertKind(elements_kind.fast_smi_only, a); |
320 var b = [4.5, 5.5]; | 320 var b = [4.5, 5.5]; |
321 assertKind(elements_kind.fast_double, b); | 321 assertKind(elements_kind.fast_double, b); |
322 var c = a.concat(b); | 322 var c = a.concat(b); |
323 assertEquals([1, 2, 4.5, 5.5], c); | 323 assertEquals([1, 2, 4.5, 5.5], c); |
324 // TODO(1810): Change implementation so that we get DOUBLE elements here? | 324 assertKind(elements_kind.fast_double, c); |
325 assertKind(elements_kind.fast, c); | |
326 } | 325 } |
327 | 326 |
328 // Test that Array.push() correctly handles SMI elements. | 327 // Test that Array.push() correctly handles SMI elements. |
329 if (support_smi_only_arrays) { | 328 if (support_smi_only_arrays) { |
330 var a = [1, 2]; | 329 var a = [1, 2]; |
331 assertKind(elements_kind.fast_smi_only, a); | 330 assertKind(elements_kind.fast_smi_only, a); |
332 a.push(3, 4, 5); | 331 a.push(3, 4, 5); |
333 assertKind(elements_kind.fast_smi_only, a); | 332 assertKind(elements_kind.fast_smi_only, a); |
334 assertEquals([1, 2, 3, 4, 5], a); | 333 assertEquals([1, 2, 3, 4, 5], a); |
335 } | 334 } |
336 | 335 |
337 // Test that Array.splice() and Array.slice() return correct ElementsKinds. | 336 // Test that Array.splice() and Array.slice() return correct ElementsKinds. |
338 if (support_smi_only_arrays) { | 337 if (support_smi_only_arrays) { |
339 var a = ["foo", "bar"]; | 338 var a = ["foo", "bar"]; |
340 assertKind(elements_kind.fast, a); | 339 assertKind(elements_kind.fast, a); |
341 var b = a.splice(0, 1); | 340 var b = a.splice(0, 1); |
342 assertKind(elements_kind.fast, b); | 341 assertKind(elements_kind.fast, b); |
343 var c = a.slice(0, 1); | 342 var c = a.slice(0, 1); |
344 assertKind(elements_kind.fast, c); | 343 assertKind(elements_kind.fast, c); |
345 } | 344 } |
346 | 345 |
347 // Throw away type information in the ICs for next stress run. | 346 // Throw away type information in the ICs for next stress run. |
348 gc(); | 347 gc(); |
OLD | NEW |