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 13 matching lines...) Expand all Loading... |
24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
27 | 27 |
28 "use strict"; | 28 "use strict"; |
29 | 29 |
30 // This file relies on the fact that the following declaration has been made | 30 // This file relies on the fact that the following declaration has been made |
31 // in runtime.js: | 31 // in runtime.js: |
32 // var $Array = global.Array; | 32 // var $Array = global.Array; |
33 | 33 |
34 var $ArrayBuffer = global.__ArrayBuffer; | 34 var $ArrayBuffer = global.ArrayBuffer; |
35 | 35 |
36 // ------------------------------------------------------------------- | 36 // ------------------------------------------------------------------- |
37 | 37 |
38 function ArrayBufferConstructor(byteLength) { // length = 1 | 38 function ArrayBufferConstructor(byteLength) { // length = 1 |
39 if (%_IsConstructCall()) { | 39 if (%_IsConstructCall()) { |
40 var l = TO_POSITIVE_INTEGER(byteLength); | 40 var l = TO_POSITIVE_INTEGER(byteLength); |
41 %ArrayBufferInitialize(this, l); | 41 %ArrayBufferInitialize(this, l); |
42 } else { | 42 } else { |
43 return new $ArrayBuffer(byteLength); | 43 return new $ArrayBuffer(byteLength); |
44 } | 44 } |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
174 %SetProperty(constructor.prototype, | 174 %SetProperty(constructor.prototype, |
175 "BYTES_PER_ELEMENT", elementSize, | 175 "BYTES_PER_ELEMENT", elementSize, |
176 READ_ONLY | DONT_ENUM | DONT_DELETE); | 176 READ_ONLY | DONT_ENUM | DONT_DELETE); |
177 InstallGetter(constructor.prototype, "buffer", TypedArrayGetBuffer); | 177 InstallGetter(constructor.prototype, "buffer", TypedArrayGetBuffer); |
178 InstallGetter(constructor.prototype, "byteOffset", TypedArrayGetByteOffset); | 178 InstallGetter(constructor.prototype, "byteOffset", TypedArrayGetByteOffset); |
179 InstallGetter(constructor.prototype, "byteLength", TypedArrayGetByteLength); | 179 InstallGetter(constructor.prototype, "byteLength", TypedArrayGetByteLength); |
180 InstallGetter(constructor.prototype, "length", TypedArrayGetLength); | 180 InstallGetter(constructor.prototype, "length", TypedArrayGetLength); |
181 } | 181 } |
182 | 182 |
183 // arrayIds below should be synchronized with Runtime_TypedArrayInitialize. | 183 // arrayIds below should be synchronized with Runtime_TypedArrayInitialize. |
184 SetupTypedArray(1, "Uint8Array", global.__Uint8Array, 1); | 184 SetupTypedArray(1, "Uint8Array", global.Uint8Array, 1); |
185 SetupTypedArray(2, "Int8Array", global.__Int8Array, 1); | 185 SetupTypedArray(2, "Int8Array", global.Int8Array, 1); |
186 SetupTypedArray(3, "Uint16Array", global.__Uint16Array, 2); | 186 SetupTypedArray(3, "Uint16Array", global.Uint16Array, 2); |
187 SetupTypedArray(4, "Int16Array", global.__Int16Array, 2); | 187 SetupTypedArray(4, "Int16Array", global.Int16Array, 2); |
188 SetupTypedArray(5, "Uint32Array", global.__Uint32Array, 4); | 188 SetupTypedArray(5, "Uint32Array", global.Uint32Array, 4); |
189 SetupTypedArray(6, "Int32Array", global.__Int32Array, 4); | 189 SetupTypedArray(6, "Int32Array", global.Int32Array, 4); |
190 SetupTypedArray(7, "Float32Array", global.__Float32Array, 4); | 190 SetupTypedArray(7, "Float32Array", global.Float32Array, 4); |
191 SetupTypedArray(8, "Float64Array", global.__Float64Array, 8); | 191 SetupTypedArray(8, "Float64Array", global.Float64Array, 8); |
192 | 192 |
OLD | NEW |