| 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 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 92 throw MakeRangeError("invalid_typed_array_length"); | 92 throw MakeRangeError("invalid_typed_array_length"); |
| 93 } | 93 } |
| 94 var byteLength = l * ELEMENT_SIZE; | 94 var byteLength = l * ELEMENT_SIZE; |
| 95 var buffer = new $ArrayBuffer(byteLength); | 95 var buffer = new $ArrayBuffer(byteLength); |
| 96 %TypedArrayInitialize(obj, ARRAY_ID, buffer, 0, byteLength); | 96 %TypedArrayInitialize(obj, ARRAY_ID, buffer, 0, byteLength); |
| 97 } | 97 } |
| 98 | 98 |
| 99 function NAMEConstructByArrayLike(obj, arrayLike) { | 99 function NAMEConstructByArrayLike(obj, arrayLike) { |
| 100 var length = arrayLike.length; | 100 var length = arrayLike.length; |
| 101 var l = ToPositiveInteger(length, "invalid_typed_array_length"); | 101 var l = ToPositiveInteger(length, "invalid_typed_array_length"); |
| 102 if (l > %MaxSmi()) { |
| 103 throw MakeRangeError("invalid_typed_array_length"); |
| 104 } |
| 102 if(!%TypedArrayInitializeFromArrayLike(obj, ARRAY_ID, arrayLike, l)) { | 105 if(!%TypedArrayInitializeFromArrayLike(obj, ARRAY_ID, arrayLike, l)) { |
| 103 for (var i = 0; i < l; i++) { | 106 for (var i = 0; i < l; i++) { |
| 104 // It is crucial that we let any execptions from arrayLike[i] | 107 // It is crucial that we let any execptions from arrayLike[i] |
| 105 // propagate outside the function. | 108 // propagate outside the function. |
| 106 obj[i] = arrayLike[i]; | 109 obj[i] = arrayLike[i]; |
| 107 } | 110 } |
| 108 } | 111 } |
| 109 } | 112 } |
| 110 | 113 |
| 111 function NAMEConstructor(arg1, arg2, arg3) { | 114 function NAMEConstructor(arg1, arg2, arg3) { |
| (...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 433 | 436 |
| 434 "getFloat32", DataViewGetFloat32, | 437 "getFloat32", DataViewGetFloat32, |
| 435 "setFloat32", DataViewSetFloat32, | 438 "setFloat32", DataViewSetFloat32, |
| 436 | 439 |
| 437 "getFloat64", DataViewGetFloat64, | 440 "getFloat64", DataViewGetFloat64, |
| 438 "setFloat64", DataViewSetFloat64 | 441 "setFloat64", DataViewSetFloat64 |
| 439 )); | 442 )); |
| 440 } | 443 } |
| 441 | 444 |
| 442 SetupDataView(); | 445 SetupDataView(); |
| OLD | NEW |