From 6776944f8f9eafe1fee6ea299fd540ecdb798f59 Mon Sep 17 00:00:00 2001 From: Adam Klein Date: Wed, 19 Dec 2018 11:49:20 -0800 Subject: [PATCH] Remove always-true --harmony-array-prototype-values flag It's been enabled for several releases now. R=gsathya@chromium.org Change-Id: Ib1806a1373821ee542dae2fd80f639b56bd99ed9 Reviewed-on: https://chromium-review.googlesource.com/c/1384796 Reviewed-by: Sathya Gunasekaran Commit-Queue: Adam Klein Cr-Commit-Position: refs/heads/master@{#58381} --- src/bootstrapper.cc | 33 ++++------------------ src/flag-definitions.h | 1 - src/js/prologue.js | 1 + test/mjsunit/es6/array-prototype-values.js | 2 -- 4 files changed, 7 insertions(+), 30 deletions(-) diff --git a/src/bootstrapper.cc b/src/bootstrapper.cc index db8be9484d..516d9ab709 100644 --- a/src/bootstrapper.cc +++ b/src/bootstrapper.cc @@ -1727,9 +1727,12 @@ void Genesis::InitializeGlobal(Handle global_object, InstallFunctionWithBuiltinId(isolate_, proto, "entries", Builtins::kArrayPrototypeEntries, 0, true, BuiltinFunctionId::kArrayEntries); - InstallFunctionAtSymbol(isolate_, proto, factory->iterator_symbol(), - "values", Builtins::kArrayPrototypeValues, 0, true, - DONT_ENUM, BuiltinFunctionId::kArrayValues); + Handle values_iterator = InstallFunctionWithBuiltinId( + isolate_, proto, "values", Builtins::kArrayPrototypeValues, 0, true, + BuiltinFunctionId::kArrayValues); + JSObject::AddProperty(isolate_, proto, factory->iterator_symbol(), + values_iterator, DONT_ENUM); + SimpleInstallFunction(isolate_, proto, "forEach", Builtins::kArrayForEach, 1, false); SimpleInstallFunction(isolate_, proto, "filter", Builtins::kArrayFilter, 1, @@ -4400,30 +4403,6 @@ void Genesis::InitializeGlobal_harmony_sharedarraybuffer() { } } -void Genesis::InitializeGlobal_harmony_array_prototype_values() { - if (!FLAG_harmony_array_prototype_values) return; - Handle array_constructor(native_context()->array_function(), - isolate()); - Handle array_prototype( - JSObject::cast(array_constructor->instance_prototype()), isolate()); - Handle values_iterator = - JSObject::GetProperty(isolate(), array_prototype, - factory()->iterator_symbol()) - .ToHandleChecked(); - DCHECK(values_iterator->IsJSFunction()); - JSObject::AddProperty(isolate(), array_prototype, factory()->values_string(), - values_iterator, DONT_ENUM); - - Handle unscopables = - JSObject::GetProperty(isolate(), array_prototype, - factory()->unscopables_symbol()) - .ToHandleChecked(); - DCHECK(unscopables->IsJSObject()); - JSObject::AddProperty(isolate(), Handle::cast(unscopables), - factory()->values_string(), factory()->true_value(), - NONE); -} - void Genesis::InitializeGlobal_harmony_array_flat() { if (!FLAG_harmony_array_flat) return; Handle array_constructor(native_context()->array_function(), diff --git a/src/flag-definitions.h b/src/flag-definitions.h index 287ab87800..737ac847fe 100644 --- a/src/flag-definitions.h +++ b/src/flag-definitions.h @@ -236,7 +236,6 @@ DEFINE_IMPLICATION(harmony_private_methods, harmony_private_fields) V(harmony_sharedarraybuffer, "harmony sharedarraybuffer") \ V(harmony_import_meta, "harmony import.meta property") \ V(harmony_dynamic_import, "harmony dynamic import") \ - V(harmony_array_prototype_values, "harmony Array.prototype.values") \ V(harmony_array_flat, "harmony Array.prototype.{flat,flatMap}") \ V(harmony_symbol_description, "harmony Symbol.prototype.description") \ V(harmony_global, "harmony global") \ diff --git a/src/js/prologue.js b/src/js/prologue.js index 93ef3fa0f3..a4c49f8c5c 100644 --- a/src/js/prologue.js +++ b/src/js/prologue.js @@ -62,6 +62,7 @@ function PostNatives(utils) { findIndex: true, includes: true, keys: true, + values: true, }; %ToFastProperties(unscopables); diff --git a/test/mjsunit/es6/array-prototype-values.js b/test/mjsunit/es6/array-prototype-values.js index b7c4e78e33..4b4c04342b 100644 --- a/test/mjsunit/es6/array-prototype-values.js +++ b/test/mjsunit/es6/array-prototype-values.js @@ -1,8 +1,6 @@ // Copyright 2016 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. -// -// Flags: --harmony-array-prototype-values // Functionality of the values iterator is tested elsewhere; this test // merely verifies that the 'values' property is set up correctly.