Bug 1753709 - Add test case to verify delazification strategy is used. r=arai
Differential Revision: https://phabricator.services.mozilla.com/D138541
This commit is contained in:
10
dom/base/test/file_delazification_strategy.html
Normal file
10
dom/base/test/file_delazification_strategy.html
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<title>Add a tag script to check delazification strategy</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<script id="watchme" src="file_delazification_strategy.js" async></script>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
91
dom/base/test/file_delazification_strategy.js
Normal file
91
dom/base/test/file_delazification_strategy.js
Normal file
@@ -0,0 +1,91 @@
|
|||||||
|
function baz() {}
|
||||||
|
function bar() {}
|
||||||
|
function foo() {
|
||||||
|
bar();
|
||||||
|
}
|
||||||
|
foo();
|
||||||
|
|
||||||
|
// For testing, we require the script to be parsed off-htread. To schedule a
|
||||||
|
// script off-thread, we require the script to be at least 5 KB. Thus, here is
|
||||||
|
// one comment which is used to trick this heuristics:
|
||||||
|
//
|
||||||
|
// MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMWWX0Oxoc;,.... ....,;coxO0XWWMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM
|
||||||
|
// MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMWX0kdlc;'.. ..';:ldk0XWMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM
|
||||||
|
// MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMWNKkoc,.. ..,cok0NWMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM
|
||||||
|
// MMMMMMMMMMMMMMMMMMMMMMM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;0WMMMMMMMMMM
|
||||||
|
// MMMMMMMMMWk' ..,:loxxkOOkxdo:,. 'kWMMMMMMMMM
|
||||||
|
// MMMMMMMMWx. .':lxO000000000000000ko;. .xWMMMMMMMM
|
||||||
|
// MMMMMMMNd. .'cdk00000000000000000000000x;. ..',;ccloodddddddollc:;,'.. .dNMMMMMMM
|
||||||
|
// MMMMMMNd. ,dO000000000000000000000000000Oo' ..;coxk00000000000000000000000Okdlc;'. .dNMMMMMM
|
||||||
|
// MMMMMNd. .cO000000000000000000000000000000k; .;lxO0000000000000000000000000000000000Okoc,. .dWMMMMM
|
||||||
|
// MMMMWx. .'cO0000000000000000000000000000Oc. .;ok0000K00000000000000000000000000000000000000ko, .kWMMMM
|
||||||
|
// MMMMO' ,kK0000000000000000000000000000Oc. .:x000000000000000OkdoollcccllodxkO0000K00000000000k' 'OMMMM
|
||||||
|
// MMMK; .'lO000000000000000000000000000000Ol'... 'd000000000000Odl;'.. ..',:ldkO00000000KO, ;KMMM
|
||||||
|
// MMNo ,dkO0K00000000000000000000000000000000OOkxdoc;,,ck0000000000Oo;. .'ck000000KO; oNMM
|
||||||
|
// MMk. .o0000000000000000000000000000000000000000000000000000000000d, .o000000K0: .OMM
|
||||||
|
// MX: .o00000000000000000000000000000000000000000000000000000000Oc. c000000K0l. :XM
|
||||||
|
// Wx. .c00000000000000000000000000000000000000000000000000000000x, :OK000000o. .xW
|
||||||
|
// X: .:dxO00000000000000000000000000000000000000000000000000000Oo' ,k0000000d. :X
|
||||||
|
// O. .:xOO0000000000000000000000000000000000000000000000000000Ol. .x000000Kd. .O
|
||||||
|
// o ..'''''''',,:lx000000000000000000000000000000000000000000x, .lOOOOkkko. o
|
||||||
|
// ; .:x00000000000000000000000000000000000000000O:. ......... ;
|
||||||
|
// . 'd00000000000000000000000000000000000000000Ol. .
|
||||||
|
// . ,k000000000000000000000000000000000000000000o. .
|
||||||
|
// .o0000000000000000000000000000000000000000000d.
|
||||||
|
// c00000000000000000000000000000000000000000000o.
|
||||||
|
// ;OK0000000000000000000000000000000000000000000o.
|
||||||
|
// ,kK00000000000000000000000000000000000000000000xoc:,'..
|
||||||
|
// .x00000000000000000000000000000000000000000000000000Okxolc;,'..
|
||||||
|
// .d000000000000000K000000000000000000000000000000000000000000OOxdl:,..
|
||||||
|
// . .o00000000000000OO0000000000000000000000000000000000000000000000000Oxo:'. .
|
||||||
|
// . .l0000000000000Oc:k0000000000000000000000000000000000000000000000000000Oxl,. .
|
||||||
|
// ; c000000000000Kk, ,x000000000000000000000000000000xodkO00000000000000000000xc. ;
|
||||||
|
// o ..''.. :000000000000Kx' ,k0000000000000000000000000000Oc. ..';codkO000000000000000k:. o
|
||||||
|
// O. .,lxO00Okxl:,. :O000000000000d. ;k0000000000000000000000000000l. ..,cok0000000000000d' .O
|
||||||
|
// X: ,d000000000000kdc;. :O000000000000l. .c0000000000000000000000000000o. .;oO00000000000k; :X
|
||||||
|
// Wx. 'x00000000000000000Oxl;..:O00000000000O: .x000000000000000000000000000d. 'oO00000K0000k, .kW
|
||||||
|
// MX: c0000000000000000000000Oxk00000000000Kk, cO00000000000000000000000000d. ;k0000000000d. :XM
|
||||||
|
// MMO. :O000000000000000000000000000000000000x. cO00000000000000000000000000d. ,k000000000O: .OMM
|
||||||
|
// MMNo .d000000000000000000000000000000000000l. .d000000000000000000000000000o. cO000000000o. .oNMM
|
||||||
|
// MMMK; 'd00000000000000000000000000000000000c ,k000000000000000000000000000l. 'x000000000d. ;KMMM
|
||||||
|
// MMMMO' .lO000000000000000000000000000000000kl;. .o00000000000000000000000000K0c .d000000000d. 'OMMMM
|
||||||
|
// MMMMWx. ;x00000000000000000000000000000000000ko:lO000000000000000000000000000O; .x000000000d. .xWMMMM
|
||||||
|
// MMMMMWd. .ck00000000000000000000000000000000000000000000000000000000000000000k, ;kK00000000l. .dWMMMMM
|
||||||
|
// MMMMMMNd. .:x000000000000000000000000000000000000000000000000000000000000000d. .o000000000O; .dNMMMMMM
|
||||||
|
// MMMMMMMNd. .;dO000000000000000000000000000000000000000000000000000000000000l. .o0000000000d. .dNMMMMMMM
|
||||||
|
// MMMMMMMMWx. .,,'.. 'cx00000000000000000000000000000000000000000000000000000000KO: .;d0000000000x, .xWMMMMMMMM
|
||||||
|
// MMMMMMMMMWk' 'd00Oxdl;'. .,lx000000000000000000000000000000000000000000000000000000k' .:dO0000000000x, 'kWMMMMMMMMM
|
||||||
|
// MMMMMMMMMMW0; .:x000000kd:'. .,lk000000000000000000000000000000000000000000000000000d. ..,cdk0K000000000Oo. :0WMMMMMMMMMM
|
||||||
|
// MMMMMMMMMMMMXo. .,ok000000Odc. ,x000000000000000000000000000000000000000000000000000d,...'',;:cldxO000000000000K0d;. .oXMMMMMMMMMMMM
|
||||||
|
// MMMMMMMMMMMMMWk, .:x0000000Oo;.. .,oO000000000000000000000000000000000000000000000000000000OOOO00000000000000000000Od;. ,kWMMMMMMMMMMMMM
|
||||||
|
// MMMMMMMMMMMMMMMXl. .;dO0000000Oxdoooxk0000000000OxxO0000000000000000000000000000000000000000000000000000000000000000Oxc' .lXMMMMMMMMMMMMMMM
|
||||||
|
// MMMMMMMMMMMMMMMMWO; 'lk00000000000000000000Oxc' ..:oxO0K000000000000000000000000000000000000000000000000000000Oko:'. ;OWMMMMMMMMMMMMMMMM
|
||||||
|
// MMMMMMMMMMMMMMMMMMNx, .;ok00000000000000kdc'. ..;cdxO00000000000000000000000000000000000000000000Okxdoc;'. ,xNMMMMMMMMMMMMMMMMMM
|
||||||
|
// MMMMMMMMMMMMMMMMMMMMXd' .,:ldxkkkkxdl:,. ..,:cldxkkkO000000000000Okkxdlc:;;;:::::;;;,,'... 'dXMMMMMMMMMMMMMMMMMMMM
|
||||||
|
// MMMMMMMMMMMMMMMMMMMMMMXd' ...... ....'',,,,,,,,'.... 'dXWMMMMMMMMMMMMMMMMMMMMM
|
||||||
|
// MMMMMMMMMMMMMMMMMMMMMMMMXx,. ,xXMMMMMMMMMMMMMMMMMMMMMMMM
|
||||||
|
// MMMM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||||
@@ -755,6 +755,11 @@ support-files =
|
|||||||
file_js_cache_save_after_load.js
|
file_js_cache_save_after_load.js
|
||||||
file_js_cache_syntax_error.html
|
file_js_cache_syntax_error.html
|
||||||
file_js_cache_syntax_error.js
|
file_js_cache_syntax_error.js
|
||||||
|
[test_delazification_strategy.html]
|
||||||
|
skip-if = verify
|
||||||
|
support-files =
|
||||||
|
file_delazification_strategy.html
|
||||||
|
file_delazification_strategy.js
|
||||||
[test_setInterval_from_start.html]
|
[test_setInterval_from_start.html]
|
||||||
[test_setInterval_uncatchable_exception.html]
|
[test_setInterval_uncatchable_exception.html]
|
||||||
skip-if = debug == false
|
skip-if = debug == false
|
||||||
|
|||||||
151
dom/base/test/test_delazification_strategy.html
Normal file
151
dom/base/test/test_delazification_strategy.html
Normal file
@@ -0,0 +1,151 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<!-- https://bugzilla.mozilla.org/show_bug.cgi?id=1753709 -->
|
||||||
|
<!-- Script delazification strategy is not supposed to have any observable
|
||||||
|
side-effect. To make it observable, the ScriptLoader is instrumented to
|
||||||
|
trigger events on the script tag. These events are used to validate that
|
||||||
|
the strategy is used as execpected. This does not garantee that all
|
||||||
|
functions are delazified properly, but this should be checked in the JS
|
||||||
|
engine test suite.
|
||||||
|
-->
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<title>Test for triggering eager delazification.</title>
|
||||||
|
<script src="/resources/testharness.js"></script>
|
||||||
|
<script src="/resources/testharnessreport.js"></script>
|
||||||
|
<script type="application/javascript">
|
||||||
|
function WaitForScriptTagEvent() {
|
||||||
|
var url = "file_delazification_strategy.html";
|
||||||
|
var iframe = document.createElement("iframe");
|
||||||
|
document.body.appendChild(iframe);
|
||||||
|
|
||||||
|
var stateMachineResolve, stateMachineReject;
|
||||||
|
var statePromise = new Promise((resolve, reject) => {
|
||||||
|
stateMachineResolve = resolve;
|
||||||
|
stateMachineReject = reject;
|
||||||
|
});
|
||||||
|
|
||||||
|
// Wait for the event to be emitted.
|
||||||
|
function log_event(evt) {
|
||||||
|
// If we have multiple script tags in the loaded source, make sure
|
||||||
|
// we only watch a single one.
|
||||||
|
if (evt.target.id != "watchme")
|
||||||
|
return;
|
||||||
|
|
||||||
|
dump("## ScriptLoader event: " + evt.type + "\n");
|
||||||
|
switch (evt.type) {
|
||||||
|
case "delazification_on_demand_only":
|
||||||
|
case "delazification_concurrent_depth_first":
|
||||||
|
case "delazification_parse_everything_eagerly":
|
||||||
|
stateMachineResolve(evt.type.split('_').slice(1).join('_'));
|
||||||
|
break;
|
||||||
|
case "scriptloader_main_thread_compile":
|
||||||
|
stateMachineResolve(evt.type);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
var iwin = iframe.contentWindow;
|
||||||
|
iwin.addEventListener("delazification_on_demand_only", log_event);
|
||||||
|
iwin.addEventListener("delazification_concurrent_depth_first", log_event);
|
||||||
|
iwin.addEventListener("delazification_parse_everything_eagerly", log_event);
|
||||||
|
iwin.addEventListener("scriptloader_main_thread_compile", log_event);
|
||||||
|
iframe.src = url;
|
||||||
|
|
||||||
|
statePromise.then(() => {
|
||||||
|
document.body.removeChild(iframe);
|
||||||
|
});
|
||||||
|
return statePromise;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Setting dom.expose_test_interfaces pref causes the
|
||||||
|
// nsScriptLoadRequest to fire event on script tags, with information
|
||||||
|
// about its internal state. The ScriptLoader source send events to
|
||||||
|
// trace these and resolve a promise with the path taken by the
|
||||||
|
// script loader.
|
||||||
|
//
|
||||||
|
// Setting dom.script_loader.bytecode_cache.enabled to false in order
|
||||||
|
// to prevent the bytecode cache to perturb this test case.
|
||||||
|
//
|
||||||
|
// Setting dom.script_loader.external_scripts.speculate_* are used to
|
||||||
|
// force off-main-thread compilation, while hoping that we have enough
|
||||||
|
// processors to run the test case
|
||||||
|
//
|
||||||
|
// Setting dom.delazification.* are used to select the delazification
|
||||||
|
// strategy and to check that it is well selected.
|
||||||
|
promise_test(async function() {
|
||||||
|
await SpecialPowers.pushPrefEnv({set: [
|
||||||
|
['dom.expose_test_interfaces', true],
|
||||||
|
['dom.script_loader.bytecode_cache.enabled', false],
|
||||||
|
['dom.script_loader.external_scripts.speculate_non_parser_inserted.enable', true],
|
||||||
|
['dom.script_loader.external_scripts.speculate_async.enabled', true],
|
||||||
|
['dom.script_loader.external_scripts.speculate_link_preload.enabled', true],
|
||||||
|
// Parse everything eagerly
|
||||||
|
['dom.script_loader.delazification.strategy', 255],
|
||||||
|
['dom.script_loader.delazification.max_size', 0],
|
||||||
|
['dom.script_loader.delazification.min_mem', 0],
|
||||||
|
]});
|
||||||
|
|
||||||
|
assert_equals(await WaitForScriptTagEvent(), "on_demand_only",
|
||||||
|
"[1] AttemptAsyncScriptCompile: On demand only");
|
||||||
|
}, "Check that max_size can disable delazification strategy");
|
||||||
|
|
||||||
|
promise_test(async function() {
|
||||||
|
await SpecialPowers.pushPrefEnv({set: [
|
||||||
|
['dom.expose_test_interfaces', true],
|
||||||
|
['dom.script_loader.bytecode_cache.enabled', false],
|
||||||
|
// Enable OffMainThread compilation for everything, and cross-fingers
|
||||||
|
// about the number of CPU.
|
||||||
|
['dom.script_loader.external_scripts.speculate_non_parser_inserted.enable', true],
|
||||||
|
['dom.script_loader.external_scripts.speculate_async.enabled', true],
|
||||||
|
['dom.script_loader.external_scripts.speculate_link_preload.enabled', true],
|
||||||
|
// Parse everything eagerly
|
||||||
|
['dom.script_loader.delazification.strategy', 255],
|
||||||
|
['dom.script_loader.delazification.max_size', 10485760],
|
||||||
|
// 4 TB should of RAM be enough.
|
||||||
|
['dom.script_loader.delazification.min_mem', 4096],
|
||||||
|
]});
|
||||||
|
|
||||||
|
assert_equals(await WaitForScriptTagEvent(), "on_demand_only",
|
||||||
|
"[2] AttemptAsyncScriptCompile: On demand only");
|
||||||
|
}, "Check that min_mem can disable delazification strategy");
|
||||||
|
|
||||||
|
promise_test(async function() {
|
||||||
|
await SpecialPowers.pushPrefEnv({set: [
|
||||||
|
['dom.expose_test_interfaces', true],
|
||||||
|
['dom.script_loader.bytecode_cache.enabled', false],
|
||||||
|
// Enable OffMainThread compilation for everything, and cross-fingers
|
||||||
|
// about the number of CPU.
|
||||||
|
['dom.script_loader.external_scripts.speculate_non_parser_inserted.enable', true],
|
||||||
|
['dom.script_loader.external_scripts.speculate_async.enabled', true],
|
||||||
|
['dom.script_loader.external_scripts.speculate_link_preload.enabled', true],
|
||||||
|
['dom.script_loader.delazification.max_size', 10485760],
|
||||||
|
['dom.script_loader.delazification.min_mem', 0],
|
||||||
|
]});
|
||||||
|
|
||||||
|
await SpecialPowers.pushPrefEnv({set: [
|
||||||
|
['dom.script_loader.delazification.strategy', 0],
|
||||||
|
]});
|
||||||
|
assert_equals(await WaitForScriptTagEvent(), "on_demand_only",
|
||||||
|
"[3] AttemptAsyncScriptCompile: On demand only");
|
||||||
|
|
||||||
|
await SpecialPowers.pushPrefEnv({set: [
|
||||||
|
['dom.script_loader.delazification.strategy', 1],
|
||||||
|
]});
|
||||||
|
assert_equals(await WaitForScriptTagEvent(), "concurrent_depth_first",
|
||||||
|
"[3] AttemptAsyncScriptCompile: Concurrent Depth First");
|
||||||
|
|
||||||
|
await SpecialPowers.pushPrefEnv({set: [
|
||||||
|
['dom.script_loader.delazification.strategy', 255],
|
||||||
|
]});
|
||||||
|
assert_equals(await WaitForScriptTagEvent(), "parse_everything_eagerly",
|
||||||
|
"[3] AttemptAsyncScriptCompile: Parse Everything Eagerly");
|
||||||
|
}, "Check enabling delazification strategy works");
|
||||||
|
|
||||||
|
done();
|
||||||
|
</script>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1753709">Mozilla Bug 1753709</a>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
@@ -1494,6 +1494,8 @@ nsresult ScriptLoader::AttemptAsyncScriptCompile(ScriptLoadRequest* aRequest,
|
|||||||
|
|
||||||
if (aRequest->IsTextSource()) {
|
if (aRequest->IsTextSource()) {
|
||||||
if (!JS::CanCompileOffThread(cx, options, aRequest->ScriptTextLength())) {
|
if (!JS::CanCompileOffThread(cx, options, aRequest->ScriptTextLength())) {
|
||||||
|
TRACE_FOR_TEST(aRequest->GetScriptElement(),
|
||||||
|
"scriptloader_main_thread_compile");
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@@ -1567,6 +1569,23 @@ nsresult ScriptLoader::AttemptAsyncScriptCompile(ScriptLoadRequest* aRequest,
|
|||||||
nsresult rv = aRequest->GetScriptSource(cx, &maybeSource);
|
nsresult rv = aRequest->GetScriptSource(cx, &maybeSource);
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
|
||||||
|
if (StaticPrefs::dom_expose_test_interfaces()) {
|
||||||
|
switch (options.eagerDelazificationStrategy()) {
|
||||||
|
case JS::DelazificationOption::OnDemandOnly:
|
||||||
|
TRACE_FOR_TEST(aRequest->GetScriptElement(),
|
||||||
|
"delazification_on_demand_only");
|
||||||
|
break;
|
||||||
|
case JS::DelazificationOption::ConcurrentDepthFirst:
|
||||||
|
TRACE_FOR_TEST(aRequest->GetScriptElement(),
|
||||||
|
"delazification_concurrent_depth_first");
|
||||||
|
break;
|
||||||
|
case JS::DelazificationOption::ParseEverythingEagerly:
|
||||||
|
TRACE_FOR_TEST(aRequest->GetScriptElement(),
|
||||||
|
"delazification_parse_everything_eagerly");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
aRequest->GetLoadContext()->mOffThreadToken =
|
aRequest->GetLoadContext()->mOffThreadToken =
|
||||||
maybeSource.constructed<SourceText<char16_t>>()
|
maybeSource.constructed<SourceText<char16_t>>()
|
||||||
? JS::CompileToStencilOffThread(
|
? JS::CompileToStencilOffThread(
|
||||||
|
|||||||
Reference in New Issue
Block a user