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

Side by Side Diff: test/mjsunit/external-array.js

Issue 19086003: TypedArray.set function should ignore non-array-like arguments instead of throwing. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 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 | « src/typedarray.js ('k') | test/mjsunit/external-array-no-sse2.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
(...skipping 587 matching lines...) Expand 10 before | Expand all | Expand 10 after
598 598
599 // Mixed types of same size. 599 // Mixed types of same size.
600 var a61 = new Float32Array([1.2, 12.3]) 600 var a61 = new Float32Array([1.2, 12.3])
601 var a62 = new Int32Array(2) 601 var a62 = new Int32Array(2)
602 a62.set(a61) 602 a62.set(a61)
603 assertArrayPrefix([1, 12], a62) 603 assertArrayPrefix([1, 12], a62)
604 a61.set(a62) 604 a61.set(a62)
605 assertArrayPrefix([1, 12], a61) 605 assertArrayPrefix([1, 12], a61)
606 606
607 // Invalid source 607 // Invalid source
608 assertThrows(function() { a.set(0) }) 608 a.set(0); // does not throw
609 assertThrows(function() { a.set({}) }) 609 assertArrayPrefix([1,2,3,4,5,6], a);
610 a.set({}); // does not throw
611 assertArrayPrefix([1,2,3,4,5,6], a);
610 612
611 613
612 // Test arraybuffer.slice 614 // Test arraybuffer.slice
613 615
614 var a0 = new Int8Array([1, 2, 3, 4, 5, 6]) 616 var a0 = new Int8Array([1, 2, 3, 4, 5, 6])
615 var b0 = a0.buffer 617 var b0 = a0.buffer
616 618
617 var b1 = b0.slice(0) 619 var b1 = b0.slice(0)
618 assertEquals(b0.byteLength, b1.byteLength) 620 assertEquals(b0.byteLength, b1.byteLength)
619 assertArrayPrefix([1, 2, 3, 4, 5, 6], new Int8Array(b1)) 621 assertArrayPrefix([1, 2, 3, 4, 5, 6], new Int8Array(b1))
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
669 671
670 built_in_array = new Array(1.5, 2, 3, 4, 5, 6); 672 built_in_array = new Array(1.5, 2, 3, 4, 5, 6);
671 assertEquals(1.5, goo(built_in_array, 0)); 673 assertEquals(1.5, goo(built_in_array, 0));
672 assertEquals(1.5, goo(built_in_array, 0)); 674 assertEquals(1.5, goo(built_in_array, 0));
673 %OptimizeFunctionOnNextCall(goo); 675 %OptimizeFunctionOnNextCall(goo);
674 %OptimizeFunctionOnNextCall(boo); 676 %OptimizeFunctionOnNextCall(boo);
675 boo(built_in_array, 0, 2.5); 677 boo(built_in_array, 0, 2.5);
676 assertEquals(2.5, goo(built_in_array, 0)); 678 assertEquals(2.5, goo(built_in_array, 0));
677 %ClearFunctionTypeFeedback(goo); 679 %ClearFunctionTypeFeedback(goo);
678 %ClearFunctionTypeFeedback(boo); 680 %ClearFunctionTypeFeedback(boo);
OLDNEW
« no previous file with comments | « src/typedarray.js ('k') | test/mjsunit/external-array-no-sse2.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698