Граф коммитов

292 Коммитов

Автор SHA1 Сообщение Дата
Jon Coppeard 4c9a0dab80 Bug 1634459 - Simplify the wrapper used for rooting non-GC thing types r=jandem
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
2020-05-04 16:53:56 +00:00
Jon Coppeard fd4b8f30fb Bug 1634435 - Remove parser auto rooters r=sfink
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
2020-05-04 16:53:56 +00:00
Jon Coppeard 7699bb2b02 Bug 1634435 - Replace AutoValueArray and AutoArrayRooter implementations with Rooted<> r=jandem
We can make these kinds use the existing Rooted infrastructure.

Differential Revision: https://phabricator.services.mozilla.com/D73293
2020-05-04 16:49:59 +00:00
Jon Coppeard 87d409b266 Bug 1632846 - Split auto rooter list into separate lists for each kind so we can only trace the onse we care about r=sfink
Differential Revision: https://phabricator.services.mozilla.com/D72594
2020-04-28 07:58:18 +00:00
André Bargull ccbf88b7b0 Bug 1626587 - Part 4: Remove mozilla::IsPod for HashMapEntry. r=jwalden
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
2020-04-27 12:00:48 +00:00
Jon Coppeard 7c6bb08a84 Bug 1631114 - Make Handle<Maybe<Value>> easier to use r=jandem
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
2020-04-21 06:10:42 +00:00
Jon Coppeard 11b739d096 Bug 1628389 - Replace standard library traits classes with _v and _t versions in the GC r=jwalden
Differential Revision: https://phabricator.services.mozilla.com/D70224

--HG--
extra : moz-landing-system : lando
2020-04-09 09:49:24 +00:00
André Bargull 43443a9706 Bug 1623957 - Part 14: Replace mozilla::IsPointer with std::is_pointer. r=jwalden
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
2020-03-21 14:27:24 +00:00
André Bargull 94fe0cb565 Bug 1623957 - Part 10: Replace mozilla::Conditional with std::conditional. r=jwalden
Differential Revision: https://phabricator.services.mozilla.com/D67658

--HG--
extra : moz-landing-system : lando
2020-03-21 14:25:21 +00:00
André Bargull 3f258924fb Bug 1623957 - Part 7: Replace mozilla::EnableIf with std::enable_if. r=jwalden
Differential Revision: https://phabricator.services.mozilla.com/D67655

--HG--
extra : moz-landing-system : lando
2020-03-21 14:41:09 +00:00
André Bargull a582a6c75f Bug 1623957 - Part 6: Replace mozilla::IsConvertible with std::is_convertible. r=jwalden
Differential Revision: https://phabricator.services.mozilla.com/D67653

--HG--
extra : moz-landing-system : lando
2020-03-21 14:20:17 +00:00
Simon Giesecke 6f38376be4 Bug 1613985 - Use default for equivalent-to-default constructors/destructors in js. r=jorendorff
Differential Revision: https://phabricator.services.mozilla.com/D65493

--HG--
extra : moz-landing-system : lando
2020-03-16 13:47:02 +00:00
Bogdan Tara c60fd3fdd2 Backed out 4 changesets (bug 1613985) for causing build bustages CLOSED TREE
Backed out changeset fba0caac746c (bug 1613985)
Backed out changeset 8605d7a19107 (bug 1613985)
Backed out changeset 41e858fbf235 (bug 1613985)
Backed out changeset 847433cf1e0a (bug 1613985)
2020-03-16 12:41:41 +02:00
Simon Giesecke d77407a756 Bug 1613985 - Use default for equivalent-to-default constructors/destructors in js. r=jorendorff
Differential Revision: https://phabricator.services.mozilla.com/D65493

--HG--
extra : moz-landing-system : lando
2020-03-16 09:38:17 +00:00
Jeff Walden 6d28e8ffba Bug 1618038 - Implement support for wrapper-class comparisons in the innermost namespace containing each wrapper class, as ADL intended. Also simplify the operator implementations in certain minor ways. r=sfink
Differential Revision: https://phabricator.services.mozilla.com/D64242

--HG--
extra : moz-landing-system : lando
2020-03-10 02:01:28 +00:00
Narcis Beleuzu a5a8b4f53e Backed out changeset f6898bd931c5 (bug 1618038) for SM bustages on AbstractScope.h . CLOSED TREE
--HG--
extra : rebase_source : 8b421404660589d79947f869497c37206ecab858
2020-03-09 22:53:43 +02:00
Jeff Walden 4ab1c168ae Bug 1618038 - Implement support for wrapper-class comparisons in the innermost namespace containing each wrapper class, as ADL intended. Also simplify the operator implementations in certain minor ways. r=sfink
Differential Revision: https://phabricator.services.mozilla.com/D64242

