<?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>156034</bug_id>
          
          <creation_ts>2016-03-30 12:36:07 -0700</creation_ts>
          <short_desc>DFG JIT bug in typeof constant folding where the input to typeof is an object or function</short_desc>
          <delta_ts>2016-08-11 18:47:39 -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>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="Saam Barati">saam</assigned_to>
          <cc>benjamin</cc>
    
    <cc>commit-queue</cc>
    
    <cc>fpizlo</cc>
    
    <cc>ggaren</cc>
    
    <cc>john.david.dalton</cc>
    
    <cc>keith_miller</cc>
    
    <cc>mark.lam</cc>
    
    <cc>msaboff</cc>
    
    <cc>saam</cc>
    
    <cc>webkit-bug-importer</cc>
    
    <cc>ysuzuki</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1179136</commentid>
    <comment_count>0</comment_count>
    <who name="Ryosuke Niwa">rniwa</who>
    <bug_when>2016-03-30 12:36:07 -0700</bug_when>
    <thetext>Reported on https://github.com/gaearon/normalizr/pull/82#issuecomment-203589131

Repro steps:
1. Open https://jsbin.com/coquxaduhu/1/edit?html,js,output
2. Wait for a few iterations until &quot;looks okay&quot; turns &quot;missing entities.tweets&quot;.

There&apos;s a smaller js file reported to reproduce the same issue at:
https://github.com/gaearon/normalizr/pull/82#issuecomment-203590718

