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 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
255 // TODO(littledan): Use the right prototype based on bufferConstructor's realm | 255 // TODO(littledan): Use the right prototype based on bufferConstructor's realm |
256 if (IS_RECEIVER(prototype) && prototype !== GlobalArrayBufferPrototype) { | 256 if (IS_RECEIVER(prototype) && prototype !== GlobalArrayBufferPrototype) { |
257 %InternalSetPrototype(%TypedArrayGetBuffer(obj), prototype); | 257 %InternalSetPrototype(%TypedArrayGetBuffer(obj), prototype); |
258 } | 258 } |
259 } | 259 } |
260 | 260 |
261 function NAMEConstructor(arg1, arg2, arg3) { | 261 function NAMEConstructor(arg1, arg2, arg3) { |
262 if (!IS_UNDEFINED(new.target)) { | 262 if (!IS_UNDEFINED(new.target)) { |
263 if (IS_ARRAYBUFFER(arg1) || IS_SHAREDARRAYBUFFER(arg1)) { | 263 if (IS_ARRAYBUFFER(arg1) || IS_SHAREDARRAYBUFFER(arg1)) { |
264 NAMEConstructByArrayBuffer(this, arg1, arg2, arg3); | 264 NAMEConstructByArrayBuffer(this, arg1, arg2, arg3); |
| 265 } else if (IS_NUMBER(arg1) || IS_STRING(arg1) || |
| 266 IS_BOOLEAN(arg1) || IS_UNDEFINED(arg1)) { |
| 267 NAMEConstructByLength(this, arg1); |
265 } else if (IS_TYPEDARRAY(arg1)) { | 268 } else if (IS_TYPEDARRAY(arg1)) { |
266 NAMEConstructByTypedArray(this, arg1); | 269 NAMEConstructByTypedArray(this, arg1); |
267 } else if (IS_RECEIVER(arg1)) { | 270 } else { |
268 var iteratorFn = arg1[iteratorSymbol]; | 271 var iteratorFn = arg1[iteratorSymbol]; |
269 if (IS_UNDEFINED(iteratorFn) || iteratorFn === ArrayValues) { | 272 if (IS_UNDEFINED(iteratorFn) || iteratorFn === ArrayValues) { |
270 NAMEConstructByArrayLike(this, arg1, arg1.length); | 273 NAMEConstructByArrayLike(this, arg1, arg1.length); |
271 } else { | 274 } else { |
272 NAMEConstructByIterable(this, arg1, iteratorFn); | 275 NAMEConstructByIterable(this, arg1, iteratorFn); |
273 } | 276 } |
274 } else { | |
275 NAMEConstructByLength(this, arg1); | |
276 } | 277 } |
277 } else { | 278 } else { |
278 throw MakeTypeError(kConstructorNotFunction, "NAME") | 279 throw MakeTypeError(kConstructorNotFunction, "NAME") |
279 } | 280 } |
280 } | 281 } |
281 | 282 |
282 function NAMESubArray(begin, end) { | 283 function NAMESubArray(begin, end) { |
283 var beginInt = TO_INTEGER(begin); | 284 var beginInt = TO_INTEGER(begin); |
284 if (!IS_UNDEFINED(end)) { | 285 if (!IS_UNDEFINED(end)) { |
285 var endInt = TO_INTEGER(end); | 286 var endInt = TO_INTEGER(end); |
(...skipping 612 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
898 "setUint32", DataViewSetUint32JS, | 899 "setUint32", DataViewSetUint32JS, |
899 | 900 |
900 "getFloat32", DataViewGetFloat32JS, | 901 "getFloat32", DataViewGetFloat32JS, |
901 "setFloat32", DataViewSetFloat32JS, | 902 "setFloat32", DataViewSetFloat32JS, |
902 | 903 |
903 "getFloat64", DataViewGetFloat64JS, | 904 "getFloat64", DataViewGetFloat64JS, |
904 "setFloat64", DataViewSetFloat64JS | 905 "setFloat64", DataViewSetFloat64JS |
905 ]); | 906 ]); |
906 | 907 |
907 }) | 908 }) |
OLD | NEW |