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 29 matching lines...) Expand all Loading... |
40 var InternalArray = utils.InternalArray; | 40 var InternalArray = utils.InternalArray; |
41 var IsNaN; | 41 var IsNaN; |
42 var MakeRangeError; | 42 var MakeRangeError; |
43 var MakeTypeError; | 43 var MakeTypeError; |
44 var MaxSimple; | 44 var MaxSimple; |
45 var MinSimple; | 45 var MinSimple; |
46 var PackedArrayReverse; | 46 var PackedArrayReverse; |
47 var SpeciesConstructor; | 47 var SpeciesConstructor; |
48 var ToPositiveInteger; | 48 var ToPositiveInteger; |
49 var iteratorSymbol = utils.ImportNow("iterator_symbol"); | 49 var iteratorSymbol = utils.ImportNow("iterator_symbol"); |
| 50 var speciesSymbol = utils.ImportNow("species_symbol"); |
50 var toStringTagSymbol = utils.ImportNow("to_string_tag_symbol"); | 51 var toStringTagSymbol = utils.ImportNow("to_string_tag_symbol"); |
51 | 52 |
52 macro TYPED_ARRAYS(FUNCTION) | 53 macro TYPED_ARRAYS(FUNCTION) |
53 // arrayIds below should be synchronized with Runtime_TypedArrayInitialize. | 54 // arrayIds below should be synchronized with Runtime_TypedArrayInitialize. |
54 FUNCTION(1, Uint8Array, 1) | 55 FUNCTION(1, Uint8Array, 1) |
55 FUNCTION(2, Int8Array, 1) | 56 FUNCTION(2, Int8Array, 1) |
56 FUNCTION(3, Uint16Array, 2) | 57 FUNCTION(3, Uint16Array, 2) |
57 FUNCTION(4, Int16Array, 2) | 58 FUNCTION(4, Int16Array, 2) |
58 FUNCTION(5, Uint32Array, 4) | 59 FUNCTION(5, Uint32Array, 4) |
59 FUNCTION(6, Int32Array, 4) | 60 FUNCTION(6, Int32Array, 4) |
(...skipping 717 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
777 // TODO(bmeurer): Migrate this to a proper builtin. | 778 // TODO(bmeurer): Migrate this to a proper builtin. |
778 function TypedArrayConstructor() { | 779 function TypedArrayConstructor() { |
779 if (IS_UNDEFINED(new.target)) { | 780 if (IS_UNDEFINED(new.target)) { |
780 throw MakeTypeError(kConstructorNonCallable, "TypedArray"); | 781 throw MakeTypeError(kConstructorNonCallable, "TypedArray"); |
781 } | 782 } |
782 if (new.target === GlobalTypedArray) { | 783 if (new.target === GlobalTypedArray) { |
783 throw MakeTypeError(kConstructAbstractClass, "TypedArray"); | 784 throw MakeTypeError(kConstructAbstractClass, "TypedArray"); |
784 } | 785 } |
785 } | 786 } |
786 | 787 |
| 788 function TypedArraySpecies() { |
| 789 return this; |
| 790 } |
| 791 |
787 // ------------------------------------------------------------------- | 792 // ------------------------------------------------------------------- |
788 | 793 |
789 %SetCode(GlobalTypedArray, TypedArrayConstructor); | 794 %SetCode(GlobalTypedArray, TypedArrayConstructor); |
790 utils.InstallFunctions(GlobalTypedArray, DONT_ENUM, [ | 795 utils.InstallFunctions(GlobalTypedArray, DONT_ENUM, [ |
791 "from", TypedArrayFrom, | 796 "from", TypedArrayFrom, |
792 "of", TypedArrayOf | 797 "of", TypedArrayOf |
793 ]); | 798 ]); |
| 799 utils.InstallGetter(GlobalTypedArray, speciesSymbol, TypedArraySpecies); |
794 utils.InstallGetter(GlobalTypedArray.prototype, toStringTagSymbol, | 800 utils.InstallGetter(GlobalTypedArray.prototype, toStringTagSymbol, |
795 TypedArrayGetToStringTag); | 801 TypedArrayGetToStringTag); |
796 utils.InstallFunctions(GlobalTypedArray.prototype, DONT_ENUM, [ | 802 utils.InstallFunctions(GlobalTypedArray.prototype, DONT_ENUM, [ |
797 "subarray", TypedArraySubArray, | 803 "subarray", TypedArraySubArray, |
798 "set", TypedArraySet, | 804 "set", TypedArraySet, |
799 "copyWithin", TypedArrayCopyWithin, | 805 "copyWithin", TypedArrayCopyWithin, |
800 "every", TypedArrayEvery, | 806 "every", TypedArrayEvery, |
801 "fill", TypedArrayFill, | 807 "fill", TypedArrayFill, |
802 "filter", TypedArrayFilter, | 808 "filter", TypedArrayFilter, |
803 "find", TypedArrayFind, | 809 "find", TypedArrayFind, |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
899 "setUint32", DataViewSetUint32JS, | 905 "setUint32", DataViewSetUint32JS, |
900 | 906 |
901 "getFloat32", DataViewGetFloat32JS, | 907 "getFloat32", DataViewGetFloat32JS, |
902 "setFloat32", DataViewSetFloat32JS, | 908 "setFloat32", DataViewSetFloat32JS, |
903 | 909 |
904 "getFloat64", DataViewGetFloat64JS, | 910 "getFloat64", DataViewGetFloat64JS, |
905 "setFloat64", DataViewSetFloat64JS | 911 "setFloat64", DataViewSetFloat64JS |
906 ]); | 912 ]); |
907 | 913 |
908 }) | 914 }) |
OLD | NEW |