<?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>96893</bug_id>
          
          <creation_ts>2012-09-16 22:52:43 -0700</creation_ts>
          <short_desc>32-bit LLInt get_by_val does vector length checks incorrectly</short_desc>
          <delta_ts>2012-09-17 16:36:57 -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>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="Mark Lam">mark.lam</reporter>
          <assigned_to name="Filip Pizlo">fpizlo</assigned_to>
          <cc>fpizlo</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>721686</commentid>
    <comment_count>0</comment_count>
    <who name="Mark Lam">mark.lam</who>
    <bug_when>2012-09-16 22:52:43 -0700</bug_when>
    <thetext>The butterflies (r128400) are causing crashes in the 32-bit build.  I&apos;ve confirmed this by running the JS part of the layout as follows:

$ ./Tools/Scripts/run-webkit-tests --debug --32-bit fast/js fast/regex ietestcenter/Javascript sputnik

The crashes started to manifest on r128400.  They do not on r128369.

Here&apos;s what an example call trace looks like:
Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0   com.apple.JavaScriptCore      	0x00724ad7 llint_op_get_by_val + 150
1   com.apple.JavaScriptCore      	0x004fa434 JSC::JITCode::execute(JSC::RegisterFile*, JSC::ExecState*, JSC::JSGlobalData*) + 100 (JITCode.h:134)
2   com.apple.JavaScriptCore      	0x004f61d6 JSC::Interpreter::execute(JSC::ProgramExecutable*, JSC::ExecState*, JSC::JSObject*) + 5814 (Interpreter.cpp:991)
3   com.apple.JavaScriptCore      	0x003a4e7f JSC::evaluate(JSC::ExecState*, JSC::SourceCode const&amp;, JSC::JSValue, JSC::JSValue*) + 559 (Completion.cpp:75)
4   com.apple.WebCore             	0x02271c98 WebCore::JSMainThreadExecState::evaluate(JSC::ExecState*, JSC::SourceCode const&amp;, JSC::JSValue, JSC::JSValue*) + 120 (JSMainThreadExecState.h:77)
5   com.apple.WebCore             	0x02b0ce4e WebCore::ScriptController::evaluateInWorld(WebCore::ScriptSourceCode const&amp;, WebCore::DOMWrapperWorld*) + 350 (ScriptController.cpp:148)
6   com.apple.WebCore             	0x02b0cf91 WebCore::ScriptController::evaluate(WebCore::ScriptSourceCode const&amp;) + 65 (ScriptController.cpp:165)
7   com.apple.WebCore             	0x02b2659a WebCore::ScriptElement::executeScript(WebCore::ScriptSourceCode const&amp;) + 794 (ScriptElement.cpp:301)
8   com.apple.WebCore             	0x02b250fa WebCore::ScriptElement::prepareScript(WTF::TextPosition const&amp;, WebCore::ScriptElement::LegacyTypeSupport) + 1770 (ScriptElement.cpp:241)
9   com.apple.WebCore             	0x01d5c7ce WebCore::HTMLScriptRunner::runScript(WebCore::Element*, WTF::TextPosition const&amp;) + 510 (HTMLScriptRunner.cpp:292)
...

From running the C++ llint, I found that the crash occurs here:
_llint_op_get_by_val:
    traceExecution()
    loadi 8[PC], t2
    loadi 12[PC], t3
    loadConstantOrVariablePayload(t2, CellTag, t0, .opGetByValSlow)
    loadConstantOrVariablePayload(t3, Int32Tag, t1, .opGetByValSlow)
    loadp JSCell::m_structure[t0], t3
    loadp 16[PC], t2
    if VALUE_PROFILER
        storep t3, ArrayProfile::m_lastSeenStructure[t2]
    end
    btpz Structure::m_indexingType[t3], HasArrayStorage, .opGetByValSlow
    loadp JSObject::m_butterfly[t0], t3
    biaeq t1, -sizeof IndexingHeader + IndexingHeader::m_vectorLength[t0], .opGetByValSlow
    loadi 4[PC], t0
    loadi ArrayStorage::m_vector + TagOffset[t3, t1, 8], t2      // &lt;=== Crashed here.
    loadi ArrayStorage::m_vector + PayloadOffset[t3, t1, 8], t1
    bieq t2, EmptyValueTag, .opGetByValSlow

