| OLD | NEW |
| 1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 (function(global, utils) { | 5 (function(global, utils) { |
| 6 | 6 |
| 7 "use strict"; | 7 "use strict"; |
| 8 | 8 |
| 9 %CheckIsBootstrapping(); | 9 %CheckIsBootstrapping(); |
| 10 | 10 |
| (...skipping 19 matching lines...) Expand all Loading... |
| 30 FUNCTION(8, Float64Array, 8) | 30 FUNCTION(8, Float64Array, 8) |
| 31 FUNCTION(9, Uint8ClampedArray, 1) | 31 FUNCTION(9, Uint8ClampedArray, 1) |
| 32 endmacro | 32 endmacro |
| 33 | 33 |
| 34 macro DECLARE_GLOBALS(INDEX, NAME, SIZE) | 34 macro DECLARE_GLOBALS(INDEX, NAME, SIZE) |
| 35 var GlobalNAME = global.NAME; | 35 var GlobalNAME = global.NAME; |
| 36 endmacro | 36 endmacro |
| 37 | 37 |
| 38 TYPED_ARRAYS(DECLARE_GLOBALS) | 38 TYPED_ARRAYS(DECLARE_GLOBALS) |
| 39 | 39 |
| 40 var ToNumber; | |
| 41 | |
| 42 utils.Import(function(from) { | |
| 43 ToNumber = from.ToNumber; | |
| 44 }); | |
| 45 | |
| 46 var InternalArray = utils.InternalArray; | 40 var InternalArray = utils.InternalArray; |
| 47 | 41 |
| 48 // --------------- Typed Arrays --------------------- | 42 // --------------- Typed Arrays --------------------- |
| 49 | 43 |
| 50 macro TYPED_ARRAY_CONSTRUCTOR(ARRAY_ID, NAME, ELEMENT_SIZE) | 44 macro TYPED_ARRAY_CONSTRUCTOR(ARRAY_ID, NAME, ELEMENT_SIZE) |
| 51 function NAMEConstructByArrayBuffer(obj, buffer, byteOffset, length) { | 45 function NAMEConstructByArrayBuffer(obj, buffer, byteOffset, length) { |
| 52 if (!IS_UNDEFINED(byteOffset)) { | 46 if (!IS_UNDEFINED(byteOffset)) { |
| 53 byteOffset = | 47 byteOffset = |
| 54 $toPositiveInteger(byteOffset, kInvalidTypedArrayLength); | 48 $toPositiveInteger(byteOffset, kInvalidTypedArrayLength); |
| 55 } | 49 } |
| (...skipping 400 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 456 return %DataViewGetTYPENAME(this, offset, !!little_endian); | 450 return %DataViewGetTYPENAME(this, offset, !!little_endian); |
| 457 } | 451 } |
| 458 | 452 |
| 459 function DataViewSetTYPENAMEJS(offset, value, little_endian) { | 453 function DataViewSetTYPENAMEJS(offset, value, little_endian) { |
| 460 if (!IS_DATAVIEW(this)) { | 454 if (!IS_DATAVIEW(this)) { |
| 461 throw MakeTypeError(kIncompatibleMethodReceiver, | 455 throw MakeTypeError(kIncompatibleMethodReceiver, |
| 462 'DataView.setTYPENAME', this); | 456 'DataView.setTYPENAME', this); |
| 463 } | 457 } |
| 464 if (%_ArgumentsLength() < 2) throw MakeTypeError(kInvalidArgument); | 458 if (%_ArgumentsLength() < 2) throw MakeTypeError(kInvalidArgument); |
| 465 offset = $toPositiveInteger(offset, kInvalidDataViewAccessorOffset); | 459 offset = $toPositiveInteger(offset, kInvalidDataViewAccessorOffset); |
| 466 %DataViewSetTYPENAME(this, offset, TO_NUMBER_INLINE(value), !!little_endian); | 460 %DataViewSetTYPENAME(this, offset, TO_NUMBER(value), !!little_endian); |
| 467 } | 461 } |
| 468 endmacro | 462 endmacro |
| 469 | 463 |
| 470 DATA_VIEW_TYPES(DATA_VIEW_GETTER_SETTER) | 464 DATA_VIEW_TYPES(DATA_VIEW_GETTER_SETTER) |
| 471 | 465 |
| 472 // Setup the DataView constructor. | 466 // Setup the DataView constructor. |
| 473 %SetCode(GlobalDataView, DataViewConstructor); | 467 %SetCode(GlobalDataView, DataViewConstructor); |
| 474 %FunctionSetPrototype(GlobalDataView, new GlobalObject); | 468 %FunctionSetPrototype(GlobalDataView, new GlobalObject); |
| 475 | 469 |
| 476 // Set up constructor property on the DataView prototype. | 470 // Set up constructor property on the DataView prototype. |
| (...skipping 28 matching lines...) Expand all Loading... |
| 505 "setUint32", DataViewSetUint32JS, | 499 "setUint32", DataViewSetUint32JS, |
| 506 | 500 |
| 507 "getFloat32", DataViewGetFloat32JS, | 501 "getFloat32", DataViewGetFloat32JS, |
| 508 "setFloat32", DataViewSetFloat32JS, | 502 "setFloat32", DataViewSetFloat32JS, |
| 509 | 503 |
| 510 "getFloat64", DataViewGetFloat64JS, | 504 "getFloat64", DataViewGetFloat64JS, |
| 511 "setFloat64", DataViewSetFloat64JS | 505 "setFloat64", DataViewSetFloat64JS |
| 512 ]); | 506 ]); |
| 513 | 507 |
| 514 }) | 508 }) |
| OLD | NEW |