Commit Graph

355 Commits

Author SHA1 Message Date
Jan de Mooij
1ff9a98f17 Bug 1803438 - Bump wasiRecursionDepthLimit to 350. r=arai
Based on some local testing, this should still be small enough to avoid hitting the
WASI runtime's stack limit.

Differential Revision: https://phabricator.services.mozilla.com/D164323
2022-12-09 15:05:51 +00:00
Tooru Fujisawa
287c234f6b Bug 1781641 - Add JS::NativeStackBase, JS::NativeStackSize, and JS::NativeStackLimit. r=bthrall
Depends on D152783

Differential Revision: https://phabricator.services.mozilla.com/D152854
2022-07-30 04:45:22 +00:00
Steve Fink
7302e712ae Bug 1556604 - [Structured Clone] Replace ChildCounter mechanism with a conditionally-pushed state stack. r=evilpie
Differential Revision: https://phabricator.services.mozilla.com/D148227
2022-06-16 22:01:13 +00:00
Jon Coppeard
8645d72a16 Bug 1759174 - Part 2: Optimize GCThingIsMarkedGray APIs by removing check for shared GC things r=sfink,mccr8
This splits the API into two, one that does a bunch of checks and calls into
the JS engine, and one for use by the CC where all preconditions are assumed to
be satisfied and can be inlined entirely.

Depends on D140865

Differential Revision: https://phabricator.services.mozilla.com/D140866
2022-03-14 11:13:52 +00:00
Steve Fink
853747dc43 Bug 1736737 - Implement Heap<ArrayBufferOrView> (for all subtypes) r=jonco
Differential Revision: https://phabricator.services.mozilla.com/D129328
2021-10-25 21:18:57 +00:00
Steve Fink
f2863b67ef Bug 1736737 - Move SafelyInitialized into a struct to allow partial specialization. r=jonco
Differential Revision: https://phabricator.services.mozilla.com/D129345
2021-10-25 21:18:56 +00:00
Steve Fink
17c6d876fa Bug 1736737 - Change Heap<T> constructors to accept non-default-constructible T r=jonco
Differential Revision: https://phabricator.services.mozilla.com/D129344
2021-10-25 21:18:55 +00:00
Steve Fink
b82d87038f Bug 1736737 - Use template magic to specialize WrappedPtrOperations for ArrayBufferOrView subtypes r=jonco
Differential Revision: https://phabricator.services.mozilla.com/D128963
2021-10-25 21:18:55 +00:00
Iulian Moraru
ccabf7cce9 Backed out 5 changesets (bug 1736737) for causing spidermonkey and bp-hybrid build bustages.
Backed out changeset 4ac615dbeb56 (bug 1736737)
Backed out changeset aa3037448983 (bug 1736737)
Backed out changeset 0c286f5836f6 (bug 1736737)
Backed out changeset 61da0b175b0b (bug 1736737)
Backed out changeset 43a22e362156 (bug 1736737)
2021-10-25 22:16:23 +03:00
Steve Fink
da2659f024 Bug 1736737 - Implement Heap<ArrayBufferOrView> (for all subtypes) r=jonco
Differential Revision: https://phabricator.services.mozilla.com/D129328
2021-10-25 17:35:21 +00:00
Steve Fink
ff8a4526e9 Bug 1736737 - Move SafelyInitialized into a struct to allow partial specialization. r=jonco
Differential Revision: https://phabricator.services.mozilla.com/D129345
2021-10-25 17:35:20 +00:00
Steve Fink
b4cd30a411 Bug 1736737 - Change Heap<T> constructors to accept non-default-constructible T r=jonco
Differential Revision: https://phabricator.services.mozilla.com/D129344
2021-10-25 17:35:19 +00:00
Steve Fink
0f0867e3e9 Bug 1736737 - Use template magic to specialize WrappedPtrOperations for ArrayBufferOrView subtypes r=jonco
Differential Revision: https://phabricator.services.mozilla.com/D128963
2021-10-25 17:35:19 +00:00
Jon Coppeard
8e4f381606 Bug 1734392 - Part 2: Add a read barrier on JS::Heap<T> construction r=sfink
Differential Revision: https://phabricator.services.mozilla.com/D127673
2021-10-08 14:00:04 +00:00
Csoregi Natalia
03c4091654 Backed out 5 changesets (bug 1734392, bug 1734362) for bustages on TestJSHolderMap.cpp. CLOSED TREE
Backed out changeset 53f7d8f6758a (bug 1734392)
Backed out changeset c55d9ca8c869 (bug 1734392)
Backed out changeset cd61ff016587 (bug 1734392)
Backed out changeset 211f5803783a (bug 1734362)
Backed out changeset 5f118a3deafc (bug 1734362)
2021-10-08 14:45:33 +03:00
Jon Coppeard
0fdd3c7dbe Bug 1734392 - Part 2: Add a read barrier on JS::Heap<T> construction r=sfink
Differential Revision: https://phabricator.services.mozilla.com/D127673
2021-10-08 08:53:29 +00:00
Marian-Vasile Laza
6a95011637 Backed out changeset fbae5c0c9322 (bug 1731432) for causing crashes on nightly. CLOSED TREE 2021-09-23 16:09:28 +03:00
Jon Coppeard
894498420b Bug 1731432 - Re-add the pre-write barrier on Heap<T> r=sfink
This is a backout of the patch in bug 1581574 in the hope that it will fix the
crashes in bug 1731432.

