Bug 183857

Summary: Use CodeBlock::instructions()[] and CodeBlock::bytecodeOffset() instead of doing own pointer math.
Product: WebKit Reporter: Mark Lam <mark.lam>
Component: JavaScriptCoreAssignee: Mark Lam <mark.lam>
Status: RESOLVED FIXED    
Severity: Normal CC: ews-watchlist, fpizlo, jfbastien, keith_miller, msaboff, rmorisset, saam, webkit-bug-importer, ysuzuki
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
proposed patch.
mark.lam: review-
proposed patch.
mark.lam: review-
proposed patch. jfbastien: review+

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>.