Closed Bug 1421152 Opened 7 years ago Closed 7 years ago

Add a checked cast method to TenuredCell

Categories

(Core :: JavaScript: GC, enhancement)

enhancement
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla59
Tracking Status
firefox59 --- fixed

People

(Reporter: allstars.chh, Assigned: allstars.chh)

Details

Attachments

(1 file, 1 obsolete file)

Attached patch Patch (obsolete) — Splinter Review
Hi Jonco
This is the patch for TenuredCell, however I didn't find any caller that could use as() instead.
Attachment #8932339 - Flags: review?(jcoppeard)
Comment on attachment 8932339 [details] [diff] [review]
Patch

Review of attachment 8932339 [details] [diff] [review]:
-----------------------------------------------------------------

Looks good!

There's a couple of places in AtomMarkingRuntime::atomIsMarked() where we can use is/as on a TenuredCell.

::: js/src/gc/Marking.cpp
@@ +2015,5 @@
>  inline T*
>  MarkStack::TaggedPtr::as() const
>  {
>      MOZ_ASSERT(tag() == MapTypeToMarkStackTag<T*>::value);
> +    MOZ_ASSERT(ptr()->asTenured().is<T>());

We don't care about efficiency (so much) in assertions, so for simplicity these could be:

  MOZ_ASSERT(ptr()->isTenured());
  MOZ_ASERTT(ptr()->is<T>));
Attachment #8932339 - Flags: review?(jcoppeard) → review+
Attached patch Patch v2Splinter Review
Attachment #8932339 - Attachment is obsolete: true
Attachment #8932749 - Flags: review+
Pushed by yhuang@mozilla.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/72fbce0bb347
Add a checked cast method to TenuredCell. r=jonco
https://hg.mozilla.org/mozilla-central/rev/72fbce0bb347
Status: ASSIGNED → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla59
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: