Closed Bug 1689140 Opened 4 years ago Closed 4 years ago

SliceBudget::counter has smaller range than WorkBudget::budget on 32-bit platforms

Categories

(Core :: JavaScript: GC, defect)

defect

Tracking

()

RESOLVED FIXED
87 Branch
Tracking Status
firefox87 --- fixed

People

(Reporter: jonco, Assigned: jonco)

References

Details

Attachments

(1 file)

When we create a SliceBudget based on a WorkBudget, we assign counter from the budget:

https://searchfox.org/mozilla-central/source/js/src/gc/GC.cpp#3004

Unfortunately, counter is a intptr_t and budget is int64_t, so there is the potential for this to go wrong.

Work budgets are mainly used for testing (e.g. in zeal modes) and any sensible budget will fit in 32 bits so it's unlikely this is causing a problem.

This patch does several things:

  • make the counter type int64_t like the work budget parameter (the original purpose of this bug)
  • simplify implementation by using a Variant to discriminate between different kinds of budget
  • remove the global initialization
  • remove makeUnlimited() (and replace uses with assignment from SliceBudget::unlimited())
  • add convenience methods to get the original budget parameters
  • add basic API tests

The use of Variant had the consequence that we now have to pass SliceBudget by reference now to make the linter happy.

Assignee: nobody → jcoppeard
Status: NEW → ASSIGNED
Status: ASSIGNED → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → 87 Branch
Regressions: 1690104
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: