Avoid needing JSContext directly for parser to report errors
Categories
(Core :: JavaScript Engine, task, P3)
Tracking
()
Tracking | Status | |
---|---|---|
firefox105 | --- | fixed |
People
(Reporter: tcampbell, Assigned: bthrall)
References
Details
Attachments
(25 files)
48 bytes,
text/x-phabricator-request
|
Details | Review | |
48 bytes,
text/x-phabricator-request
|
Details | Review | |
48 bytes,
text/x-phabricator-request
|
Details | Review | |
48 bytes,
text/x-phabricator-request
|
Details | Review | |
48 bytes,
text/x-phabricator-request
|
Details | Review | |
48 bytes,
text/x-phabricator-request
|
Details | Review | |
48 bytes,
text/x-phabricator-request
|
Details | Review | |
48 bytes,
text/x-phabricator-request
|
Details | Review | |
48 bytes,
text/x-phabricator-request
|
Details | Review | |
48 bytes,
text/x-phabricator-request
|
Details | Review | |
48 bytes,
text/x-phabricator-request
|
Details | Review | |
48 bytes,
text/x-phabricator-request
|
Details | Review | |
48 bytes,
text/x-phabricator-request
|
Details | Review | |
48 bytes,
text/x-phabricator-request
|
Details | Review | |
48 bytes,
text/x-phabricator-request
|
Details | Review | |
48 bytes,
text/x-phabricator-request
|
Details | Review | |
48 bytes,
text/x-phabricator-request
|
Details | Review | |
48 bytes,
text/x-phabricator-request
|
Details | Review | |
48 bytes,
text/x-phabricator-request
|
Details | Review | |
48 bytes,
text/x-phabricator-request
|
Details | Review | |
48 bytes,
text/x-phabricator-request
|
Details | Review | |
48 bytes,
text/x-phabricator-request
|
Details | Review | |
48 bytes,
text/x-phabricator-request
|
Details | Review | |
48 bytes,
text/x-phabricator-request
|
Details | Review | |
48 bytes,
text/x-phabricator-request
|
Details | Review |
In order to support parsing-to-stencil without a JSContext, we need to clean up error reporting. Fortunately this is already somewhat abstracted because helper-threads cannot allocate ErrorObjects but they checks around this still use the JSContext.
There will still be some non-trivial refactoring in ErrorReporting.cpp for these errors though.
Assignee | ||
Updated•3 years ago
|
Assignee | ||
Comment 1•3 years ago
|
||
Assignee | ||
Comment 2•3 years ago
|
||
The type of the allocator will be varying separately from the type of the context.
Depends on D149996
Assignee | ||
Comment 3•3 years ago
|
||
Depends on D149997
Assignee | ||
Comment 4•3 years ago
|
||
This allows the Parser creator to provide the ErrorContext appropriate
for the situation (main thread or helper thread). For now, we just use
a flexible implementation.
I think the lifetime of the ErrorContext is the same as the Parser, so
putting the ErrorContext on the stack when the Parser is, too, should be
safe.
Depends on D150641
Assignee | ||
Comment 5•3 years ago
|
||
Depends on D150642
Assignee | ||
Comment 6•3 years ago
|
||
Depends on D150643
Assignee | ||
Comment 7•3 years ago
|
||
I could get rid of OffThreadErrorContext::cx_ by subclassing from
MallocProvider, but I don't think that would work since
OffThreadErrorContext has a vtable and MallocProvider does a
static_cast to get the client pointer.
OffThreadFrontendErrors moved to ErrorContext.h to avoid
recursive header inclusion.
Depends on D150644
Assignee | ||
Comment 8•3 years ago
|
||
This will allowe us to gather the errors after parsing without
needing a separate OffThreadFrontendErrors member.
Depends on D150645
Assignee | ||
Comment 9•3 years ago
|
||
Depends on D150646
Assignee | ||
Comment 10•3 years ago
|
||
Depends on D150647
Updated•3 years ago
|
Assignee | ||
Comment 11•3 years ago
|
||
Fixes jit-test. Probably needs coordination with ESMification efforts.
It looks like JS::CompileModule() would be called from the main thread, so
it should use GeneralErrorContext.
Depends on D150644
Assignee | ||
Comment 12•3 years ago
|
||
ErrorAllocator is an adapter that allows MallocProvider to delegate
to polymorphic Contexts. MallocProvider provides a well-known interface,
but doesn't support polymorphism, so we resort to templating and adapters
like this.
JS::CharsToNewUTF8CharsZ() needs a definition in CharacterEncoding.cpp,
so for now I explicitly instantiate it for ErrorAllocator<JSContext>.
A better solution would be to move the definition to a header, but that's
a bigger task.
Depends on D150648
Updated•3 years ago
|
Assignee | ||
Comment 13•3 years ago
|
||
ReportErrorVA(), ReportErrorNumberVA(), and ReportErrorNumberUCArray(), and
ReportErrorNumberUTF8Array() use JSContext for rooting, so they will have to be
called from the main thread. The only reason to pass ErrorContext to them would
be for consistency with the other error reporting functions.
Depends on D151179
Assignee | ||
Comment 14•3 years ago
|
||
ErrorAllocator was only ever used with ErrorContext, so no need for templating.
linkWithJSContext() better describes what it is doing, since JSContext needs its
errors_ field filled in, at least until we can replace it with a different
allocator for functions that are called during compilation.
getAllocator() is a convenience so we don't have to add a separate allocator
parameter everywhere we pass an ErrorContext and also need an allocator.
Depends on D151608
Assignee | ||
Comment 15•3 years ago
|
||
This removes a lot of plumbing allocators through function parameters but still
maintains the ErrorContext and allocator as separate concepts.
At this point, there is no need for the type or instances of ErrorContext and
ErrorAllocator to vary independently.
Depends on D151609
Assignee | ||
Comment 16•3 years ago
|
||
Depends on D151610
Assignee | ||
Comment 17•3 years ago
|
||
Depends on D151611
Assignee | ||
Comment 18•3 years ago
|
||
"GenericErrorContext" hasn't been an appropriate name since 6b27a74292dc.
Depends on D151612
Assignee | ||
Comment 19•3 years ago
|
||
At the cost of moving the filled-in CompileError into the allocated space for OffThreadErrorContext.
Depends on D151667
Assignee | ||
Comment 20•3 years ago
|
||
hadErrors() is more descriptive than errors().empty()
.
Access to the pending errors list is pushed down to OffThreadErrorContext,
because that's the only context where it is used.
Depends on D151668
Assignee | ||
Comment 21•3 years ago
|
||
Depends on D151669
Assignee | ||
Comment 22•3 years ago
|
||
Depends on D151670
Assignee | ||
Comment 23•3 years ago
|
||
Moving recordErrors in DelazifyTask::Create() to after the allocation of the
task allows us to use the ErrorContext in the task to store the errors instead
of having to move them into the task later, and we only miss the allocation of
the task itself (which wasn't recorded in the errors anyway).
Depends on D151671
Updated•3 years ago
|
Updated•3 years ago
|
Updated•3 years ago
|
Updated•3 years ago
|
Updated•3 years ago
|
Updated•3 years ago
|
Updated•3 years ago
|
Updated•3 years ago
|
Updated•3 years ago
|
Updated•3 years ago
|
Updated•3 years ago
|
Updated•3 years ago
|
Updated•3 years ago
|
Updated•3 years ago
|
Updated•3 years ago
|
Updated•3 years ago
|
Updated•3 years ago
|
Updated•3 years ago
|
Updated•3 years ago
|
Updated•3 years ago
|
Updated•3 years ago
|
Updated•3 years ago
|
Updated•3 years ago
|
Assignee | ||
Comment 24•3 years ago
|
||
addPendingCompileError() is replaced by OffThreadErrorContext::reportError().
Depends on D151878
Assignee | ||
Comment 25•3 years ago
|
||
Depends on D152191
Comment 26•3 years ago
|
||
Comment 27•3 years ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/5369fa38a413
https://hg.mozilla.org/mozilla-central/rev/b31863ca872e
https://hg.mozilla.org/mozilla-central/rev/61e92a33c07d
https://hg.mozilla.org/mozilla-central/rev/b6f70c94d870
https://hg.mozilla.org/mozilla-central/rev/cf0dada16695
https://hg.mozilla.org/mozilla-central/rev/c3d1f8ea4873
https://hg.mozilla.org/mozilla-central/rev/4bc7da9d66df
https://hg.mozilla.org/mozilla-central/rev/86c6381232c7
https://hg.mozilla.org/mozilla-central/rev/bb106324e318
https://hg.mozilla.org/mozilla-central/rev/aef2d3304fc6
https://hg.mozilla.org/mozilla-central/rev/6c044f146772
https://hg.mozilla.org/mozilla-central/rev/ed424d92b1c2
https://hg.mozilla.org/mozilla-central/rev/d4df7e3387c4
https://hg.mozilla.org/mozilla-central/rev/e31782ad0907
https://hg.mozilla.org/mozilla-central/rev/e2184ca5ef0f
https://hg.mozilla.org/mozilla-central/rev/99db76fde555
https://hg.mozilla.org/mozilla-central/rev/2588027facdf
https://hg.mozilla.org/mozilla-central/rev/0b9187cc4be4
https://hg.mozilla.org/mozilla-central/rev/0cb5b56b74fb
https://hg.mozilla.org/mozilla-central/rev/f3c25d3a623c
https://hg.mozilla.org/mozilla-central/rev/10d24e14a707
https://hg.mozilla.org/mozilla-central/rev/67dcf42b40bd
https://hg.mozilla.org/mozilla-central/rev/01aa3be551d3
https://hg.mozilla.org/mozilla-central/rev/da28877d8368
https://hg.mozilla.org/mozilla-central/rev/dea62af6ee07
Description
•