Give binding error messages a consistent prefix
Categories
(Core :: DOM: Bindings (WebIDL), task, P1)
Tracking
()
Tracking | Status | |
---|---|---|
firefox75 | --- | fixed |
People
(Reporter: bzbarsky, Assigned: bzbarsky)
References
(Blocks 4 open bugs)
Details
Attachments
(24 files)
7.39 KB,
text/html
|
Details | |
37.49 KB,
patch
|
Details | Diff | Splinter Review | |
11.33 KB,
patch
|
Details | Diff | Splinter Review | |
4.08 KB,
patch
|
Details | Diff | Splinter Review | |
10.17 KB,
patch
|
Details | Diff | Splinter Review | |
1.16 KB,
patch
|
Details | Diff | Splinter Review | |
5.21 KB,
patch
|
Details | Diff | Splinter Review | |
5.25 KB,
patch
|
Details | Diff | Splinter Review | |
61.07 KB,
patch
|
Details | Diff | Splinter Review | |
10.92 KB,
patch
|
Details | Diff | Splinter Review | |
16.54 KB,
patch
|
Details | Diff | Splinter Review | |
14.03 KB,
patch
|
Details | Diff | Splinter Review | |
5.01 KB,
patch
|
Details | Diff | Splinter Review | |
47 bytes,
text/x-phabricator-request
|
Details | Review | |
47 bytes,
text/x-phabricator-request
|
Details | Review | |
47 bytes,
text/x-phabricator-request
|
Details | Review | |
47 bytes,
text/x-phabricator-request
|
Details | Review | |
47 bytes,
text/x-phabricator-request
|
Details | Review | |
47 bytes,
text/x-phabricator-request
|
Details | Review | |
47 bytes,
text/x-phabricator-request
|
Details | Review | |
47 bytes,
text/x-phabricator-request
|
Details | Review | |
47 bytes,
text/x-phabricator-request
|
Details | Review | |
47 bytes,
text/x-phabricator-request
|
Details | Review | |
47 bytes,
text/x-phabricator-request
|
Details | Review |
Right now we have a consistent prefix (the function name) for error messages thrown via ErrorResult to bindings, but not for error messages thrown from the bindings themselves. It would be good to fix this. Working on it.
Assignee | ||
Updated•5 years ago
|
Assignee | ||
Comment 1•5 years ago
|
||
The new ones are better, or at least I think so. ;)
The patches I have right now add about 150KB of codesize. I'm going to measure what happens to the codesize if we use explicit string passing instead of bundling up the JSContext* and string in a BindingCallContext.
Assignee | ||
Comment 2•5 years ago
|
||
OK, I tried the "pass strings around" approach and it seems to do better on codesize: it only increases .text
by 49KB or so. In addition to that, it decreases .rodata
by 55KB (as compared to 24KB with the BindingCallContext
approach) and only increases .eh_frame
and .eh_frame_hdr
by about 12KB, compared to 30KB for BindingCallContext
. So net it's an increase of 49KB of code and net decrease of 42KB of readonly data (as compared to an increase of 150KB of code and net increase of 7KB of readonly data).
I can improve the readonly data bits for the BindingCallContext
stuff by applying the ": "
handling from the other patches to it, but I'm not sure it's worth spending time on that unless we plan to use those patches.
The BindingCallContext
version does have the benefit of being slightly simpler, I think, and not being quite as fragile wrt unused variable warnings. Avoiding those means either getting the set of cases when we need a method description variable exactly right (which at this point I think I have) or using literal strings instead that then get threaded through the codegen instead of a variable at the top of the method.
Also, there are some cases where a binding method has a methodDescription
string and an identical string in the MaybeSetPendingException
call. I think compilers will coalesce those anyway, so I didn't worry about manually trying to coalesce them.
I'm going to post my BindingCallContext
patches here, just so they don't get lost, then work on posting the string-passing patches for review in Phabricator. Still waiting on the try runs for those.
Assignee | ||
Comment 3•5 years ago
|
||
Nathan, if you find a convenient way to measure the ARM codesize, or can just do it locally, I am happy to provide rollup patches here too...
Assignee | ||
Comment 4•5 years ago
|
||
Assignee | ||
Comment 5•5 years ago
|
||
Assignee | ||
Comment 6•5 years ago
|
||
Assignee | ||
Comment 7•5 years ago
|
||
Assignee | ||
Comment 8•5 years ago
|
||
Assignee | ||
Comment 9•5 years ago
|
||
Assignee | ||
Comment 10•5 years ago
|
||
Assignee | ||
Comment 11•5 years ago
|
||
Assignee | ||
Comment 12•5 years ago
|
||
Assignee | ||
Comment 13•5 years ago
|
||
Assignee | ||
Comment 14•5 years ago
|
||
Assignee | ||
Comment 15•5 years ago
|
||
Assignee | ||
Comment 16•5 years ago
|
||
This does not change behavior at the moment, because the only callers of
ThrowErrorMessage that pass an error number that has a context pass an empty
string for the first (context) arg. Both of those callers are changed to pass
nullptr for the context in this patch.
We want to support nullptr to mean "empty context", because that way at
callsites we can avoid having extra empty strings.
We could avoid putting this machinery in place if we hardcoded the trailing ":
" at all the callsites, but that would reduce future flexibility in where the
context is placed in the message string (e.g. if we wanted to move it to the
end instead of the beginning) and increase the amount of string data we have to
cart around in the binary quite noticeably: we have a lot of places in
bindings where we call ThrowErrorMessage.
Assignee | ||
Comment 17•5 years ago
|
||
Future patches will pass these method descriptions to the places where we might
need them to call ThrowErrorMessage.
Assignee | ||
Comment 18•5 years ago
|
||
There are a few places where we pass null temporarily just so things compile;
future patches will fix those to pass something useful.
Assignee | ||
Comment 19•5 years ago
|
||
To catch cases which were passing the optional sourceDescription argument, we
define two overloads of Init(): one which takes neither description and one
which requires both of them.
Assignee | ||
Comment 20•5 years ago
|
||
There's a bit of hoop-jumping here to only declare methodDescription when it'll
actually be used, so we don't trigger unused variable warnings which break
-Werror compiles.
Assignee | ||
Comment 21•5 years ago
|
||
The method description is something like "InterfaceName.methodName", and the
sorce description is how the primitive is involved in that method
(e.g. "argument 5").
Assignee | ||
Comment 22•5 years ago
|
||
Assignee | ||
Comment 23•5 years ago
|
||
Assignee | ||
Comment 24•5 years ago
|
||
Instead of something like
"ByteStringSequenceSequenceOrByteStringByteStringRecord" we should have
"(sequence<sequence<ByteString>> or record<ByteString, Bytestring>)" in error
messages.
Please take a careful look at the resulting error messages (see attachment
in the bug) to see whether this makes sense.
Assignee | ||
Comment 25•5 years ago
|
||
Updated•5 years ago
|
Assignee | ||
Comment 26•5 years ago
|
||
Oh, the codesize numbers were without LTO. I guess I should measure with LTO, just in case....
Assignee | ||
Comment 27•5 years ago
|
||
Well, with LTO the numbers are much closer to each other. Which makes sense, because LTO can get rid of a bunch of the BindingCallContext helper methods that are unused.
Further, with LTO the numbers seem to be within the noise level (LTO builds from the same source have codesize swings that are about the same size as the observed differences).
So I'm going to switch back to the BindingCallContext
approach, because it's more maintainable and imo simpler.
Updated•5 years ago
|
Updated•5 years ago
|
Updated•5 years ago
|
Updated•5 years ago
|
Updated•5 years ago
|
Updated•5 years ago
|
Assignee | ||
Comment 28•5 years ago
|
||
Comment 29•5 years ago
|
||
Comment 30•5 years ago
|
||
Backed out 11 changesets (bug 1618011)for Linting failure.
Backout revision https://hg.mozilla.org/integration/autoland/rev/b5c15277450eda187610b12df8abba5981bcbaf7
Failure log https://treeherder.mozilla.org/logviewer.html#?job_id=292053049&repo=autoland
Boris can you please take a look?
Assignee | ||
Comment 31•5 years ago
|
||
I can take a look, but I did a try push for these exact changes before I pushed them: https://treeherder.mozilla.org/#/jobs?repo=try&revision=31c7ee2bd97e1b80413927505e4d4faac9e93c49
Does that lint job not run by default?
Assignee | ||
Comment 32•5 years ago
|
||
Looks like that's the webidl parser tests. Easy fix. Wish try would run them.
Comment 33•5 years ago
|
||
Updated•5 years ago
|
Comment 34•5 years ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/4617ca707005
https://hg.mozilla.org/mozilla-central/rev/98fff114a273
https://hg.mozilla.org/mozilla-central/rev/5e6bd14f80f9
https://hg.mozilla.org/mozilla-central/rev/d255e3548e0d
https://hg.mozilla.org/mozilla-central/rev/a2ae77d44d02
https://hg.mozilla.org/mozilla-central/rev/ceb5d82e68bc
https://hg.mozilla.org/mozilla-central/rev/abc482029dfe
https://hg.mozilla.org/mozilla-central/rev/f77f2be72d2b
https://hg.mozilla.org/mozilla-central/rev/e665071e5de0
https://hg.mozilla.org/mozilla-central/rev/825f196932d1
https://hg.mozilla.org/mozilla-central/rev/e2dfeee4b34a
Description
•