Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(473)

Side by Side Diff: src/js/typedarray.js

Issue 2096873002: Amends the TypedArray constructor to use the path for primitives for all (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: rebase Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | test/mjsunit/es6/typedarray.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
256 // TODO(littledan): Use the right prototype based on bufferConstructor's realm 256 // TODO(littledan): Use the right prototype based on bufferConstructor's realm
257 if (IS_RECEIVER(prototype) && prototype !== GlobalArrayBufferPrototype) { 257 if (IS_RECEIVER(prototype) && prototype !== GlobalArrayBufferPrototype) {
258 %InternalSetPrototype(%TypedArrayGetBuffer(obj), prototype); 258 %InternalSetPrototype(%TypedArrayGetBuffer(obj), prototype);
259 } 259 }
260 } 260 }
261 261
262 function NAMEConstructor(arg1, arg2, arg3) { 262 function NAMEConstructor(arg1, arg2, arg3) {
263 if (!IS_UNDEFINED(new.target)) { 263 if (!IS_UNDEFINED(new.target)) {
264 if (IS_ARRAYBUFFER(arg1) || IS_SHAREDARRAYBUFFER(arg1)) { 264 if (IS_ARRAYBUFFER(arg1) || IS_SHAREDARRAYBUFFER(arg1)) {
265 NAMEConstructByArrayBuffer(this, arg1, arg2, arg3); 265 NAMEConstructByArrayBuffer(this, arg1, arg2, arg3);
266 } else if (IS_NUMBER(arg1) || IS_STRING(arg1) ||
267 IS_BOOLEAN(arg1) || IS_UNDEFINED(arg1)) {
268 NAMEConstructByLength(this, arg1);
269 } else if (IS_TYPEDARRAY(arg1)) { 266 } else if (IS_TYPEDARRAY(arg1)) {
270 NAMEConstructByTypedArray(this, arg1); 267 NAMEConstructByTypedArray(this, arg1);
271 } else { 268 } else if (IS_RECEIVER(arg1)) {
272 var iteratorFn = arg1[iteratorSymbol]; 269 var iteratorFn = arg1[iteratorSymbol];
273 if (IS_UNDEFINED(iteratorFn) || iteratorFn === ArrayValues) { 270 if (IS_UNDEFINED(iteratorFn) || iteratorFn === ArrayValues) {
274 NAMEConstructByArrayLike(this, arg1, arg1.length); 271 NAMEConstructByArrayLike(this, arg1, arg1.length);
275 } else { 272 } else {
276 NAMEConstructByIterable(this, arg1, iteratorFn); 273 NAMEConstructByIterable(this, arg1, iteratorFn);
277 } 274 }
275 } else {
276 NAMEConstructByLength(this, arg1);
278 } 277 }
279 } else { 278 } else {
280 throw MakeTypeError(kConstructorNotFunction, "NAME") 279 throw MakeTypeError(kConstructorNotFunction, "NAME")
281 } 280 }
282 } 281 }
283 282
284 function NAMESubArray(begin, end) { 283 function NAMESubArray(begin, end) {
285 var beginInt = TO_INTEGER(begin); 284 var beginInt = TO_INTEGER(begin);
286 if (!IS_UNDEFINED(end)) { 285 if (!IS_UNDEFINED(end)) {
287 var endInt = TO_INTEGER(end); 286 var endInt = TO_INTEGER(end);
(...skipping 618 matching lines...) Expand 10 before | Expand all | Expand 10 after
906 "setUint32", DataViewSetUint32JS, 905 "setUint32", DataViewSetUint32JS,
907 906
908 "getFloat32", DataViewGetFloat32JS, 907 "getFloat32", DataViewGetFloat32JS,
909 "setFloat32", DataViewSetFloat32JS, 908 "setFloat32", DataViewSetFloat32JS,
910 909
911 "getFloat64", DataViewGetFloat64JS, 910 "getFloat64", DataViewGetFloat64JS,
912 "setFloat64", DataViewSetFloat64JS 911 "setFloat64", DataViewSetFloat64JS
913 ]); 912 ]);
914 913
915 }) 914 })
OLDNEW
« no previous file with comments | « no previous file | test/mjsunit/es6/typedarray.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698