From 0b9a70ade35a13a6142472ef704231923a8ca53f Mon Sep 17 00:00:00 2001 From: "rossberg@chromium.org" Date: Tue, 4 Nov 2014 16:05:27 +0000 Subject: [PATCH] Remove --harmony implications for incomplete features This is in preparation for making --harmony and --es-staging synonyms. The only remaining difference currently is block-scoping, which is still implied by --harmony, to avoid regressing on a long-available feature. Also removes the special-casing of --harmony-proxies. R=adamk@chromium.org BUG= Review URL: https://codereview.chromium.org/693153004 Cr-Commit-Position: refs/heads/master@{#25115} git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@25115 ce2b1a6d-e550-0410-aec6-3dcde31c8c00 --- src/bootstrapper.cc | 32 ++++++-------- src/flag-definitions.h | 61 +++++++++++++++----------- test/mjsunit/harmony/classes.js | 2 +- test/mjsunit/harmony/regress/regress-343928.js | 2 +- 4 files changed, 51 insertions(+), 46 deletions(-) diff --git a/src/bootstrapper.cc b/src/bootstrapper.cc index 8fd762c..264d1c6 100644 --- a/src/bootstrapper.cc +++ b/src/bootstrapper.cc @@ -215,11 +215,9 @@ class Genesis BASE_EMBEDDED { void InstallNativeFunctions_##id(); \ void InitializeGlobal_##id(); - SHIPPING_FEATURES(DECLARE_FEATURE_INITIALIZATION) - HARMONY_FEATURES(DECLARE_FEATURE_INITIALIZATION) - STAGED_FEATURES(DECLARE_FEATURE_INITIALIZATION) - - DECLARE_FEATURE_INITIALIZATION(harmony_proxies, "") + HARMONY_INPROGRESS(DECLARE_FEATURE_INITIALIZATION) + HARMONY_STAGED(DECLARE_FEATURE_INITIALIZATION) + HARMONY_SHIPPING(DECLARE_FEATURE_INITIALIZATION) #undef DECLARE_FEATURE_INITIALIZATION Handle InstallInternalArray(Handle builtins, @@ -1344,7 +1342,7 @@ void Genesis::InitializeGlobal(Handle global_object, #define FEATURE_INITIALIZE_GLOBAL(id, descr) InitializeGlobal_##id(); - SHIPPING_FEATURES(FEATURE_INITIALIZE_GLOBAL) + HARMONY_SHIPPING(FEATURE_INITIALIZE_GLOBAL) #undef FEATURE_INITIALIZE_GLOBAL // Initialize the embedder data slot. @@ -1379,8 +1377,8 @@ void Genesis::InstallTypedArray( void Genesis::InitializeExperimentalGlobal() { #define FEATURE_INITIALIZE_GLOBAL(id, descr) InitializeGlobal_##id(); - HARMONY_FEATURES(FEATURE_INITIALIZE_GLOBAL) - STAGED_FEATURES(FEATURE_INITIALIZE_GLOBAL) + HARMONY_INPROGRESS(FEATURE_INITIALIZE_GLOBAL) + HARMONY_STAGED(FEATURE_INITIALIZE_GLOBAL) #undef FEATURE_INITIALIZE_GLOBAL } @@ -1565,8 +1563,7 @@ void Genesis::InstallNativeFunctions() { INSTALL_NATIVE(JSFunction, "ArrayValues", array_values_iterator); #define INSTALL_NATIVE_FUNCTIONS_FOR(id, descr) InstallNativeFunctions_##id(); - - SHIPPING_FEATURES(INSTALL_NATIVE_FUNCTIONS_FOR) + HARMONY_SHIPPING(INSTALL_NATIVE_FUNCTIONS_FOR) #undef INSTALL_NATIVE_FUNCTIONS_FOR } @@ -1580,10 +1577,8 @@ void Genesis::InstallExperimentalNativeFunctions() { } #define INSTALL_NATIVE_FUNCTIONS_FOR(id, descr) InstallNativeFunctions_##id(); - - HARMONY_FEATURES(INSTALL_NATIVE_FUNCTIONS_FOR) - STAGED_FEATURES(INSTALL_NATIVE_FUNCTIONS_FOR) - INSTALL_NATIVE_FUNCTIONS_FOR(harmony_proxies, "") + HARMONY_INPROGRESS(INSTALL_NATIVE_FUNCTIONS_FOR) + HARMONY_STAGED(INSTALL_NATIVE_FUNCTIONS_FOR) #undef INSTALL_NATIVE_FUNCTIONS_FOR } @@ -1626,6 +1621,7 @@ EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_object_literals) EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_arrow_functions) EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_numeric_literals) EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_tostring) +EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_proxies) void Genesis::InitializeGlobal_harmony_regexps() { Handle builtins(native_context()->builtins()); @@ -2180,16 +2176,14 @@ bool Genesis::InstallExperimentalNatives() { } \ } \ } - INSTALL_EXPERIMENTAL_NATIVES(harmony_proxies, ""); // Iterate over flags that are not enabled by default. - HARMONY_FEATURES(INSTALL_EXPERIMENTAL_NATIVES); - STAGED_FEATURES(INSTALL_EXPERIMENTAL_NATIVES); + HARMONY_INPROGRESS(INSTALL_EXPERIMENTAL_NATIVES); + HARMONY_STAGED(INSTALL_EXPERIMENTAL_NATIVES); #undef INSTALL_EXPERIMENTAL_NATIVES } #define USE_NATIVES_FOR_FEATURE(id, descr) USE(id##_natives); - - SHIPPING_FEATURES(USE_NATIVES_FOR_FEATURE) + HARMONY_SHIPPING(USE_NATIVES_FOR_FEATURE) #undef USE_NATIVES_FOR_FEATURE InstallExperimentalNativeFunctions(); diff --git a/src/flag-definitions.h b/src/flag-definitions.h index d161d55..690e5c7 100644 --- a/src/flag-definitions.h +++ b/src/flag-definitions.h @@ -155,54 +155,65 @@ struct MaybeBoolFlag { // Flags for language modes and experimental language features. DEFINE_BOOL(use_strict, false, "enforce strict mode") -DEFINE_BOOL(es_staging, false, "enable upcoming ES6+ features") -DEFINE_BOOL(harmony, false, "enable all harmony features (except proxies)") +DEFINE_BOOL(es_staging, false, "enable all completed harmony features") +DEFINE_BOOL(harmony, false, "enable all completed harmony features") DEFINE_IMPLICATION(harmony, es_staging) +// TODO(rossberg): activate once we have staged scoping: +// DEFINE_IMPLICATION(es_staging, harmony) -#define HARMONY_FEATURES(V) \ +// Features that are still work in progress (behind individual flags). +#define HARMONY_INPROGRESS(V) \ V(harmony_scoping, "harmony block scoping") \ V(harmony_modules, "harmony modules (implies block scoping)") \ - V(harmony_arrays, "harmony arrays") \ - V(harmony_classes, "harmony classes") \ + V(harmony_arrays, "harmony array methods") \ + V(harmony_classes, \ + "harmony classes (implies block scoping & object literal extension)") \ V(harmony_object_literals, "harmony object literal extensions") \ - V(harmony_regexps, "reg-exp related harmony features") \ + V(harmony_regexps, "harmony regular expression extensions") \ V(harmony_arrow_functions, "harmony arrow functions") \ - V(harmony_tostring, "harmony Symbol.toStringTag") + V(harmony_tostring, "harmony toString") \ + V(harmony_proxies, "harmony proxies") -#define STAGED_FEATURES(V) \ - V(harmony_strings, "harmony strings") \ - V(harmony_numeric_literals, "harmony numeric literals (0o77, 0b11)") +// Features that are complete (but still behind --harmony/es-staging flag). +#define HARMONY_STAGED(V) \ + V(harmony_strings, "harmony string methods") \ + V(harmony_numeric_literals, "harmony numeric literals") -#define SHIPPING_FEATURES(V) +// Features that are shipping (turned on by default, but internal flag remains). +#define HARMONY_SHIPPING(V) + +// Once a shipping feature has proved stable in the wild, it will be dropped +// from HARMONY_SHIPPING, all occurrences of the FLAG_ variable are removed, +// and associated tests are moved from the harmony directory to the appropriate +// esN directory. -#define FLAG_FEATURES(id, description) \ - DEFINE_BOOL(id, false, "enable " #description) \ - DEFINE_IMPLICATION(harmony, id) -HARMONY_FEATURES(FLAG_FEATURES) -STAGED_FEATURES(FLAG_FEATURES) -#undef FLAG_FEATURES +#define FLAG_INPROGRESS_FEATURES(id, description) \ + DEFINE_BOOL(id, false, "enable " #description " (in progress)") +HARMONY_INPROGRESS(FLAG_INPROGRESS_FEATURES) +#undef FLAG_INPROGRESS_FEATURES -#define FLAG_STAGED_FEATURES(id, description) DEFINE_IMPLICATION(es_staging, id) +// TODO(rossberg): temporary, remove once we have staged scoping. +// After that, --harmony will be synonymous to --es-staging. +DEFINE_IMPLICATION(harmony, harmony_scoping) -STAGED_FEATURES(FLAG_STAGED_FEATURES) +#define FLAG_STAGED_FEATURES(id, description) \ + DEFINE_BOOL(id, false, "enable " #description) \ + DEFINE_IMPLICATION(es_staging, id) +HARMONY_STAGED(FLAG_STAGED_FEATURES) #undef FLAG_STAGED_FEATURES #define FLAG_SHIPPING_FEATURES(id, description) \ DEFINE_BOOL_READONLY(id, true, "enable " #description) - -SHIPPING_FEATURES(FLAG_SHIPPING_FEATURES) +HARMONY_SHIPPING(FLAG_SHIPPING_FEATURES) #undef FLAG_SHIPPING_FEATURES + // Feature dependencies. DEFINE_IMPLICATION(harmony_modules, harmony_scoping) DEFINE_IMPLICATION(harmony_classes, harmony_scoping) DEFINE_IMPLICATION(harmony_classes, harmony_object_literals) -DEFINE_BOOL(harmony_proxies, false, "enable harmony proxies") -// TODO(rossberg): Reenable when problems are sorted out. -// DEFINE_IMPLICATION(harmony, harmony_proxies) - // Flags for experimental implementation features. DEFINE_BOOL(compiled_keyed_generic_loads, false, diff --git a/test/mjsunit/harmony/classes.js b/test/mjsunit/harmony/classes.js index c5c2b72..59371e4 100644 --- a/test/mjsunit/harmony/classes.js +++ b/test/mjsunit/harmony/classes.js @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flags: --harmony +// Flags: --harmony-classes (function TestBasics() { var C = class C {} diff --git a/test/mjsunit/harmony/regress/regress-343928.js b/test/mjsunit/harmony/regress/regress-343928.js index b102ab9..f2ff371 100644 --- a/test/mjsunit/harmony/regress/regress-343928.js +++ b/test/mjsunit/harmony/regress/regress-343928.js @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flags: --harmony --expose-debug-as=debug +// Flags: --harmony-modules --expose-debug-as=debug (function () { // Scope for utility functions. escaping_function = function(object) { -- 2.7.4