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 826 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
837 mappedValue = value; | 837 mappedValue = value; |
838 } | 838 } |
839 targetObject[i] = mappedValue; | 839 targetObject[i] = mappedValue; |
840 } | 840 } |
841 return targetObject; | 841 return targetObject; |
842 } | 842 } |
843 %FunctionSetLength(TypedArrayFrom, 1); | 843 %FunctionSetLength(TypedArrayFrom, 1); |
844 | 844 |
845 // TODO(bmeurer): Migrate this to a proper builtin. | 845 // TODO(bmeurer): Migrate this to a proper builtin. |
846 function TypedArrayConstructor() { | 846 function TypedArrayConstructor() { |
847 if (IS_UNDEFINED(new.target)) { | 847 throw %make_type_error(kConstructAbstractClass, "TypedArray"); |
848 throw %make_type_error(kConstructorNonCallable, "TypedArray"); | |
849 } | |
850 if (new.target === GlobalTypedArray) { | |
851 throw %make_type_error(kConstructAbstractClass, "TypedArray"); | |
852 } | |
853 } | 848 } |
854 | 849 |
855 function TypedArraySpecies() { | 850 function TypedArraySpecies() { |
856 return this; | 851 return this; |
857 } | 852 } |
858 | 853 |
859 // ------------------------------------------------------------------- | 854 // ------------------------------------------------------------------- |
860 | 855 |
861 %SetCode(GlobalTypedArray, TypedArrayConstructor); | 856 %SetCode(GlobalTypedArray, TypedArrayConstructor); |
862 utils.InstallFunctions(GlobalTypedArray, DONT_ENUM, [ | 857 utils.InstallFunctions(GlobalTypedArray, DONT_ENUM, [ |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
906 %AddNamedProperty(GlobalNAME.prototype, | 901 %AddNamedProperty(GlobalNAME.prototype, |
907 "constructor", global.NAME, DONT_ENUM); | 902 "constructor", global.NAME, DONT_ENUM); |
908 %AddNamedProperty(GlobalNAME.prototype, | 903 %AddNamedProperty(GlobalNAME.prototype, |
909 "BYTES_PER_ELEMENT", ELEMENT_SIZE, | 904 "BYTES_PER_ELEMENT", ELEMENT_SIZE, |
910 READ_ONLY | DONT_ENUM | DONT_DELETE); | 905 READ_ONLY | DONT_ENUM | DONT_DELETE); |
911 endmacro | 906 endmacro |
912 | 907 |
913 TYPED_ARRAYS(SETUP_TYPED_ARRAY) | 908 TYPED_ARRAYS(SETUP_TYPED_ARRAY) |
914 | 909 |
915 }) | 910 }) |
OLD | NEW |