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

Unified Diff: src/flag-definitions.h

Issue 642233003: Simplify language feature management. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: NOT FOR LANDING - example of shipping a feature Created 6 years, 2 months 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
Index: src/flag-definitions.h
diff --git a/src/flag-definitions.h b/src/flag-definitions.h
index c2abd0f5a1553ddf5a2bb031f71e14f7d234c80b..b47a52afd004cd579a424135df1fd31a732ddb41 100644
--- a/src/flag-definitions.h
+++ b/src/flag-definitions.h
@@ -126,6 +126,8 @@ struct MaybeBoolFlag {
#endif
#define DEFINE_BOOL(nam, def, cmt) FLAG(BOOL, bool, nam, def, cmt)
+#define DEFINE_BOOL_READONLY(nam, def, cmt) \
+ FLAG_READONLY(BOOL, bool, nam, def, cmt)
#define DEFINE_MAYBE_BOOL(nam, cmt) \
FLAG(MAYBE_BOOL, MaybeBoolFlag, nam, {false COMMA false}, cmt)
#define DEFINE_INT(nam, def, cmt) FLAG(INT, int, nam, def, cmt)
@@ -147,39 +149,55 @@ 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_scoping, false, "enable harmony block scoping")
-DEFINE_BOOL(harmony_modules, false,
- "enable harmony modules (implies block scoping)")
-DEFINE_BOOL(harmony_proxies, false, "enable harmony proxies")
-DEFINE_BOOL(harmony_numeric_literals, false,
- "enable harmony numeric literals (0o77, 0b11)")
-DEFINE_BOOL(harmony_strings, false, "enable harmony string")
-DEFINE_BOOL(harmony_arrays, false, "enable harmony arrays")
-DEFINE_BOOL(harmony_arrow_functions, false, "enable harmony arrow functions")
-DEFINE_BOOL(harmony_classes, false, "enable harmony classes")
-DEFINE_BOOL(harmony_object_literals, false,
- "enable harmony object literal extensions")
-DEFINE_BOOL(harmony_regexps, false, "enable regexp-related harmony features")
+DEFINE_BOOL(es_staging, false, "enable upcoming ES6+ features")
DEFINE_BOOL(harmony, false, "enable all harmony features (except proxies)")
+DEFINE_IMPLICATION(harmony, es_staging)
-DEFINE_IMPLICATION(harmony, harmony_scoping)
-DEFINE_IMPLICATION(harmony, harmony_modules)
-// TODO(rossberg): Reenable when problems are sorted out.
-// DEFINE_IMPLICATION(harmony, harmony_proxies)
-DEFINE_IMPLICATION(harmony, harmony_strings)
-DEFINE_IMPLICATION(harmony, harmony_arrays)
-DEFINE_IMPLICATION(harmony, harmony_arrow_functions)
-DEFINE_IMPLICATION(harmony, harmony_classes)
-DEFINE_IMPLICATION(harmony, harmony_object_literals)
-DEFINE_IMPLICATION(harmony, harmony_regexps)
+#define HARMONY_FEATURES(V) \
+ V(scoping, "harmony block scoping") \
rossberg 2014/10/20 13:14:27 I'd prefer not to strip the harmony_ prefix from t
Dmitry Lomov (no reviews) 2014/10/20 13:32:53 Done.
+ V(modules, "harmony modules (implies block scoping)") \
+ V(strings, "harmony strings") \
+ V(classes, "harmony classes") \
+ V(object_literals, "harmony object literal extensions") \
+ V(regexps, "reg-exp related harmony features") \
+ V(arrow_functions, "harmony arrow functions")
+
+#define STAGED_FEATURES(V) \
+ V(numeric_literals, "harmony numeric literals (0o77, 0b11)")
+
+#define SHIPPING_FEATURES(V) \
+ V(arrays, "harmony arrays")
+
+#define FLAG_FEATURES(id, description) \
+ DEFINE_BOOL(harmony_##id, false, "enable " #description) \
+ DEFINE_IMPLICATION(harmony, harmony_##id)
+
+HARMONY_FEATURES(FLAG_FEATURES)
+STAGED_FEATURES(FLAG_FEATURES)
+#undef FLAG_FEATURES
+
+#define FLAG_STAGED_FEATURES(id, description) \
+ DEFINE_IMPLICATION(es_staging, harmony_##id)
+
+STAGED_FEATURES(FLAG_STAGED_FEATURES)
+#undef FLAG_STAGED_FEATURES
+
+#define FLAG_SHIPPING_FEATURES(id, description) \
+ DEFINE_BOOL_READONLY(harmony_##id, true, "enable " #description)
+
+SHIPPING_FEATURES(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_IMPLICATION(harmony, es_staging)
-DEFINE_IMPLICATION(es_staging, harmony_numeric_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,
« no previous file with comments | « src/bootstrapper.cc ('k') | src/runtime/runtime.h » ('j') | test/mjsunit/debug-script.js » ('J')

Powered by Google App Engine
This is Rietveld 408576698