Bug 226537 - Drop Checked::safeGet()
Summary: Drop Checked::safeGet()
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Web Template Framework (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Chris Dumez
URL:
Keywords: InRadar
Depends on: 226514
Blocks:
  Show dependency treegraph
 
Reported: 2021-06-02 08:13 PDT by Chris Dumez
Modified: 2021-06-02 12:03 PDT (History)
4 users (show)

See Also:


Attachments
Patch (20.81 KB, patch)
2021-06-02 08:16 PDT, Chris Dumez
no flags Details | Formatted Diff | Diff
Patch (21.00 KB, patch)
2021-06-02 08:36 PDT, Chris Dumez
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Chris Dumez 2021-06-02 08:13:55 PDT
Drop Checked::safeGet() and replace with uses of Checked::operator T() or Checked::value().
Comment 1 Chris Dumez 2021-06-02 08:16:30 PDT
Created attachment 430355 [details]
Patch
Comment 2 Chris Dumez 2021-06-02 08:36:18 PDT
Created attachment 430361 [details]
Patch
Comment 3 Geoffrey Garen 2021-06-02 11:04:33 PDT
Comment on attachment 430361 [details]
Patch

r=me
Comment 4 Darin Adler 2021-06-02 11:09:02 PDT
Looks good. In future code we write, I hope people will not need pairs of checked and unchecked local variables; just use Checked<> and it will typically do the right thing without naming everything xxxChecked.

By the way, I think the syntax Checked<uint32_t> will be better than CheckedUint32 some day, so I hope we can later move to that. For now, I think moving to the aliases is better, but I don’t think we need modes other than RecordOverflow. Presumably the "crash right away when we overflow" mode is there for optimization reasons, but it seems unnecessary. Seems like it would always be fine to crash when you go to fetch the value rather than eagerly crashing while doing the math.
Comment 5 EWS 2021-06-02 12:02:24 PDT
Committed r278369 (238396@main): <https://commits.webkit.org/238396@main>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 430361 [details].
Comment 6 Radar WebKit Bug Importer 2021-06-02 12:03:20 PDT
<rdar://problem/78776138>