Previously this write barrier was not required and we relied on the read
barrier, but it seems that may not be sufficient to allow us to mark gray roots
after the first GC slice. There are few ways that the value of a Heap<T> can be
observed without triggering the read barrier, and that could explain what's
happening here.

The contents of JS holders are cleared when they are removed from the holder
map, so that will also trigger the write barrier.

Differential Revision: https://phabricator.services.mozilla.com/D126253
2021-09-22 12:15:09 +00:00
Marian-Vasile Laza
7104ccdf17 Backed out changeset c0b5f3efa4d4 (bug 1731432) for causing reftest failures. CLOSED TREE 2021-09-21 22:13:33 +03:00
Jon Coppeard
aaf83658bf Bug 1731432 - Re-add the pre-write barrier on Heap<T> r=sfink
This is a backout of the patch in bug 1581574 in the hope that it will fix the
crashes in bug 1731432.

Previously this write barrier was not required and we relied on the read
barrier, but it seems that may not be sufficient to allow us to mark gray roots
after the first GC slice. There are few ways that the value of a Heap<T> can be
observed without triggering the read barrier, and that could explain what's
happening here.

The contents of JS holders are cleared when they are removed from the holder
map, so that will also trigger the write barrier.

Differential Revision: https://phabricator.services.mozilla.com/D126253
2021-09-21 17:19:01 +00:00
Jon Coppeard
ba7fd90527 Bug 1731218 - Part 4: Add typed base classes for roots r=tcampbell
This adds typed base classes with trace() methods. RootedTraceable is removed
and we store T directly in Rooted.

Differential Revision: https://phabricator.services.mozilla.com/D125953
2021-09-21 11:17:50 +00:00
Jon Coppeard
6dad3e1d0d Bug 1731218 - Part 3: Give Rooted a base class and use this refer to these roots when we don't know the type r=tcampbell
The link pointers move to the base class in a similar way to PersistentRootedBase.
This lets us get rid of a bunch more reinterpret_casts.

Differential Revision: https://phabricator.services.mozilla.com/D125952
2021-09-21 11:17:50 +00:00
Jon Coppeard
b3e8fa487f Bug 1731218 - Part 2: Give PersistentRooted a base class and use this refer to these roots when we don't know the type r=tcampbell
This removes the need for a bunch of reinterpret_casts.

Differential Revision: https://phabricator.services.mozilla.com/D125951
2021-09-21 11:17:49 +00:00
Jon Coppeard
174d704606 Bug 1731218 - Part 1: Rename rooting API base classes to 'Operations' in prepartion for adding base classes r=sfink
These are really mixins used to add public methods based on the type and don't
need to the base of an inheritance tree.

Differential Revision: https://phabricator.services.mozilla.com/D125950
2021-09-21 11:17:49 +00:00
Jon Coppeard
13d878dcbb Bug 1731218 - Part 0: Remove unnecessary template from Rooted constructor r=sfink
I don't think this does anything. The type is always present so we won't
restrict use of this constructor by SFINAE, although I may have misunderstood
the purpose of this.

I tried 'fixing' the SFINAE to what I though it should be by using enable_if_t
but it had the same effect as removing it. In both cases the code compiles, and
if I try to construct a rooted with an inappropriate argument it fails with a
sensible error.

