| 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 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 62 newByteLength = newLength * elementSize; | 62 newByteLength = newLength * elementSize; |
| 63 } | 63 } |
| 64 if (offset + newByteLength > bufferByteLength) { | 64 if (offset + newByteLength > bufferByteLength) { |
| 65 throw MakeRangeError("invalid_typed_array_length"); | 65 throw MakeRangeError("invalid_typed_array_length"); |
| 66 } | 66 } |
| 67 %TypedArrayInitialize(obj, arrayId, buffer, offset, newByteLength); | 67 %TypedArrayInitialize(obj, arrayId, buffer, offset, newByteLength); |
| 68 } | 68 } |
| 69 | 69 |
| 70 function ConstructByLength(obj, length) { | 70 function ConstructByLength(obj, length) { |
| 71 var l = ToPositiveInteger(length, "invalid_typed_array_length"); | 71 var l = ToPositiveInteger(length, "invalid_typed_array_length"); |
| 72 if (l > %MaxSmi()) { |
| 73 throw MakeRangeError("invalid_typed_array_length"); |
| 74 } |
| 72 var byteLength = l * elementSize; | 75 var byteLength = l * elementSize; |
| 73 var buffer = new $ArrayBuffer(byteLength); | 76 var buffer = new $ArrayBuffer(byteLength); |
| 74 %TypedArrayInitialize(obj, arrayId, buffer, 0, byteLength); | 77 %TypedArrayInitialize(obj, arrayId, buffer, 0, byteLength); |
| 75 } | 78 } |
| 76 | 79 |
| 77 function ConstructByArrayLike(obj, arrayLike) { | 80 function ConstructByArrayLike(obj, arrayLike) { |
| 78 var length = arrayLike.length; | 81 var length = arrayLike.length; |
| 79 var l = ToPositiveInteger(length, "invalid_typed_array_length"); | 82 var l = ToPositiveInteger(length, "invalid_typed_array_length"); |
| 80 if(!%TypedArrayInitializeFromArrayLike(obj, arrayId, arrayLike, l)) { | 83 if(!%TypedArrayInitializeFromArrayLike(obj, arrayId, arrayLike, l)) { |
| 81 for (var i = 0; i < l; i++) { | 84 for (var i = 0; i < l; i++) { |
| (...skipping 506 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 588 | 591 |
| 589 "getFloat32", DataViewGetFloat32, | 592 "getFloat32", DataViewGetFloat32, |
| 590 "setFloat32", DataViewSetFloat32, | 593 "setFloat32", DataViewSetFloat32, |
| 591 | 594 |
| 592 "getFloat64", DataViewGetFloat64, | 595 "getFloat64", DataViewGetFloat64, |
| 593 "setFloat64", DataViewSetFloat64 | 596 "setFloat64", DataViewSetFloat64 |
| 594 )); | 597 )); |
| 595 } | 598 } |
| 596 | 599 |
| 597 SetupDataView(); | 600 SetupDataView(); |
| OLD | NEW |