--HG--
extra : moz-landing-system : lando
2020-03-09 20:05:10 +00:00
Jeff Walden b8b7080914 Bug 1618038 - Move |MaybeRooted|, |FakeRooted|, and |FakeMutableHandle| to a fresh header. r=sfink
Differential Revision: https://phabricator.services.mozilla.com/D64236

--HG--
rename : js/src/gc/Rooting.h => js/src/gc/MaybeRooted.h
extra : moz-landing-system : lando
2020-03-02 12:24:35 +00:00
Emilio Cobos Álvarez b4600e67fc Bug 1609996 - Run check_spidermonkey_style.py --fixup. r=froydnj
Differential Revision: https://phabricator.services.mozilla.com/D60325

--HG--
extra : moz-landing-system : lando
2020-01-20 16:18:40 +00:00
Emilio Cobos Álvarez aa3a695712 Bug 1609996 - Remove mozilla/Move.h. r=froydnj
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
2020-01-20 16:18:20 +00:00
Emilio Cobos Álvarez 5cd5e6f148 Bug 1609996 - Remove mozilla::Swap in favor of std::swap. r=froydnj
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
2020-01-20 16:17:06 +00:00
André Bargull 980e63f88b Bug 1530372 - Part 4: Support nursery allocation for BigInt. r=sfink,jandem
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
2020-01-06 12:49:45 +00:00
Jon Coppeard 0b6cc147e4 Bug 1603122 - Make js::MaybeRooted an internal class r=allstarschh
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
2019-12-12 03:46:26 +00:00
Jeff Walden 3cf1f6541c Bug 1603256 - Move the GC pointer type enumeration macros to a standalone header. r=sfink
Differential Revision: https://phabricator.services.mozilla.com/D56804

--HG--
extra : moz-landing-system : lando
2019-12-12 01:38:21 +00:00
Philip Chimento dda8b08621 Bug 1590907 - Stop configure macros from masking function prototypes in public JS headers. r=jwalden,sfink
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
2019-11-26 10:27:27 +00:00
Brindusan Cristian 3e0cb96b6e Backed out 7 changesets (bug 1590907) for build bustages at jsfriendapi.cpp. CLOSED TREE
Backed out changeset d6ac9325cb2c (bug 1590907)
Backed out changeset fc85ee5e144c (bug 1590907)
Backed out changeset 1b5b40dcaac4 (bug 1590907)
Backed out changeset 1b2d91f00be2 (bug 1590907)
Backed out changeset 67f939760329 (bug 1590907)
Backed out changeset 4d5818a72b46 (bug 1590907)
Backed out changeset 308b42f3a99c (bug 1590907)

--HG--
extra : rebase_source : 47578231d4749f023c3d206c479ee532dbf6fc6c
extra : histedit_source : 9e7427349342272e7fbe02fee29cb87cda45f75d
2019-11-26 05:23:11 +02:00
Philip Chimento 1ccf7df721 Bug 1590907 - Stop configure macros from masking function prototypes in public JS headers. r=jwalden,sfink
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
2019-11-26 02:00:58 +00:00
Jon Coppeard b9540d5e60 Bug 1597321 - Implement MutableWrappedPtrOperations for JS::Value in terms of Wrapper::set r=sfink
Depends on D53694

Differential Revision: https://phabricator.services.mozilla.com/D53695

--HG--
extra : moz-landing-system : lando
2019-11-19 23:40:02 +00:00
Jon Coppeard d1664d884b Bug 1589717 - Simplify GCVector::sweep and allow use with element types that don't have barriers r=sfink
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
2019-10-22 04:58:53 +00:00
Jon Coppeard ad4df9ae33 Bug 1581574 - Remove Heap<T> write barrier and rely on existing read barrier to make incremental marking work r=sfink
Differential Revision: https://phabricator.services.mozilla.com/D46133

--HG--
extra : moz-landing-system : lando
2019-09-20 10:09:19 +00:00
Boris Zbarsky 0809eb5853 Bug 1561887 part 1. Add an overload of JS::ObjectIsMarkedGray that works on TenuredHeap. r=sfink
Differential Revision: https://phabricator.services.mozilla.com/D36868

--HG--
extra : moz-landing-system : lando
2019-07-08 22:52:51 +00:00
Karl Tomlinson c606cdd6d0 Bug 1558131 permit PersistentRooted::init() with RootingContext r=sfink
https://hg.mozilla.org/mozilla-central/rev/79d18ff4fe2853abadab372bc3bc00872f52403e#l1.143
added support for PersistentRooted initialization from a RootingContext.
https://hg.mozilla.org/mozilla-central/rev/d2758f635f72f779f712bf9c6e838868ed53c9f7#l5.97
changed the init() methods to require JSContext but continued to support
RootingContext for constructors.

Differential Revision: https://phabricator.services.mozilla.com/D34318

