Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(91)

Unified Diff: src/js/harmony-array-includes.js

Issue 1513843006: Remove --harmony-array-includes flag (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/js/array.js ('k') | src/js/typedarray.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/js/harmony-array-includes.js
diff --git a/src/js/harmony-array-includes.js b/src/js/harmony-array-includes.js
deleted file mode 100644
index bb1f01cd5761c42ced4c0dbeaea67dfc6de6c327..0000000000000000000000000000000000000000
--- a/src/js/harmony-array-includes.js
+++ /dev/null
@@ -1,118 +0,0 @@
-// Copyright 2014 the V8 project authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-(function(global, utils) {
-
-'use strict';
-
-%CheckIsBootstrapping();
-
-// -------------------------------------------------------------------
-// Imports
-
-var GlobalArray = global.Array;
-var MakeTypeError;
-var SameValueZero;
-
-utils.Import(function(from) {
- MakeTypeError = from.MakeTypeError;
- SameValueZero = from.SameValueZero;
-});
-
-// -------------------------------------------------------------------
-
-// Proposed for ES7
-// https://github.com/tc39/Array.prototype.includes
-// 46c7532ec8499dea3e51aeb940d09e07547ed3f5
-function InnerArrayIncludes(searchElement, fromIndex, array, length) {
- if (length === 0) {
- return false;
- }
-
- var n = TO_INTEGER(fromIndex);
-
- var k;
- if (n >= 0) {
- k = n;
- } else {
- k = length + n;
- if (k < 0) {
- k = 0;
- }
- }
-
- while (k < length) {
- var elementK = array[k];
- if (SameValueZero(searchElement, elementK)) {
- return true;
- }
-
- ++k;
- }
-
- return false;
-}
-
-
-function ArrayIncludes(searchElement, fromIndex) {
- CHECK_OBJECT_COERCIBLE(this, "Array.prototype.includes");
-
- var array = TO_OBJECT(this);
- var length = TO_LENGTH(array.length);
-
- return InnerArrayIncludes(searchElement, fromIndex, array, length);
-}
-
-
-function TypedArrayIncludes(searchElement, fromIndex) {
- if (!%_IsTypedArray(this)) throw MakeTypeError(kNotTypedArray);
-
- var length = %_TypedArrayGetLength(this);
-
- return InnerArrayIncludes(searchElement, fromIndex, this, length);
-}
-
-// -------------------------------------------------------------------
-
-%FunctionSetLength(ArrayIncludes, 1);
-%FunctionSetLength(TypedArrayIncludes, 1);
-
-// Set up the non-enumerable function on the Array prototype object.
-utils.InstallFunctions(GlobalArray.prototype, DONT_ENUM, [
- "includes", ArrayIncludes
-]);
-
-// Set up the non-enumerable function on the typed array prototypes.
-// This duplicates some of the machinery in harmony-typedarray.js in order to
-// keep includes behind the separate --harmony-array-includes flag.
-// TODO(littledan): Fix the TypedArray proto chain (bug v8:4085).
-
-macro TYPED_ARRAYS(FUNCTION)
-// arrayIds below should be synchronized with Runtime_TypedArrayInitialize.
-FUNCTION(Uint8Array)
-FUNCTION(Int8Array)
-FUNCTION(Uint16Array)
-FUNCTION(Int16Array)
-FUNCTION(Uint32Array)
-FUNCTION(Int32Array)
-FUNCTION(Float32Array)
-FUNCTION(Float64Array)
-FUNCTION(Uint8ClampedArray)
-endmacro
-
-macro DECLARE_GLOBALS(NAME)
-var GlobalNAME = global.NAME;
-endmacro
-
-macro EXTEND_TYPED_ARRAY(NAME)
-// Set up non-enumerable functions on the prototype object.
-utils.InstallFunctions(GlobalNAME.prototype, DONT_ENUM, [
- "includes", TypedArrayIncludes
-]);
-endmacro
-
-TYPED_ARRAYS(DECLARE_GLOBALS)
-TYPED_ARRAYS(EXTEND_TYPED_ARRAY)
-
-})
« no previous file with comments | « src/js/array.js ('k') | src/js/typedarray.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698