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

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

Issue 1977983002: Revert "Fix TypedArray Property optimizations", add regression test and eliminate dead code (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Address review comments Created 4 years, 7 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
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 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 FUNCTION(8, Float64Array, 8) 61 FUNCTION(8, Float64Array, 8)
62 FUNCTION(9, Uint8ClampedArray, 1) 62 FUNCTION(9, Uint8ClampedArray, 1)
63 endmacro 63 endmacro
64 64
65 macro DECLARE_GLOBALS(INDEX, NAME, SIZE) 65 macro DECLARE_GLOBALS(INDEX, NAME, SIZE)
66 var GlobalNAME = global.NAME; 66 var GlobalNAME = global.NAME;
67 endmacro 67 endmacro
68 68
69 TYPED_ARRAYS(DECLARE_GLOBALS) 69 TYPED_ARRAYS(DECLARE_GLOBALS)
70 70
71 var TypedArray = %object_get_prototype_of(GlobalUint8Array);
72
73 utils.Import(function(from) { 71 utils.Import(function(from) {
74 ArrayValues = from.ArrayValues; 72 ArrayValues = from.ArrayValues;
75 GetIterator = from.GetIterator; 73 GetIterator = from.GetIterator;
76 GetMethod = from.GetMethod; 74 GetMethod = from.GetMethod;
77 InnerArrayCopyWithin = from.InnerArrayCopyWithin; 75 InnerArrayCopyWithin = from.InnerArrayCopyWithin;
78 InnerArrayEvery = from.InnerArrayEvery; 76 InnerArrayEvery = from.InnerArrayEvery;
79 InnerArrayFill = from.InnerArrayFill; 77 InnerArrayFill = from.InnerArrayFill;
80 InnerArrayFilter = from.InnerArrayFilter; 78 InnerArrayFilter = from.InnerArrayFilter;
81 InnerArrayFind = from.InnerArrayFind; 79 InnerArrayFind = from.InnerArrayFind;
82 InnerArrayFindIndex = from.InnerArrayFindIndex; 80 InnerArrayFindIndex = from.InnerArrayFindIndex;
(...skipping 720 matching lines...) Expand 10 before | Expand all | Expand 10 after
803 mappedValue = %_Call(mapfn, thisArg, value, i); 801 mappedValue = %_Call(mapfn, thisArg, value, i);
804 } else { 802 } else {
805 mappedValue = value; 803 mappedValue = value;
806 } 804 }
807 targetObject[i] = mappedValue; 805 targetObject[i] = mappedValue;
808 } 806 }
809 return targetObject; 807 return targetObject;
810 } 808 }
811 %FunctionSetLength(TypedArrayFrom, 1); 809 %FunctionSetLength(TypedArrayFrom, 1);
812 810
813 function TypedArrayConstructor() { 811 function TypedArray() {
814 if (IS_UNDEFINED(new.target)) { 812 if (IS_UNDEFINED(new.target)) {
815 throw MakeTypeError(kConstructorNonCallable, "TypedArray"); 813 throw MakeTypeError(kConstructorNonCallable, "TypedArray");
816 } 814 }
817 if (new.target === TypedArray) { 815 if (new.target === TypedArray) {
818 throw MakeTypeError(kConstructAbstractClass, "TypedArray"); 816 throw MakeTypeError(kConstructAbstractClass, "TypedArray");
819 } 817 }
820 } 818 }
821 819
822 // ------------------------------------------------------------------- 820 // -------------------------------------------------------------------
823 821
824 %SetCode(TypedArray, TypedArrayConstructor); 822 %FunctionSetPrototype(TypedArray, new GlobalObject());
825 %AddNamedProperty(TypedArray.prototype, 823 %AddNamedProperty(TypedArray.prototype,
826 "constructor", TypedArray, DONT_ENUM); 824 "constructor", TypedArray, DONT_ENUM);
827
828 utils.InstallFunctions(TypedArray, DONT_ENUM, [ 825 utils.InstallFunctions(TypedArray, DONT_ENUM, [
829 "from", TypedArrayFrom, 826 "from", TypedArrayFrom,
830 "of", TypedArrayOf 827 "of", TypedArrayOf
831 ]); 828 ]);
832 utils.InstallGetter(TypedArray.prototype, "buffer", TypedArrayGetBuffer); 829 utils.InstallGetter(TypedArray.prototype, "buffer", TypedArrayGetBuffer);
833 utils.InstallGetter(TypedArray.prototype, "byteOffset", TypedArrayGetByteOffset, 830 utils.InstallGetter(TypedArray.prototype, "byteOffset", TypedArrayGetByteOffset,
834 DONT_ENUM | DONT_DELETE); 831 DONT_ENUM | DONT_DELETE);
835 utils.InstallGetter(TypedArray.prototype, "byteLength", 832 utils.InstallGetter(TypedArray.prototype, "byteLength",
836 TypedArrayGetByteLength, DONT_ENUM | DONT_DELETE); 833 TypedArrayGetByteLength, DONT_ENUM | DONT_DELETE);
837 utils.InstallGetter(TypedArray.prototype, "length", TypedArrayGetLength, 834 utils.InstallGetter(TypedArray.prototype, "length", TypedArrayGetLength,
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
982 "setUint32", DataViewSetUint32JS, 979 "setUint32", DataViewSetUint32JS,
983 980
984 "getFloat32", DataViewGetFloat32JS, 981 "getFloat32", DataViewGetFloat32JS,
985 "setFloat32", DataViewSetFloat32JS, 982 "setFloat32", DataViewSetFloat32JS,
986 983
987 "getFloat64", DataViewGetFloat64JS, 984 "getFloat64", DataViewGetFloat64JS,
988 "setFloat64", DataViewSetFloat64JS 985 "setFloat64", DataViewSetFloat64JS
989 ]); 986 ]);
990 987
991 }) 988 })
OLDNEW
« no previous file with comments | « src/js/array-iterator.js ('k') | test/cctest/interpreter/bytecode_expectations/CallRuntime.golden » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698