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

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

Issue 1624383003: Restore per-TypedArray-class length accessors as a perf workaround (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 11 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-proto.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 NAMEConstructByArrayLike(this, arg1); 256 NAMEConstructByArrayLike(this, arg1);
257 } else { 257 } else {
258 NAMEConstructByIterable(this, arg1, iteratorFn); 258 NAMEConstructByIterable(this, arg1, iteratorFn);
259 } 259 }
260 } 260 }
261 } else { 261 } else {
262 throw MakeTypeError(kConstructorNotFunction, "NAME") 262 throw MakeTypeError(kConstructorNotFunction, "NAME")
263 } 263 }
264 } 264 }
265 265
266 function NAME_GetLength() {
267 if (!(%_ClassOf(this) === 'NAME')) {
268 throw MakeTypeError(kIncompatibleMethodReceiver, "NAME.length", this);
269 }
270 return %_TypedArrayGetLength(this);
271 }
272
266 function NAMESubArray(begin, end) { 273 function NAMESubArray(begin, end) {
267 var beginInt = TO_INTEGER(begin); 274 var beginInt = TO_INTEGER(begin);
268 if (!IS_UNDEFINED(end)) { 275 if (!IS_UNDEFINED(end)) {
269 var endInt = TO_INTEGER(end); 276 var endInt = TO_INTEGER(end);
270 var srcLength = %_TypedArrayGetLength(this); 277 var srcLength = %_TypedArrayGetLength(this);
271 } else { 278 } else {
272 var srcLength = %_TypedArrayGetLength(this); 279 var srcLength = %_TypedArrayGetLength(this);
273 var endInt = srcLength; 280 var endInt = srcLength;
274 } 281 }
275 282
(...skipping 546 matching lines...) Expand 10 before | Expand all | Expand 10 after
822 %InternalSetPrototype(GlobalNAME.prototype, TypedArray.prototype); 829 %InternalSetPrototype(GlobalNAME.prototype, TypedArray.prototype);
823 830
824 %AddNamedProperty(GlobalNAME, "BYTES_PER_ELEMENT", ELEMENT_SIZE, 831 %AddNamedProperty(GlobalNAME, "BYTES_PER_ELEMENT", ELEMENT_SIZE,
825 READ_ONLY | DONT_ENUM | DONT_DELETE); 832 READ_ONLY | DONT_ENUM | DONT_DELETE);
826 833
827 %AddNamedProperty(GlobalNAME.prototype, 834 %AddNamedProperty(GlobalNAME.prototype,
828 "constructor", global.NAME, DONT_ENUM); 835 "constructor", global.NAME, DONT_ENUM);
829 %AddNamedProperty(GlobalNAME.prototype, 836 %AddNamedProperty(GlobalNAME.prototype,
830 "BYTES_PER_ELEMENT", ELEMENT_SIZE, 837 "BYTES_PER_ELEMENT", ELEMENT_SIZE,
831 READ_ONLY | DONT_ENUM | DONT_DELETE); 838 READ_ONLY | DONT_ENUM | DONT_DELETE);
839 utils.InstallGetter(GlobalNAME.prototype, "length", NAME_GetLength,
adamk 2016/01/25 19:21:22 Please add a comment here too.
840 DONT_ENUM | DONT_DELETE);
832 endmacro 841 endmacro
833 842
834 TYPED_ARRAYS(SETUP_TYPED_ARRAY) 843 TYPED_ARRAYS(SETUP_TYPED_ARRAY)
835 844
836 // --------------------------- DataView ----------------------------- 845 // --------------------------- DataView -----------------------------
837 846
838 function DataViewConstructor(buffer, byteOffset, byteLength) { // length = 3 847 function DataViewConstructor(buffer, byteOffset, byteLength) { // length = 3
839 if (IS_UNDEFINED(new.target)) { 848 if (IS_UNDEFINED(new.target)) {
840 throw MakeTypeError(kConstructorNotFunction, "DataView"); 849 throw MakeTypeError(kConstructorNotFunction, "DataView");
841 } 850 }
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
960 "setUint32", DataViewSetUint32JS, 969 "setUint32", DataViewSetUint32JS,
961 970
962 "getFloat32", DataViewGetFloat32JS, 971 "getFloat32", DataViewGetFloat32JS,
963 "setFloat32", DataViewSetFloat32JS, 972 "setFloat32", DataViewSetFloat32JS,
964 973
965 "getFloat64", DataViewGetFloat64JS, 974 "getFloat64", DataViewGetFloat64JS,
966 "setFloat64", DataViewSetFloat64JS 975 "setFloat64", DataViewSetFloat64JS
967 ]); 976 ]);
968 977
969 }) 978 })
OLDNEW
« no previous file with comments | « no previous file | test/mjsunit/es6/typedarray-proto.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698