Skip to content

Commit

Permalink
Bug 1871186 - Make simulated alloc failure when marking less frequent…
Browse files Browse the repository at this point in the history
… r=jandem

Something I found when testing the original testcase attached to the bug was
that OOM tests involving GC can take a very long time (and sometimes time out)
because of the very frequent simulated OOM when pushing things onto the mark
stack. I added this originally to improve test coverage here but this may have
been over-enthusiastic. The patch changes this to rely on simulated alloc
failure whew the mark stack vector is resized and starts this off with a
smaller size in debug builds to ensure coverage.

Depends on D197911

Differential Revision: https://phabricator.services.mozilla.com/D197912
  • Loading branch information
jonco3 committed Jan 8, 2024
1 parent 55d5b1b commit c16b4af
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 5 additions & 0 deletions js/src/gc/GCMarker.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,12 @@ class GCMarker;
class SliceBudget;
class WeakMapBase;

#ifdef DEBUG
// Force stack resizing to ensure OOM test coverage in debug builds.
static const size_t MARK_STACK_BASE_CAPACITY = 4;
#else
static const size_t MARK_STACK_BASE_CAPACITY = 4096;
#endif

enum class SlotsOrElementsKind {
Unused = 0, // Must match SlotsOrElementsRangeTag
Expand Down
2 changes: 1 addition & 1 deletion js/src/gc/Marking.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1924,7 +1924,7 @@ inline MarkStack::SlotsOrElementsRange MarkStack::popSlotsOrElementsRange() {

inline bool MarkStack::ensureSpace(size_t count) {
if (MOZ_LIKELY((topIndex_ + count) <= capacity())) {
return !js::oom::ShouldFailWithOOM();
return true;
}

return enlarge(count);
Expand Down

0 comments on commit c16b4af

Please sign in to comment.