| 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 "use strict"; | 5 "use strict"; | 
| 6 | 6 | 
| 7 // This file relies on the fact that the following declaration has been made | 7 // This file relies on the fact that the following declaration has been made | 
| 8 // in runtime.js: | 8 // in runtime.js: | 
| 9 // var $Array = global.Array; | 9 // var $Array = global.Array; | 
| 10 | 10 | 
| (...skipping 13 matching lines...) Expand all  Loading... | 
| 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)) { | 
| 32     throw MakeTypeError('not_typed_array', []); | 32     throw MakeTypeError('not_typed_array', []); | 
| 33   } | 33   } | 
| 34   if (!IS_SPEC_FUNCTION(f)) throw MakeTypeError(kCalledNonCallable, f); | 34   if (!IS_SPEC_FUNCTION(f)) { | 
|  | 35     throw MakeTypeError('called_non_callable', [ f ]); | 
|  | 36   } | 
| 35 | 37 | 
| 36   var length = %_TypedArrayGetLength(this); | 38   var length = %_TypedArrayGetLength(this); | 
| 37   var receiver; | 39   var receiver; | 
| 38 | 40 | 
| 39   if (%_ArgumentsLength() > 1) { | 41   if (%_ArgumentsLength() > 1) { | 
| 40     receiver = %_Arguments(1); | 42     receiver = %_Arguments(1); | 
| 41   } | 43   } | 
| 42 | 44 | 
| 43   var needs_wrapper = false; | 45   var needs_wrapper = false; | 
| 44   if (IS_NULL_OR_UNDEFINED(receiver)) { | 46   if (IS_NULL_OR_UNDEFINED(receiver)) { | 
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 84   // Set up non-enumerable functions on the prototype object. | 86   // Set up non-enumerable functions on the prototype object. | 
| 85   InstallFunctions(global.NAME.prototype, DONT_ENUM, [ | 87   InstallFunctions(global.NAME.prototype, DONT_ENUM, [ | 
| 86     "forEach", NAMEForEach | 88     "forEach", NAMEForEach | 
| 87   ]); | 89   ]); | 
| 88 endmacro | 90 endmacro | 
| 89 | 91 | 
| 90   TYPED_ARRAYS(EXTEND_TYPED_ARRAY) | 92   TYPED_ARRAYS(EXTEND_TYPED_ARRAY) | 
| 91 } | 93 } | 
| 92 | 94 | 
| 93 HarmonyTypedArrayExtendPrototypes(); | 95 HarmonyTypedArrayExtendPrototypes(); | 
| OLD | NEW | 
|---|