<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[194730] trunk/Source/JavaScriptCore</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/194730">194730</a></dd>
<dt>Author</dt> <dd>fpizlo@apple.com</dd>
<dt>Date</dt> <dd>2016-01-07 14:59:43 -0800 (Thu, 07 Jan 2016)</dd>
</dl>

<h3>Log Message</h3>
<pre>FTL B3 PutById should do exceptions
https://bugs.webkit.org/show_bug.cgi?id=152850

Reviewed by Saam Barati.

Implemented PutById exception handling by following the idiom used in GetById. Reduces the
number of JSC test failures to 128.

* ftl/FTLLowerDFGToLLVM.cpp:
(JSC::FTL::DFG::LowerDFGToLLVM::compilePutById):
* tests/stress/ftl-put-by-id-setter-exception-interesting-live-state.js: Added.
* tests/stress/ftl-put-by-id-setter-exception-no-catch.js: Added.
* tests/stress/ftl-put-by-id-setter-exception.js: Added.
* tests/stress/ftl-put-by-id-slow-exception-interesting-live-state.js: Added.
* tests/stress/ftl-put-by-id-slow-exception-no-catch.js: Added.
* tests/stress/ftl-put-by-id-slow-exception.js: Added.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceJavaScriptCoreChangeLog">trunk/Source/JavaScriptCore/ChangeLog</a></li>
<li><a href="#trunkSourceJavaScriptCoreftlFTLLowerDFGToLLVMcpp">trunk/Source/JavaScriptCore/ftl/FTLLowerDFGToLLVM.cpp</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkSourceJavaScriptCoretestsstressftlputbyidsetterexceptioninterestinglivestatejs">trunk/Source/JavaScriptCore/tests/stress/ftl-put-by-id-setter-exception-interesting-live-state.js</a></li>
<li><a href="#trunkSourceJavaScriptCoretestsstressftlputbyidsetterexceptionnocatchjs">trunk/Source/JavaScriptCore/tests/stress/ftl-put-by-id-setter-exception-no-catch.js</a></li>
<li><a href="#trunkSourceJavaScriptCoretestsstressftlputbyidsetterexceptionjs">trunk/Source/JavaScriptCore/tests/stress/ftl-put-by-id-setter-exception.js</a></li>
<li><a href="#trunkSourceJavaScriptCoretestsstressftlputbyidslowexceptioninterestinglivestatejs">trunk/Source/JavaScriptCore/tests/stress/ftl-put-by-id-slow-exception-interesting-live-state.js</a></li>
<li><a href="#trunkSourceJavaScriptCoretestsstressftlputbyidslowexceptionnocatchjs">trunk/Source/JavaScriptCore/tests/stress/ftl-put-by-id-slow-exception-no-catch.js</a></li>
<li><a href="#trunkSourceJavaScriptCoretestsstressftlputbyidslowexceptionjs">trunk/Source/JavaScriptCore/tests/stress/ftl-put-by-id-slow-exception.js</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceJavaScriptCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/ChangeLog (194729 => 194730)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/ChangeLog        2016-01-07 22:42:44 UTC (rev 194729)
+++ trunk/Source/JavaScriptCore/ChangeLog        2016-01-07 22:59:43 UTC (rev 194730)
</span><span class="lines">@@ -1,3 +1,22 @@
</span><ins>+2016-01-07  Filip Pizlo  &lt;fpizlo@apple.com&gt;
+
+        FTL B3 PutById should do exceptions
+        https://bugs.webkit.org/show_bug.cgi?id=152850
+
+        Reviewed by Saam Barati.
+
+        Implemented PutById exception handling by following the idiom used in GetById. Reduces the
+        number of JSC test failures to 128.
+
+        * ftl/FTLLowerDFGToLLVM.cpp:
+        (JSC::FTL::DFG::LowerDFGToLLVM::compilePutById):
+        * tests/stress/ftl-put-by-id-setter-exception-interesting-live-state.js: Added.
+        * tests/stress/ftl-put-by-id-setter-exception-no-catch.js: Added.
+        * tests/stress/ftl-put-by-id-setter-exception.js: Added.
+        * tests/stress/ftl-put-by-id-slow-exception-interesting-live-state.js: Added.
+        * tests/stress/ftl-put-by-id-slow-exception-no-catch.js: Added.
+        * tests/stress/ftl-put-by-id-slow-exception.js: Added.
+
</ins><span class="cx"> 2016-01-07  Commit Queue  &lt;commit-queue@webkit.org&gt;
</span><span class="cx"> 
</span><span class="cx">         Unreviewed, rolling out r194714.
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreftlFTLLowerDFGToLLVMcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/ftl/FTLLowerDFGToLLVM.cpp (194729 => 194730)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/ftl/FTLLowerDFGToLLVM.cpp        2016-01-07 22:42:44 UTC (rev 194729)
+++ trunk/Source/JavaScriptCore/ftl/FTLLowerDFGToLLVM.cpp        2016-01-07 22:59:43 UTC (rev 194730)
</span><span class="lines">@@ -2652,14 +2652,17 @@
</span><span class="cx">         auto uid = m_graph.identifiers()[node-&gt;identifierNumber()];
</span><span class="cx"> 
</span><span class="cx"> #if FTL_USES_B3
</span><del>-        // FIXME: Make this do exceptions.
-        // https://bugs.webkit.org/show_bug.cgi?id=151686
-
</del><span class="cx">         B3::PatchpointValue* patchpoint = m_out.patchpoint(Void);
</span><span class="cx">         patchpoint-&gt;appendSomeRegister(base);
</span><span class="cx">         patchpoint-&gt;appendSomeRegister(value);
</span><span class="cx">         patchpoint-&gt;clobber(RegisterSet::macroScratchRegisters());
</span><span class="cx"> 
</span><ins>+        // FIXME: If this is a PutByIdFlush, we might want to late-clobber volatile registers.
+        // https://bugs.webkit.org/show_bug.cgi?id=152848
+
+        RefPtr&lt;PatchpointExceptionHandle&gt; exceptionHandle =
+            preparePatchpointForExceptions(patchpoint);
+
</ins><span class="cx">         State* state = &amp;m_ftlState;
</span><span class="cx">         ECMAMode ecmaMode = m_graph.executableFor(node-&gt;origin.semantic)-&gt;ecmaMode();
</span><span class="cx">         
</span><span class="lines">@@ -2667,9 +2670,17 @@
</span><span class="cx">             [=] (CCallHelpers&amp; jit, const StackmapGenerationParams&amp; params) {
</span><span class="cx">                 AllowMacroScratchRegisterUsage allowScratch(jit);
</span><span class="cx"> 
</span><ins>+                CallSiteIndex callSiteIndex =
+                    state-&gt;jitCode-&gt;common.addUniqueCallSiteIndex(node-&gt;origin.semantic);
+
+                Box&lt;CCallHelpers::JumpList&gt; exceptions =
+                    exceptionHandle-&gt;scheduleExitCreation(params)-&gt;jumps(jit);
+
+                // JS setter call ICs generated by the PutById IC will need this.
+                exceptionHandle-&gt;scheduleExitCreationForUnwind(params, callSiteIndex);
+
</ins><span class="cx">                 auto generator = Box&lt;JITPutByIdGenerator&gt;::create(
</span><del>-                    jit.codeBlock(), node-&gt;origin.semantic,
-                    state-&gt;jitCode-&gt;common.addUniqueCallSiteIndex(node-&gt;origin.semantic),
</del><ins>+                    jit.codeBlock(), node-&gt;origin.semantic, callSiteIndex,
</ins><span class="cx">                     params.unavailableRegisters(), JSValueRegs(params[0].gpr()),
</span><span class="cx">                     JSValueRegs(params[1].gpr()), GPRInfo::patchpointScratchRegister, ecmaMode,
</span><span class="cx">                     node-&gt;op() == PutByIdDirect ? Direct : NotDirect);
</span><span class="lines">@@ -2681,14 +2692,11 @@
</span><span class="cx">                     [=] (CCallHelpers&amp; jit) {
</span><span class="cx">                         AllowMacroScratchRegisterUsage allowScratch(jit);
</span><span class="cx"> 
</span><del>-                        // FIXME: Make this do something.
-                        CCallHelpers::JumpList exceptions;
-
</del><span class="cx">                         generator-&gt;slowPathJump().link(&amp;jit);
</span><span class="cx">                         CCallHelpers::Label slowPathBegin = jit.label();
</span><span class="cx">                         CCallHelpers::Call slowPathCall = callOperation(
</span><span class="cx">                             *state, params.unavailableRegisters(), jit, node-&gt;origin.semantic,
</span><del>-                            &amp;exceptions, generator-&gt;slowPathFunction(), InvalidGPRReg,
</del><ins>+                            exceptions.get(), generator-&gt;slowPathFunction(), InvalidGPRReg,
</ins><span class="cx">                             CCallHelpers::TrustedImmPtr(generator-&gt;stubInfo()), params[1].gpr(),
</span><span class="cx">                             params[0].gpr(), CCallHelpers::TrustedImmPtr(uid)).call();
</span><span class="cx">                         jit.jump().linkTo(done, &amp;jit);
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoretestsstressftlputbyidsetterexceptioninterestinglivestatejs"></a>
<div class="addfile"><h4>Added: trunk/Source/JavaScriptCore/tests/stress/ftl-put-by-id-setter-exception-interesting-live-state.js (0 => 194730)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/tests/stress/ftl-put-by-id-setter-exception-interesting-live-state.js                                (rev 0)
+++ trunk/Source/JavaScriptCore/tests/stress/ftl-put-by-id-setter-exception-interesting-live-state.js        2016-01-07 22:59:43 UTC (rev 194730)
</span><span class="lines">@@ -0,0 +1,61 @@
</span><ins>+function foo(o, p) {
+    var x = 100;
+    var result = 101;
+    var pf = p.g;
+    try {
+        x = 102;
+        pf++;
+        o.f = x + pf;
+        o = 104;
+        pf++;
+        x = 106;
+    } catch (e) {
+        return {outcome: &quot;exception&quot;, values: [o, pf, x]};
+    }
+    return {outcome: &quot;return&quot;, values: [o, pf, x]};
+}
+
+noInline(foo);
+
+// Warm up foo() with polymorphic objects and getters.
+for (var i = 0; i &lt; 100000; ++i) {
+    var o = {};
+    o.__defineSetter__(&quot;f&quot;, function(value) {
+        this._f = value;
+    });
+    if (i &amp; 1)
+        o[&quot;i&quot; + i] = i; // Make it polymorphic.
+    var result = foo(o, {g:200});
+    if (result.outcome !== &quot;return&quot;)
+        throw &quot;Error in loop: bad outcome: &quot; + result.outcome;
+    if (result.values.length !== 3)
+        throw &quot;Error in loop: bad number of values: &quot; + result.values.length;
+    if (result.values[0] !== 104)
+        throw &quot;Error in loop: bad values[0]: &quot; + result.values[0];
+    if (result.values[1] !== 202)
+        throw &quot;Error in loop: bad values[1]: &quot; + result.values[1];
+    if (result.values[2] !== 106)
+        throw &quot;Error in loop: bad values[2]: &quot; + result.values[2];
+    if (o._f != 102 + 201)
+        throw &quot;Error in loop: bad value of o._f: &quot; + o._f;
+}
+
+// Now throw an exception.
+var o = {};
+o.__defineSetter__(&quot;f&quot;, function() {
+    throw &quot;Error42&quot;;
+});
+var result = foo(o, {g:300});
+if (result.outcome !== &quot;exception&quot;)
+    throw &quot;Error at end: bad outcome: &quot; + result.outcome;
+if (result.values.length !== 3)
+    throw &quot;Error at end: bad number of values: &quot; + result.values.length;
+if (result.values[0] !== o)
+    throw &quot;Error at end: bad values[0]: &quot; + result.values[0];
+if (result.values[1] !== 301)
+    throw &quot;Error at end: bad values[1]: &quot; + result.values[1];
+if (result.values[2] !== 102)
+    throw &quot;Error at end: bad values[2]: &quot; + result.values[2];
+if (&quot;_f&quot; in o)
+    throw &quot;Error at end: o has _f.&quot;;
+
</ins></span></pre></div>
<a id="trunkSourceJavaScriptCoretestsstressftlputbyidsetterexceptionnocatchjs"></a>
<div class="addfile"><h4>Added: trunk/Source/JavaScriptCore/tests/stress/ftl-put-by-id-setter-exception-no-catch.js (0 => 194730)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/tests/stress/ftl-put-by-id-setter-exception-no-catch.js                                (rev 0)
+++ trunk/Source/JavaScriptCore/tests/stress/ftl-put-by-id-setter-exception-no-catch.js        2016-01-07 22:59:43 UTC (rev 194730)
</span><span class="lines">@@ -0,0 +1,54 @@
</span><ins>+function foo(o, p) {
+    var x = 100;
+    var result = 101;
+    x = 102;
+    p = 103;
+    o.f = x + p;
+    o = 104;
+    p = 105;
+    x = 106;
+    return {outcome: &quot;return&quot;, values: [o, p, x]};
+}
+
+noInline(foo);
+
+// Warm up foo() with polymorphic objects and getters.
+for (var i = 0; i &lt; 100000; ++i) {
+    var o = {};
+    o.__defineSetter__(&quot;f&quot;, function(value) {
+        this._f = value;
+    });
+    if (i &amp; 1)
+        o[&quot;i&quot; + i] = i; // Make it polymorphic.
+    var result = foo(o);
+    if (result.outcome !== &quot;return&quot;)
+        throw &quot;Error in loop: bad outcome: &quot; + result.outcome;
+    if (result.values.length !== 3)
+        throw &quot;Error in loop: bad number of values: &quot; + result.values.length;
+    if (result.values[0] !== 104)
+        throw &quot;Error in loop: bad values[0]: &quot; + result.values[0];
+    if (result.values[1] !== 105)
+        throw &quot;Error in loop: bad values[1]: &quot; + result.values[1];
+    if (result.values[2] !== 106)
+        throw &quot;Error in loop: bad values[2]: &quot; + result.values[2];
+    if (o._f != 102 + 103)
+        throw &quot;Error in loop: bad value of o._f: &quot; + o._f;
+}
+
+// Now throw an exception.
+var result;
+try {
+    var o = {};
+    o.__defineSetter__(&quot;f&quot;, function() {
+        throw &quot;Error42&quot;;
+    });
+    result = foo(o, 108);
+} catch (e) {
+    if (e != &quot;Error42&quot;)
+        throw &quot;Error at end: bad exception: &quot; + e;
+    result = {outcome: &quot;exception&quot;};
+}
+if (result.outcome !== &quot;exception&quot;)
+    throw &quot;Error at end: bad outcome: &quot; + result.outcome;
+if (&quot;_f&quot; in o)
+    throw &quot;Error at end: o has _f&quot;;
</ins></span></pre></div>
<a id="trunkSourceJavaScriptCoretestsstressftlputbyidsetterexceptionjs"></a>
<div class="addfile"><h4>Added: trunk/Source/JavaScriptCore/tests/stress/ftl-put-by-id-setter-exception.js (0 => 194730)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/tests/stress/ftl-put-by-id-setter-exception.js                                (rev 0)
+++ trunk/Source/JavaScriptCore/tests/stress/ftl-put-by-id-setter-exception.js        2016-01-07 22:59:43 UTC (rev 194730)
</span><span class="lines">@@ -0,0 +1,60 @@
</span><ins>+function foo(o, p) {
+    var x = 100;
+    var result = 101;
+    try {
+        x = 102;
+        p = 103;
+        o.f = x + p;
+        o = 104;
+        p = 105;
+        x = 106;
+    } catch (e) {
+        return {outcome: &quot;exception&quot;, values: [o, p, x]};
+    }
+    return {outcome: &quot;return&quot;, values: [o, p, x]};
+}
+
+noInline(foo);
+
+// Warm up foo() with polymorphic objects and getters.
+for (var i = 0; i &lt; 100000; ++i) {
+    var o = {};
+    o.__defineSetter__(&quot;f&quot;, function(value) {
+        this._f = value;
+    });
+    if (i &amp; 1)
+        o[&quot;i&quot; + i] = i; // Make it polymorphic.
+    var result = foo(o);
+    if (result.outcome !== &quot;return&quot;)
+        throw &quot;Error in loop: bad outcome: &quot; + result.outcome;
+    if (result.values.length !== 3)
+        throw &quot;Error in loop: bad number of values: &quot; + result.values.length;
+    if (result.values[0] !== 104)
+        throw &quot;Error in loop: bad values[0]: &quot; + result.values[0];
+    if (result.values[1] !== 105)
+        throw &quot;Error in loop: bad values[1]: &quot; + result.values[1];
+    if (result.values[2] !== 106)
+        throw &quot;Error in loop: bad values[2]: &quot; + result.values[2];
+    if (o._f != 102 + 103)
+        throw &quot;Error in loop: bad value of o._f: &quot; + o._f;
+}
+
+// Now throw an exception.
+var o = {};
+o.__defineSetter__(&quot;f&quot;, function() {
+    throw &quot;Error42&quot;;
+});
+var result = foo(o, 108);
+if (result.outcome !== &quot;exception&quot;)
+    throw &quot;Error at end: bad outcome: &quot; + result.outcome;
+if (result.values.length !== 3)
+    throw &quot;Error at end: bad number of values: &quot; + result.values.length;
+if (result.values[0] !== o)
+    throw &quot;Error at end: bad values[0]: &quot; + result.values[0];
+if (result.values[1] !== 103)
+    throw &quot;Error at end: bad values[1]: &quot; + result.values[1];
+if (result.values[2] !== 102)
+    throw &quot;Error at end: bad values[2]: &quot; + result.values[2];
+if (&quot;_f&quot; in o)
+    throw &quot;Error at end: o has _f.&quot;;
+
</ins></span></pre></div>
<a id="trunkSourceJavaScriptCoretestsstressftlputbyidslowexceptioninterestinglivestatejs"></a>
<div class="addfile"><h4>Added: trunk/Source/JavaScriptCore/tests/stress/ftl-put-by-id-slow-exception-interesting-live-state.js (0 => 194730)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/tests/stress/ftl-put-by-id-slow-exception-interesting-live-state.js                                (rev 0)
+++ trunk/Source/JavaScriptCore/tests/stress/ftl-put-by-id-slow-exception-interesting-live-state.js        2016-01-07 22:59:43 UTC (rev 194730)
</span><span class="lines">@@ -0,0 +1,56 @@
</span><ins>+function foo(o, p) {
+    var x = 100;
+    var result = 101;
+    var pf = p.g;
+    try {
+        x = 102;
+        pf++;
+        o.f = x + pf;
+        o = 104;
+        pf++;
+        x = 106;
+    } catch (e) {
+        return {outcome: &quot;exception&quot;, values: [o, pf, x]};
+    }
+    return {outcome: &quot;return&quot;, values: [o, pf, x]};
+}
+
+noInline(foo);
+
+// Warm up foo() with polymorphic objects and getters.
+for (var i = 0; i &lt; 100000; ++i) {
+    var o = {};
+    if (i &amp; 1)
+        o[&quot;i&quot; + i] = i; // Make it polymorphic.
+    var result = foo(o, {g:200});
+    if (result.outcome !== &quot;return&quot;)
+        throw &quot;Error in loop: bad outcome: &quot; + result.outcome;
+    if (result.values.length !== 3)
+        throw &quot;Error in loop: bad number of values: &quot; + result.values.length;
+    if (result.values[0] !== 104)
+        throw &quot;Error in loop: bad values[0]: &quot; + result.values[0];
+    if (result.values[1] !== 202)
+        throw &quot;Error in loop: bad values[1]: &quot; + result.values[1];
+    if (result.values[2] !== 106)
+        throw &quot;Error in loop: bad values[2]: &quot; + result.values[2];
+    if (o.f != 102 + 201)
+        throw &quot;Error in loop: bad value of o.f: &quot; + o.f;
+}
+
+// Now throw an exception.
+var o = {};
+o.__defineSetter__(&quot;f&quot;, function() {
+    throw &quot;Error42&quot;;
+});
+var result = foo(o, {g:300});
+if (result.outcome !== &quot;exception&quot;)
+    throw &quot;Error at end: bad outcome: &quot; + result.outcome;
+if (result.values.length !== 3)
+    throw &quot;Error at end: bad number of values: &quot; + result.values.length;
+if (result.values[0] !== o)
+    throw &quot;Error at end: bad values[0]: &quot; + result.values[0];
+if (result.values[1] !== 301)
+    throw &quot;Error at end: bad values[1]: &quot; + result.values[1];
+if (result.values[2] !== 102)
+    throw &quot;Error at end: bad values[2]: &quot; + result.values[2];
+
</ins></span></pre></div>
<a id="trunkSourceJavaScriptCoretestsstressftlputbyidslowexceptionnocatchjs"></a>
<div class="addfile"><h4>Added: trunk/Source/JavaScriptCore/tests/stress/ftl-put-by-id-slow-exception-no-catch.js (0 => 194730)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/tests/stress/ftl-put-by-id-slow-exception-no-catch.js                                (rev 0)
+++ trunk/Source/JavaScriptCore/tests/stress/ftl-put-by-id-slow-exception-no-catch.js        2016-01-07 22:59:43 UTC (rev 194730)
</span><span class="lines">@@ -0,0 +1,51 @@
</span><ins>+function foo(o, p) {
+    var x = 100;
+    var result = 101;
+    var pf = p.g;
+    x = 102;
+    pf++;
+    o.f = x + pf;
+    o = 104;
+    pf++;
+    x = 106;
+    return {outcome: &quot;return&quot;, values: [o, pf, x]};
+}
+
+noInline(foo);
+
+// Warm up foo() with polymorphic objects and getters.
+for (var i = 0; i &lt; 100000; ++i) {
+    var o = {};
+    if (i &amp; 1)
+        o[&quot;i&quot; + i] = i; // Make it polymorphic.
+    var result = foo(o, {g:200});
+    if (result.outcome !== &quot;return&quot;)
+        throw &quot;Error in loop: bad outcome: &quot; + result.outcome;
+    if (result.values.length !== 3)
+        throw &quot;Error in loop: bad number of values: &quot; + result.values.length;
+    if (result.values[0] !== 104)
+        throw &quot;Error in loop: bad values[0]: &quot; + result.values[0];
+    if (result.values[1] !== 202)
+        throw &quot;Error in loop: bad values[1]: &quot; + result.values[1];
+    if (result.values[2] !== 106)
+        throw &quot;Error in loop: bad values[2]: &quot; + result.values[2];
+    if (o.f != 102 + 201)
+        throw &quot;Error in loop: bad value of o.f: &quot; + o.f;
+}
+
+// Now throw an exception.
+var result;
+try {
+    var o = {};
+    o.__defineSetter__(&quot;f&quot;, function() {
+        throw &quot;Error42&quot;;
+    });
+    result = foo(o, {g:300});
+} catch (e) {
+    if (e != &quot;Error42&quot;)
+        throw &quot;Error at end: bad exception: &quot; + e;
+    result = {outcome: &quot;exception&quot;};
+}
+if (result.outcome !== &quot;exception&quot;)
+    throw &quot;Error at end: bad outcome: &quot; + result.outcome;
+
</ins></span></pre></div>
<a id="trunkSourceJavaScriptCoretestsstressftlputbyidslowexceptionjs"></a>
<div class="addfile"><h4>Added: trunk/Source/JavaScriptCore/tests/stress/ftl-put-by-id-slow-exception.js (0 => 194730)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/tests/stress/ftl-put-by-id-slow-exception.js                                (rev 0)
+++ trunk/Source/JavaScriptCore/tests/stress/ftl-put-by-id-slow-exception.js        2016-01-07 22:59:43 UTC (rev 194730)
</span><span class="lines">@@ -0,0 +1,55 @@
</span><ins>+ function foo(o, p) {
+    var x = 100;
+    var result = 101;
+    try {
+        x = 102;
+        p = 103;
+        o.f = x + p;
+        o = 104;
+        p = 105;
+        x = 106;
+    } catch (e) {
+        return {outcome: &quot;exception&quot;, values: [o, p, x]};
+    }
+    return {outcome: &quot;return&quot;, values: [o, p, x]};
+}
+
+noInline(foo);
+
+// Warm up foo() with polymorphic objects and getters.
+for (var i = 0; i &lt; 100000; ++i) {
+    var o = {};
+    if (i &amp; 1)
+        o[&quot;i&quot; + i] = i; // Make it polymorphic.
+    var result = foo(o);
+    if (result.outcome !== &quot;return&quot;)
+        throw &quot;Error in loop: bad outcome: &quot; + result.outcome;
+    if (result.values.length !== 3)
+        throw &quot;Error in loop: bad number of values: &quot; + result.values.length;
+    if (result.values[0] !== 104)
+        throw &quot;Error in loop: bad values[0]: &quot; + result.values[0];
+    if (result.values[1] !== 105)
+        throw &quot;Error in loop: bad values[1]: &quot; + result.values[1];
+    if (result.values[2] !== 106)
+        throw &quot;Error in loop: bad values[2]: &quot; + result.values[2];
+    if (o.f != 102 + 103)
+        throw &quot;Error in loop: bad value of o.f: &quot; + o.f;
+}
+
+// Now throw an exception.
+var o = {};
+o.__defineSetter__(&quot;f&quot;, function() {
+    throw &quot;Error42&quot;;
+});
+var result = foo(o, 108);
+if (result.outcome !== &quot;exception&quot;)
+    throw &quot;Error at end: bad outcome: &quot; + result.outcome;
+if (result.values.length !== 3)
+    throw &quot;Error at end: bad number of values: &quot; + result.values.length;
+if (result.values[0] !== o)
+    throw &quot;Error at end: bad values[0]: &quot; + result.values[0];
+if (result.values[1] !== 103)
+    throw &quot;Error at end: bad values[1]: &quot; + result.values[1];
+if (result.values[2] !== 102)
+    throw &quot;Error at end: bad values[2]: &quot; + result.values[2];
+
</ins></span></pre>
</div>
</div>

</body>
</html>