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 23 matching lines...) Expand all Loading... |
34 var InnerArraySort; | 34 var InnerArraySort; |
35 var InnerArrayToLocaleString; | 35 var InnerArrayToLocaleString; |
36 var InternalArray = utils.InternalArray; | 36 var InternalArray = utils.InternalArray; |
37 var MaxSimple; | 37 var MaxSimple; |
38 var MinSimple; | 38 var MinSimple; |
39 var PackedArrayReverse; | 39 var PackedArrayReverse; |
40 var SpeciesConstructor; | 40 var SpeciesConstructor; |
41 var ToPositiveInteger; | 41 var ToPositiveInteger; |
42 var ToIndex; | 42 var ToIndex; |
43 var iteratorSymbol = utils.ImportNow("iterator_symbol"); | 43 var iteratorSymbol = utils.ImportNow("iterator_symbol"); |
44 var speciesSymbol = utils.ImportNow("species_symbol"); | |
45 var toStringTagSymbol = utils.ImportNow("to_string_tag_symbol"); | 44 var toStringTagSymbol = utils.ImportNow("to_string_tag_symbol"); |
46 | 45 |
47 macro TYPED_ARRAYS(FUNCTION) | 46 macro TYPED_ARRAYS(FUNCTION) |
48 // arrayIds below should be synchronized with Runtime_TypedArrayInitialize. | 47 // arrayIds below should be synchronized with Runtime_TypedArrayInitialize. |
49 FUNCTION(1, Uint8Array, 1) | 48 FUNCTION(1, Uint8Array, 1) |
50 FUNCTION(2, Int8Array, 1) | 49 FUNCTION(2, Int8Array, 1) |
51 FUNCTION(3, Uint16Array, 2) | 50 FUNCTION(3, Uint16Array, 2) |
52 FUNCTION(4, Int16Array, 2) | 51 FUNCTION(4, Int16Array, 2) |
53 FUNCTION(5, Uint32Array, 4) | 52 FUNCTION(5, Uint32Array, 4) |
54 FUNCTION(6, Int32Array, 4) | 53 FUNCTION(6, Int32Array, 4) |
(...skipping 785 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
840 } | 839 } |
841 return targetObject; | 840 return targetObject; |
842 } | 841 } |
843 %FunctionSetLength(TypedArrayFrom, 1); | 842 %FunctionSetLength(TypedArrayFrom, 1); |
844 | 843 |
845 // TODO(bmeurer): Migrate this to a proper builtin. | 844 // TODO(bmeurer): Migrate this to a proper builtin. |
846 function TypedArrayConstructor() { | 845 function TypedArrayConstructor() { |
847 throw %make_type_error(kConstructAbstractClass, "TypedArray"); | 846 throw %make_type_error(kConstructAbstractClass, "TypedArray"); |
848 } | 847 } |
849 | 848 |
850 function TypedArraySpecies() { | |
851 return this; | |
852 } | |
853 | |
854 // ------------------------------------------------------------------- | 849 // ------------------------------------------------------------------- |
855 | 850 |
856 %SetCode(GlobalTypedArray, TypedArrayConstructor); | 851 %SetCode(GlobalTypedArray, TypedArrayConstructor); |
857 utils.InstallFunctions(GlobalTypedArray, DONT_ENUM, [ | 852 utils.InstallFunctions(GlobalTypedArray, DONT_ENUM, [ |
858 "from", TypedArrayFrom, | 853 "from", TypedArrayFrom, |
859 "of", TypedArrayOf | 854 "of", TypedArrayOf |
860 ]); | 855 ]); |
861 utils.InstallGetter(GlobalTypedArray, speciesSymbol, TypedArraySpecies); | |
862 utils.InstallGetter(GlobalTypedArray.prototype, toStringTagSymbol, | 856 utils.InstallGetter(GlobalTypedArray.prototype, toStringTagSymbol, |
863 TypedArrayGetToStringTag); | 857 TypedArrayGetToStringTag); |
864 utils.InstallFunctions(GlobalTypedArray.prototype, DONT_ENUM, [ | 858 utils.InstallFunctions(GlobalTypedArray.prototype, DONT_ENUM, [ |
865 "subarray", TypedArraySubArray, | 859 "subarray", TypedArraySubArray, |
866 "set", TypedArraySet, | 860 "set", TypedArraySet, |
867 "copyWithin", TypedArrayCopyWithin, | 861 "copyWithin", TypedArrayCopyWithin, |
868 "every", TypedArrayEvery, | 862 "every", TypedArrayEvery, |
869 "fill", TypedArrayFill, | 863 "fill", TypedArrayFill, |
870 "filter", TypedArrayFilter, | 864 "filter", TypedArrayFilter, |
871 "find", TypedArrayFind, | 865 "find", TypedArrayFind, |
(...skipping 29 matching lines...) Expand all Loading... |
901 %AddNamedProperty(GlobalNAME.prototype, | 895 %AddNamedProperty(GlobalNAME.prototype, |
902 "constructor", global.NAME, DONT_ENUM); | 896 "constructor", global.NAME, DONT_ENUM); |
903 %AddNamedProperty(GlobalNAME.prototype, | 897 %AddNamedProperty(GlobalNAME.prototype, |
904 "BYTES_PER_ELEMENT", ELEMENT_SIZE, | 898 "BYTES_PER_ELEMENT", ELEMENT_SIZE, |
905 READ_ONLY | DONT_ENUM | DONT_DELETE); | 899 READ_ONLY | DONT_ENUM | DONT_DELETE); |
906 endmacro | 900 endmacro |
907 | 901 |
908 TYPED_ARRAYS(SETUP_TYPED_ARRAY) | 902 TYPED_ARRAYS(SETUP_TYPED_ARRAY) |
909 | 903 |
910 }) | 904 }) |
OLD | NEW |