aboutsummaryrefslogtreecommitdiff
path: root/deps/v8/src/harmony-array-includes.js
diff options
context:
space:
mode:
Diffstat (limited to 'deps/v8/src/harmony-array-includes.js')
-rw-r--r--deps/v8/src/harmony-array-includes.js32
1 files changed, 15 insertions, 17 deletions
diff --git a/deps/v8/src/harmony-array-includes.js b/deps/v8/src/harmony-array-includes.js
index d1a7790421..109499ea6b 100644
--- a/deps/v8/src/harmony-array-includes.js
+++ b/deps/v8/src/harmony-array-includes.js
@@ -2,11 +2,13 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+(function(global, shared, exports) {
+
'use strict';
-// This file relies on the fact that the following declaration has been made
-// in runtime.js:
-// var $Array = global.Array;
+%CheckIsBootstrapping();
+
+var GlobalArray = global.Array;
// -------------------------------------------------------------------
@@ -14,14 +16,14 @@
// https://github.com/tc39/Array.prototype.includes
// 6e3b78c927aeda20b9d40e81303f9d44596cd904
function ArrayIncludes(searchElement, fromIndex) {
- var array = ToObject(this);
- var len = ToLength(array.length);
+ var array = $toObject(this);
+ var len = $toLength(array.length);
if (len === 0) {
return false;
}
- var n = ToInteger(fromIndex);
+ var n = $toInteger(fromIndex);
var k;
if (n >= 0) {
@@ -35,7 +37,7 @@ function ArrayIncludes(searchElement, fromIndex) {
while (k < len) {
var elementK = array[k];
- if (SameValueZero(searchElement, elementK)) {
+ if ($sameValueZero(searchElement, elementK)) {
return true;
}
@@ -47,15 +49,11 @@ function ArrayIncludes(searchElement, fromIndex) {
// -------------------------------------------------------------------
-function HarmonyArrayIncludesExtendArrayPrototype() {
- %CheckIsBootstrapping();
+%FunctionSetLength(ArrayIncludes, 1);
- %FunctionSetLength(ArrayIncludes, 1);
-
- // Set up the non-enumerable functions on the Array prototype object.
- InstallFunctions($Array.prototype, DONT_ENUM, $Array(
- "includes", ArrayIncludes
- ));
-}
+// Set up the non-enumerable functions on the Array prototype object.
+$installFunctions(GlobalArray.prototype, DONT_ENUM, [
+ "includes", ArrayIncludes
+]);
-HarmonyArrayIncludesExtendArrayPrototype();
+})