зеркало из https://github.com/mozilla/gecko-dev.git
Backed out 5 changesets (bug 1743623) for causing hybrid bustages on RuntimeService. CLOSED TREE
Backed out changeset f671659046b1 (bug 1743623) Backed out changeset 2f2368b8f931 (bug 1743623) Backed out changeset 51820e97c1eb (bug 1743623) Backed out changeset 824c5cd5ea17 (bug 1743623) Backed out changeset cee175fa09e7 (bug 1743623)
This commit is contained in:
Родитель
8a695bf931
Коммит
64df8411ef
|
@ -65,6 +65,7 @@
|
|||
#include "nsXPCOMPrivate.h"
|
||||
#include "OSFileConstants.h"
|
||||
#include "xpcpublic.h"
|
||||
#include "XPCPrefableContextOptions.h"
|
||||
#include "XPCSelfHostedShmem.h"
|
||||
|
||||
#if defined(XP_MACOSX)
|
||||
|
@ -131,8 +132,9 @@ static_assert(MAX_WORKERS_PER_DOMAIN >= 1,
|
|||
|
||||
// Prefixes for observing preference changes.
|
||||
#define PREF_JS_OPTIONS_PREFIX "javascript.options."
|
||||
#define PREF_WORKERS_OPTIONS_PREFIX PREF_WORKERS_PREFIX "options."
|
||||
#define PREF_MEM_OPTIONS_PREFIX "mem."
|
||||
#define PREF_GCZEAL "gczeal"
|
||||
#define PREF_GCZEAL "gcZeal"
|
||||
|
||||
static NS_DEFINE_CID(kStreamTransportServiceCID, NS_STREAMTRANSPORTSERVICE_CID);
|
||||
|
||||
|
@ -192,9 +194,9 @@ struct PrefTraits<int32_t> {
|
|||
};
|
||||
|
||||
template <typename T>
|
||||
T GetPref(const char* aFullPref,
|
||||
const T aDefault = PrefTraits<T>::kDefaultValue,
|
||||
bool* aPresent = nullptr) {
|
||||
T GetWorkerPref(const nsACString& aPref,
|
||||
const T aDefault = PrefTraits<T>::kDefaultValue,
|
||||
bool* aPresent = nullptr) {
|
||||
AssertIsOnMainThread();
|
||||
|
||||
using PrefHelper = PrefTraits<T>;
|
||||
|
@ -202,11 +204,22 @@ T GetPref(const char* aFullPref,
|
|||
T result;
|
||||
bool present = true;
|
||||
|
||||
if (PrefHelper::Exists(aFullPref)) {
|
||||
result = PrefHelper::Get(aFullPref);
|
||||
nsAutoCString prefName;
|
||||
prefName.AssignLiteral(PREF_WORKERS_OPTIONS_PREFIX);
|
||||
prefName.Append(aPref);
|
||||
|
||||
if (PrefHelper::Exists(prefName.get())) {
|
||||
result = PrefHelper::Get(prefName.get());
|
||||
} else {
|
||||
result = aDefault;
|
||||
present = false;
|
||||
prefName.AssignLiteral(PREF_JS_OPTIONS_PREFIX);
|
||||
prefName.Append(aPref);
|
||||
|
||||
if (PrefHelper::Exists(prefName.get())) {
|
||||
result = PrefHelper::Get(prefName.get());
|
||||
} else {
|
||||
result = aDefault;
|
||||
present = false;
|
||||
}
|
||||
}
|
||||
|
||||
if (aPresent) {
|
||||
|
@ -215,6 +228,23 @@ T GetPref(const char* aFullPref,
|
|||
return result;
|
||||
}
|
||||
|
||||
// Optimized version for bool that receives already-concatenated pref names.
|
||||
//
|
||||
// Used by xpc::SetPrefableContextOptions.
|
||||
bool GetWorkerBoolPref(const char* jsPref, const char* workerPref) {
|
||||
using PrefHelper = PrefTraits<bool>;
|
||||
|
||||
if (PrefHelper::Exists(workerPref)) {
|
||||
return PrefHelper::Get(workerPref);
|
||||
}
|
||||
|
||||
if (PrefHelper::Exists(jsPref)) {
|
||||
return PrefHelper::Get(jsPref);
|
||||
}
|
||||
|
||||
return PrefHelper::kDefaultValue;
|
||||
}
|
||||
|
||||
void LoadContextOptions(const char* aPrefName, void* /* aClosure */) {
|
||||
AssertIsOnMainThread();
|
||||
|
||||
|
@ -230,18 +260,22 @@ void LoadContextOptions(const char* aPrefName, void* /* aClosure */) {
|
|||
// another callback that will handle this change.
|
||||
if (StringBeginsWith(
|
||||
prefName,
|
||||
nsLiteralCString(PREF_JS_OPTIONS_PREFIX PREF_MEM_OPTIONS_PREFIX))) {
|
||||
nsLiteralCString(PREF_JS_OPTIONS_PREFIX PREF_MEM_OPTIONS_PREFIX)) ||
|
||||
StringBeginsWith(
|
||||
prefName, nsLiteralCString(
|
||||
PREF_WORKERS_OPTIONS_PREFIX PREF_MEM_OPTIONS_PREFIX))) {
|
||||
return;
|
||||
}
|
||||
|
||||
#ifdef JS_GC_ZEAL
|
||||
if (prefName.EqualsLiteral(PREF_JS_OPTIONS_PREFIX PREF_GCZEAL)) {
|
||||
if (prefName.EqualsLiteral(PREF_JS_OPTIONS_PREFIX PREF_GCZEAL) ||
|
||||
prefName.EqualsLiteral(PREF_WORKERS_OPTIONS_PREFIX PREF_GCZEAL)) {
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
JS::ContextOptions contextOptions;
|
||||
xpc::SetPrefableContextOptions(contextOptions);
|
||||
xpc::SetPrefableContextOptions(contextOptions, GetWorkerBoolPref);
|
||||
|
||||
nsCOMPtr<nsIXULRuntime> xr = do_GetService("@mozilla.org/xre/runtime;1");
|
||||
if (xr) {
|
||||
|
@ -269,13 +303,12 @@ void LoadGCZealOptions(const char* /* aPrefName */, void* /* aClosure */) {
|
|||
return;
|
||||
}
|
||||
|
||||
int32_t gczeal = GetPref<int32_t>(PREF_JS_OPTIONS_PREFIX PREF_GCZEAL, -1);
|
||||
int32_t gczeal = GetWorkerPref<int32_t>(nsLiteralCString(PREF_GCZEAL), -1);
|
||||
if (gczeal < 0) {
|
||||
gczeal = 0;
|
||||
}
|
||||
|
||||
int32_t frequency =
|
||||
GetPref<int32_t>(PREF_JS_OPTIONS_PREFIX PREF_GCZEAL ".frequency", -1);
|
||||
int32_t frequency = GetWorkerPref<int32_t>("gcZeal.frequency"_ns, -1);
|
||||
if (frequency < 0) {
|
||||
frequency = JS_DEFAULT_ZEAL_FREQ;
|
||||
}
|
||||
|
@ -289,11 +322,12 @@ void LoadGCZealOptions(const char* /* aPrefName */, void* /* aClosure */) {
|
|||
#endif
|
||||
|
||||
void UpdateCommonJSGCMemoryOption(RuntimeService* aRuntimeService,
|
||||
const char* aPrefName, JSGCParamKey aKey) {
|
||||
const nsACString& aPrefName,
|
||||
JSGCParamKey aKey) {
|
||||
AssertIsOnMainThread();
|
||||
NS_ASSERTION(aPrefName, "Null pref name!");
|
||||
NS_ASSERTION(!aPrefName.IsEmpty(), "Empty pref name!");
|
||||
|
||||
int32_t prefValue = GetPref(aPrefName, -1);
|
||||
int32_t prefValue = GetWorkerPref(aPrefName, -1);
|
||||
Maybe<uint32_t> value = (prefValue < 0 || prefValue >= 10000)
|
||||
? Nothing()
|
||||
: Some(uint32_t(prefValue));
|
||||
|
@ -326,31 +360,30 @@ void LoadJSGCMemoryOptions(const char* aPrefName, void* /* aClosure */) {
|
|||
return;
|
||||
}
|
||||
|
||||
constexpr auto memPrefix =
|
||||
nsLiteralCString{PREF_JS_OPTIONS_PREFIX PREF_MEM_OPTIONS_PREFIX};
|
||||
constexpr auto jsPrefix = nsLiteralCString{PREF_JS_OPTIONS_PREFIX};
|
||||
constexpr auto workersPrefix = nsLiteralCString{PREF_WORKERS_OPTIONS_PREFIX};
|
||||
|
||||
const nsDependentCString fullPrefName(aPrefName);
|
||||
|
||||
// Pull out the string that actually distinguishes the parameter we need to
|
||||
// change.
|
||||
nsDependentCSubstring memPrefName;
|
||||
if (StringBeginsWith(fullPrefName, memPrefix)) {
|
||||
memPrefName.Rebind(fullPrefName, memPrefix.Length());
|
||||
if (StringBeginsWith(fullPrefName, jsPrefix)) {
|
||||
memPrefName.Rebind(fullPrefName, jsPrefix.Length());
|
||||
} else if (StringBeginsWith(fullPrefName, workersPrefix)) {
|
||||
memPrefName.Rebind(fullPrefName, workersPrefix.Length());
|
||||
} else {
|
||||
NS_ERROR("Unknown pref name!");
|
||||
return;
|
||||
}
|
||||
|
||||
struct WorkerGCPref {
|
||||
nsLiteralCString memName;
|
||||
const char* fullName;
|
||||
nsLiteralCString name;
|
||||
JSGCParamKey key;
|
||||
};
|
||||
|
||||
#define PREF(suffix_, key_) \
|
||||
{ \
|
||||
nsLiteralCString(PREF_MEM_OPTIONS_PREFIX suffix_), \
|
||||
PREF_JS_OPTIONS_PREFIX PREF_MEM_OPTIONS_PREFIX suffix_, key_ \
|
||||
}
|
||||
#define PREF(suffix_, key_) \
|
||||
{ nsLiteralCString(PREF_MEM_OPTIONS_PREFIX suffix_), key_ }
|
||||
constexpr WorkerGCPref kWorkerPrefs[] = {
|
||||
PREF("max", JSGC_MAX_BYTES),
|
||||
PREF("gc_high_frequency_time_limit_ms", JSGC_HIGH_FREQUENCY_TIME_LIMIT),
|
||||
|
@ -380,12 +413,12 @@ void LoadJSGCMemoryOptions(const char* aPrefName, void* /* aClosure */) {
|
|||
|
||||
if (gRuntimeServiceDuringInit) {
|
||||
// During init, we want to update every pref in kWorkerPrefs.
|
||||
MOZ_ASSERT(memPrefName.IsEmpty(),
|
||||
MOZ_ASSERT(memPrefName.EqualsLiteral(PREF_MEM_OPTIONS_PREFIX),
|
||||
"Pref branch prefix only expected during init");
|
||||
} else {
|
||||
// Otherwise, find the single pref that changed.
|
||||
while (pref != end) {
|
||||
if (pref->memName == memPrefName) {
|
||||
if (pref->name == memPrefName) {
|
||||
end = pref + 1;
|
||||
break;
|
||||
}
|
||||
|
@ -404,7 +437,7 @@ void LoadJSGCMemoryOptions(const char* aPrefName, void* /* aClosure */) {
|
|||
while (pref != end) {
|
||||
switch (pref->key) {
|
||||
case JSGC_MAX_BYTES: {
|
||||
int32_t prefValue = GetPref(pref->fullName, -1);
|
||||
int32_t prefValue = GetWorkerPref(pref->name, -1);
|
||||
Maybe<uint32_t> value = (prefValue <= 0 || prefValue >= 0x1000)
|
||||
? Nothing()
|
||||
: Some(uint32_t(prefValue) * 1024 * 1024);
|
||||
|
@ -412,7 +445,7 @@ void LoadJSGCMemoryOptions(const char* aPrefName, void* /* aClosure */) {
|
|||
break;
|
||||
}
|
||||
case JSGC_SLICE_TIME_BUDGET_MS: {
|
||||
int32_t prefValue = GetPref(pref->fullName, -1);
|
||||
int32_t prefValue = GetWorkerPref(pref->name, -1);
|
||||
Maybe<uint32_t> value = (prefValue <= 0 || prefValue >= 100000)
|
||||
? Nothing()
|
||||
: Some(uint32_t(prefValue));
|
||||
|
@ -421,7 +454,7 @@ void LoadJSGCMemoryOptions(const char* aPrefName, void* /* aClosure */) {
|
|||
}
|
||||
case JSGC_COMPACTING_ENABLED: {
|
||||
bool present;
|
||||
bool prefValue = GetPref(pref->fullName, false, &present);
|
||||
bool prefValue = GetWorkerPref(pref->name, false, &present);
|
||||
Maybe<uint32_t> value = present ? Some(prefValue ? 1 : 0) : Nothing();
|
||||
UpdateOtherJSGCMemoryOption(rts, pref->key, value);
|
||||
break;
|
||||
|
@ -439,7 +472,7 @@ void LoadJSGCMemoryOptions(const char* aPrefName, void* /* aClosure */) {
|
|||
case JSGC_URGENT_THRESHOLD_MB:
|
||||
case JSGC_MIN_EMPTY_CHUNK_COUNT:
|
||||
case JSGC_MAX_EMPTY_CHUNK_COUNT:
|
||||
UpdateCommonJSGCMemoryOption(rts, pref->fullName, pref->key);
|
||||
UpdateCommonJSGCMemoryOption(rts, pref->name, pref->key);
|
||||
break;
|
||||
default:
|
||||
MOZ_ASSERT_UNREACHABLE("Unknown JSGCParamKey value");
|
||||
|
@ -1452,9 +1485,12 @@ nsresult RuntimeService::Init() {
|
|||
#define WORKER_PREF(name, callback) \
|
||||
NS_FAILED(Preferences::RegisterCallbackAndCall(callback, name))
|
||||
|
||||
if (NS_FAILED(Preferences::RegisterPrefixCallbackAndCall(
|
||||
if (NS_FAILED(Preferences::RegisterPrefixCallback(
|
||||
LoadJSGCMemoryOptions,
|
||||
PREF_JS_OPTIONS_PREFIX PREF_MEM_OPTIONS_PREFIX)) ||
|
||||
NS_FAILED(Preferences::RegisterPrefixCallbackAndCall(
|
||||
LoadJSGCMemoryOptions,
|
||||
PREF_WORKERS_OPTIONS_PREFIX PREF_MEM_OPTIONS_PREFIX)) ||
|
||||
#ifdef JS_GC_ZEAL
|
||||
NS_FAILED(Preferences::RegisterCallback(
|
||||
LoadGCZealOptions, PREF_JS_OPTIONS_PREFIX PREF_GCZEAL)) ||
|
||||
|
@ -1463,8 +1499,13 @@ nsresult RuntimeService::Init() {
|
|||
WORKER_PREF("general.appname.override", AppNameOverrideChanged) ||
|
||||
WORKER_PREF("general.appversion.override", AppVersionOverrideChanged) ||
|
||||
WORKER_PREF("general.platform.override", PlatformOverrideChanged) ||
|
||||
#ifdef JS_GC_ZEAL
|
||||
WORKER_PREF("dom.workers.options.gcZeal", LoadGCZealOptions) ||
|
||||
#endif
|
||||
NS_FAILED(Preferences::RegisterPrefixCallbackAndCall(
|
||||
LoadContextOptions, PREF_JS_OPTIONS_PREFIX))) {
|
||||
LoadContextOptions, PREF_WORKERS_OPTIONS_PREFIX)) ||
|
||||
NS_FAILED(Preferences::RegisterPrefixCallback(LoadContextOptions,
|
||||
PREF_JS_OPTIONS_PREFIX))) {
|
||||
NS_WARNING("Failed to register pref callbacks!");
|
||||
}
|
||||
|
||||
|
@ -1726,17 +1767,23 @@ void RuntimeService::Cleanup() {
|
|||
if (mObserved) {
|
||||
if (NS_FAILED(Preferences::UnregisterPrefixCallback(
|
||||
LoadContextOptions, PREF_JS_OPTIONS_PREFIX)) ||
|
||||
NS_FAILED(Preferences::UnregisterPrefixCallback(
|
||||
LoadContextOptions, PREF_WORKERS_OPTIONS_PREFIX)) ||
|
||||
WORKER_PREF("intl.accept_languages", PrefLanguagesChanged) ||
|
||||
WORKER_PREF("general.appname.override", AppNameOverrideChanged) ||
|
||||
WORKER_PREF("general.appversion.override", AppVersionOverrideChanged) ||
|
||||
WORKER_PREF("general.platform.override", PlatformOverrideChanged) ||
|
||||
#ifdef JS_GC_ZEAL
|
||||
WORKER_PREF("dom.workers.options.gcZeal", LoadGCZealOptions) ||
|
||||
NS_FAILED(Preferences::UnregisterCallback(
|
||||
LoadGCZealOptions, PREF_JS_OPTIONS_PREFIX PREF_GCZEAL)) ||
|
||||
#endif
|
||||
NS_FAILED(Preferences::UnregisterPrefixCallback(
|
||||
LoadJSGCMemoryOptions,
|
||||
PREF_JS_OPTIONS_PREFIX PREF_MEM_OPTIONS_PREFIX))) {
|
||||
PREF_JS_OPTIONS_PREFIX PREF_MEM_OPTIONS_PREFIX)) ||
|
||||
NS_FAILED(Preferences::UnregisterPrefixCallback(
|
||||
LoadJSGCMemoryOptions,
|
||||
PREF_WORKERS_OPTIONS_PREFIX PREF_MEM_OPTIONS_PREFIX))) {
|
||||
NS_WARNING("Failed to unregister pref callbacks!");
|
||||
}
|
||||
|
||||
|
|
|
@ -55,7 +55,6 @@ class JS_PUBLIC_API ContextOptions {
|
|||
changeArrayByCopy_(false),
|
||||
#endif
|
||||
ergonomicBrandChecks_(false),
|
||||
classStaticBlocks_(false),
|
||||
importAssertions_(false) {
|
||||
}
|
||||
// clang-format on
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
#include "xpcpublic.h"
|
||||
#include "XPCWrapper.h"
|
||||
#include "XPCJSMemoryReporter.h"
|
||||
#include "XPCPrefableContextOptions.h"
|
||||
#include "XPCSelfHostedShmem.h"
|
||||
#include "WrapperFactory.h"
|
||||
#include "mozJSComponentLoader.h"
|
||||
|
@ -806,64 +807,6 @@ void xpc::SetPrefableRealmOptions(JS::RealmOptions& options) {
|
|||
;
|
||||
}
|
||||
|
||||
void xpc::SetPrefableContextOptions(JS::ContextOptions& options) {
|
||||
options
|
||||
.setAsmJS(Preferences::GetBool(JS_OPTIONS_DOT_STR "asmjs"))
|
||||
#ifdef FUZZING
|
||||
.setFuzzing(Preferences::GetBool(JS_OPTIONS_DOT_STR "fuzzing.enabled"))
|
||||
#endif
|
||||
.setWasm(Preferences::GetBool(JS_OPTIONS_DOT_STR "wasm"))
|
||||
.setWasmForTrustedPrinciples(
|
||||
Preferences::GetBool(JS_OPTIONS_DOT_STR "wasm_trustedprincipals"))
|
||||
#ifdef ENABLE_WASM_CRANELIFT
|
||||
.setWasmCranelift(
|
||||
Preferences::GetBool(JS_OPTIONS_DOT_STR "wasm_optimizingjit"))
|
||||
.setWasmIon(false)
|
||||
#else
|
||||
.setWasmCranelift(false)
|
||||
.setWasmIon(Preferences::GetBool(JS_OPTIONS_DOT_STR "wasm_optimizingjit"))
|
||||
#endif
|
||||
.setWasmBaseline(
|
||||
Preferences::GetBool(JS_OPTIONS_DOT_STR "wasm_baselinejit"))
|
||||
#define WASM_FEATURE(NAME, LOWER_NAME, COMPILE_PRED, COMPILER_PRED, FLAG_PRED, \
|
||||
SHELL, PREF) \
|
||||
.setWasm##NAME(Preferences::GetBool(JS_OPTIONS_DOT_STR "wasm_" PREF))
|
||||
JS_FOR_WASM_FEATURES(WASM_FEATURE, WASM_FEATURE, WASM_FEATURE)
|
||||
#undef WASM_FEATURE
|
||||
#ifdef ENABLE_WASM_SIMD_WORMHOLE
|
||||
# ifdef EARLY_BETA_OR_EARLIER
|
||||
.setWasmSimdWormhole(
|
||||
Preferences::GetBool(JS_OPTIONS_DOT_STR "wasm_simd_wormhole"))
|
||||
# else
|
||||
.setWasmSimdWormhole(false)
|
||||
# endif
|
||||
#endif
|
||||
.setWasmVerbose(Preferences::GetBool(JS_OPTIONS_DOT_STR "wasm_verbose"))
|
||||
.setThrowOnAsmJSValidationFailure(Preferences::GetBool(
|
||||
JS_OPTIONS_DOT_STR "throw_on_asmjs_validation_failure"))
|
||||
.setSourcePragmas(
|
||||
Preferences::GetBool(JS_OPTIONS_DOT_STR "source_pragmas"))
|
||||
.setAsyncStack(Preferences::GetBool(JS_OPTIONS_DOT_STR "asyncstack"))
|
||||
.setAsyncStackCaptureDebuggeeOnly(Preferences::GetBool(
|
||||
JS_OPTIONS_DOT_STR "asyncstack_capture_debuggee_only"))
|
||||
.setPrivateClassFields(Preferences::GetBool(
|
||||
JS_OPTIONS_DOT_STR "experimental.private_fields"))
|
||||
.setPrivateClassMethods(Preferences::GetBool(
|
||||
JS_OPTIONS_DOT_STR "experimental.private_methods"))
|
||||
.setClassStaticBlocks(Preferences::GetBool(
|
||||
JS_OPTIONS_DOT_STR "experimental.class_static_blocks"))
|
||||
#ifdef ENABLE_CHANGE_ARRAY_BY_COPY
|
||||
.setChangeArrayByCopy(Preferences::GetBool(
|
||||
JS_OPTIONS_DOT_STR "experimental.enable_change_array_by_copy"))
|
||||
#endif
|
||||
#ifdef NIGHTLY_BUILD
|
||||
.setImportAssertions(Preferences::GetBool(
|
||||
JS_OPTIONS_DOT_STR "experimental.import_assertions"))
|
||||
#endif
|
||||
.setErgnomicBrandChecks(Preferences::GetBool(
|
||||
JS_OPTIONS_DOT_STR "experimental.ergonomic_brand_checks"));
|
||||
}
|
||||
|
||||
// Mirrored value of javascript.options.self_hosted.use_shared_memory.
|
||||
static bool sSelfHostedUseSharedMemory = false;
|
||||
|
||||
|
@ -1020,7 +963,10 @@ static void ReloadPrefsCallback(const char* pref, void* aXpccx) {
|
|||
#endif // JS_GC_ZEAL
|
||||
|
||||
auto& contextOptions = JS::ContextOptionsRef(cx);
|
||||
SetPrefableContextOptions(contextOptions);
|
||||
SetPrefableContextOptions(contextOptions,
|
||||
[](const char* jsPref, const char* workerPref) {
|
||||
return Preferences::GetBool(jsPref);
|
||||
});
|
||||
|
||||
// Set options not shared with workers.
|
||||
contextOptions
|
||||
|
|
|
@ -0,0 +1,81 @@
|
|||
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#ifndef XPCPrefableContextOptions_h__
|
||||
#define XPCPrefableContextOptions_h__
|
||||
|
||||
#include "js/ContextOptions.h"
|
||||
|
||||
namespace xpc {
|
||||
|
||||
// Worker supports overriding JS prefs with different prefix.
|
||||
// Generate pref names for both of them by macro.
|
||||
#define JS_OPTIONS_PREFIX "javascript.options."
|
||||
#define WORKERS_OPTIONS_PREFIX "dom.workers.options."
|
||||
#define PREF_NAMES(s) JS_OPTIONS_PREFIX s, WORKERS_OPTIONS_PREFIX s
|
||||
|
||||
// Load and set JS::ContextOptions flags shared between the main thread and
|
||||
// workers.
|
||||
//
|
||||
// `load`'s signature is `bool (*)(const char* jsPref, const char* workerPref)`.
|
||||
template <typename T>
|
||||
void SetPrefableContextOptions(JS::ContextOptions& options, T load) {
|
||||
options
|
||||
.setAsmJS(load(PREF_NAMES("asmjs")))
|
||||
#ifdef FUZZING
|
||||
.setFuzzing(load(PREF_NAMES("fuzzing.enabled")))
|
||||
#endif
|
||||
.setWasm(load(PREF_NAMES("wasm")))
|
||||
.setWasmForTrustedPrinciples(load(PREF_NAMES("wasm_trustedprincipals")))
|
||||
#ifdef ENABLE_WASM_CRANELIFT
|
||||
.setWasmCranelift(load(PREF_NAMES("wasm_optimizingjit")))
|
||||
.setWasmIon(false)
|
||||
#else
|
||||
.setWasmCranelift(false)
|
||||
.setWasmIon(load(PREF_NAMES("wasm_optimizingjit")))
|
||||
#endif
|
||||
.setWasmBaseline(load(PREF_NAMES("wasm_baselinejit")))
|
||||
#define WASM_FEATURE(NAME, LOWER_NAME, COMPILE_PRED, COMPILER_PRED, FLAG_PRED, \
|
||||
SHELL, PREF) \
|
||||
.setWasm##NAME(load(PREF_NAMES("wasm_" PREF)))
|
||||
JS_FOR_WASM_FEATURES(WASM_FEATURE, WASM_FEATURE, WASM_FEATURE)
|
||||
#undef WASM_FEATURE
|
||||
#ifdef ENABLE_WASM_SIMD_WORMHOLE
|
||||
# ifdef EARLY_BETA_OR_EARLIER
|
||||
.setWasmSimdWormhole(load(PREF_NAMES("wasm_simd_wormhole")))
|
||||
# else
|
||||
.setWasmSimdWormhole(false)
|
||||
# endif
|
||||
#endif
|
||||
.setWasmVerbose(load(PREF_NAMES("wasm_verbose")))
|
||||
.setThrowOnAsmJSValidationFailure(
|
||||
load(PREF_NAMES("throw_on_asmjs_validation_failure")))
|
||||
.setSourcePragmas(load(PREF_NAMES("source_pragmas")))
|
||||
.setAsyncStack(load(PREF_NAMES("asyncstack")))
|
||||
.setAsyncStackCaptureDebuggeeOnly(
|
||||
load(PREF_NAMES("asyncstack_capture_debuggee_only")))
|
||||
.setPrivateClassFields(load(PREF_NAMES("experimental.private_fields")))
|
||||
.setPrivateClassMethods(load(PREF_NAMES("experimental.private_methods")))
|
||||
.setClassStaticBlocks(
|
||||
load(PREF_NAMES("experimental.class_static_blocks")))
|
||||
#ifdef ENABLE_CHANGE_ARRAY_BY_COPY
|
||||
.setChangeArrayByCopy(
|
||||
load(PREF_NAMES("experimental.enable_change_array_by_copy")))
|
||||
#endif
|
||||
#ifdef NIGHTLY_BUILD
|
||||
.setImportAssertions(load(PREF_NAMES("experimental.import_assertions")))
|
||||
#endif
|
||||
.setErgnomicBrandChecks(
|
||||
load(PREF_NAMES("experimental.ergonomic_brand_checks")));
|
||||
}
|
||||
|
||||
#undef PREF_NAMES
|
||||
#undef WORKERS_OPTIONS_PREFIX
|
||||
#undef JS_OPTIONS_PREFIX
|
||||
|
||||
} // namespace xpc
|
||||
|
||||
#endif // XPCPrefableContextOptions_h__
|
|
@ -8,6 +8,7 @@ EXPORTS += [
|
|||
"BackstagePass.h",
|
||||
"XPCJSMemoryReporter.h",
|
||||
"xpcObjectHelper.h",
|
||||
"XPCPrefableContextOptions.h",
|
||||
"xpcpublic.h",
|
||||
"XPCSelfHostedShmem.h",
|
||||
]
|
||||
|
|
|
@ -55,7 +55,6 @@ struct nsXPTInterfaceInfo;
|
|||
|
||||
namespace JS {
|
||||
class Compartment;
|
||||
class ContextOptions;
|
||||
class Realm;
|
||||
class RealmOptions;
|
||||
class Value;
|
||||
|
@ -582,7 +581,6 @@ class MOZ_RAII AutoScriptActivity {
|
|||
bool ShouldDiscardSystemSource();
|
||||
|
||||
void SetPrefableRealmOptions(JS::RealmOptions& options);
|
||||
void SetPrefableContextOptions(JS::ContextOptions& options);
|
||||
|
||||
class ErrorBase {
|
||||
public:
|
||||
|
|
Загрузка…
Ссылка в новой задаче