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

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

Issue 2202163002: Revert of [builtins] implement Array.prototype.includes in TurboFan (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 4 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 | « src/js/array.js ('k') | src/objects.h » ('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 10 matching lines...) Expand all
21 var GlobalArrayBufferPrototype = GlobalArrayBuffer.prototype; 21 var GlobalArrayBufferPrototype = GlobalArrayBuffer.prototype;
22 var GlobalDataView = global.DataView; 22 var GlobalDataView = global.DataView;
23 var GlobalObject = global.Object; 23 var GlobalObject = global.Object;
24 var InnerArrayCopyWithin; 24 var InnerArrayCopyWithin;
25 var InnerArrayEvery; 25 var InnerArrayEvery;
26 var InnerArrayFill; 26 var InnerArrayFill;
27 var InnerArrayFilter; 27 var InnerArrayFilter;
28 var InnerArrayFind; 28 var InnerArrayFind;
29 var InnerArrayFindIndex; 29 var InnerArrayFindIndex;
30 var InnerArrayForEach; 30 var InnerArrayForEach;
31 var InnerArrayIncludes;
31 var InnerArrayIndexOf; 32 var InnerArrayIndexOf;
32 var InnerArrayJoin; 33 var InnerArrayJoin;
33 var InnerArrayLastIndexOf; 34 var InnerArrayLastIndexOf;
34 var InnerArrayReduce; 35 var InnerArrayReduce;
35 var InnerArrayReduceRight; 36 var InnerArrayReduceRight;
36 var InnerArraySome; 37 var InnerArraySome;
37 var InnerArraySort; 38 var InnerArraySort;
38 var InnerArrayToLocaleString; 39 var InnerArrayToLocaleString;
39 var InternalArray = utils.InternalArray; 40 var InternalArray = utils.InternalArray;
40 var IsNaN; 41 var IsNaN;
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 ArrayValues = from.ArrayValues; 75 ArrayValues = from.ArrayValues;
75 GetIterator = from.GetIterator; 76 GetIterator = from.GetIterator;
76 GetMethod = from.GetMethod; 77 GetMethod = from.GetMethod;
77 InnerArrayCopyWithin = from.InnerArrayCopyWithin; 78 InnerArrayCopyWithin = from.InnerArrayCopyWithin;
78 InnerArrayEvery = from.InnerArrayEvery; 79 InnerArrayEvery = from.InnerArrayEvery;
79 InnerArrayFill = from.InnerArrayFill; 80 InnerArrayFill = from.InnerArrayFill;
80 InnerArrayFilter = from.InnerArrayFilter; 81 InnerArrayFilter = from.InnerArrayFilter;
81 InnerArrayFind = from.InnerArrayFind; 82 InnerArrayFind = from.InnerArrayFind;
82 InnerArrayFindIndex = from.InnerArrayFindIndex; 83 InnerArrayFindIndex = from.InnerArrayFindIndex;
83 InnerArrayForEach = from.InnerArrayForEach; 84 InnerArrayForEach = from.InnerArrayForEach;
85 InnerArrayIncludes = from.InnerArrayIncludes;
84 InnerArrayIndexOf = from.InnerArrayIndexOf; 86 InnerArrayIndexOf = from.InnerArrayIndexOf;
85 InnerArrayJoin = from.InnerArrayJoin; 87 InnerArrayJoin = from.InnerArrayJoin;
86 InnerArrayLastIndexOf = from.InnerArrayLastIndexOf; 88 InnerArrayLastIndexOf = from.InnerArrayLastIndexOf;
87 InnerArrayReduce = from.InnerArrayReduce; 89 InnerArrayReduce = from.InnerArrayReduce;
88 InnerArrayReduceRight = from.InnerArrayReduceRight; 90 InnerArrayReduceRight = from.InnerArrayReduceRight;
89 InnerArraySome = from.InnerArraySome; 91 InnerArraySome = from.InnerArraySome;
90 InnerArraySort = from.InnerArraySort; 92 InnerArraySort = from.InnerArraySort;
91 InnerArrayToLocaleString = from.InnerArrayToLocaleString; 93 InnerArrayToLocaleString = from.InnerArrayToLocaleString;
92 IsNaN = from.IsNaN; 94 IsNaN = from.IsNaN;
93 MakeRangeError = from.MakeRangeError; 95 MakeRangeError = from.MakeRangeError;
(...skipping 610 matching lines...) Expand 10 before | Expand all | Expand 10 after
704 return array; 706 return array;
705 } 707 }
706 708
707 709
708 // ES2016 draft, section 22.2.3.14 710 // ES2016 draft, section 22.2.3.14
709 function TypedArrayIncludes(searchElement, fromIndex) { 711 function TypedArrayIncludes(searchElement, fromIndex) {
710 if (!IS_TYPEDARRAY(this)) throw MakeTypeError(kNotTypedArray); 712 if (!IS_TYPEDARRAY(this)) throw MakeTypeError(kNotTypedArray);
711 713
712 var length = %_TypedArrayGetLength(this); 714 var length = %_TypedArrayGetLength(this);
713 715
714 if (length === 0) return false; 716 return InnerArrayIncludes(searchElement, fromIndex, this, length);
715 var n = TO_INTEGER(fromIndex);
716
717 var k;
718 if (n >= 0) {
719 k = n;
720 } else {
721 k = length + n;
722 if (k < 0) {
723 k = 0;
724 }
725 }
726
727 while (k < length) {
728 var elementK = this[k];
729 if (%SameValueZero(searchElement, elementK)) {
730 return true;
731 }
732
733 ++k;
734 }
735
736 return false;
737 } 717 }
738 %FunctionSetLength(TypedArrayIncludes, 1); 718 %FunctionSetLength(TypedArrayIncludes, 1);
739 719
740 720
741 // ES6 draft 08-24-14, section 22.2.2.2 721 // ES6 draft 08-24-14, section 22.2.2.2
742 function TypedArrayOf() { 722 function TypedArrayOf() {
743 var length = arguments.length; 723 var length = arguments.length;
744 var array = TypedArrayCreate(this, length); 724 var array = TypedArrayCreate(this, length);
745 for (var i = 0; i < length; i++) { 725 for (var i = 0; i < length; i++) {
746 array[i] = arguments[i]; 726 array[i] = arguments[i];
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after
926 "setUint32", DataViewSetUint32JS, 906 "setUint32", DataViewSetUint32JS,
927 907
928 "getFloat32", DataViewGetFloat32JS, 908 "getFloat32", DataViewGetFloat32JS,
929 "setFloat32", DataViewSetFloat32JS, 909 "setFloat32", DataViewSetFloat32JS,
930 910
931 "getFloat64", DataViewGetFloat64JS, 911 "getFloat64", DataViewGetFloat64JS,
932 "setFloat64", DataViewSetFloat64JS 912 "setFloat64", DataViewSetFloat64JS
933 ]); 913 ]);
934 914
935 }) 915 })
OLDNEW
« no previous file with comments | « src/js/array.js ('k') | src/objects.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698