<?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>88438</bug_id>
          
          <creation_ts>2012-06-06 11:41:39 -0700</creation_ts>
          <short_desc>Setting scratch buffer usage in osrExitGenerationThunkGenerator trashes arg0 on ARM</short_desc>
          <delta_ts>2012-06-06 12:01:22 -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>Unspecified</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>DUPLICATE</resolution>
          <dup_id>87307</dup_id>
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>Major</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>642650</commentid>
    <comment_count>0</comment_count>
    <who name="Michael Saboff">msaboff</who>
    <bug_when>2012-06-06 11:41:39 -0700</bug_when>
    <thetext>In osrExitGenerationThunkGenerator(), after setting up arg0, we store the active length of the scratch register.  We use regT0 to set the size, but regT0 is also argumentGPR0 on ARM. 

..
    // Set up one argument.
#if CPU(X86)
    jit.poke(GPRInfo::callFrameRegister, 0);
#else
    jit.move(GPRInfo::callFrameRegister, GPRInfo::argumentGPR0);
#endif

    // Tell GC mark phase how much of the scratch buffer is active during call.
    jit.move(MacroAssembler::TrustedImmPtr(scratchBuffer-&gt;activeLengthPtr()), GPRInfo::regT0);  &lt;== This wil trash arg0
    jit.storePtr(MacroAssembler::TrustedImmPtr(scratchSize), GPRInfo::regT0);
    
    MacroAssembler::Call functionCall = jit.call();

...

The fix is to move the storing of the active scratch buffer length to before setting up arg0.

A visual inspection of the other locations in the code where we set the scratch buffer active length appear safe. either because we use an allocated register or because regT0 is available.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>642673</commentid>
    <comment_count>1</comment_count>
    <who name="Michael Saboff">msaboff</who>
    <bug_when>2012-06-06 12:01:22 -0700</bug_when>
    <thetext>

*** This bug has been marked as a duplicate of bug 87307 ***</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>