| 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 288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 299 | 299 |
| 300 // --------------------------- DataView ----------------------------- | 300 // --------------------------- DataView ----------------------------- |
| 301 | 301 |
| 302 var $DataView = global.DataView; | 302 var $DataView = global.DataView; |
| 303 | 303 |
| 304 function DataViewConstructor(buffer, byteOffset, byteLength) { // length = 3 | 304 function DataViewConstructor(buffer, byteOffset, byteLength) { // length = 3 |
| 305 if (%_IsConstructCall()) { | 305 if (%_IsConstructCall()) { |
| 306 if (!IS_ARRAYBUFFER(buffer)) { | 306 if (!IS_ARRAYBUFFER(buffer)) { |
| 307 throw MakeTypeError('data_view_not_array_buffer', []); | 307 throw MakeTypeError('data_view_not_array_buffer', []); |
| 308 } | 308 } |
| 309 var bufferByteLength = %ArrayBufferGetByteLength(buffer); | 309 var bufferByteLength = buffer.byteLength; |
| 310 var offset = IS_UNDEFINED(byteOffset) ? | 310 var offset = IS_UNDEFINED(byteOffset) ? |
| 311 0 : ToPositiveInteger(byteOffset, 'invalid_data_view_offset'); | 311 0 : ToPositiveInteger(byteOffset, 'invalid_data_view_offset'); |
| 312 if (offset > bufferByteLength) { | 312 if (offset > bufferByteLength) { |
| 313 throw MakeRangeError('invalid_data_view_offset'); | 313 throw MakeRangeError('invalid_data_view_offset'); |
| 314 } | 314 } |
| 315 var length = IS_UNDEFINED(byteLength) ? | 315 var length = IS_UNDEFINED(byteLength) ? |
| 316 bufferByteLength - offset : TO_INTEGER(byteLength); | 316 bufferByteLength - offset : TO_INTEGER(byteLength); |
| 317 if (length < 0 || offset + length > bufferByteLength) { | 317 if (length < 0 || offset + length > bufferByteLength) { |
| 318 throw new MakeRangeError('invalid_data_view_length'); | 318 throw new MakeRangeError('invalid_data_view_length'); |
| 319 } | 319 } |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 429 | 429 |
| 430 "getFloat32", DataViewGetFloat32, | 430 "getFloat32", DataViewGetFloat32, |
| 431 "setFloat32", DataViewSetFloat32, | 431 "setFloat32", DataViewSetFloat32, |
| 432 | 432 |
| 433 "getFloat64", DataViewGetFloat64, | 433 "getFloat64", DataViewGetFloat64, |
| 434 "setFloat64", DataViewSetFloat64 | 434 "setFloat64", DataViewSetFloat64 |
| 435 )); | 435 )); |
| 436 } | 436 } |
| 437 | 437 |
| 438 SetupDataView(); | 438 SetupDataView(); |
| OLD | NEW |