<?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>34939</bug_id>
          
          <creation_ts>2010-02-15 05:01:19 -0800</creation_ts>
          <short_desc>Fix the SP at ctiOpThrowNotCaught on Thumb2 (JSVALUE32)</short_desc>
          <delta_ts>2010-02-15 23:42:33 -0800</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>Other</rep_platform>
          <op_sys>Other</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>Critical</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Gabor Loki">loki</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>barraclough</cc>
    
    <cc>commit-queue</cc>
    
    <cc>zherczeg</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>190430</commentid>
    <comment_count>0</comment_count>
    <who name="Gabor Loki">loki</who>
    <bug_when>2010-02-15 05:01:19 -0800</bug_when>
    <thetext>There is a typo inside ctiOpThrowNotCaught for JSValue32 on Thumb2.
The SP addition should be 0x40 (according to ctiTrampoline).</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>190431</commentid>
    <comment_count>1</comment_count>
      <attachid>48747</attachid>
    <who name="Gabor Loki">loki</who>
    <bug_when>2010-02-15 05:02:56 -0800</bug_when>
    <thetext>Created attachment 48747
Fix the SP at ctiOpThrowNotCaught on Thumb2 (JSVALUE32)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>190432</commentid>
    <comment_count>2</comment_count>
    <who name="Zoltan Herczeg">zherczeg</who>
    <bug_when>2010-02-15 05:30:09 -0800</bug_when>
    <thetext>Nice catch. Oh wait, this is a fix for not catch :)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>190433</commentid>
    <comment_count>3</comment_count>
    <who name="Gabor Loki">loki</who>
    <bug_when>2010-02-15 05:41:03 -0800</bug_when>
    <thetext>&gt; Nice catch. Oh wait, this is a fix for not catch :)

Hahaha. Thanks Pal! ;)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>190604</commentid>
    <comment_count>4</comment_count>
      <attachid>48747</attachid>
    <who name="Gavin Barraclough">barraclough</who>
    <bug_when>2010-02-15 22:41:26 -0800</bug_when>
    <thetext>Comment on attachment 48747
Fix the SP at ctiOpThrowNotCaught on Thumb2 (JSVALUE32)

r+, but...

Here&apos;s one way you could make this awesomer.

The underlying problem here is that the hardcoded constants in the asm make this code really error prone - it&apos;s really easy to miss one of these &amp; end up with a typo like this.  So.

The magic value 0x40 represents the amount of stack frame that needs to be dynamically allocated on entry through the cti trampoline stub.  We expect this to be equal to the offset of enabledProfilerReference within JITStackFrame (and assert such in the JITThunks constructor).

You could so something like:

    #define JIT_STACK_FRAME_ALLOCATION 0x40
    #define JIT_STACK_FRAME_ALLOCATION_string STRINGIZE(JIT_STACK_FRAME_ALLOCATION)

then change all the asm to use this string instead of the hardcoded constant, e.g.:

    &quot;add sp, sp,&quot; JIT_STACK_FRAME_ALLOCATION_string &quot;\n&quot;

and make the assert in JITThunks::JITThunks be:

    // The fifth argument is the first item already on the stack.
    ASSERT(OBJECT_OFFSETOF(struct JITStackFrame, enabledProfilerReference) == JIT_STACK_FRAME_ALLOCATION);

Less had coded constants should hopefully make this code less fragile in the future.

r+ with or without the asm/ASSERT changes suggested.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>190611</commentid>
    <comment_count>5</comment_count>
      <attachid>48747</attachid>
    <who name="WebKit Commit Bot">commit-queue</who>
    <bug_when>2010-02-15 23:42:26 -0800</bug_when>
    <thetext>Comment on attachment 48747
Fix the SP at ctiOpThrowNotCaught on Thumb2 (JSVALUE32)

Clearing flags on attachment: 48747

Committed r54809: &lt;http://trac.webkit.org/changeset/54809&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>190612</commentid>
    <comment_count>6</comment_count>
    <who name="WebKit Commit Bot">commit-queue</who>
    <bug_when>2010-02-15 23:42:33 -0800</bug_when>
    <thetext>All reviewed patches have been landed.  Closing bug.</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="1"
              isprivate="0"
          >
            <attachid>48747</attachid>
            <date>2010-02-15 05:02:56 -0800</date>
            <delta_ts>2010-02-15 23:42:26 -0800</delta_ts>
            <desc>Fix the SP at ctiOpThrowNotCaught on Thumb2 (JSVALUE32)</desc>
            <filename>0001-Fix-ctiOpThrowNotCaught.patch</filename>
            <type>text/plain</type>
            <size>1326</size>
            <attacher name="Gabor Loki">loki</attacher>
            
              <data encoding="base64">RnJvbSA3YWNlYzdkOTM1MjQ2ZmVlMDM5MTlkNTg1MmFmOTJhODA3NzE4MDkwIE1vbiBTZXAgMTcg
MDA6MDA6MDAgMjAwMQpGcm9tOiBHYWJvciBMb2tpIDxsb2tpQGluZi51LXN6ZWdlZC5odT4KRGF0
ZTogTW9uLCAxNSBGZWIgMjAxMCAxMTo1MToyMyArMDEwMApTdWJqZWN0OiBbUEFUQ0hdIEZpeCBj
dGlPcFRocm93Tm90Q2F1Z2h0CgpTaWduZWQtb2ZmLWJ5OiBHYWJvciBMb2tpIDxsb2tpQHdlYmtp
dC5vcmc+Ci0tLQogSmF2YVNjcmlwdENvcmUvQ2hhbmdlTG9nICAgICAgICB8ICAgIDggKysrKysr
KysKIEphdmFTY3JpcHRDb3JlL2ppdC9KSVRTdHVicy5jcHAgfCAgICAyICstCiAyI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ogICAgICJs
ZHIgcjUsIFtzcCwgIzB4MjhdIiAiXG4iCiAgICAgImxkciByNCwgW3NwLCAjMHgyNF0iICJcbiIK
ICAgICAibGRyIGxyLCBbc3AsICMweDIwXSIgIlxuIgotICAgICJhZGQgc3AsIHNwLCAjMHgzYyIg
IlxuIgorICAgICJhZGQgc3AsIHNwLCAjMHg0MCIgIlxuIgogICAgICJieCBsciIgIlxuIgogKTsK
IAotLSAKMS41LjQuMwoK
</data>

          </attachment>
      

    </bug>

</bugzilla>