<?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>18649</bug_id>
          
          <creation_ts>2008-04-20 18:27:10 -0700</creation_ts>
          <short_desc>SQUIRRELFISH: correctly handle exceptions in eval code</short_desc>
          <delta_ts>2008-04-21 17:45:33 -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></keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          <blocked>18624</blocked>
          <everconfirmed>1</everconfirmed>
          <reporter name="Cameron Zwarich (cpst)">zwarich</reporter>
          <assigned_to name="Oliver Hunt">oliver</assigned_to>
          <cc>oliver</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>78355</commentid>
    <comment_count>0</comment_count>
    <who name="Cameron Zwarich (cpst)">zwarich</who>
    <bug_when>2008-04-20 18:27:10 -0700</bug_when>
    <thetext>Exceptions are broken in eval code. This leads to assertion failures of the following form when running JavaScriptCore tests:

ASSERTION FAILED: it != end
(./VM/Machine.cpp:431 bool KJS::Machine::unwindCallFrame(KJS::Register**, const KJS::Instruction*&amp;, KJS::CodeBlock*&amp;, KJS::JSValue**&amp;, KJS::ScopeChainNode*&amp;, KJS::Register*&amp;))

ASSERTION FAILED: addressOffset &lt; instructions.size()
(/Users/Cameron/sf/JavaScriptCore/VM/CodeBlock.cpp:541 bool KJS::CodeBlock::getHandlerForVPC(const KJS::Instruction*, KJS::Instruction*&amp;, int&amp;))</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>78356</commentid>
    <comment_count>1</comment_count>
    <who name="Cameron Zwarich (cpst)">zwarich</who>
    <bug_when>2008-04-20 19:13:59 -0700</bug_when>
    <thetext>The it != end assertion failure is hit when throwing an exception from eval in a global context. Global code is a special case at the beginning, because no unwind is necessary, and the rest of the function deals with the case of function code. If the eval is in a global context, then the end of the scope chain is also the top, hitting the assertion.

The addressOffset &lt; instructions.size() assertion failure is hit when throwing an exception from eval in a function context. The top of the scope chain is an activation object, so Machine::unwindCallFrame() thinks it has succeeded when it really hasn&apos;t, passing the buck onto CodeBlock::getHandlerForVPC().
</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>78436</commentid>
    <comment_count>2</comment_count>
    <who name="Oliver Hunt">oliver</who>
    <bug_when>2008-04-21 11:55:32 -0700</bug_when>
    <thetext>Partial fix Committed r32331</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>78488</commentid>
    <comment_count>3</comment_count>
      <attachid>20743</attachid>
    <who name="Oliver Hunt">oliver</who>
    <bug_when>2008-04-21 17:16:48 -0700</bug_when>
    <thetext>Created attachment 20743
Make eval setup a &quot;native&quot; callframe</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>78492</commentid>
    <comment_count>4</comment_count>
      <attachid>20743</attachid>
    <who name="Geoffrey Garen">ggaren</who>
    <bug_when>2008-04-21 17:23:44 -0700</bug_when>
    <thetext>Comment on attachment 20743
Make eval setup a &quot;native&quot; callframe

Need to fix the other eval case. Otherwise, code looks good. Clearing review flag.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>78494</commentid>
    <comment_count>5</comment_count>
      <attachid>20743</attachid>
    <who name="Geoffrey Garen">ggaren</who>
    <bug_when>2008-04-21 17:26:47 -0700</bug_when>
    <thetext>Comment on attachment 20743
Make eval setup a &quot;native&quot; callframe

Sorry, the second version just calls the first, so this looks good.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>78497</commentid>
    <comment_count>6</comment_count>
    <who name="Oliver Hunt">oliver</who>
    <bug_when>2008-04-21 17:45:33 -0700</bug_when>
    <thetext>Committed r32361</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="1"
              isprivate="0"
          >
            <attachid>20743</attachid>
            <date>2008-04-21 17:16:48 -0700</date>
            <delta_ts>2008-04-21 17:26:47 -0700</delta_ts>
            <desc>Make eval setup a &quot;native&quot; callframe</desc>
            <filename>eval-exceptions.patch</filename>
            <type>text/plain</type>
            <size>1755</size>
            <attacher name="Oliver Hunt">oliver</attacher>
            
              <data encoding="base64">ZGlmZiAtLWdpdCBhL0phdmFTY3JpcHRDb3JlL0NoYW5nZUxvZyBiL0phdmFTY3JpcHRDb3JlL0No
YW5nZUxvZwppbmRleCBlYjc5MWIyLi4zNGUzZjk0IDEwMDY0NAotLS0gYS9KYXZhU2NyaXB0Q29y
ZS9DaGFuZ2VMb2cKKysrIGIvSmF2YVNjcmlwdENvcmUvQ2hhbmdlTG9nCkBAIC0xLDMgKzEsMTcg
QEAKKzIwMDgtMDQtMjEgIE9saXZlciBIdW50ICA8b2xpdmVyQGFwcGxlLmNvbT4KKworICAgICAg
ICBSZXZpZXdlZCBieSBOT0JPRFkgKE9PUFMhKS4KKworICAgICAgICBCdWcgMTg2NDk6IFNRVUlS
UkVMRklTSDogY29ycmVjdGx5IGhhbmRsZSBleGNlcHRpb25zIGluIGV2YWwgY29kZQorICAgICAg
ICA8aHR0cHM6Ly9idWdzLndlYmtpdC5vcmcvc2hvd19idWcuY2dpP2lkPTE4NjQ5PgorCisgICAg
ICAgIEFsbG9jYXRlIGEgY2FsbGZyYW1lIGZvciBldmFsKCkgYW5kIGluaXRpYWxpc2Ugd2l0aCBh
IG51bGwgY29kZUJsb2NrIHRvCisgICAgICAgIGluZGljYXRlIG5hdGl2ZSBjb2RlLiAgVGhp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XIq
IHIgPSAoKnJlZ2lzdGVyRmlsZS0+YmFzZVBvaW50ZXIoKSkgKyByZWdpc3Rlck9mZnNldCArIGNv
ZGVCbG9jay0+bnVtVmFyczsKKyAgICBSZWdpc3RlciogciA9ICgqcmVnaXN0ZXJGaWxlLT5iYXNl
UG9pbnRlcigpKSArIHJlZ2lzdGVyT2Zmc2V0ICsgY29kZUJsb2NrLT5udW1WYXJzICsgQ2FsbEZy
YW1lSGVhZGVyU2l6ZTsKICAgICAKKyAgICAoKCpyZWdpc3RlckZpbGUtPmJhc2VQb2ludGVyKCkp
ICsgcmVnaXN0ZXJPZmZzZXQpW0NhbGxlckNvZGVCbG9ja10udS5jb2RlQmxvY2sgPSAwOwogICAg
IHJbUHJvZ3JhbUNvZGVUaGlzUmVnaXN0ZXJdLnUuanNWYWx1ZSA9IHRoaXNPYmo7CiAgICAgSlNW
YWx1ZSogcmVzdWx0ID0gcHJpdmF0ZUV4ZWN1dGUoTm9ybWFsLCBleGVjLCByZWdpc3RlckZpbGUs
IHIsIHNjb3BlQ2hhaW4sIGNvZGVCbG9jaywgZXhjZXB0aW9uKTsKICAgICAK
</data>
<flag name="review"
          id="9070"
          type_id="1"
          status="+"
          setter="ggaren"
    />
          </attachment>
      

    </bug>

</bugzilla>