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 588 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
599 | 599 |
600 // Mixed types of same size. | 600 // Mixed types of same size. |
601 var a61 = new Float32Array([1.2, 12.3]) | 601 var a61 = new Float32Array([1.2, 12.3]) |
602 var a62 = new Int32Array(2) | 602 var a62 = new Int32Array(2) |
603 a62.set(a61) | 603 a62.set(a61) |
604 assertArrayPrefix([1, 12], a62) | 604 assertArrayPrefix([1, 12], a62) |
605 a61.set(a62) | 605 a61.set(a62) |
606 assertArrayPrefix([1, 12], a61) | 606 assertArrayPrefix([1, 12], a61) |
607 | 607 |
608 // Invalid source | 608 // Invalid source |
609 assertThrows(function() { a.set(0) }) | 609 a.set(0); // does not throw |
610 assertThrows(function() { a.set({}) }) | 610 assertArrayPrefix([1,2,3,4,5,6], a); |
| 611 a.set({}); // does not throw |
| 612 assertArrayPrefix([1,2,3,4,5,6], a); |
611 | 613 |
612 | 614 |
613 // Test arraybuffer.slice | 615 // Test arraybuffer.slice |
614 | 616 |
615 var a0 = new Int8Array([1, 2, 3, 4, 5, 6]) | 617 var a0 = new Int8Array([1, 2, 3, 4, 5, 6]) |
616 var b0 = a0.buffer | 618 var b0 = a0.buffer |
617 | 619 |
618 var b1 = b0.slice(0) | 620 var b1 = b0.slice(0) |
619 assertEquals(b0.byteLength, b1.byteLength) | 621 assertEquals(b0.byteLength, b1.byteLength) |
620 assertArrayPrefix([1, 2, 3, 4, 5, 6], new Int8Array(b1)) | 622 assertArrayPrefix([1, 2, 3, 4, 5, 6], new Int8Array(b1)) |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
670 | 672 |
671 built_in_array = new Array(1.5, 2, 3, 4, 5, 6); | 673 built_in_array = new Array(1.5, 2, 3, 4, 5, 6); |
672 assertEquals(1.5, goo(built_in_array, 0)); | 674 assertEquals(1.5, goo(built_in_array, 0)); |
673 assertEquals(1.5, goo(built_in_array, 0)); | 675 assertEquals(1.5, goo(built_in_array, 0)); |
674 %OptimizeFunctionOnNextCall(goo); | 676 %OptimizeFunctionOnNextCall(goo); |
675 %OptimizeFunctionOnNextCall(boo); | 677 %OptimizeFunctionOnNextCall(boo); |
676 boo(built_in_array, 0, 2.5); | 678 boo(built_in_array, 0, 2.5); |
677 assertEquals(2.5, goo(built_in_array, 0)); | 679 assertEquals(2.5, goo(built_in_array, 0)); |
678 %ClearFunctionTypeFeedback(goo); | 680 %ClearFunctionTypeFeedback(goo); |
679 %ClearFunctionTypeFeedback(boo); | 681 %ClearFunctionTypeFeedback(boo); |
OLD | NEW |