Differential Revision: https://phabricator.services.mozilla.com/D125949
2021-09-21 11:17:49 +00:00
Sandor Molnar
10773301cf Backed out 7 changesets (bug 1731218) for causing spidermonkey build bustages in RootingAPI. CLOSED TREE
Backed out changeset 0dfcae852026 (bug 1731218)
Backed out changeset e2c59b5af7ea (bug 1731218)
Backed out changeset 3e98b832dcc6 (bug 1731218)
Backed out changeset 57e60277e4ca (bug 1731218)
Backed out changeset 3b264a4bc67e (bug 1731218)
Backed out changeset 304f27af6b95 (bug 1731218)
Backed out changeset 06e7a1992de8 (bug 1731218)
2021-09-21 11:37:12 +03:00
Jon Coppeard
4e793eed42 Bug 1731218 - Part 4: Add typed base classes for roots r=tcampbell
This adds typed base classes with trace() methods. RootedTraceable is removed
and we store T directly in Rooted.

Differential Revision: https://phabricator.services.mozilla.com/D125953
2021-09-21 07:57:24 +00:00
Jon Coppeard
96c9aca4a9 Bug 1731218 - Part 3: Give Rooted a base class and use this refer to these roots when we don't know the type r=tcampbell
The link pointers move to the base class in a similar way to PersistentRootedBase.
This lets us get rid of a bunch more reinterpret_casts.

Differential Revision: https://phabricator.services.mozilla.com/D125952
2021-09-21 07:57:24 +00:00
Jon Coppeard
09ae160102 Bug 1731218 - Part 2: Give PersistentRooted a base class and use this refer to these roots when we don't know the type r=tcampbell
This removes the need for a bunch of reinterpret_casts.

Differential Revision: https://phabricator.services.mozilla.com/D125951
2021-09-21 07:57:23 +00:00
Jon Coppeard
da8915efaf Bug 1731218 - Part 1: Rename rooting API base classes to 'Operations' in prepartion for adding base classes r=sfink
These are really mixins used to add public methods based on the type and don't
need to the base of an inheritance tree.

Differential Revision: https://phabricator.services.mozilla.com/D125950
2021-09-21 07:57:23 +00:00
Jon Coppeard
ae4e5f23b3 Bug 1731218 - Part 0: Remove unnecessary template from Rooted constructor r=sfink
I don't think this does anything. The type is always present so we won't
restrict use of this constructor by SFINAE, although I may have misunderstood
the purpose of this.

I tried 'fixing' the SFINAE to what I though it should be by using enable_if_t
but it had the same effect as removing it. In both cases the code compiles, and
if I try to construct a rooted with an inappropriate argument it fails with a
sensible error.

Differential Revision: https://phabricator.services.mozilla.com/D125949
2021-09-21 07:57:23 +00:00
Steve Fink
3ff9c34f6e Bug 1729602 - Forward T constructor arguments through PersistentRooted<T> foo(cx, ...args...) r=tcampbell,jonco
Differential Revision: https://phabricator.services.mozilla.com/D124996
2021-09-13 22:58:53 +00:00
Steve Fink
2ddcc9e183 Bug 1729602 - Templatize RootHolder in PersistentRooted to more closely match Rooted r=tcampbell,jonco
Differential Revision: https://phabricator.services.mozilla.com/D124995
2021-09-13 22:58:53 +00:00
Steve Fink
90d784a9bd Bug 1729602 - Forward T constructor arguments through Rooted<T> foo(cx, ...args...); r=tcampbell
Differential Revision: https://phabricator.services.mozilla.com/D124869
2021-09-13 22:58:52 +00:00
Steve Fink
c6e64ca198 Bug 1729602 - Remove the magic cx constructor handling in Rooted<TypeConstructibleWithCx> foo(cx); r=tcampbell,jonco
Differential Revision: https://phabricator.services.mozilla.com/D124994
2021-09-13 22:58:52 +00:00
Marian-Vasile Laza
53d94ff3fb Backed out 4 changesets (bug 1729602) for causing build bustages on RootingAPI.h. CLOSED TREE
Backed out changeset ba1ba9d974a4 (bug 1729602)
Backed out changeset 0f06d31a9008 (bug 1729602)
Backed out changeset cf7f13072e9f (bug 1729602)
Backed out changeset b277bca3bfe1 (bug 1729602)
2021-09-14 01:24:35 +03:00
Steve Fink
1aeed2512d Bug 1729602 - Forward T constructor arguments through PersistentRooted<T> foo(cx, ...args...) r=tcampbell,jonco
Differential Revision: https://phabricator.services.mozilla.com/D124996
2021-09-13 22:10:11 +00:00
Steve Fink
93a074d14e Bug 1729602 - Templatize RootHolder in PersistentRooted to more closely match Rooted r=tcampbell,jonco
Differential Revision: https://phabricator.services.mozilla.com/D124995
2021-09-13 22:10:11 +00:00
Steve Fink
270176e7f7 Bug 1729602 - Forward T constructor arguments through Rooted<T> foo(cx, ...args...); r=tcampbell
Differential Revision: https://phabricator.services.mozilla.com/D124869
2021-09-13 22:10:10 +00:00
Steve Fink
55a28eed06 Bug 1729602 - Remove the magic cx constructor handling in Rooted<TypeConstructibleWithCx> foo(cx); r=tcampbell,jonco
Differential Revision: https://phabricator.services.mozilla.com/D124994
2021-09-13 22:10:09 +00:00
Ted Campbell
498eb65932 Bug 1716247 - Remove dead code from GC rooting API. r=sfink
Differential Revision: https://phabricator.services.mozilla.com/D117603
2021-07-08 23:48:07 +00:00
Ted Campbell
41b6fc2de4 Bug 1716247 - Fix RootListEntry on MSVC. r=sfink
When compiling spidermonkey public APIs under MSVC, the dummy type RootListEntry
needs a GCPolicy even though it is not instantiated.

