void Bootstrapper::TearDown() {
if (delete_these_non_arrays_on_tear_down_ != NULL) {
int len = delete_these_non_arrays_on_tear_down_->length();
- DCHECK(len < 28); // Don't use this mechanism for unbounded allocations.
+ DCHECK(len < 1000); // Don't use this mechanism for unbounded allocations.
for (int i = 0; i < len; i++) {
delete delete_these_non_arrays_on_tear_down_->at(i);
delete_these_non_arrays_on_tear_down_->at(i) = NULL;
// Used for creating a context from scratch.
void InstallNativeFunctions();
void InstallExperimentalNativeFunctions();
+
+#define DECLARE_FEATURE_INITIALIZATION(id, descr) \
+ 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, "")
+#undef DECLARE_FEATURE_INITIALIZATION
+
Handle<JSFunction> InstallInternalArray(Handle<JSBuiltinsObject> builtins,
const char* name,
ElementsKind elements_kind);
delegate->shared()->DontAdaptArguments();
}
+#define FEATURE_INITIALIZE_GLOBAL(id, descr) InitializeGlobal_##id();
+
+ SHIPPING_FEATURES(FEATURE_INITIALIZE_GLOBAL)
+#undef FEATURE_INITIALIZE_GLOBAL
+
// Initialize the embedder data slot.
Handle<FixedArray> embedder_data = factory->NewFixedArray(3);
native_context()->set_embedder_data(*embedder_data);
void Genesis::InitializeExperimentalGlobal() {
- // TODO(erikcorry): Move this into Genesis::InitializeGlobal once we no
- // longer need to live behind a flag.
- Handle<JSObject> builtins(native_context()->builtins());
+#define FEATURE_INITIALIZE_GLOBAL(id, descr) InitializeGlobal_##id();
- Handle<HeapObject> flag(
- FLAG_harmony_regexps ? heap()->true_value() : heap()->false_value());
- PropertyAttributes attributes =
- static_cast<PropertyAttributes>(DONT_DELETE | READ_ONLY);
- Runtime::DefineObjectProperty(builtins, factory()->harmony_regexps_string(),
- flag, attributes).Assert();
+ HARMONY_FEATURES(FEATURE_INITIALIZE_GLOBAL)
+ STAGED_FEATURES(FEATURE_INITIALIZE_GLOBAL)
+#undef FEATURE_INITIALIZE_GLOBAL
}
INSTALL_NATIVE(Symbol, "symbolIterator", iterator_symbol);
INSTALL_NATIVE(Symbol, "symbolUnscopables", unscopables_symbol);
INSTALL_NATIVE(JSFunction, "ArrayValues", array_values_iterator);
+
+#define INSTALL_NATIVE_FUNCTIONS_FOR(id, descr) InstallNativeFunctions_##id();
+
+ SHIPPING_FEATURES(INSTALL_NATIVE_FUNCTIONS_FOR)
+#undef INSTALL_NATIVE_FUNCTIONS_FOR
}
INSTALL_NATIVE(JSFunction, "DerivedSetTrap", derived_set_trap);
INSTALL_NATIVE(JSFunction, "ProxyEnumerate", proxy_enumerate);
}
+
+#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, "")
+#undef INSTALL_NATIVE_FUNCTIONS_FOR
+}
+
+
+#define EMPTY_NATIVE_FUNCTIONS_FOR_FEATURE(id) \
+ void Genesis::InstallNativeFunctions_##id() {}
+
+EMPTY_NATIVE_FUNCTIONS_FOR_FEATURE(harmony_scoping)
+EMPTY_NATIVE_FUNCTIONS_FOR_FEATURE(harmony_modules)
+EMPTY_NATIVE_FUNCTIONS_FOR_FEATURE(harmony_strings)
+EMPTY_NATIVE_FUNCTIONS_FOR_FEATURE(harmony_arrays)
+EMPTY_NATIVE_FUNCTIONS_FOR_FEATURE(harmony_classes)
+EMPTY_NATIVE_FUNCTIONS_FOR_FEATURE(harmony_object_literals)
+EMPTY_NATIVE_FUNCTIONS_FOR_FEATURE(harmony_regexps)
+EMPTY_NATIVE_FUNCTIONS_FOR_FEATURE(harmony_arrow_functions)
+EMPTY_NATIVE_FUNCTIONS_FOR_FEATURE(harmony_numeric_literals)
+
+
+void Genesis::InstallNativeFunctions_harmony_proxies() {
+ if (FLAG_harmony_proxies) {
+ INSTALL_NATIVE(JSFunction, "DerivedHasTrap", derived_has_trap);
+ INSTALL_NATIVE(JSFunction, "DerivedGetTrap", derived_get_trap);
+ INSTALL_NATIVE(JSFunction, "DerivedSetTrap", derived_set_trap);
+ INSTALL_NATIVE(JSFunction, "ProxyEnumerate", proxy_enumerate);
+ }
}
#undef INSTALL_NATIVE
+#define EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(id) \
+ void Genesis::InitializeGlobal_##id() {}
+
+EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_scoping)
+EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_modules)
+EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_strings)
+EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_arrays)
+EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_classes)
+EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_object_literals)
+EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_arrow_functions)
+EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_numeric_literals)
+
+void Genesis::InitializeGlobal_harmony_regexps() {
+ Handle<JSObject> builtins(native_context()->builtins());
+
+ Handle<HeapObject> flag(FLAG_harmony_regexps ? heap()->true_value()
+ : heap()->false_value());
+ PropertyAttributes attributes =
+ static_cast<PropertyAttributes>(DONT_DELETE | READ_ONLY);
+ Runtime::DefineObjectProperty(builtins, factory()->harmony_regexps_string(),
+ flag, attributes).Assert();
+}
+
Handle<JSFunction> Genesis::InstallInternalArray(
Handle<JSBuiltinsObject> builtins,
}
-#define INSTALL_EXPERIMENTAL_NATIVE(i, flag, file) \
- if (FLAG_harmony_##flag && \
- strcmp(ExperimentalNatives::GetScriptName(i).start(), \
- "native " file) == 0) { \
- if (!CompileExperimentalBuiltin(isolate(), i)) return false; \
+#define INSTALL_EXPERIMENTAL_NATIVE(i, flag, file) \
+ if (FLAG_##flag && \
+ strcmp(ExperimentalNatives::GetScriptName(i).start(), "native " file) == \
+ 0) { \
+ if (!CompileExperimentalBuiltin(isolate(), i)) return false; \
}
bool Genesis::InstallExperimentalNatives() {
+ static const char* harmony_arrays_natives[] = {
+ "native harmony-array.js", "native harmony-typedarray.js", NULL};
+ static const char* harmony_proxies_natives[] = {"native proxy.js", NULL};
+ static const char* harmony_strings_natives[] = {"native harmony-string.js",
+ NULL};
+ static const char* harmony_classes_natives[] = {"native harmony-classes.js",
+ NULL};
+ static const char* harmony_modules_natives[] = {NULL};
+ static const char* harmony_scoping_natives[] = {NULL};
+ static const char* harmony_object_literals_natives[] = {NULL};
+ static const char* harmony_regexps_natives[] = {NULL};
+ static const char* harmony_arrow_functions_natives[] = {NULL};
+ static const char* harmony_numeric_literals_natives[] = {NULL};
+
for (int i = ExperimentalNatives::GetDebuggerCount();
- i < ExperimentalNatives::GetBuiltinsCount();
- i++) {
- INSTALL_EXPERIMENTAL_NATIVE(i, proxies, "proxy.js")
- INSTALL_EXPERIMENTAL_NATIVE(i, strings, "harmony-string.js")
- INSTALL_EXPERIMENTAL_NATIVE(i, arrays, "harmony-array.js")
- INSTALL_EXPERIMENTAL_NATIVE(i, arrays, "harmony-typedarray.js")
- INSTALL_EXPERIMENTAL_NATIVE(i, classes, "harmony-classes.js")
- }
+ i < ExperimentalNatives::GetBuiltinsCount(); i++) {
+#define INSTALL_EXPERIMENTAL_NATIVES(id, desc) \
+ if (FLAG_##id) { \
+ for (size_t j = 0; id##_natives[j] != NULL; j++) { \
+ if (strcmp(ExperimentalNatives::GetScriptName(i).start(), \
+ id##_natives[j]) == 0) { \
+ if (!CompileExperimentalBuiltin(isolate(), i)) return false; \
+ } \
+ } \
+ }
+ INSTALL_EXPERIMENTAL_NATIVES(harmony_proxies, "");
+ // Iterate over flags that are not enabled by default.
+ HARMONY_FEATURES(INSTALL_EXPERIMENTAL_NATIVES);
+ STAGED_FEATURES(INSTALL_EXPERIMENTAL_NATIVES);
+#undef INSTALL_EXPERIMENTAL_NATIVES
+ }
+
+#define USE_NATIVES_FOR_FEATURE(id, descr) USE(id##_natives);
+
+ SHIPPING_FEATURES(USE_NATIVES_FOR_FEATURE)
+#undef USE_NATIVES_FOR_FEATURE
InstallExperimentalNativeFunctions();
return true;
#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)
// 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(harmony_scoping, "harmony block scoping") \
+ V(harmony_modules, "harmony modules (implies block scoping)") \
+ V(harmony_strings, "harmony strings") \
+ V(harmony_arrays, "harmony arrays") \
+ V(harmony_classes, "harmony classes") \
+ V(harmony_object_literals, "harmony object literal extensions") \
+ V(harmony_regexps, "reg-exp related harmony features") \
+ V(harmony_arrow_functions, "harmony arrow functions")
+
+#define STAGED_FEATURES(V) \
+ V(harmony_numeric_literals, "harmony numeric literals (0o77, 0b11)")
+
+#define SHIPPING_FEATURES(V)
+
+#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_STAGED_FEATURES(id, description) DEFINE_IMPLICATION(es_staging, id)
+
+STAGED_FEATURES(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)
+#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,