| 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 23 matching lines...) Expand all Loading... |
| 34 if (!IS_SPEC_FUNCTION(f)) throw MakeTypeError(kCalledNonCallable, f); | 34 if (!IS_SPEC_FUNCTION(f)) throw MakeTypeError(kCalledNonCallable, f); |
| 35 | 35 |
| 36 var length = %_TypedArrayGetLength(this); | 36 var length = %_TypedArrayGetLength(this); |
| 37 var receiver; | 37 var receiver; |
| 38 | 38 |
| 39 if (%_ArgumentsLength() > 1) { | 39 if (%_ArgumentsLength() > 1) { |
| 40 receiver = %_Arguments(1); | 40 receiver = %_Arguments(1); |
| 41 } | 41 } |
| 42 | 42 |
| 43 var needs_wrapper = false; | 43 var needs_wrapper = false; |
| 44 if (IS_NULL_OR_UNDEFINED(receiver)) { | 44 if (IS_NULL(receiver)) { |
| 45 receiver = %GetDefaultReceiver(f) || receiver; | 45 if (%IsSloppyModeFunction(mapfn)) receiver = UNDEFINED; |
| 46 } else { | 46 } else if (!IS_UNDEFINED(receiver)) { |
| 47 needs_wrapper = SHOULD_CREATE_WRAPPER(f, receiver); | 47 needs_wrapper = SHOULD_CREATE_WRAPPER(f, receiver); |
| 48 } | 48 } |
| 49 | 49 |
| 50 var stepping = DEBUG_IS_ACTIVE && %DebugCallbackSupportsStepping(f); | 50 var stepping = DEBUG_IS_ACTIVE && %DebugCallbackSupportsStepping(f); |
| 51 for (var i = 0; i < length; i++) { | 51 for (var i = 0; i < length; i++) { |
| 52 var element = this[i]; | 52 var element = this[i]; |
| 53 // Prepare break slots for debugger step in. | 53 // Prepare break slots for debugger step in. |
| 54 if (stepping) %DebugPrepareStepInIfStepping(f); | 54 if (stepping) %DebugPrepareStepInIfStepping(f); |
| 55 var new_receiver = needs_wrapper ? ToObject(receiver) : receiver; | 55 var new_receiver = needs_wrapper ? ToObject(receiver) : receiver; |
| 56 %_CallFunction(new_receiver, TO_OBJECT_INLINE(element), i, this, f); | 56 %_CallFunction(new_receiver, TO_OBJECT_INLINE(element), i, this, f); |
| (...skipping 23 matching lines...) Expand all Loading... |
| 80 | 80 |
| 81 // Set up non-enumerable functions on the prototype object. | 81 // Set up non-enumerable functions on the prototype object. |
| 82 InstallFunctions(global.NAME.prototype, DONT_ENUM, [ | 82 InstallFunctions(global.NAME.prototype, DONT_ENUM, [ |
| 83 "forEach", NAMEForEach | 83 "forEach", NAMEForEach |
| 84 ]); | 84 ]); |
| 85 endmacro | 85 endmacro |
| 86 | 86 |
| 87 TYPED_ARRAYS(EXTEND_TYPED_ARRAY) | 87 TYPED_ARRAYS(EXTEND_TYPED_ARRAY) |
| 88 | 88 |
| 89 })(); | 89 })(); |
| OLD | NEW |