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 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
256 NAMEConstructByArrayLike(this, arg1); | 256 NAMEConstructByArrayLike(this, arg1); |
257 } else { | 257 } else { |
258 NAMEConstructByIterable(this, arg1, iteratorFn); | 258 NAMEConstructByIterable(this, arg1, iteratorFn); |
259 } | 259 } |
260 } | 260 } |
261 } else { | 261 } else { |
262 throw MakeTypeError(kConstructorNotFunction, "NAME") | 262 throw MakeTypeError(kConstructorNotFunction, "NAME") |
263 } | 263 } |
264 } | 264 } |
265 | 265 |
266 // TODO(littledan): Remove this performance workaround BUG(chromium:579905) | |
267 function NAME_GetLength() { | |
268 if (!(%_ClassOf(this) === 'NAME')) { | |
269 throw MakeTypeError(kIncompatibleMethodReceiver, "NAME.length", this); | |
270 } | |
271 return %_TypedArrayGetLength(this); | |
272 } | |
273 | |
274 function NAMESubArray(begin, end) { | 266 function NAMESubArray(begin, end) { |
275 var beginInt = TO_INTEGER(begin); | 267 var beginInt = TO_INTEGER(begin); |
276 if (!IS_UNDEFINED(end)) { | 268 if (!IS_UNDEFINED(end)) { |
277 var endInt = TO_INTEGER(end); | 269 var endInt = TO_INTEGER(end); |
278 var srcLength = %_TypedArrayGetLength(this); | 270 var srcLength = %_TypedArrayGetLength(this); |
279 } else { | 271 } else { |
280 var srcLength = %_TypedArrayGetLength(this); | 272 var srcLength = %_TypedArrayGetLength(this); |
281 var endInt = srcLength; | 273 var endInt = srcLength; |
282 } | 274 } |
283 | 275 |
(...skipping 546 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
830 %InternalSetPrototype(GlobalNAME.prototype, TypedArray.prototype); | 822 %InternalSetPrototype(GlobalNAME.prototype, TypedArray.prototype); |
831 | 823 |
832 %AddNamedProperty(GlobalNAME, "BYTES_PER_ELEMENT", ELEMENT_SIZE, | 824 %AddNamedProperty(GlobalNAME, "BYTES_PER_ELEMENT", ELEMENT_SIZE, |
833 READ_ONLY | DONT_ENUM | DONT_DELETE); | 825 READ_ONLY | DONT_ENUM | DONT_DELETE); |
834 | 826 |
835 %AddNamedProperty(GlobalNAME.prototype, | 827 %AddNamedProperty(GlobalNAME.prototype, |
836 "constructor", global.NAME, DONT_ENUM); | 828 "constructor", global.NAME, DONT_ENUM); |
837 %AddNamedProperty(GlobalNAME.prototype, | 829 %AddNamedProperty(GlobalNAME.prototype, |
838 "BYTES_PER_ELEMENT", ELEMENT_SIZE, | 830 "BYTES_PER_ELEMENT", ELEMENT_SIZE, |
839 READ_ONLY | DONT_ENUM | DONT_DELETE); | 831 READ_ONLY | DONT_ENUM | DONT_DELETE); |
840 // TODO(littledan): Remove this performance workaround BUG(chromium:579905) | |
841 utils.InstallGetter(GlobalNAME.prototype, "length", NAME_GetLength, | |
842 DONT_ENUM | DONT_DELETE); | |
843 endmacro | 832 endmacro |
844 | 833 |
845 TYPED_ARRAYS(SETUP_TYPED_ARRAY) | 834 TYPED_ARRAYS(SETUP_TYPED_ARRAY) |
846 | 835 |
847 // --------------------------- DataView ----------------------------- | 836 // --------------------------- DataView ----------------------------- |
848 | 837 |
849 function DataViewConstructor(buffer, byteOffset, byteLength) { // length = 3 | 838 function DataViewConstructor(buffer, byteOffset, byteLength) { // length = 3 |
850 if (IS_UNDEFINED(new.target)) { | 839 if (IS_UNDEFINED(new.target)) { |
851 throw MakeTypeError(kConstructorNotFunction, "DataView"); | 840 throw MakeTypeError(kConstructorNotFunction, "DataView"); |
852 } | 841 } |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
971 "setUint32", DataViewSetUint32JS, | 960 "setUint32", DataViewSetUint32JS, |
972 | 961 |
973 "getFloat32", DataViewGetFloat32JS, | 962 "getFloat32", DataViewGetFloat32JS, |
974 "setFloat32", DataViewSetFloat32JS, | 963 "setFloat32", DataViewSetFloat32JS, |
975 | 964 |
976 "getFloat64", DataViewGetFloat64JS, | 965 "getFloat64", DataViewGetFloat64JS, |
977 "setFloat64", DataViewSetFloat64JS | 966 "setFloat64", DataViewSetFloat64JS |
978 ]); | 967 ]); |
979 | 968 |
980 }) | 969 }) |
OLD | NEW |