OLD | NEW |
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 Loading... |
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 |
71 utils.Import(function(from) { | 73 utils.Import(function(from) { |
72 ArrayValues = from.ArrayValues; | 74 ArrayValues = from.ArrayValues; |
73 GetIterator = from.GetIterator; | 75 GetIterator = from.GetIterator; |
74 GetMethod = from.GetMethod; | 76 GetMethod = from.GetMethod; |
75 InnerArrayCopyWithin = from.InnerArrayCopyWithin; | 77 InnerArrayCopyWithin = from.InnerArrayCopyWithin; |
76 InnerArrayEvery = from.InnerArrayEvery; | 78 InnerArrayEvery = from.InnerArrayEvery; |
77 InnerArrayFill = from.InnerArrayFill; | 79 InnerArrayFill = from.InnerArrayFill; |
78 InnerArrayFilter = from.InnerArrayFilter; | 80 InnerArrayFilter = from.InnerArrayFilter; |
79 InnerArrayFind = from.InnerArrayFind; | 81 InnerArrayFind = from.InnerArrayFind; |
80 InnerArrayFindIndex = from.InnerArrayFindIndex; | 82 InnerArrayFindIndex = from.InnerArrayFindIndex; |
(...skipping 720 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
801 mappedValue = %_Call(mapfn, thisArg, value, i); | 803 mappedValue = %_Call(mapfn, thisArg, value, i); |
802 } else { | 804 } else { |
803 mappedValue = value; | 805 mappedValue = value; |
804 } | 806 } |
805 targetObject[i] = mappedValue; | 807 targetObject[i] = mappedValue; |
806 } | 808 } |
807 return targetObject; | 809 return targetObject; |
808 } | 810 } |
809 %FunctionSetLength(TypedArrayFrom, 1); | 811 %FunctionSetLength(TypedArrayFrom, 1); |
810 | 812 |
811 function TypedArray() { | 813 function TypedArrayConstructor() { |
812 if (IS_UNDEFINED(new.target)) { | 814 if (IS_UNDEFINED(new.target)) { |
813 throw MakeTypeError(kConstructorNonCallable, "TypedArray"); | 815 throw MakeTypeError(kConstructorNonCallable, "TypedArray"); |
814 } | 816 } |
815 if (new.target === TypedArray) { | 817 if (new.target === TypedArray) { |
816 throw MakeTypeError(kConstructAbstractClass, "TypedArray"); | 818 throw MakeTypeError(kConstructAbstractClass, "TypedArray"); |
817 } | 819 } |
818 } | 820 } |
819 | 821 |
820 // ------------------------------------------------------------------- | 822 // ------------------------------------------------------------------- |
821 | 823 |
822 %FunctionSetPrototype(TypedArray, new GlobalObject()); | 824 %SetCode(TypedArray, TypedArrayConstructor); |
823 %AddNamedProperty(TypedArray.prototype, | 825 %AddNamedProperty(TypedArray.prototype, |
824 "constructor", TypedArray, DONT_ENUM); | 826 "constructor", TypedArray, DONT_ENUM); |
| 827 |
825 utils.InstallFunctions(TypedArray, DONT_ENUM, [ | 828 utils.InstallFunctions(TypedArray, DONT_ENUM, [ |
826 "from", TypedArrayFrom, | 829 "from", TypedArrayFrom, |
827 "of", TypedArrayOf | 830 "of", TypedArrayOf |
828 ]); | 831 ]); |
829 utils.InstallGetter(TypedArray.prototype, "buffer", TypedArrayGetBuffer); | 832 utils.InstallGetter(TypedArray.prototype, "buffer", TypedArrayGetBuffer); |
830 utils.InstallGetter(TypedArray.prototype, "byteOffset", TypedArrayGetByteOffset, | 833 utils.InstallGetter(TypedArray.prototype, "byteOffset", TypedArrayGetByteOffset, |
831 DONT_ENUM | DONT_DELETE); | 834 DONT_ENUM | DONT_DELETE); |
832 utils.InstallGetter(TypedArray.prototype, "byteLength", | 835 utils.InstallGetter(TypedArray.prototype, "byteLength", |
833 TypedArrayGetByteLength, DONT_ENUM | DONT_DELETE); | 836 TypedArrayGetByteLength, DONT_ENUM | DONT_DELETE); |
834 utils.InstallGetter(TypedArray.prototype, "length", TypedArrayGetLength, | 837 utils.InstallGetter(TypedArray.prototype, "length", TypedArrayGetLength, |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
979 "setUint32", DataViewSetUint32JS, | 982 "setUint32", DataViewSetUint32JS, |
980 | 983 |
981 "getFloat32", DataViewGetFloat32JS, | 984 "getFloat32", DataViewGetFloat32JS, |
982 "setFloat32", DataViewSetFloat32JS, | 985 "setFloat32", DataViewSetFloat32JS, |
983 | 986 |
984 "getFloat64", DataViewGetFloat64JS, | 987 "getFloat64", DataViewGetFloat64JS, |
985 "setFloat64", DataViewSetFloat64JS | 988 "setFloat64", DataViewSetFloat64JS |
986 ]); | 989 ]); |
987 | 990 |
988 }) | 991 }) |
OLD | NEW |