Bug 1364118 - List JS bytecode cache preferences in all.js. r=mrbkap
This commit is contained in:
@@ -116,14 +116,14 @@
|
||||
// trace these and resolve a promise with the path taken by the
|
||||
// script loader.
|
||||
//
|
||||
// Setting dom.script_loader.force_bytecode_cache causes the
|
||||
// Setting dom.script_loader.bytecode_cache.eager causes the
|
||||
// nsScriptLoadRequest to force all the conditions necessary to make a
|
||||
// script be saved as bytecode in the alternate data storage provided
|
||||
// by the channel (necko cache).
|
||||
await SpecialPowers.pushPrefEnv({set: [
|
||||
['dom.script_loader.bytecode_cache.enabled', true],
|
||||
['dom.expose_test_interfaces', true],
|
||||
['dom.script_loader.force_bytecode_cache', true]
|
||||
['dom.script_loader.bytecode_cache.eager', true]
|
||||
]});
|
||||
|
||||
// Load the test page, and verify that the code path taken by the
|
||||
@@ -174,7 +174,7 @@
|
||||
await SpecialPowers.pushPrefEnv({set: [
|
||||
['dom.script_loader.bytecode_cache.enabled', true],
|
||||
['dom.expose_test_interfaces', true],
|
||||
['dom.script_loader.force_bytecode_cache', true]
|
||||
['dom.script_loader.bytecode_cache.eager', true]
|
||||
]});
|
||||
|
||||
// The test page add a new script which generate a "ping" event, which
|
||||
|
||||
@@ -818,6 +818,21 @@ ScriptLoader::IsBytecodeCacheEnabled()
|
||||
return sExposeTestInterfaceEnabled;
|
||||
}
|
||||
|
||||
/* static */ bool
|
||||
ScriptLoader::IsEagerBytecodeCache()
|
||||
{
|
||||
// When testing, we want to force use of the bytecode cache.
|
||||
static bool sEagerBytecodeCache = false;
|
||||
static bool sForceBytecodeCachePrefCached = false;
|
||||
if (!sForceBytecodeCachePrefCached) {
|
||||
sForceBytecodeCachePrefCached = true;
|
||||
Preferences::AddBoolVarCache(&sEagerBytecodeCache,
|
||||
"dom.script_loader.bytecode_cache.eager",
|
||||
false);
|
||||
}
|
||||
return sEagerBytecodeCache;
|
||||
}
|
||||
|
||||
nsresult
|
||||
ScriptLoader::RestartLoad(ScriptLoadRequest* aRequest)
|
||||
{
|
||||
@@ -1864,19 +1879,10 @@ ScriptLoader::FillCompileOptionsForRequest(const AutoJSAPI&jsapi,
|
||||
aOptions->setElement(&elementVal.toObject());
|
||||
}
|
||||
|
||||
// When testing, we want to force use of the bytecode cache.
|
||||
static bool sForceBytecodeCacheEnabled = false;
|
||||
static bool sForceBytecodeCachePrefCached = false;
|
||||
if (!sForceBytecodeCachePrefCached) {
|
||||
sForceBytecodeCachePrefCached = true;
|
||||
Preferences::AddBoolVarCache(&sForceBytecodeCacheEnabled,
|
||||
"dom.script_loader.force_bytecode_cache",
|
||||
false);
|
||||
}
|
||||
// At the moment, the bytecode cache is only triggered if a script is large
|
||||
// enough to be parsed out of the main thread. Thus, for testing purposes, we
|
||||
// force parsing any script out of the main thread.
|
||||
if (sForceBytecodeCacheEnabled) {
|
||||
if (IsEagerBytecodeCache()) {
|
||||
aOptions->forceAsync = true;
|
||||
}
|
||||
|
||||
|
||||
@@ -471,6 +471,9 @@ private:
|
||||
static bool
|
||||
IsBytecodeCacheEnabled();
|
||||
|
||||
static bool
|
||||
IsEagerBytecodeCache();
|
||||
|
||||
nsresult CreateModuleScript(ModuleLoadRequest* aRequest);
|
||||
nsresult ProcessFetchedModuleSource(ModuleLoadRequest* aRequest);
|
||||
void ProcessLoadedModuleTree(ModuleLoadRequest* aRequest);
|
||||
|
||||
@@ -209,6 +209,16 @@ pref("dom.keyboardevent.dispatch_during_composition", false);
|
||||
// significantly increase the number of compartments in the system.
|
||||
pref("dom.compartment_per_addon", true);
|
||||
|
||||
// Whether to enable the JavaScript start-up cache. This causes one of the first
|
||||
// execution to record the bytecode of the JavaScript function used, and save it
|
||||
// in the existing cache entry. On the following loads of the same script, the
|
||||
// bytecode would be loaded from the cache instead of being generated once more.
|
||||
pref("dom.script_loader.bytecode_cache.enabled", false); // Not tuned yet.
|
||||
|
||||
// Ignore the heuristics of the bytecode cache, and always record on the first
|
||||
// visit. (used for testing purposes).
|
||||
pref("dom.script_loader.bytecode_cache.eager", false);
|
||||
|
||||
// Fastback caching - if this pref is negative, then we calculate the number
|
||||
// of content viewers to cache based on the amount of available memory.
|
||||
pref("browser.sessionhistory.max_total_viewers", -1);
|
||||
|
||||
Reference in New Issue
Block a user