Commit 0436b3f6 authored by Jon Coppeard's avatar Jon Coppeard
Browse files

Bug 1823622 - Part 4: Make SliceBudget's interrupt word a relaxed atomic r=sfink

Since this can get checked by all marking threads it's not optimal to have this
as a sequentially consistent atomic as this will cause cache traffic every time
it's read.

We should be able to make this a relaxed atomic without observable difference
to interruptible GC.

Depends on D173129

Differential Revision: https://phabricator.services.mozilla.com/D173130
parent debe3612
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -476,7 +476,7 @@ class CCGCScheduler {

  // Set when the IdleTaskRunner requests the current task be interrupted.
  // Cleared when the GC slice budget has detected the interrupt request.
  mozilla::Atomic<bool> mInterruptRequested;
  js::SliceBudget::InterruptRequestFlag mInterruptRequested;

  // When a shrinking GC has been requested but we back-out, if this is true
  // we run a non-shrinking GC.
+1 −1
Original line number Diff line number Diff line
@@ -48,7 +48,7 @@ struct UnlimitedBudget {};
 */
class JS_PUBLIC_API SliceBudget {
 public:
  using InterruptRequestFlag = mozilla::Atomic<bool>;
  using InterruptRequestFlag = mozilla::Atomic<bool, mozilla::Relaxed>;

  // Whether this slice is running in (predicted to be) idle time.
  // Only used for recording in the profile.
+1 −1
Original line number Diff line number Diff line
@@ -75,7 +75,7 @@ BEGIN_TEST(testSliceBudgetTimeZero) {
END_TEST(testSliceBudgetTimeZero)

BEGIN_TEST(testSliceBudgetInterruptibleTime) {
  mozilla::Atomic<bool> wantInterrupt(false);
  SliceBudget::InterruptRequestFlag wantInterrupt(false);

  // Interruptible 100 second budget. This test will finish in well under that
  // time.