<?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>129657</bug_id>
          
          <creation_ts>2014-03-03 21:18:30 -0800</creation_ts>
          <short_desc>AbstractMacroAssembler::CachedTempRegister should start out invalid</short_desc>
          <delta_ts>2014-04-24 16:46:03 -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>JavaScriptCore</component>
          <version>528+ (Nightly build)</version>
          <rep_platform>All</rep_platform>
          <op_sys>All</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="Michael Saboff">msaboff</reporter>
          <assigned_to name="Michael Saboff">msaboff</assigned_to>
          
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>986665</commentid>
    <comment_count>0</comment_count>
    <who name="Michael Saboff">msaboff</who>
    <bug_when>2014-03-03 21:18:30 -0800</bug_when>
    <thetext>Currently AbstractMacroAssembler::CachedTempRegister() are initialized with a value of 0 and that the contents are valid.  Instead they should be mark as invalid as we don&apos;t know the prior contents before the first use.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>986669</commentid>
    <comment_count>1</comment_count>
    <who name="Michael Saboff">msaboff</who>
    <bug_when>2014-03-03 21:27:52 -0800</bug_when>
    <thetext>&lt;rdar://problem/16214527&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>986670</commentid>
    <comment_count>2</comment_count>
      <attachid>225738</attachid>
    <who name="Michael Saboff">msaboff</who>
    <bug_when>2014-03-03 21:30:28 -0800</bug_when>
    <thetext>Created attachment 225738
Patch</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>986674</commentid>
    <comment_count>3</comment_count>
      <attachid>225738</attachid>
    <who name="Mark Lam">mark.lam</who>
    <bug_when>2014-03-03 21:39:39 -0800</bug_when>
    <thetext>Comment on attachment 225738
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=225738&amp;action=review

&gt; Source/JavaScriptCore/assembler/AbstractMacroAssembler.h:881
&gt; +            , m_validBit(0 &lt;&lt; static_cast&lt;unsigned&gt;(registerID))

