mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-07 00:08:39 +09:00
Increase thresholds for small function compilation and warm-up to optimize performance for jQuery-style code.
This commit is contained in:
parent
57eac6fab8
commit
2dd5267098
3 changed files with 38 additions and 28 deletions
|
|
@ -1493,8 +1493,6 @@ imgLoader::PutIntoCache(const ImageCacheKey& aKey, imgCacheEntry* entry)
|
|||
MOZ_LOG(gImgLog, LogLevel::Debug,
|
||||
("[this=%p] imgLoader::PutIntoCache -- Element already in the cache",
|
||||
nullptr));
|
||||
RefPtr<imgRequest> tmpRequest = tmpCacheEntry->GetRequest();
|
||||
|
||||
// If it already exists, and we're putting the same key into the cache, we
|
||||
// should remove the old version.
|
||||
MOZ_LOG(gImgLog, LogLevel::Debug,
|
||||
|
|
@ -1778,30 +1776,29 @@ imgLoader::ValidateEntry(imgCacheEntry* aEntry,
|
|||
{
|
||||
LOG_SCOPE(gImgLog, "imgLoader::ValidateEntry");
|
||||
|
||||
bool hasExpired;
|
||||
uint32_t expirationTime = aEntry->GetExpiryTime();
|
||||
if (expirationTime <= SecondsFromPRTime(PR_Now())) {
|
||||
hasExpired = true;
|
||||
} else {
|
||||
hasExpired = false;
|
||||
}
|
||||
uint32_t now = SecondsFromPRTime(PR_Now());
|
||||
bool hasExpired = expirationTime <= now;
|
||||
|
||||
nsresult rv;
|
||||
|
||||
// Special treatment for file URLs - aEntry has expired if file has changed
|
||||
nsCOMPtr<nsIFileURL> fileUrl(do_QueryInterface(aURI));
|
||||
if (fileUrl) {
|
||||
uint32_t lastModTime = aEntry->GetLoadTime();
|
||||
bool isFileURI = false;
|
||||
if (NS_SUCCEEDED(aURI->SchemeIs("file", &isFileURI)) && isFileURI) {
|
||||
nsCOMPtr<nsIFileURL> fileUrl(do_QueryInterface(aURI));
|
||||
if (fileUrl) {
|
||||
uint32_t lastModTime = aEntry->GetLoadTime();
|
||||
|
||||
nsCOMPtr<nsIFile> theFile;
|
||||
rv = fileUrl->GetFile(getter_AddRefs(theFile));
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
PRTime fileLastMod;
|
||||
rv = theFile->GetLastModifiedTime(&fileLastMod);
|
||||
nsCOMPtr<nsIFile> theFile;
|
||||
rv = fileUrl->GetFile(getter_AddRefs(theFile));
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
// nsIFile uses millisec, NSPR usec
|
||||
fileLastMod *= 1000;
|
||||
hasExpired = SecondsFromPRTime((PRTime)fileLastMod) > lastModTime;
|
||||
PRTime fileLastMod;
|
||||
rv = theFile->GetLastModifiedTime(&fileLastMod);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
// nsIFile uses millisec, NSPR usec
|
||||
fileLastMod *= 1000;
|
||||
hasExpired = SecondsFromPRTime((PRTime)fileLastMod) > lastModTime;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1821,9 +1818,8 @@ imgLoader::ValidateEntry(imgCacheEntry* aEntry,
|
|||
// just return true in that case. Doing so would mean that shift-reload
|
||||
// doesn't reload data URI documents/images though (which is handy for
|
||||
// debugging during gecko development) so we make an exception in that case.
|
||||
nsAutoCString scheme;
|
||||
aURI->GetScheme(scheme);
|
||||
if (scheme.EqualsLiteral("data") &&
|
||||
bool isDataURI = false;
|
||||
if (NS_SUCCEEDED(aURI->SchemeIs("data", &isDataURI)) && isDataURI &&
|
||||
!(aLoadFlags & nsIRequest::LOAD_BYPASS_CACHE)) {
|
||||
return true;
|
||||
}
|
||||
|
|
@ -1870,7 +1866,7 @@ imgLoader::ValidateEntry(imgCacheEntry* aEntry,
|
|||
if ((appCacheContainer = do_GetInterface(request->GetRequest()))) {
|
||||
appCacheContainer->GetApplicationCache(getter_AddRefs(requestAppCache));
|
||||
}
|
||||
if ((appCacheContainer = do_QueryInterface(aLoadGroup))) {
|
||||
if (aLoadGroup && (appCacheContainer = do_QueryInterface(aLoadGroup))) {
|
||||
appCacheContainer->GetApplicationCache(getter_AddRefs(groupAppCache));
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -47,8 +47,11 @@ OptimizationInfo::initNormalOptimizationInfo()
|
|||
scalarReplacement_ = true;
|
||||
smallFunctionMaxInlineDepth_ = 10;
|
||||
compilerWarmUpThreshold_ = CompilerWarmupThreshold;
|
||||
compilerSmallFunctionWarmUpThreshold_ = CompilerSmallFunctionWarmupThreshold;
|
||||
inliningWarmUpThresholdFactor_ = 0.10;
|
||||
// Start compiling tiny helper functions sooner. This is particularly
|
||||
// useful for jQuery-style code with many frequently-called short helpers.
|
||||
compilerSmallFunctionWarmUpThreshold_ = 32;
|
||||
// Inline callees a bit earlier once a script becomes warm.
|
||||
inliningWarmUpThresholdFactor_ = 0.08;
|
||||
inliningRecompileThresholdFactor_ = 4;
|
||||
}
|
||||
|
||||
|
|
@ -112,6 +115,16 @@ OptimizationInfo::compilerWarmUpThreshold(JSScript* script, jsbytecode* pc) cons
|
|||
warmUpThreshold *= ratio;
|
||||
}
|
||||
|
||||
// jQuery spends a lot of time in medium-small wrappers that are too large
|
||||
// to be classified as "small" but still hot enough to benefit from Ion.
|
||||
// Nudge these scripts toward earlier compilation without affecting large
|
||||
// scripts that are expensive to optimize.
|
||||
if (script->length() <= 400 && numLocalsAndArgs <= 48) {
|
||||
warmUpThreshold = (warmUpThreshold * 3) / 4;
|
||||
if (warmUpThreshold < 30)
|
||||
warmUpThreshold = 30;
|
||||
}
|
||||
|
||||
if (!pc || JitOptions.eagerCompilation)
|
||||
return warmUpThreshold;
|
||||
|
||||
|
|
|
|||
|
|
@ -167,8 +167,9 @@ DefaultJitOptions::DefaultJitOptions()
|
|||
// invalidating the script.
|
||||
SET_DEFAULT(osrPcMismatchesBeforeRecompile, 6000);
|
||||
|
||||
// The bytecode length limit for small function.
|
||||
SET_DEFAULT(smallFunctionMaxBytecodeLength_, 200);
|
||||
// The bytecode length limit for small function. jQuery has many helpers
|
||||
// just above 200 bytecodes, so raise this to compile them sooner.
|
||||
SET_DEFAULT(smallFunctionMaxBytecodeLength_, 320);
|
||||
|
||||
// An artificial testing limit for the maximum supported offset of
|
||||
// pc-relative jump and call instructions.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue