| 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 73 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 84 function ArrayCopyWithin(target, start, end) { | 84 function ArrayCopyWithin(target, start, end) { | 
| 85   CHECK_OBJECT_COERCIBLE(this, "Array.prototype.copyWithin"); | 85   CHECK_OBJECT_COERCIBLE(this, "Array.prototype.copyWithin"); | 
| 86 | 86 | 
| 87   var array = TO_OBJECT(this); | 87   var array = TO_OBJECT(this); | 
| 88   var length = $toLength(array.length); | 88   var length = $toLength(array.length); | 
| 89 | 89 | 
| 90   return InnerArrayCopyWithin(target, start, end, array, length); | 90   return InnerArrayCopyWithin(target, start, end, array, length); | 
| 91 } | 91 } | 
| 92 | 92 | 
| 93 function InnerArrayFind(predicate, thisArg, array, length) { | 93 function InnerArrayFind(predicate, thisArg, array, length) { | 
| 94   if (!IS_SPEC_FUNCTION(predicate)) { | 94   if (!IS_CALLABLE(predicate)) { | 
| 95     throw MakeTypeError(kCalledNonCallable, predicate); | 95     throw MakeTypeError(kCalledNonCallable, predicate); | 
| 96   } | 96   } | 
| 97 | 97 | 
| 98   var needs_wrapper = false; | 98   var needs_wrapper = false; | 
| 99   if (IS_NULL(thisArg)) { | 99   if (IS_NULL(thisArg)) { | 
| 100     if (%IsSloppyModeFunction(predicate)) thisArg = UNDEFINED; | 100     if (%IsSloppyModeFunction(predicate)) thisArg = UNDEFINED; | 
| 101   } else if (!IS_UNDEFINED(thisArg)) { | 101   } else if (!IS_UNDEFINED(thisArg)) { | 
| 102     needs_wrapper = SHOULD_CREATE_WRAPPER(predicate, thisArg); | 102     needs_wrapper = SHOULD_CREATE_WRAPPER(predicate, thisArg); | 
| 103   } | 103   } | 
| 104 | 104 | 
| (...skipping 12 matching lines...) Expand all  Loading... | 
| 117 function ArrayFind(predicate, thisArg) { | 117 function ArrayFind(predicate, thisArg) { | 
| 118   CHECK_OBJECT_COERCIBLE(this, "Array.prototype.find"); | 118   CHECK_OBJECT_COERCIBLE(this, "Array.prototype.find"); | 
| 119 | 119 | 
| 120   var array = TO_OBJECT(this); | 120   var array = TO_OBJECT(this); | 
| 121   var length = $toInteger(array.length); | 121   var length = $toInteger(array.length); | 
| 122 | 122 | 
| 123   return InnerArrayFind(predicate, thisArg, array, length); | 123   return InnerArrayFind(predicate, thisArg, array, length); | 
| 124 } | 124 } | 
| 125 | 125 | 
| 126 function InnerArrayFindIndex(predicate, thisArg, array, length) { | 126 function InnerArrayFindIndex(predicate, thisArg, array, length) { | 
| 127   if (!IS_SPEC_FUNCTION(predicate)) { | 127   if (!IS_CALLABLE(predicate)) { | 
| 128     throw MakeTypeError(kCalledNonCallable, predicate); | 128     throw MakeTypeError(kCalledNonCallable, predicate); | 
| 129   } | 129   } | 
| 130 | 130 | 
| 131   var needs_wrapper = false; | 131   var needs_wrapper = false; | 
| 132   if (IS_NULL(thisArg)) { | 132   if (IS_NULL(thisArg)) { | 
| 133     if (%IsSloppyModeFunction(predicate)) thisArg = UNDEFINED; | 133     if (%IsSloppyModeFunction(predicate)) thisArg = UNDEFINED; | 
| 134   } else if (!IS_UNDEFINED(thisArg)) { | 134   } else if (!IS_UNDEFINED(thisArg)) { | 
| 135     needs_wrapper = SHOULD_CREATE_WRAPPER(predicate, thisArg); | 135     needs_wrapper = SHOULD_CREATE_WRAPPER(predicate, thisArg); | 
| 136   } | 136   } | 
| 137 | 137 | 
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 203     }); | 203     }); | 
| 204   } | 204   } | 
| 205 } | 205 } | 
| 206 | 206 | 
| 207 // ES6, draft 10-14-14, section 22.1.2.1 | 207 // ES6, draft 10-14-14, section 22.1.2.1 | 
| 208 function ArrayFrom(arrayLike, mapfn, receiver) { | 208 function ArrayFrom(arrayLike, mapfn, receiver) { | 
| 209   var items = TO_OBJECT(arrayLike); | 209   var items = TO_OBJECT(arrayLike); | 
| 210   var mapping = !IS_UNDEFINED(mapfn); | 210   var mapping = !IS_UNDEFINED(mapfn); | 
| 211 | 211 | 
| 212   if (mapping) { | 212   if (mapping) { | 
| 213     if (!IS_SPEC_FUNCTION(mapfn)) { | 213     if (!IS_CALLABLE(mapfn)) { | 
| 214       throw MakeTypeError(kCalledNonCallable, mapfn); | 214       throw MakeTypeError(kCalledNonCallable, mapfn); | 
| 215     } else if (%IsSloppyModeFunction(mapfn)) { | 215     } else if (%IsSloppyModeFunction(mapfn)) { | 
| 216       if (IS_NULL(receiver)) { | 216       if (IS_NULL(receiver)) { | 
| 217         receiver = UNDEFINED; | 217         receiver = UNDEFINED; | 
| 218       } else if (!IS_UNDEFINED(receiver)) { | 218       } else if (!IS_UNDEFINED(receiver)) { | 
| 219         receiver = TO_OBJECT(receiver); | 219         receiver = TO_OBJECT(receiver); | 
| 220       } | 220       } | 
| 221     } | 221     } | 
| 222   } | 222   } | 
| 223 | 223 | 
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 313 | 313 | 
| 314 utils.Export(function(to) { | 314 utils.Export(function(to) { | 
| 315   to.ArrayFrom = ArrayFrom; | 315   to.ArrayFrom = ArrayFrom; | 
| 316   to.InnerArrayCopyWithin = InnerArrayCopyWithin; | 316   to.InnerArrayCopyWithin = InnerArrayCopyWithin; | 
| 317   to.InnerArrayFill = InnerArrayFill; | 317   to.InnerArrayFill = InnerArrayFill; | 
| 318   to.InnerArrayFind = InnerArrayFind; | 318   to.InnerArrayFind = InnerArrayFind; | 
| 319   to.InnerArrayFindIndex = InnerArrayFindIndex; | 319   to.InnerArrayFindIndex = InnerArrayFindIndex; | 
| 320 }); | 320 }); | 
| 321 | 321 | 
| 322 }) | 322 }) | 
| OLD | NEW | 
|---|