<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.webkit.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4.1"
          urlbase="https://bugs.webkit.org/"
          
          maintainer="admin@webkit.org"
>

    <bug>
          <bug_id>224589</bug_id>
          
          <creation_ts>2021-04-14 19:16:46 -0700</creation_ts>
          <short_desc>Avoid indirect load in ContainerNode::hasOneChild()</short_desc>
          <delta_ts>2021-04-14 20:35:15 -0700</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>DOM</component>
          <version>WebKit Nightly Build</version>
          <rep_platform>Unspecified</rep_platform>
          <op_sys>Unspecified</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords>InRadar</keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Ryosuke Niwa">rniwa</reporter>
          <assigned_to name="Ryosuke Niwa">rniwa</assigned_to>
          <cc>cdumez</cc>
    
    <cc>darin</cc>
    
    <cc>esprehn+autocc</cc>
    
    <cc>ews-watchlist</cc>
    
    <cc>kangil.han</cc>
    
    <cc>webkit-bug-importer</cc>
    
    <cc>ysuzuki</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1750446</commentid>
    <comment_count>0</comment_count>
    <who name="Ryosuke Niwa">rniwa</who>
    <bug_when>2021-04-14 19:16:46 -0700</bug_when>
    <thetext>Getting nextSibling() will involve loading the first child into the register.
Avoid that and just check m_firstChild and m_lastChild instead to avoid this extra memory load.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1750452</commentid>
    <comment_count>1</comment_count>
      <attachid>426070</attachid>
    <who name="Ryosuke Niwa">rniwa</who>
    <bug_when>2021-04-14 19:43:00 -0700</bug_when>
    <thetext>Created attachment 426070
Patch</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1750454</commentid>
    <comment_count>2</comment_count>
      <attachid>426070</attachid>
    <who name="Chris Dumez">cdumez</who>
    <bug_when>2021-04-14 19:47:33 -0700</bug_when>
    <thetext>Comment on attachment 426070
Patch

If you say this is more efficient, I believe you. R=me. The new code definitely still is correct.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1750455</commentid>
    <comment_count>3</comment_count>
    <who name="Ryosuke Niwa">rniwa</who>
    <bug_when>2021-04-14 19:52:44 -0700</bug_when>
    <thetext>(In reply to Chris Dumez from comment #2)
&gt; Comment on attachment 426070 [details]
&gt; Patch
&gt; 
&gt; If you say this is more efficient, I believe you. R=me. The new code
&gt; definitely still is correct.

Yeah because m_firstChild and m_lastChild are both in the same object whereas m_firstChild isn&apos;t. CPU needs to load the content of m_firstChild and then retrieve m_nextSibling, which is an indirect load that CPU will have a hard time predicting so whilst prefetched would detect this and will fetch it, it can still result in either TLB hit miss and/or L2/L3 cache misses, which would be horrifyingly expensive.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1750466</commentid>
    <comment_count>4</comment_count>
      <attachid>426070</attachid>
    <who name="Ryosuke Niwa">rniwa</who>
    <bug_when>2021-04-14 20:34:17 -0700</bug_when>
    <thetext>Comment on attachment 426070
Patch

Clearing flags on attachment: 426070

Committed r275997 (236549@main): &lt;https://commits.webkit.org/236549@main&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1750467</commentid>
    <comment_count>5</comment_count>
    <who name="Ryosuke Niwa">rniwa</who>
    <bug_when>2021-04-14 20:34:19 -0700</bug_when>
    <thetext>All reviewed patches have been landed.  Closing bug.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1750468</commentid>
    <comment_count>6</comment_count>
    <who name="Radar WebKit Bug Importer">webkit-bug-importer</who>
    <bug_when>2021-04-14 20:35:15 -0700</bug_when>
    <thetext>&lt;rdar://problem/76682121&gt;</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="1"
              isprivate="0"
          >
            <attachid>426070</attachid>
            <date>2021-04-14 19:43:00 -0700</date>
            <delta_ts>2021-04-14 20:34:17 -0700</delta_ts>
            <desc>Patch</desc>
            <filename>fix224589.patch</filename>
            <type>text/plain</type>
            <size>1658</size>
            <attacher name="Ryosuke Niwa">rniwa</attacher>
            
              <data encoding="base64">ZGlmZiAtLWdpdCBhL1NvdXJjZS9XZWJDb3JlL0NoYW5nZUxvZyBiL1NvdXJjZS9XZWJDb3JlL0No
YW5nZUxvZwppbmRleCA4ODM4MTU2NDRlY2IuLjk2MThlNzJlZWY3MiAxMDA2NDQKLS0tIGEvU291
cmNlL1dlYkNvcmUvQ2hhbmdlTG9nCisrKyBiL1NvdXJjZS9XZWJDb3JlL0NoYW5nZUxvZwpAQCAt
MSwzICsxLDE2IEBACisyMDIxLTA0LTE0ICBSeW9zdWtlIE5pd2EgIDxybml3YUB3ZWJraXQub3Jn
PgorCisgICAgICAgIEF2b2lkIGluZGlyZWN0IGxvYWQgaW4gQ29udGFpbmVyTm9kZTo6aGFzT25l
Q2hpbGQoKQorICAgICAgICBodHRwczovL2J1Z3Mud2Via2l0Lm9yZy9zaG93X2J1Zy5jZ2k/aWQ9
MjI0NTg5CisKKyAgICAgICAgUmV2aWV3ZWQgYnkgTk9CT0RZIChPT1BTISkuCisKKyAgICAgICAg
R2V0dGluZyBuZXh0U2libGluZygpIHdpbGwgaW52b2x2ZSBsb2FkaW5nIHRoZSBmaXJzdCBjaGls
ZCBpbnRvIHRoZSByZWdpc3Rlci4KKyAgICAgICAgQXZvaWQgdGhhdCBhbmQganVzdCBjaGVjayBt
X2ZpcnN0Q2hpbGQgYW5kIG1fbGFzdENoaWxkIGluc3RlYWQgdG8gYXZvaWQgdGhpcyBleHRyYSBt
ZW1vcnkgbG9hZC4K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