mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-20 00:35:44 +00:00
Bug 1662140 - Add javascript.options.off_thread_parse_global pref and --no-off-thread-parse-global shell option. r=tcampbell
This adds the preference, JS shell option, and {ContextOptions,CompileOptions} fields, but the value isn't read and the code always acts as it's set to true. Differential Revision: https://phabricator.services.mozilla.com/D88922
This commit is contained in:
parent
a7cd806311
commit
6eecdba324
@ -290,7 +290,9 @@ void LoadContextOptions(const char* aPrefName, void* /* aClosure */) {
|
||||
.setPrivateClassFields(
|
||||
GetWorkerPref<bool>("experimental.private_fields"_ns))
|
||||
.setPrivateClassMethods(
|
||||
GetWorkerPref<bool>("experimental.private_methods"_ns));
|
||||
GetWorkerPref<bool>("experimental.private_methods"_ns))
|
||||
.setUseOffThreadParseGlobal(
|
||||
GetWorkerPref<bool>("off_thread_parse_global"_ns));
|
||||
|
||||
nsCOMPtr<nsIXULRuntime> xr = do_GetService("@mozilla.org/xre/runtime;1");
|
||||
if (xr) {
|
||||
|
@ -133,6 +133,11 @@ class JS_PUBLIC_API TransitiveCompileOptions {
|
||||
bool privateClassFields = false;
|
||||
bool privateClassMethods = false;
|
||||
|
||||
// True if off-thread parsing should use a parse GlobalObject in order to
|
||||
// directly allocate to the GC from a helper thread. If false, transfer the
|
||||
// CompilationStencil back to main thread before allocating GC objects.
|
||||
bool useOffThreadParseGlobal = true;
|
||||
|
||||
/**
|
||||
* |introductionType| is a statically allocated C string: one of "eval",
|
||||
* "Function", or "GeneratorFunction".
|
||||
|
@ -45,7 +45,8 @@ class JS_PUBLIC_API ContextOptions {
|
||||
#endif
|
||||
fuzzing_(false),
|
||||
privateClassFields_(false),
|
||||
privateClassMethods_(false) {
|
||||
privateClassMethods_(false),
|
||||
useOffThreadParseGlobal_(true) {
|
||||
}
|
||||
|
||||
bool asmJS() const { return asmJS_; }
|
||||
@ -153,6 +154,12 @@ class JS_PUBLIC_API ContextOptions {
|
||||
return *this;
|
||||
}
|
||||
|
||||
bool useOffThreadParseGlobal() const { return useOffThreadParseGlobal_; }
|
||||
ContextOptions& setUseOffThreadParseGlobal(bool use) {
|
||||
useOffThreadParseGlobal_ = use;
|
||||
return *this;
|
||||
}
|
||||
|
||||
// Override to allow disabling the eval restriction security checks for
|
||||
// this context.
|
||||
bool disableEvalSecurityChecks() const { return disableEvalSecurityChecks_; }
|
||||
@ -262,6 +269,9 @@ class JS_PUBLIC_API ContextOptions {
|
||||
bool fuzzing_ : 1;
|
||||
bool privateClassFields_ : 1;
|
||||
bool privateClassMethods_ : 1;
|
||||
|
||||
// See TransitiveCompileOptions.useOffThreadParseGlobal.
|
||||
bool useOffThreadParseGlobal_ : 1;
|
||||
};
|
||||
|
||||
JS_PUBLIC_API ContextOptions& ContextOptionsRef(JSContext* cx);
|
||||
|
@ -175,6 +175,13 @@ static bool GetRealmConfiguration(JSContext* cx, unsigned argc, Value* vp) {
|
||||
return false;
|
||||
}
|
||||
|
||||
bool offThreadParseGlobal = cx->options().useOffThreadParseGlobal();
|
||||
if (!JS_SetProperty(
|
||||
cx, info, "offThreadParseGlobal",
|
||||
offThreadParseGlobal ? TrueHandleValue : FalseHandleValue)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
args.rval().setObject(*info);
|
||||
return true;
|
||||
}
|
||||
|
@ -3466,6 +3466,7 @@ void JS::TransitiveCompileOptions::copyPODTransitiveOptions(
|
||||
nonSyntacticScope = rhs.nonSyntacticScope;
|
||||
privateClassFields = rhs.privateClassFields;
|
||||
privateClassMethods = rhs.privateClassMethods;
|
||||
useOffThreadParseGlobal = rhs.useOffThreadParseGlobal;
|
||||
};
|
||||
|
||||
void JS::ReadOnlyCompileOptions::copyPODNonTransitiveOptions(
|
||||
@ -3559,6 +3560,7 @@ JS::CompileOptions::CompileOptions(JSContext* cx)
|
||||
cx->options().throwOnAsmJSValidationFailure();
|
||||
privateClassFields = cx->options().privateClassFields();
|
||||
privateClassMethods = cx->options().privateClassMethods();
|
||||
useOffThreadParseGlobal = cx->options().useOffThreadParseGlobal();
|
||||
|
||||
sourcePragmas_ = cx->options().sourcePragmas();
|
||||
|
||||
|
@ -521,6 +521,7 @@ bool shell::enablePropertyErrorMessageFix = false;
|
||||
bool shell::enableIteratorHelpers = false;
|
||||
bool shell::enablePrivateClassFields = false;
|
||||
bool shell::enablePrivateClassMethods = false;
|
||||
bool shell::useOffThreadParseGlobal = true;
|
||||
#ifdef JS_GC_ZEAL
|
||||
uint32_t shell::gZealBits = 0;
|
||||
uint32_t shell::gZealFrequency = 0;
|
||||
@ -10251,6 +10252,7 @@ static bool SetContextOptions(JSContext* cx, const OptionParser& op) {
|
||||
enablePrivateClassFields = op.getBoolOption("enable-private-fields") ||
|
||||
op.getBoolOption("enable-private-methods");
|
||||
enablePrivateClassMethods = op.getBoolOption("enable-private-methods");
|
||||
useOffThreadParseGlobal = !op.getBoolOption("no-off-thread-parse-global");
|
||||
|
||||
JS::ContextOptionsRef(cx)
|
||||
.setAsmJS(enableAsmJS)
|
||||
@ -10277,7 +10279,8 @@ static bool SetContextOptions(JSContext* cx, const OptionParser& op) {
|
||||
.setAsyncStack(enableAsyncStacks)
|
||||
.setAsyncStackCaptureDebuggeeOnly(enableAsyncStackCaptureDebuggeeOnly)
|
||||
.setPrivateClassFields(enablePrivateClassFields)
|
||||
.setPrivateClassMethods(enablePrivateClassMethods);
|
||||
.setPrivateClassMethods(enablePrivateClassMethods)
|
||||
.setUseOffThreadParseGlobal(useOffThreadParseGlobal);
|
||||
|
||||
if (op.getBoolOption("no-ion-for-main-context")) {
|
||||
JS::ContextOptionsRef(cx).setDisableIon();
|
||||
@ -11143,6 +11146,9 @@ int main(int argc, char** argv, char** envp) {
|
||||
"Enable private class fields") ||
|
||||
!op.addBoolOption('\0', "enable-private-methods",
|
||||
"Enable private class methods") ||
|
||||
!op.addBoolOption('\0', "no-off-thread-parse-global",
|
||||
"Do not use parseGlobal in off-thread compilation and "
|
||||
"instead instantiate stencil in main-thread") ||
|
||||
!op.addStringOption('\0', "shared-memory", "on/off",
|
||||
"SharedArrayBuffer and Atomics "
|
||||
#if SHARED_MEMORY_DEFAULT
|
||||
|
@ -135,6 +135,7 @@ extern bool enableReadableStreamPipeTo;
|
||||
extern bool enableWeakRefs;
|
||||
extern bool enableToSource;
|
||||
extern bool enablePropertyErrorMessageFix;
|
||||
extern bool useOffThreadParseGlobal;
|
||||
extern bool enableIteratorHelpers;
|
||||
extern bool enablePrivateClassFields;
|
||||
extern bool enablePrivateClassMethods;
|
||||
|
@ -974,6 +974,9 @@ static void ReloadPrefsCallback(const char* pref, void* aXpccx) {
|
||||
Preferences::GetBool(JS_OPTIONS_DOT_STR "experimental.private_methods");
|
||||
#endif
|
||||
|
||||
bool useOffThreadParseGlobal =
|
||||
Preferences::GetBool(JS_OPTIONS_DOT_STR "off_thread_parse_global");
|
||||
|
||||
#ifdef JS_GC_ZEAL
|
||||
int32_t zeal = Preferences::GetInt(JS_OPTIONS_DOT_STR "gczeal", -1);
|
||||
int32_t zeal_frequency = Preferences::GetInt(
|
||||
@ -1017,7 +1020,8 @@ static void ReloadPrefsCallback(const char* pref, void* aXpccx) {
|
||||
.setThrowOnDebuggeeWouldRun(throwOnDebuggeeWouldRun)
|
||||
.setDumpStackOnDebuggeeWouldRun(dumpStackOnDebuggeeWouldRun)
|
||||
.setPrivateClassFields(privateFieldsEnabled)
|
||||
.setPrivateClassMethods(privateMethodsEnabled);
|
||||
.setPrivateClassMethods(privateMethodsEnabled)
|
||||
.setUseOffThreadParseGlobal(useOffThreadParseGlobal);
|
||||
|
||||
nsCOMPtr<nsIXULRuntime> xr = do_GetService("@mozilla.org/xre/runtime;1");
|
||||
if (xr) {
|
||||
|
@ -4995,6 +4995,14 @@
|
||||
#endif
|
||||
mirror: always
|
||||
|
||||
# True if off-thread parsing should use a parse GlobalObject in order to
|
||||
# directly allocate to the GC from a helper thread. If false, transfer the
|
||||
# CompilationStencil back to main thread before allocating GC objects.
|
||||
- name: javascript.options.off_thread_parse_global
|
||||
type: bool
|
||||
value: true
|
||||
mirror: once
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# Prefs starting with "layers."
|
||||
#---------------------------------------------------------------------------
|
||||
|
Loading…
Reference in New Issue
Block a user