Previously this stored a function pointer to do the tracing along with the rooted thing. The patch changes this to use a virtual method for the tracing. Calling the method on the base class means we don't need to do address arithmetic to find wher the trace function is stored and we don't need the alignment restrictions, because the virtual trace method knows the layout of its class.
I had to add a traits class, mainly to get the address of the rooted thing inside the wrapper since we need to be able to get the address of the wrapper itself now for tracing.
The wrapper class is renamed from DispatchWrapper to RootedTraceable.
Differential Revision: https://phabricator.services.mozilla.com/D73421
Since the parsers have a virtual trace method already we can handle these by making them CustomAutoRooters and get rid of the special kinds.
Differential Revision: https://phabricator.services.mozilla.com/D73297
The `mozilla::IsPod<HashMapEntry` specialisation was only needed for the static
assertions in "js/src/frontend/NameCollections.h". Part 3 removed those, so we
can now also remove `mozilla::IsPod<HashMapEntry`.
Drive-by change:
- Remove no longer needed "mozilla/PodOperations.h" include in mfbt/HashTable.h.
- And then fix up previously transitively included files for RootingAPI.h,
jsfriendapi.h, and Bench.cpp.
Differential Revision: https://phabricator.services.mozilla.com/D69201
This adds WrappedPtrOperations and MutableWrappedPtrOperations specialisations for Maybe<T> to all basic Maybe operations to used on Rooted<Maybe<T>>, Handle<Maybe<T>>, etc. I didn't add all of them; in particular I found ptr() would conflict with the Rooted::ptr data member.
This also adds JS::NothingHandleValue for passing Nothing to a Handle<Maybe<Value>>.
Differential Revision: https://phabricator.services.mozilla.com/D71555
Also reenable the `static_assert` which was disabled for some reason in
bug 1308236. (Bug 1308236 doesn't contain any information why this assertion
had to be disabled.)
Differential Revision: https://phabricator.services.mozilla.com/D67662
--HG--
extra : moz-landing-system : lando
rg -l 'mozilla/Move.h' | xargs sed -i 's/#include "mozilla\/Move.h"/#include <utility>/g'
Further manual fixups and cleanups to the include order incoming.
Differential Revision: https://phabricator.services.mozilla.com/D60323
--HG--
extra : moz-landing-system : lando
Now mfbt/Move.h is empty except for that excellent comment about move
semantics... Should we put it somewhere else and delete the header as a
follow-up? Or just delete the header and carry on?
Differential Revision: https://phabricator.services.mozilla.com/D60297
--HG--
extra : moz-landing-system : lando
Most of the code was copied from the String nursery allocation code paths and
then adjusted to work with BigInts. Where applicable, the newly added BigInt
functions were placed right next to the String functions, so it's easier to
compare them against each other. In a follow-up bug, we should try to reduce
these code duplications.
In contrast to Strings, nursery allocated BigInts will also try to nursery
allocate their heap digits, when needed, in the nursery. This works similar to
the slots and elements storage for objects, which can also be nursery
allocated. Supporting nursery allocation for BigInt digits is important when we
want to support nursery allocation of BigInts using heap digits, because it
avoids the extra overhead of registering malloc memory with nursery cells.
Differential Revision: https://phabricator.services.mozilla.com/D54772
--HG--
extra : moz-landing-system : lando
This class is not used externally so let's remove it from the public interface.
Differential Revision: https://phabricator.services.mozilla.com/D56763
--HG--
extra : moz-landing-system : lando
We should have the same public API available whenever possible, and make
it a no-op or make it throw immediately if JS was built without support
for it, instead of showing or hiding the API in header files using
configure macros. Otherwise embedders can easily get mismatches between
a library with functionality and header files without it, or vice versa.
There was no good reason why JS_GetErrorType() was nightly-only API, so
this also enables it unconditionally.
Differential Revision: https://phabricator.services.mozilla.com/D52124
--HG--
extra : moz-landing-system : lando
We should have the same public API available whenever possible, and make
it a no-op or make it throw immediately if JS was built without support
for it, instead of showing or hiding the API in header files using
configure macros. Otherwise embedders can easily get mismatches between
a library with functionality and header files without it, or vice versa.
There was no good reason why JS_GetErrorType() was nightly-only API, so
this also enables it unconditionally.
Differential Revision: https://phabricator.services.mozilla.com/D52124
--HG--
extra : moz-landing-system : lando
We can simplify this method by using std::remove_if, which does the shifting down of removed elements for us. We just need to make sure all our wrapper classes support moving assignment.
Differential Revision: https://phabricator.services.mozilla.com/D49769
--HG--
extra : moz-landing-system : lando
This adds a pre write barrier to Heap<T> so that these can be uses as non-roots in the heap without breaking our snapshot at the beginning invariant if they are written to during an incremental GC. This makes it harder to misuse and allows us to take out manual barriers in at least one place.
Differential Revision: https://phabricator.services.mozilla.com/D25083
- modify line wrap up to 80 chars; (tw=80)
- modify size of tab to 2 chars everywhere; (sts=2, sw=2)
--HG--
extra : rebase_source : 7eedce0311b340c9a5a1265dc42d3121cc0f32a0
extra : amend_source : 9cb4ffdd5005f5c4c14172390dd00b04b2066cd7
This eliminates a few instructions from every profiler label and saves code size.
We have around 9000 WebIDL constructors + methods + getters + setters which all
have an inlined instance of this code.
This change reduces the binary size on Linux x64 by around 160KB.
Here's a diff of the impact on the code generated for Attr_Binding::get_specified
in the Mac build:
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x10, %rsp
movq %rcx, %r14
movq %rdx, %r15
- movq __ZN7mozilla8profiler6detail12RacyFeatures18sActiveAndFeaturesE@GOT, %rax ; __ZN7mozilla8profiler6detail12RacyFeatures18sActiveAndFeaturesE@GOT
- movl (%rax), %eax
- testl %eax, %eax
- js loc_xxxxx
-
- movq $0x0, -40(%rbp)
- jmp loc_xxxxx
-
- movq 0x78(%rdi), %rbx
+ movq 0x80(%rdi), %rbx
movq %rbx, -40(%rbp)
testq %rbx, %rbx
je loc_xxxxx
movl 0x10(%rbx), %r12d
cmpl %r12d, (%rbx)
jbe loc_xxxxx
Differential Revision: https://phabricator.services.mozilla.com/D9192
--HG--
extra : moz-landing-system : lando