--HG--
extra : moz-landing-system : lando
2019-06-11 00:41:32 +00:00
Steve Fink 995829d42a No bug. Reformat js/** to fix accumulated divergences.
# ignore-this-changeset

--HG--
extra : amend_source : 7b51d539061710bf4939e687b4ca4b74af757cf3
2019-05-24 11:57:18 -07:00
Steve Fink 8484af2fa6 Bug 1547782 - Implement GCPolicy<T>::isValid for Gecko specializations r=jonco
Differential Revision: https://phabricator.services.mozilla.com/D29302

--HG--
extra : moz-landing-system : lando
2019-04-30 21:48:32 +00:00
Steve Fink 2bda356e27 Bug 1538779 - Make `Rooted<MyContainer> c(cx)` the equivalent of `Rooted<MyContainer> c(cx, MyContainer(cx))` if possible r=jonco
Differential Revision: https://phabricator.services.mozilla.com/D26797

--HG--
extra : moz-landing-system : lando
2019-04-30 21:25:15 +00:00
Brindusan Cristian 318a177f68 Backed out changeset f2a3fb166dfb (bug 1538779) for nojit build bustages at backup-point-bug1315634.js. CLOSED TREE 2019-04-29 21:27:59 +03:00
Steve Fink c8c09edba2 Bug 1538779 - Make `Rooted<MyContainer> c(cx)` the equivalent of `Rooted<MyContainer> c(cx, MyContainer(cx))` if possible r=jonco
Differential Revision: https://phabricator.services.mozilla.com/D26797

--HG--
extra : moz-landing-system : lando
2019-04-29 17:38:14 +00:00
Cosmin Sabou 889d5aa9e6 Backed out changeset d6f935d90da4 (bug 1538779) for causing build bustages on RootingAPI.h CLOSED TREE 2019-04-26 21:27:29 +03:00
Steve Fink 5a33bd5976 Bug 1538779 - Make `Rooted<MyContainer> c(cx)` the equivalent of `Rooted<MyContainer> c(cx, MyContainer(cx))` if possible r=jwalden
Differential Revision: https://phabricator.services.mozilla.com/D26797

--HG--
extra : moz-landing-system : lando
2019-04-26 16:54:43 +00:00
Jon Coppeard 7b5f8dce00 Bug 1539570 - Improve documentation of our various barrier classes r=sfink
Differential Revision: https://phabricator.services.mozilla.com/D25367
2019-03-29 11:08:16 +00:00
Jon Coppeard e16c189b22 Bug 1306008 - Replace ObjectPtr with JS::Heap<JSObject*> r=sfink
Heap<JSObject*> is now equivalent to ObjectPtr so we can remove the latter.

Differential Revision: https://phabricator.services.mozilla.com/D25084
2019-03-27 16:26:22 +00:00
Jon Coppeard b425876903 Bug 1306008 - Give JS::Heap<T> pointer wrappers a pre-barrier r=sfink
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
2019-03-27 16:26:09 +00:00
Tooru Fujisawa c92d5c4af5 Bug 1534516 - Use correct AutoGCRooter::Tag in BinASTParserBase. r=Yoric
Differential Revision: https://phabricator.services.mozilla.com/D23083

--HG--
extra : moz-landing-system : lando
2019-03-12 09:16:00 +00:00
Jon Coppeard e56208cb40 Bug 1463462 - Delay gray marking assertions when we are doing incremental gray marking r=sfink 2018-12-06 16:28:14 -05:00
Jon Coppeard 6f81506124 Bug 1463462 - Make gray marking assertions call a JSAPI function r=sfink 2018-12-06 16:28:10 -05:00
Tooru Fujisawa 7983faeb5d Bug 1511393 - Use c-basic-offset: 2 in Emacs mode line for C/C++ code. r=nbp 2018-12-01 04:52:05 +09:00
Benjamin Bouvier a7f1d173a0 Bug 1511383: Update vim modelines after clang-format; r=sylvestre
- 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
2018-11-30 16:39:55 +01:00
Sylvestre Ledru 265e672179 Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
# ignore-this-changeset

--HG--
extra : amend_source : 4d301d3b0b8711c4692392aa76088ba7fd7d1022
2018-11-30 11:46:48 +01:00
Jan de Mooij bccfe7c569 Bug 1508065 - Change JS_PUBLIC_{API,DATA} and JS_FRIEND_{API,DATA} to be more like similar macros to avoid confusing clang-format. r=tcampbell
Differential Revision: https://phabricator.services.mozilla.com/D12256

--HG--
extra : moz-landing-system : lando
2018-11-19 17:02:47 +00:00
Markus Stange 3be6c8467b Bug 1499507 - Fold the 'profiler is active' check into the 'JSContext has a non-null PseudoStack' check. r=sfink
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
2018-11-06 04:29:35 +00:00