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

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

Issue 1238593003: Array.prototype.reverse should call [[HasProperty]] on elements before [[Get]] (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Changes from code review Created 5 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 | « src/array.js ('k') | test/mjsunit/es6/array-reverse-order.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 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 26 matching lines...) Expand all
37 var InnerArrayEvery; 37 var InnerArrayEvery;
38 var InnerArrayFill; 38 var InnerArrayFill;
39 var InnerArrayFilter; 39 var InnerArrayFilter;
40 var InnerArrayFind; 40 var InnerArrayFind;
41 var InnerArrayFindIndex; 41 var InnerArrayFindIndex;
42 var InnerArrayForEach; 42 var InnerArrayForEach;
43 var InnerArrayIndexOf; 43 var InnerArrayIndexOf;
44 var InnerArrayJoin; 44 var InnerArrayJoin;
45 var InnerArrayLastIndexOf; 45 var InnerArrayLastIndexOf;
46 var InnerArrayMap; 46 var InnerArrayMap;
47 var InnerArrayReverse;
48 var InnerArraySome; 47 var InnerArraySome;
49 var InnerArraySort; 48 var InnerArraySort;
50 var InnerArrayToLocaleString; 49 var InnerArrayToLocaleString;
51 var IsNaN; 50 var IsNaN;
52 var MathMax; 51 var MathMax;
53 var MathMin; 52 var MathMin;
53 var PackedArrayReverse;
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;
61 InnerArrayFilter = from.InnerArrayFilter; 61 InnerArrayFilter = from.InnerArrayFilter;
62 InnerArrayFind = from.InnerArrayFind; 62 InnerArrayFind = from.InnerArrayFind;
63 InnerArrayFindIndex = from.InnerArrayFindIndex; 63 InnerArrayFindIndex = from.InnerArrayFindIndex;
64 InnerArrayForEach = from.InnerArrayForEach; 64 InnerArrayForEach = from.InnerArrayForEach;
65 InnerArrayIndexOf = from.InnerArrayIndexOf; 65 InnerArrayIndexOf = from.InnerArrayIndexOf;
66 InnerArrayJoin = from.InnerArrayJoin; 66 InnerArrayJoin = from.InnerArrayJoin;
67 InnerArrayLastIndexOf = from.InnerArrayLastIndexOf; 67 InnerArrayLastIndexOf = from.InnerArrayLastIndexOf;
68 InnerArrayMap = from.InnerArrayMap; 68 InnerArrayMap = from.InnerArrayMap;
69 InnerArrayReduce = from.InnerArrayReduce; 69 InnerArrayReduce = from.InnerArrayReduce;
70 InnerArrayReduceRight = from.InnerArrayReduceRight; 70 InnerArrayReduceRight = from.InnerArrayReduceRight;
71 InnerArrayReverse = from.InnerArrayReverse;
72 InnerArraySome = from.InnerArraySome; 71 InnerArraySome = from.InnerArraySome;
73 InnerArraySort = from.InnerArraySort; 72 InnerArraySort = from.InnerArraySort;
74 InnerArrayToLocaleString = from.InnerArrayToLocaleString; 73 InnerArrayToLocaleString = from.InnerArrayToLocaleString;
75 IsNaN = from.IsNaN; 74 IsNaN = from.IsNaN;
76 MathMax = from.MathMax; 75 MathMax = from.MathMax;
77 MathMin = from.MathMin; 76 MathMin = from.MathMin;
77 PackedArrayReverse = from.PackedArrayReverse;
78 }); 78 });
79 79
80 // ------------------------------------------------------------------- 80 // -------------------------------------------------------------------
81 81
82 function ConstructTypedArray(constructor, arg) { 82 function ConstructTypedArray(constructor, arg) {
83 // TODO(littledan): This is an approximation of the spec, which requires 83 // TODO(littledan): This is an approximation of the spec, which requires
84 // that only real TypedArray classes should be accepted (22.2.2.1.1) 84 // that only real TypedArray classes should be accepted (22.2.2.1.1)
85 if (!%IsConstructor(constructor) || IS_UNDEFINED(constructor.prototype) || 85 if (!%IsConstructor(constructor) || IS_UNDEFINED(constructor.prototype) ||
86 !%HasOwnProperty(constructor.prototype, "BYTES_PER_ELEMENT")) { 86 !%HasOwnProperty(constructor.prototype, "BYTES_PER_ELEMENT")) {
87 throw MakeTypeError(kNotTypedArray); 87 throw MakeTypeError(kNotTypedArray);
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
172 return InnerArrayFindIndex(predicate, thisArg, this, length); 172 return InnerArrayFindIndex(predicate, thisArg, this, length);
173 } 173 }
174 %FunctionSetLength(TypedArrayFindIndex, 1); 174 %FunctionSetLength(TypedArrayFindIndex, 1);
175 175
176 // ES6 draft 05-18-15, section 22.2.3.21 176 // ES6 draft 05-18-15, section 22.2.3.21
177 function TypedArrayReverse() { 177 function TypedArrayReverse() {
178 if (!%_IsTypedArray(this)) throw MakeTypeError(kNotTypedArray); 178 if (!%_IsTypedArray(this)) throw MakeTypeError(kNotTypedArray);
179 179
180 var length = %_TypedArrayGetLength(this); 180 var length = %_TypedArrayGetLength(this);
181 181
182 return InnerArrayReverse(this, length); 182 return PackedArrayReverse(this, length);
183 } 183 }
184 184
185 185
186 function TypedArrayComparefn(x, y) { 186 function TypedArrayComparefn(x, y) {
187 if (IsNaN(x) && IsNaN(y)) { 187 if (IsNaN(x) && IsNaN(y)) {
188 return IsNaN(y) ? 0 : 1; 188 return IsNaN(y) ? 0 : 1;
189 } 189 }
190 if (IsNaN(x)) { 190 if (IsNaN(x)) {
191 return 1; 191 return 1;
192 } 192 }
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 | « src/array.js ('k') | test/mjsunit/es6/array-reverse-order.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698