Why not just &quot;m_validBit(0)”?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>986675</commentid>
    <comment_count>4</comment_count>
    <who name="Michael Saboff">msaboff</who>
    <bug_when>2014-03-03 21:43:49 -0800</bug_when>
    <thetext>(In reply to comment #3)
&gt; (From update of attachment 225738 [details])
&gt; View in context: https://bugs.webkit.org/attachment.cgi?id=225738&amp;action=review
&gt; 
&gt; &gt; Source/JavaScriptCore/assembler/AbstractMacroAssembler.h:881
&gt; &gt; +            , m_validBit(0 &lt;&lt; static_cast&lt;unsigned&gt;(registerID))
&gt; 
&gt; Why not just &quot;m_validBit(0)”?

Actually, the is the wrong value to clear.  Updated patch coming.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>986676</commentid>
    <comment_count>5</comment_count>
      <attachid>225738</attachid>
    <who name="Geoffrey Garen">ggaren</who>
    <bug_when>2014-03-03 21:55:53 -0800</bug_when>
    <thetext>Comment on attachment 225738
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=225738&amp;action=review

&gt; Source/JavaScriptCore/ChangeLog:12
&gt; +        - Changed the setting of the valid bit to 0 (not valid) in the constructor as
&gt; +          we don&apos;t know the contents of the register at the entry to the block we
&gt; +          are going to generate code for.

Are you assuming that all JITs -- including the baseline JIT, the DFG, and the CSS selector JIT -- instantiate a new MacroAssembler at the head of each basic block?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>986678</commentid>
    <comment_count>6</comment_count>
      <attachid>225741</attachid>
    <who name="Michael Saboff">msaboff</who>
    <bug_when>2014-03-03 22:01:50 -0800</bug_when>
    <thetext>Created attachment 225741
Updated patch

Updated after Mark caught that I was invalidating incorrectly.

(In reply to comment #5)
&gt; (From update of attachment 225738 [details])
&gt; View in context: https://bugs.webkit.org/attachment.cgi?id=225738&amp;action=review
&gt; 
&gt; &gt; Source/JavaScriptCore/ChangeLog:12
&gt; &gt; +        - Changed the setting of the valid bit to 0 (not valid) in the constructor as
&gt; &gt; +          we don&apos;t know the contents of the register at the entry to the block we
&gt; &gt; +          are going to generate code for.
&gt; 
&gt; Are you assuming that all JITs -- including the baseline JIT, the DFG, and the CSS selector JIT -- instantiate a new MacroAssembler at the head of each basic block?

Poor choice of words.  I changed &quot;block&quot; to &quot;code&quot;.  This fix has nothing to do with basic blocks.

Whenever we create a MacroAssembler, we need to start with the cached register values as invalid.  In the case that triggered this issue, we were generating small stubs and used the temporary registers to materialize constants that fit in 16 bits.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>986681</commentid>
    <comment_count>7</comment_count>
    <who name="Michael Saboff">msaboff</who>
    <bug_when>2014-03-03 22:32:45 -0800</bug_when>
    <thetext>Committed r165038: &lt;http://trac.webkit.org/changeset/165038&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1003878</commentid>
    <comment_count>8</comment_count>
    <who name="Darin Adler">darin</who>
    <bug_when>2014-04-24 16:46:03 -0700</bug_when>
    <thetext>Moving all JavaScriptGlue bugs to JavaScriptCore. The JavaScriptGlue framework itself is long gone. And most of the more recent bugs put in this component were put there by people who thought this was for some other aspect of “JavaScript glue” and have nothing to do with the actual original reason for the existence of this component, which was an OS-X-only framework named JavaScriptGlue.</thetext>
  </long_desc>
      
          <attachment
              isobsolete="1"
              ispatch="1"
              isprivate="0"
          >
            <attachid>225738</attachid>
            <date>2014-03-03 21:30:28 -0800</date>
            <delta_ts>2014-03-03 22:01:50 -0800</delta_ts>
            <desc>Patch</desc>
            <filename>129657.patch</filename>
            <type>text/plain</type>
            <size>1543</size>
            <attacher name="Michael Saboff">msaboff</attacher>
            
              <data encoding="base64">SW5kZXg6IFNvdXJjZS9KYXZhU2NyaXB0Q29yZS9DaGFuZ2VMb2cKPT09PT09PT09PT09PT09PT09
PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PQotLS0gU291
cmNlL0phdmFTY3JpcHRDb3JlL0NoYW5nZUxvZwkocmV2aXNpb24gMTY1MDM2KQorKysgU291cmNl
L0phdmFTY3JpcHRDb3JlL0NoYW5nZUxvZwkod29ya2luZyBjb3B5KQpAQCAtMSwzICsxLDE2IEBA
CisyMDE0LTAzLTAzICBNaWNoYWVsIFNhYm9mZiAgPG1zYWJvZmZAYXBwbGUuY29tPgorCisgICAg
ICAgIEFic3RyYWN0TWFjcm9Bc3NlbWJsZXI6OkNhY2hlZFRlbXBSZWdpc3RlciBzaG91bGQgc3Rh
cnQgb3V0IGludmFsaWQKKyAgICAgICAgaHR0cHM6Ly9idWdzLndlYmtpdC5vcmcvc2hvd19idWcu
Y2dpP2lkPTEyOTY1NworCisgICAgICAgIFJldmlld2VkIGJ5IE5PQk9EWSAoT09QUyEpLgorCisg
ICAgICAgICogYXNzZW1ibGVyL0Fic3RyYWN0TWFjcm9Bc3NlbWJsZXIuaDoKKyAgICAgICAgKEpT
Qzo6QWJzdHJhY3RNYWNyb0Fzc2VtYmxlcjo6Q2FjaGVkVGVtcFJlZ2lzdGVyOjpDYWNoZWRUZW1w
UmVnaXN0ZXIpOgorICAgICAgICAtIENoYW5nZWQgdGhlIHNldHRpbmcgb2YgdGhlIHZhbGlkIGJp
dCB0byAwIChub3QgdmFsaWQpIGluIHRoZSBjb25zdHJ1Y3RvciBhcworICAgICAgICAgIHdlIGRv
bid0IGtub3cgdGhlIGNvbnRlbn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Ag
ICB9Cg==
</data>
<flag name="review"
          id="249899"
          type_id="1"
          status="-"
          setter="msaboff"
    />
          </attachment>
          <attachment
              isobsolete="0"
              ispatch="1"
              isprivate="0"
          >
            <attachid>225741</attachid>
            <date>2014-03-03 22:01:50 -0800</date>
            <delta_ts>2014-03-03 22:23:02 -0800</delta_ts>
            <desc>Updated patch</desc>
            <filename>129657-2.patch</filename>
            <type>text/plain</type>
            <size>1329</size>
            <attacher name="Michael Saboff">msaboff</attacher>
            
              <data encoding="base64">SW5kZXg6IFNvdXJjZS9KYXZhU2NyaXB0Q29yZS9DaGFuZ2VMb2cKPT09PT09PT09PT09PT09PT09
PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PQotLS0gU291
cmNlL0phdmFTY3JpcHRDb3JlL0NoYW5nZUxvZwkocmV2aXNpb24gMTY1MDM2KQorKysgU291cmNl
L0phdmFTY3JpcHRDb3JlL0NoYW5nZUxvZwkod29ya2luZyBjb3B5KQpAQCAtMSwzICsxLDE2IEBA
CisyMDE0LTAzLTAzICBNaWNoYWVsIFNhYm9mZiAgPG1zYWJvZmZAYXBwbGUuY29tPgorCisgICAg
ICAgIEFic3RyYWN0TWFjcm9Bc3NlbWJsZXI6OkNhY2hlZFRlbXBSZWdpc3RlciBzaG91bGQgc3Rh
cnQgb3V0IGludmFsaWQKKyAgICAgICAgaHR0cHM6Ly9idWdzLndlYmtpdC5vcmcvc2hvd19idWcu
Y2dpP2lkPTEyOTY1NworCisgICAgICAgIFJldmlld2VkIGJ5IE5PQk9EWSAoT09QUyEpLgorCisg
ICAgICAgICogYXNzZW1ibGVyL0Fic3RyYWN0TWFjcm9Bc3NlbWJsZXIuaDoKKyAgICAgICAgKEpT
Qzo6QWJzdHJhY3RNYWNyb0Fzc2VtYmxlcjo6QWJzdHJhY3RNYWNyb0Fzc2VtYmxlcik6CisgICAg
ICAgIC0gSW52YWxpZGF0ZSBhbGwgY2FjaGVkIHJlZ2lzdGVycyBpbiBjb25zdHJ1Y3RvciBhcyB3
ZSBkb24ndCBrbm93IHRoZQorICAgICAgICAgIGNvbnRlbnRzIG9mIGFueSByZWdpc3RlciBhdCB0
aGUgZW50cnkgdG8gdGhlIGNvZGUgd2UgYXJlIGdvaW5nIHRvCisgICAgICAgICAgZ2VuZXJhdGUu
CisKIDIwMTQtMDMtMDMgIEFuZHJlYXMgS2xpbmcgIDxha2xpbmdAYXBwbGUuY29tPgogCiAgICAg
ICAgIFN0cnVjdHVyZU9yT2Zmc2V0IHNob3VsZCBiZSBmYXN0bWFsbG9jZWQuCkluZGV4OiBTb3Vy
Y2UvSmF2YVNjcmlwdENvcmUvYXNzZW1ibGVyL0Fic3RyYWN0TWFjcm9Bc3NlbWJsZXIuaAo9PT09
PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09
PT09PT09Ci0tLSBTb3VyY2UvSmF2YVNjcmlwdENvcmUvYXNzZW1ibGVyL0Fic3RyYWN0TWFjcm9B
c3NlbWJsZXIuaAkocmV2aXNpb24gMTY1MDIxKQorKysgU291cmNlL0phdmFTY3JpcHRDb3JlL2Fz
c2VtYmxlci9BYnN0cmFjdE1hY3JvQXNzZW1ibGVyLmgJKHdvcmtpbmcgY29weSkKQEAgLTg0MCw2
ICs4NDAsNyBAQCBwcm90ZWN0ZWQ6CiAgICAgQWJzdHJhY3RNYWNyb0Fzc2VtYmxlcigpCiAgICAg
ICAgIDogbV9yYW5kb21Tb3VyY2UoY3J5cHRvZ3JhcGhpY2FsbHlSYW5kb21OdW1iZXIoKSkKICAg
ICB7CisgICAgICAgIGludmFsaWRhdGVBbGxUZW1wUmVnaXN0ZXJzKCk7CiAgICAgfQogCiAgICAg
dWludDMyX3QgcmFuZG9tKCkK
</data>
<flag name="review"
          id="249902"
          type_id="1"
          status="+"
          setter="fpizlo"
    />
          </attachment>
      

    </bug>

</bugzilla>