| OLD | NEW | 
|    1 // Copyright 2013 the V8 project authors. All rights reserved. |    1 // Copyright 2013 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 211 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  222                  RangeError); |  222                  RangeError); | 
|  223     var unalignedArrayBuffer = new ArrayBuffer(10*elementSize + 1); |  223     var unalignedArrayBuffer = new ArrayBuffer(10*elementSize + 1); | 
|  224     var goodArray = new constr(unalignedArrayBuffer, 0, 10); |  224     var goodArray = new constr(unalignedArrayBuffer, 0, 10); | 
|  225     assertSame(10, goodArray.length); |  225     assertSame(10, goodArray.length); | 
|  226     assertSame(10*elementSize, goodArray.byteLength); |  226     assertSame(10*elementSize, goodArray.byteLength); | 
|  227     assertThrows(function() { new constr(unalignedArrayBuffer)}, RangeError); |  227     assertThrows(function() { new constr(unalignedArrayBuffer)}, RangeError); | 
|  228     assertThrows(function() { new constr(unalignedArrayBuffer, 5*elementSize)}, |  228     assertThrows(function() { new constr(unalignedArrayBuffer, 5*elementSize)}, | 
|  229                  RangeError); |  229                  RangeError); | 
|  230   } |  230   } | 
|  231  |  231  | 
|  232   var aFromUndef = new constr(); |  | 
|  233   assertSame(elementSize, aFromUndef.BYTES_PER_ELEMENT); |  | 
|  234   assertSame(0, aFromUndef.length); |  | 
|  235   assertSame(0*elementSize, aFromUndef.byteLength); |  | 
|  236   assertSame(0, aFromUndef.byteOffset); |  | 
|  237   assertSame(0*elementSize, aFromUndef.buffer.byteLength); |  | 
|  238  |  | 
|  239   var aFromNull = new constr(null); |  | 
|  240   assertSame(elementSize, aFromNull.BYTES_PER_ELEMENT); |  | 
|  241   assertSame(0, aFromNull.length); |  | 
|  242   assertSame(0*elementSize, aFromNull.byteLength); |  | 
|  243   assertSame(0, aFromNull.byteOffset); |  | 
|  244   assertSame(0*elementSize, aFromNull.buffer.byteLength); |  | 
|  245  |  | 
|  246   var aFromBool = new constr(true); |  | 
|  247   assertSame(elementSize, aFromBool.BYTES_PER_ELEMENT); |  | 
|  248   assertSame(1, aFromBool.length); |  | 
|  249   assertSame(1*elementSize, aFromBool.byteLength); |  | 
|  250   assertSame(0, aFromBool.byteOffset); |  | 
|  251   assertSame(1*elementSize, aFromBool.buffer.byteLength); |  | 
|  252  |  | 
|  253   var aFromString = new constr("30"); |  232   var aFromString = new constr("30"); | 
|  254   assertSame(elementSize, aFromString.BYTES_PER_ELEMENT); |  233   assertSame(elementSize, aFromString.BYTES_PER_ELEMENT); | 
|  255   assertSame(30, aFromString.length); |  234   assertSame(30, aFromString.length); | 
|  256   assertSame(30*elementSize, aFromString.byteLength); |  235   assertSame(30*elementSize, aFromString.byteLength); | 
|  257   assertSame(0, aFromString.byteOffset); |  236   assertSame(0, aFromString.byteOffset); | 
|  258   assertSame(30*elementSize, aFromString.buffer.byteLength); |  237   assertSame(30*elementSize, aFromString.buffer.byteLength); | 
|  259  |  238  | 
|  260   assertThrows(function() { new constr(Symbol()); }, TypeError); |  | 
|  261  |  | 
|  262   var jsArray = []; |  239   var jsArray = []; | 
|  263   for (i = 0; i < 30; i++) { |  240   for (i = 0; i < 30; i++) { | 
|  264     jsArray.push(typicalElement); |  241     jsArray.push(typicalElement); | 
|  265   } |  242   } | 
|  266   var aFromArray = new constr(jsArray); |  243   var aFromArray = new constr(jsArray); | 
|  267   assertSame(elementSize, aFromArray.BYTES_PER_ELEMENT); |  244   assertSame(elementSize, aFromArray.BYTES_PER_ELEMENT); | 
|  268   assertSame(30, aFromArray.length); |  245   assertSame(30, aFromArray.length); | 
|  269   assertSame(30*elementSize, aFromArray.byteLength); |  246   assertSame(30*elementSize, aFromArray.byteLength); | 
|  270   assertSame(0, aFromArray.byteOffset); |  247   assertSame(0, aFromArray.byteOffset); | 
|  271   assertSame(30*elementSize, aFromArray.buffer.byteLength); |  248   assertSame(30*elementSize, aFromArray.buffer.byteLength); | 
| (...skipping 518 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  790  |  767  | 
|  791 function TestNonConfigurableProperties(constructor) { |  768 function TestNonConfigurableProperties(constructor) { | 
|  792   var arr = new constructor([100]) |  769   var arr = new constructor([100]) | 
|  793   assertFalse(Object.getOwnPropertyDescriptor(arr,"0").configurable) |  770   assertFalse(Object.getOwnPropertyDescriptor(arr,"0").configurable) | 
|  794   assertFalse(delete arr[0]) |  771   assertFalse(delete arr[0]) | 
|  795 } |  772 } | 
|  796  |  773  | 
|  797 for(i = 0; i < typedArrayConstructors.length; i++) { |  774 for(i = 0; i < typedArrayConstructors.length; i++) { | 
|  798   TestNonConfigurableProperties(typedArrayConstructors[i]); |  775   TestNonConfigurableProperties(typedArrayConstructors[i]); | 
|  799 } |  776 } | 
| OLD | NEW |