OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 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() { | 5 (function() { |
6 | 6 |
7 "use strict"; | 7 "use strict"; |
8 | 8 |
9 %CheckIsBootstrapping(); | 9 %CheckIsBootstrapping(); |
10 | 10 |
(...skipping 10 matching lines...) Expand all Loading... |
21 FUNCTION(7, Float32Array, 4) | 21 FUNCTION(7, Float32Array, 4) |
22 FUNCTION(8, Float64Array, 8) | 22 FUNCTION(8, Float64Array, 8) |
23 FUNCTION(9, Uint8ClampedArray, 1) | 23 FUNCTION(9, Uint8ClampedArray, 1) |
24 endmacro | 24 endmacro |
25 | 25 |
26 | 26 |
27 macro TYPED_ARRAY_HARMONY_ADDITIONS(ARRAY_ID, NAME, ELEMENT_SIZE) | 27 macro TYPED_ARRAY_HARMONY_ADDITIONS(ARRAY_ID, NAME, ELEMENT_SIZE) |
28 | 28 |
29 // ES6 draft 08-24-14, section 22.2.3.12 | 29 // ES6 draft 08-24-14, section 22.2.3.12 |
30 function NAMEForEach(f /* thisArg */) { // length == 1 | 30 function NAMEForEach(f /* thisArg */) { // length == 1 |
31 if (!%IsTypedArray(this)) throw MakeTypeError(kNotTypedArray); | 31 if (!%IsTypedArray(this)) { |
| 32 throw MakeTypeError('not_typed_array', []); |
| 33 } |
32 if (!IS_SPEC_FUNCTION(f)) throw MakeTypeError(kCalledNonCallable, f); | 34 if (!IS_SPEC_FUNCTION(f)) throw MakeTypeError(kCalledNonCallable, f); |
33 | 35 |
34 var length = %_TypedArrayGetLength(this); | 36 var length = %_TypedArrayGetLength(this); |
35 var receiver; | 37 var receiver; |
36 | 38 |
37 if (%_ArgumentsLength() > 1) { | 39 if (%_ArgumentsLength() > 1) { |
38 receiver = %_Arguments(1); | 40 receiver = %_Arguments(1); |
39 } | 41 } |
40 | 42 |
41 var needs_wrapper = false; | 43 var needs_wrapper = false; |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
78 | 80 |
79 // Set up non-enumerable functions on the prototype object. | 81 // Set up non-enumerable functions on the prototype object. |
80 InstallFunctions(global.NAME.prototype, DONT_ENUM, [ | 82 InstallFunctions(global.NAME.prototype, DONT_ENUM, [ |
81 "forEach", NAMEForEach | 83 "forEach", NAMEForEach |
82 ]); | 84 ]); |
83 endmacro | 85 endmacro |
84 | 86 |
85 TYPED_ARRAYS(EXTEND_TYPED_ARRAY) | 87 TYPED_ARRAYS(EXTEND_TYPED_ARRAY) |
86 | 88 |
87 })(); | 89 })(); |
OLD | NEW |