| 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)) { | 31 if (!%IsTypedArray(this)) throw MakeTypeError(kNotTypedArray); |
| 32 throw MakeTypeError('not_typed_array', []); | |
| 33 } | |
| 34 if (!IS_SPEC_FUNCTION(f)) throw MakeTypeError(kCalledNonCallable, f); | 32 if (!IS_SPEC_FUNCTION(f)) throw MakeTypeError(kCalledNonCallable, f); |
| 35 | 33 |
| 36 var length = %_TypedArrayGetLength(this); | 34 var length = %_TypedArrayGetLength(this); |
| 37 var receiver; | 35 var receiver; |
| 38 | 36 |
| 39 if (%_ArgumentsLength() > 1) { | 37 if (%_ArgumentsLength() > 1) { |
| 40 receiver = %_Arguments(1); | 38 receiver = %_Arguments(1); |
| 41 } | 39 } |
| 42 | 40 |
| 43 var needs_wrapper = false; | 41 var needs_wrapper = false; |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 80 | 78 |
| 81 // Set up non-enumerable functions on the prototype object. | 79 // Set up non-enumerable functions on the prototype object. |
| 82 InstallFunctions(global.NAME.prototype, DONT_ENUM, [ | 80 InstallFunctions(global.NAME.prototype, DONT_ENUM, [ |
| 83 "forEach", NAMEForEach | 81 "forEach", NAMEForEach |
| 84 ]); | 82 ]); |
| 85 endmacro | 83 endmacro |
| 86 | 84 |
| 87 TYPED_ARRAYS(EXTEND_TYPED_ARRAY) | 85 TYPED_ARRAYS(EXTEND_TYPED_ARRAY) |
| 88 | 86 |
| 89 })(); | 87 })(); |
| OLD | NEW |