Bug 183857 - Use CodeBlock::instructions()[] and CodeBlock::bytecodeOffset() instead of doing own pointer math.
Summary: Use CodeBlock::instructions()[] and CodeBlock::bytecodeOffset() instead of do...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: JavaScriptCore (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Mark Lam
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2018-03-21 10:05 PDT by Mark Lam
Modified: 2018-03-21 11:24 PDT (History)
9 users (show)

See Also:


Attachments
proposed patch. (24.16 KB, patch)
2018-03-21 10:12 PDT, Mark Lam
mark.lam: review-
Details | Formatted Diff | Diff
proposed patch. (24.15 KB, patch)
2018-03-21 10:18 PDT, Mark Lam
mark.lam: review-
Details | Formatted Diff | Diff
proposed patch. (24.15 KB, patch)
2018-03-21 10:23 PDT, Mark Lam
jfbastien: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Mark Lam 2018-03-21 10:05:43 PDT
We should avoid doing pointer math with CodeBlock::instructions().begin().  Instead, we should use the operator[] that comes with CodeBlock::instructions() for computing an Instruction*, and use CodeBlock::bytecodeOffset() for computing the bytecode offset of a given Instruction*.  These methods will do assertions which helps catch bugs sooner, plus they are more descriptive of the operation we're trying to do.
Comment 1 Radar WebKit Bug Importer 2018-03-21 10:06:12 PDT
<rdar://problem/38712184>
Comment 2 Mark Lam 2018-03-21 10:12:00 PDT
Created attachment 336203 [details]
proposed patch.
Comment 3 EWS Watchlist 2018-03-21 10:14:30 PDT
Attachment 336203 [details] did not pass style-queue:


ERROR: Source/JavaScriptCore/llint/LLIntSlowPaths.cpp:199:  Comma should be at the beginning of the line in a member initialization list.  [whitespace/init] [4]
Total errors found: 1 in 18 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 4 JF Bastien 2018-03-21 10:16:10 PDT
Comment on attachment 336203 [details]
proposed patch.

r=me
Comment 5 Mark Lam 2018-03-21 10:16:22 PDT
Comment on attachment 336203 [details]
proposed patch.

Will fix issues.
Comment 6 Mark Lam 2018-03-21 10:18:28 PDT
Created attachment 336206 [details]
proposed patch.
Comment 7 Mark Lam 2018-03-21 10:23:04 PDT
Created attachment 336208 [details]
proposed patch.
Comment 8 EWS Watchlist 2018-03-21 10:26:17 PDT
Attachment 336208 [details] did not pass style-queue:


ERROR: Source/JavaScriptCore/llint/LLIntSlowPaths.cpp:199:  Comma should be at the beginning of the line in a member initialization list.  [whitespace/init] [4]
Total errors found: 1 in 18 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 9 JF Bastien 2018-03-21 10:33:44 PDT
Comment on attachment 336208 [details]
proposed patch.

r=me
Comment 10 Mark Lam 2018-03-21 11:24:03 PDT
Thanks for the review.  Landed in r229815: <http://trac.webkit.org/r229815>.