The crash is at the above line in LowLevelInterpreter32_64.asm.  The crash does not manifest consistently on any one test (except when I run it in the C++ llint on the Windows port).  But if I run those 4 tests together (fast/js fast/regex ietestcenter/Javascript sputnik), the crash will manifest in several tests, usually a few in ietestcenter/... and many more in sputnik/.…

To repro the crashes, you will need to set useJIT() and useDFGJIT() to false in Options.cpp and run interpreted only.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>722008</commentid>
    <comment_count>1</comment_count>
    <who name="Geoffrey Garen">ggaren</who>
    <bug_when>2012-09-17 09:39:51 -0700</bug_when>
    <thetext>&lt;rdar://problem/12311678&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>722276</commentid>
    <comment_count>2</comment_count>
    <who name="Filip Pizlo">fpizlo</who>
    <bug_when>2012-09-17 14:37:38 -0700</bug_when>
    <thetext>This appears fixed as of http://trac.webkit.org/changeset/128790</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>722300</commentid>
    <comment_count>3</comment_count>
    <who name="Mark Lam">mark.lam</who>
    <bug_when>2012-09-17 15:03:24 -0700</bug_when>
    <thetext>Filip managed to repro the issue.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>722366</commentid>
    <comment_count>4</comment_count>
      <attachid>164473</attachid>
    <who name="Filip Pizlo">fpizlo</who>
    <bug_when>2012-09-17 16:34:22 -0700</bug_when>
    <thetext>Created attachment 164473
the patch</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>722367</commentid>
    <comment_count>5</comment_count>
      <attachid>164473</attachid>
    <who name="Mark Hahnenberg">mhahnenberg</who>
    <bug_when>2012-09-17 16:35:04 -0700</bug_when>
    <thetext>Comment on attachment 164473
the patch

r=me</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>722368</commentid>
    <comment_count>6</comment_count>
    <who name="Filip Pizlo">fpizlo</who>
    <bug_when>2012-09-17 16:36:57 -0700</bug_when>
    <thetext>Landed in http://trac.webkit.org/changeset/128822</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="1"
              isprivate="0"
          >
            <attachid>164473</attachid>
            <date>2012-09-17 16:34:22 -0700</date>
            <delta_ts>2012-09-17 16:35:04 -0700</delta_ts>
            <desc>the patch</desc>
            <filename>fixllint32_patch_1.diff</filename>
            <type>text/plain</type>
            <size>1464</size>
            <attacher name="Filip Pizlo">fpizlo</attacher>
            
              <data encoding="base64">SW5kZXg6IFNvdXJjZS9KYXZhU2NyaXB0Q29yZS9DaGFuZ2VMb2cKPT09PT09PT09PT09PT09PT09
PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PQotLS0gU291
cmNlL0phdmFTY3JpcHRDb3JlL0NoYW5nZUxvZwkocmV2aXNpb24gMTI4ODIwKQorKysgU291cmNl
L0phdmFTY3JpcHRDb3JlL0NoYW5nZUxvZwkod29ya2luZyBjb3B5KQpAQCAtMSwzICsxLDEzIEBA
CisyMDEyLTA5LTE3ICBGaWxpcCBQaXpsbyAgPGZwaXpsb0BhcHBsZS5jb20+CisKKyAgICAgICAg
MzItYml0IExMSW50IGdldF9ieV92YWwgZG9lcyB2ZWN0b3IgbGVuZ3RoIGNoZWNrcyBpbmNvcnJl
Y3RseQorICAgICAgICBodHRwczovL2J1Z3Mud2Via2l0Lm9yZy9zaG93X2J1Zy5jZ2k/aWQ9OTY4
OTMKKyAgICAgICAgPHJkYXI6Ly9wcm9ibGVtLzEyMzExNjc4PgorCisgICAgICAgIFJldmlld2Vk
IGJ5IE5PQk9EWSAoT09QUyEpLgorCisg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bdDNdLCAub3BHZXRCeVZh
bFNsb3cKICAgICBsb2FkaSA0W1BDXSwgdDAKICAgICBsb2FkaSBBcnJheVN0b3JhZ2U6Om1fdmVj
dG9yICsgVGFnT2Zmc2V0W3QzLCB0MSwgOF0sIHQyCiAgICAgbG9hZGkgQXJyYXlTdG9yYWdlOjpt
X3ZlY3RvciArIFBheWxvYWRPZmZzZXRbdDMsIHQxLCA4XSwgdDEK
</data>
<flag name="review"
          id="176252"
          type_id="1"
          status="+"
          setter="mhahnenberg"
    />
          </attachment>
      

    </bug>

</bugzilla>