Closed
Bug 1843956
Opened 2 years ago
Closed 2 years ago
Do not try to decompress ScriptSource in concurrent delazification
Categories
(Core :: JavaScript Engine, task, P3)
Core
JavaScript Engine
Tracking
()
RESOLVED
FIXED
117 Branch
| Tracking | Status | |
|---|---|---|
| firefox117 | --- | fixed |
People
(Reporter: arai, Assigned: arai)
References
Details
Attachments
(1 file)
DelazifyCanonicalScriptedFunctionImpl can try decompressing the ScriptSource if it's already compressed, and the decompression needs JSContext.
template <typename Unit>
static bool DelazifyCanonicalScriptedFunctionImpl(JSContext* cx,
FrontendContext* fc,
ScopeBindingCache* scopeCache,
JS::Handle<JSFunction*> fun,
JS::Handle<BaseScript*> lazy,
ScriptSource* ss) {
...
ScriptSource::PinnedUnits<Unit> units(cx, ss, holder, sourceStart,
sourceLength);
template <typename Unit>
ScriptSource::PinnedUnits<Unit>::PinnedUnits(
JSContext* cx, ScriptSource* source,
UncompressedSourceCache::AutoHoldEntry& holder, size_t begin, size_t len)
: PinnedUnitsBase(source) {
...
units_ = source->units<Unit>(cx, holder, begin, len);
template <typename Unit>
const Unit* ScriptSource::units(JSContext* cx,
UncompressedSourceCache::AutoHoldEntry& holder,
size_t begin, size_t len) {
MOZ_ASSERT(begin <= length());
...
if (isUncompressed<Unit>()) {
const Unit* units = uncompressedData<Unit>()->units();
if (!units) {
return nullptr;
}
return units + begin;
}
...
if (firstChunk == lastChunk) {
const Unit* units = chunkUnits<Unit>(cx, holder, firstChunk);
...
}
...
{
...
const Unit* units = chunkUnits<Unit>(cx, firstHolder, firstChunk);
and the compression is scheduled when the top-level script is instantiated.
bool frontend::InstantiateStencils(JSContext* cx, CompilationInput& input,
const CompilationStencil& stencil,
CompilationGCOutput& gcOutput) {
...
if (!stencil.source->tryCompressOffThread(cx)) {
bool ScriptSource::tryCompressOffThread(JSContext* cx) {
...
return EnqueueOffThreadCompression(cx, std::move(task));
bool js::EnqueueOffThreadCompression(JSContext* cx,
UniquePtr<SourceCompressionTask> task) {
...
auto& pending = HelperThreadState().compressionPendingList(lock);
if (!pending.append(std::move(task))) {
and the pending compression is started on GC:
void js::StartHandlingCompressionsOnGC(JSRuntime* runtime) {
...
HelperThreadState().startHandlingCompressionTasks(
So, the concurrent delazification isn't much necessary after this point.
making the JSContext parameter optional in the ScriptSource helps moving DelazifyTask to FrontendContext.
| Assignee | ||
Comment 1•2 years ago
|
||
Depends on D183830
Pushed by arai_a@mac.com:
https://hg.mozilla.org/integration/autoland/rev/59609798ba99
Do not decompress source in concurrent delazification. r=nbp
Comment 3•2 years ago
|
||
| bugherder | ||
Status: ASSIGNED → RESOLVED
Closed: 2 years ago
status-firefox117:
--- → fixed
Resolution: --- → FIXED
Target Milestone: --- → 117 Branch
You need to log in
before you can comment on or make changes to this bug.
Description
•