Closed
Bug 1148214
Opened 8 years ago
Closed 8 years ago
Encapsulate AllocKind range checks in a few functions
Categories
(Core :: JavaScript: GC, defect)
Core
JavaScript: GC
Tracking
()
RESOLVED
FIXED
mozilla39
Tracking | Status | |
---|---|---|
firefox39 | --- | fixed |
People
(Reporter: ehoogeveen, Assigned: ehoogeveen)
References
Details
Attachments
(1 file, 1 obsolete file)
14.66 KB,
patch
|
terrence
:
review+
|
Details | Diff | Splinter Review |
With all the range-based for loops in place we barely use specific AllocKinds directly anymore except to set a variable or pass into a function. The notable exceptions to this are the various assertions and other range checks we have scattered around to ensure that we're not holding on to some invalid AllocKind.
Assignee | ||
Comment 1•8 years ago
|
||
I went with IsValidAllocKind() for the common check of |< AllocKind::LIMIT|, and IsAllocKind() for the less common |<= AllocKind::LIMIT|. AllocKind::LIMIT is obviously a 'valid' AllocKind in some sense, but where we allow it at all, we use it to mean 'not allocated' or 'not initialized'. I put IsValidAllocKind() higher up in Heap.h so people will hopefully see it first and consider which variant they want. As for the implementation, I chose to go with >= and <= everywhere for consistency, and added back the |>= AllocKind::FIRST| and |>= AllocKind::OBJECT0| parts. Now that the underlying type of AllocKind is |int| again, it makes sense to check for negative values.
Attachment #8584185 -
Flags: review?(terrence)
Assignee | ||
Comment 2•8 years ago
|
||
This only depends on bug 1146662 in that it touches the same code, and has to land after that bug. I did change the assertions in SomeAllocKinds() a bit - checking |first| to make sure it isn't negative, and removing the |first <= limit| check since MakeEnumeratedRange already has an assertion for that.
Depends on: 1146662
Assignee | ||
Comment 3•8 years ago
|
||
Green on try: https://treeherder.mozilla.org/#/jobs?repo=try&revision=9fe319531276
Comment 4•8 years ago
|
||
Comment on attachment 8584185 [details] [diff] [review] Replace manual AllocKind range checks with a few centralized functions. Review of attachment 8584185 [details] [diff] [review]: ----------------------------------------------------------------- Very nice!
Attachment #8584185 -
Flags: review?(terrence) → review+
Assignee | ||
Updated•8 years ago
|
Keywords: checkin-needed
Assignee | ||
Comment 5•8 years ago
|
||
Carrying forward r=terrence. The mass SM restyle meant this needed some rebasing.
Attachment #8584185 -
Attachment is obsolete: true
Attachment #8585047 -
Flags: review+
Updated•8 years ago
|
Attachment #8585047 -
Attachment is obsolete: true
Comment 6•8 years ago
|
||
Comment on attachment 8584185 [details] [diff] [review] Replace manual AllocKind range checks with a few centralized functions. The SM restyle got backed out.
Attachment #8584185 -
Attachment is obsolete: false
Comment 7•8 years ago
|
||
https://hg.mozilla.org/integration/mozilla-inbound/rev/db80ac5a48aa
Keywords: checkin-needed
Assignee | ||
Comment 8•8 years ago
|
||
Thanks for landing the right one for me, Ryan!
Comment 9•8 years ago
|
||
https://hg.mozilla.org/mozilla-central/rev/db80ac5a48aa
Status: ASSIGNED → RESOLVED
Closed: 8 years ago
status-firefox39:
--- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla39
You need to log in
before you can comment on or make changes to this bug.
Description
•