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

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

Issue 1179923002: In %TypedArray%.from, use InternalArray rather than GlobalArray (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 6 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 | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 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 11 matching lines...) Expand all
22 FUNCTION(Float32Array) 22 FUNCTION(Float32Array)
23 FUNCTION(Float64Array) 23 FUNCTION(Float64Array)
24 FUNCTION(Uint8ClampedArray) 24 FUNCTION(Uint8ClampedArray)
25 endmacro 25 endmacro
26 26
27 macro DECLARE_GLOBALS(NAME) 27 macro DECLARE_GLOBALS(NAME)
28 var GlobalNAME = global.NAME; 28 var GlobalNAME = global.NAME;
29 endmacro 29 endmacro
30 30
31 TYPED_ARRAYS(DECLARE_GLOBALS) 31 TYPED_ARRAYS(DECLARE_GLOBALS)
32 DECLARE_GLOBALS(Array)
33 32
34 var ArrayFrom; 33 var ArrayFrom;
35 var ArrayToString; 34 var ArrayToString;
36 var InnerArrayCopyWithin; 35 var InnerArrayCopyWithin;
37 var InnerArrayEvery; 36 var InnerArrayEvery;
38 var InnerArrayFill; 37 var InnerArrayFill;
39 var InnerArrayFilter; 38 var InnerArrayFilter;
40 var InnerArrayFind; 39 var InnerArrayFind;
41 var InnerArrayFindIndex; 40 var InnerArrayFindIndex;
42 var InnerArrayForEach; 41 var InnerArrayForEach;
43 var InnerArrayIndexOf; 42 var InnerArrayIndexOf;
44 var InnerArrayJoin; 43 var InnerArrayJoin;
45 var InnerArrayLastIndexOf; 44 var InnerArrayLastIndexOf;
46 var InnerArrayMap; 45 var InnerArrayMap;
47 var InnerArrayReverse; 46 var InnerArrayReverse;
48 var InnerArraySome; 47 var InnerArraySome;
49 var InnerArraySort; 48 var InnerArraySort;
50 var InnerArrayToLocaleString; 49 var InnerArrayToLocaleString;
50 var InternalArray = utils.InternalArray;
51 var IsNaN; 51 var IsNaN;
52 var MathMax; 52 var MathMax;
53 var MathMin; 53 var MathMin;
54 54
55 utils.Import(function(from) { 55 utils.Import(function(from) {
56 ArrayFrom = from.ArrayFrom; 56 ArrayFrom = from.ArrayFrom;
57 ArrayToString = from.ArrayToString; 57 ArrayToString = from.ArrayToString;
58 InnerArrayCopyWithin = from.InnerArrayCopyWithin; 58 InnerArrayCopyWithin = from.InnerArrayCopyWithin;
59 InnerArrayEvery = from.InnerArrayEvery; 59 InnerArrayEvery = from.InnerArrayEvery;
60 InnerArrayFill = from.InnerArrayFill; 60 InnerArrayFill = from.InnerArrayFill;
(...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after
364 for (var i = 0; i < length; i++) { 364 for (var i = 0; i < length; i++) {
365 array[i] = %_Arguments(i); 365 array[i] = %_Arguments(i);
366 } 366 }
367 return array; 367 return array;
368 } 368 }
369 369
370 370
371 function TypedArrayFrom(source, mapfn, thisArg) { 371 function TypedArrayFrom(source, mapfn, thisArg) {
372 // TODO(littledan): Investigate if there is a receiver which could be 372 // TODO(littledan): Investigate if there is a receiver which could be
373 // faster to accumulate on than Array, e.g., a TypedVector. 373 // faster to accumulate on than Array, e.g., a TypedVector.
374 var array = %_CallFunction(GlobalArray, source, mapfn, thisArg, ArrayFrom); 374 var array = %_CallFunction(InternalArray, source, mapfn, thisArg, ArrayFrom);
375 return ConstructTypedArray(this, array); 375 return ConstructTypedArray(this, array);
376 } 376 }
377 %FunctionSetLength(TypedArrayFrom, 1); 377 %FunctionSetLength(TypedArrayFrom, 1);
378 378
379 // TODO(littledan): Fix the TypedArray proto chain (bug v8:4085). 379 // TODO(littledan): Fix the TypedArray proto chain (bug v8:4085).
380 macro EXTEND_TYPED_ARRAY(NAME) 380 macro EXTEND_TYPED_ARRAY(NAME)
381 // Set up non-enumerable functions on the object. 381 // Set up non-enumerable functions on the object.
382 utils.InstallFunctions(GlobalNAME, DONT_ENUM | DONT_DELETE | READ_ONLY, [ 382 utils.InstallFunctions(GlobalNAME, DONT_ENUM | DONT_DELETE | READ_ONLY, [
383 "from", TypedArrayFrom, 383 "from", TypedArrayFrom,
384 "of", TypedArrayOf 384 "of", TypedArrayOf
(...skipping 19 matching lines...) Expand all
404 "some", TypedArraySome, 404 "some", TypedArraySome,
405 "sort", TypedArraySort, 405 "sort", TypedArraySort,
406 "toString", TypedArrayToString, 406 "toString", TypedArrayToString,
407 "toLocaleString", TypedArrayToLocaleString 407 "toLocaleString", TypedArrayToLocaleString
408 ]); 408 ]);
409 endmacro 409 endmacro
410 410
411 TYPED_ARRAYS(EXTEND_TYPED_ARRAY) 411 TYPED_ARRAYS(EXTEND_TYPED_ARRAY)
412 412
413 }) 413 })
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698