Differential Revision: https://phabricator.services.mozilla.com/D119428
2021-07-08 23:47:37 +00:00
Ted Campbell
b172dd415c Bug 1716250 - Remove JS_FRIEND_API. r=jandem,sfink
Convert all JS_FRIEND_API to JS_PUBLIC_API. At this point, the JS_PUBLIC_API has
no formal curation process and in practice we add a lot of new features to
JS_FRIEND_API without giving much thought to if they should be public. The
result is that all embedders need to use the friend API in some form and the
distinction has lost meaning.

Going forward, we should continue to use the js/public/experimental directory as
a place to expose new APIs, and in general should strive for high quality of the
APIs that are exposed. If a particular API is tricky or discouraged, comments
explaining that will be more helpful that a losely applied FRIEND_API marker.

Differential Revision: https://phabricator.services.mozilla.com/D117607
2021-06-16 19:38:10 +00:00
Sandor Molnar
2eb4c5bf69 Backed out 3 changesets (bug 1716247) for causing jsreftest failures. CLOSED TREE
Backed out changeset 58137e59d8fc (bug 1716247)
Backed out changeset 0ea7f627a717 (bug 1716247)
Backed out changeset c52f0e7918ec (bug 1716247)
2021-06-15 21:51:23 +03:00
Ted Campbell
c987af278f Bug 1716247 - Add js::RootedUntypedBase type. r=sfink
Add a common base type with the template parameter erased. This lets us remove
the RootListEntry type and the undefined reinterpret_casts it is using.

Depends on D117604

Differential Revision: https://phabricator.services.mozilla.com/D117605
2021-06-15 17:34:33 +00:00
Ted Campbell
7140f4571a Bug 1716247 - Add js::PersistentRootedBase type. r=sfink
Add a common base type for all PersistentRooted instead of relying on undefined
reinterpret_casts. This avoids PersistentRooted<RootListEntry*> which causes
potential issues when SpiderMonkey is used in a project compiled under MSVC. The
static_cast is still unchecked so the same care needs to be taken as before.

Depends on D117603

Differential Revision: https://phabricator.services.mozilla.com/D117604
2021-06-15 17:34:33 +00:00
Ted Campbell
00b4742d6b Bug 1716247 - Remove dead code from GC rooting API. r=sfink
Differential Revision: https://phabricator.services.mozilla.com/D117603
2021-06-15 17:34:32 +00:00
Andi-Bogdan Postelnicu
a5cd8949a1 Bug 1707096 - fix deprecated-copy detected by clang-trunk. r=sfink,jandem
Differential Revision: https://phabricator.services.mozilla.com/D114087
2021-05-26 10:20:32 +00:00
Jon Coppeard
869464f64f Bug 1711423 - Move CustomAutoRooter to public/RootingAPI.h r=yulia
Differential Revision: https://phabricator.services.mozilla.com/D115192
2021-05-17 10:06:27 +00:00
Dmitry Bezhetskov
a6f2b3ce51 Bug 1704771 part 9 - Add recursion limiter. r=jandem
WASI doesn't support catching call-stack overflows with
stack-pointer checks, so custom RecursionLimiter is used to directly count entries to certain functions
and report stack overflows.

Differential Revision: https://phabricator.services.mozilla.com/D111813
2021-04-22 11:11:12 +00:00