I&apos;m sorry but I don&apos;t understand what this bug is about since the comments in the Github issue is super vague :(</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1179142</commentid>
    <comment_count>1</comment_count>
    <who name="Ryosuke Niwa">rniwa</who>
    <bug_when>2016-03-30 12:36:57 -0700</bug_when>
    <thetext>This is the function that&apos;s exhibiting non-deterministic behavior as far as I can tell:
https://github.com/lodash/lodash/blob/55c3299d5c04ee8b035ee86f034ec222f4570167/lodash.js#L12308</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1179144</commentid>
    <comment_count>2</comment_count>
    <who name="Ryosuke Niwa">rniwa</who>
    <bug_when>2016-03-30 12:39:05 -0700</bug_when>
    <thetext>This is currently affecting Safari users on Twitter until they push the workaround to the production.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1179145</commentid>
    <comment_count>3</comment_count>
    <who name="Radar WebKit Bug Importer">webkit-bug-importer</who>
    <bug_when>2016-03-30 12:39:29 -0700</bug_when>
    <thetext>&lt;rdar://problem/25446785&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1179189</commentid>
    <comment_count>4</comment_count>
    <who name="Ryosuke Niwa">rniwa</who>
    <bug_when>2016-03-30 14:36:46 -0700</bug_when>
    <thetext>React Proxy is claimed to be hitting the same issue:
https://github.com/gaearon/react-proxy/issues/55

So it seems that problem here that we mistakenly return &quot;object&quot; for typeof of a function in some JITed code.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1179238</commentid>
    <comment_count>5</comment_count>
    <who name="Ryosuke Niwa">rniwa</who>
    <bug_when>2016-03-30 16:56:00 -0700</bug_when>
    <thetext>It looks like disabling DFG fixes this bug.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1179248</commentid>
    <comment_count>6</comment_count>
    <who name="Ryosuke Niwa">rniwa</who>
    <bug_when>2016-03-30 17:24:58 -0700</bug_when>
    <thetext>Saam pinpointed the bug to http://trac.webkit.org/browser/trunk/Source/JavaScriptCore/dfg/DFGAbstractInterpreterInlines.h?rev=198865#L1173</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1179250</commentid>
    <comment_count>7</comment_count>
    <who name="Ryosuke Niwa">rniwa</who>
    <bug_when>2016-03-30 17:32:52 -0700</bug_when>
    <thetext>Minimum reproduction (credit: Saam): https://gist.github.com/anonymous/49715c82e834f8e2c184d35a821ec468</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1179271</commentid>
    <comment_count>8</comment_count>
      <attachid>275249</attachid>
    <who name="Saam Barati">saam</who>
    <bug_when>2016-03-30 18:03:20 -0700</bug_when>
    <thetext>Created attachment 275249
patch</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1179495</commentid>
    <comment_count>9</comment_count>
      <attachid>275249</attachid>
    <who name="WebKit Commit Bot">commit-queue</who>
    <bug_when>2016-03-31 11:28:45 -0700</bug_when>
    <thetext>Comment on attachment 275249
patch

Clearing flags on attachment: 275249

Committed r198902: &lt;http://trac.webkit.org/changeset/198902&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1179496</commentid>
    <comment_count>10</comment_count>
    <who name="WebKit Commit Bot">commit-queue</who>
    <bug_when>2016-03-31 11:28:51 -0700</bug_when>
    <thetext>All reviewed patches have been landed.  Closing bug.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1219438</commentid>
    <comment_count>11</comment_count>
    <who name="John-David Dalton">john.david.dalton</who>
    <bug_when>2016-08-11 15:58:48 -0700</bug_when>
    <thetext>Do you all know which updates this fix is in? I&apos;m looking for an idea of when to pull the workaround in my code.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1219440</commentid>
    <comment_count>12</comment_count>
    <who name="Benjamin Poulain">benjamin</who>
    <bug_when>2016-08-11 16:18:26 -0700</bug_when>
    <thetext>(In reply to comment #11)
&gt; Do you all know which updates this fix is in? I&apos;m looking for an idea of
&gt; when to pull the workaround in my code.

The patch should be in Safari 10 and iOS 10.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1219507</commentid>
    <comment_count>13</comment_count>
    <who name="Ryosuke Niwa">rniwa</who>
    <bug_when>2016-08-11 18:47:39 -0700</bug_when>
    <thetext>(In reply to comment #11)
&gt; Do you all know which updates this fix is in? I&apos;m looking for an idea of
&gt; when to pull the workaround in my code.

You should be able to work around the bug in old versions of Safari by wrapping the code in try {} catch {}. e.g.

try {
    return typdeof(obj) == &apos;array&apos;;
} catch (e) { }

typeof would never throw but this will disable DFG JIT, which had this bug, from compiling the code in iOS 9 / Safari 9.</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="1"
              isprivate="0"
          >
            <attachid>275249</attachid>
            <date>2016-03-30 18:03:20 -0700</date>
            <delta_ts>2016-03-31 11:28:45 -0700</delta_ts>
            <desc>patch</desc>
            <filename>a-backup.diff</filename>
            <type>text/plain</type>
            <size>2887</size>
            <attacher name="Saam Barati">saam</attacher>
            
              <data encoding="base64">SW5kZXg6IFNvdXJjZS9KYXZhU2NyaXB0Q29yZS9DaGFuZ2VMb2cKPT09PT09PT09PT09PT09PT09
PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PQotLS0gU291
cmNlL0phdmFTY3JpcHRDb3JlL0NoYW5nZUxvZwkocmV2aXNpb24gMTk4ODY4KQorKysgU291cmNl
L0phdmFTY3JpcHRDb3JlL0NoYW5nZUxvZwkod29ya2luZyBjb3B5KQpAQCAtMSwzICsxLDI1IEBA
CisyMDE2LTAzLTMwICBTYWFtIGJhcmF0aSAgPHNiYXJhdGlAYXBwbGUuY29tPgorCisgICAgICAg
IERGRyBKSVQgYnVnIGluIHR5cGVvZiBjb25zdGFudCBmb2xkaW5nIHdoZXJlIHRoZSBpbnB1dCB0
byB0eXB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KyAgICBpZiAoYm9v
bCkKKyAgICAgICAgYXNzZXJ0KHJlc3VsdCA9PT0gIm9iamVjdCIpOworICAgIGVsc2UKKyAgICAg
ICAgYXNzZXJ0KHJlc3VsdCA9PT0gImZ1bmN0aW9uIik7Cit9Cg==
</data>

          </attachment>
      

    </bug>

</bugzilla>