<!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>[199863] 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/199863">199863</a></dd>
<dt>Author</dt> <dd>keith_miller@apple.com</dd>
<dt>Date</dt> <dd>2016-04-21 19:28:00 -0700 (Thu, 21 Apr 2016)</dd>
</dl>

<h3>Log Message</h3>
<pre>FTL should handle exceptions in operationInOptimize
https://bugs.webkit.org/show_bug.cgi?id=156885

Reviewed by Michael Saboff.

For some reasone we didn't handle any exceptions in &quot;in&quot; when we called
operationInOptimize in the FTL.

* bytecode/CodeBlock.cpp:
(JSC::CodeBlock::dumpAssumingJITType):
* ftl/FTLCapabilities.cpp:
(JSC::FTL::canCompile):
* ftl/FTLLowerDFGToB3.cpp:
(JSC::FTL::DFG::LowerDFGToB3::compileIn):
* ftl/FTLPatchpointExceptionHandle.h: Add comments explaining which
function to use for different exception types.

* jsc.cpp:
(GlobalObject::finishCreation):
(functionNoFTL):
* runtime/Executable.cpp:
(JSC::ScriptExecutable::ScriptExecutable):
* runtime/Executable.h:
(JSC::ScriptExecutable::setNeverFTLOptimize):
(JSC::ScriptExecutable::neverFTLOptimize):
* tests/stress/in-ftl-exception-check.js: Added.
(foo):
(bar):
(catch):</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceJavaScriptCoreChangeLog">trunk/Source/JavaScriptCore/ChangeLog</a></li>
<li><a href="#trunkSourceJavaScriptCoreJavaScriptCorexcodeprojprojectpbxproj">trunk/Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj</a></li>
<li><a href="#trunkSourceJavaScriptCorebytecodeCodeBlockcpp">trunk/Source/JavaScriptCore/bytecode/CodeBlock.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCoreftlFTLCapabilitiescpp">trunk/Source/JavaScriptCore/ftl/FTLCapabilities.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCoreftlFTLLowerDFGToB3cpp">trunk/Source/JavaScriptCore/ftl/FTLLowerDFGToB3.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCoreftlFTLPatchpointExceptionHandleh">trunk/Source/JavaScriptCore/ftl/FTLPatchpointExceptionHandle.h</a></li>
<li><a href="#trunkSourceJavaScriptCorejsccpp">trunk/Source/JavaScriptCore/jsc.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCoreruntimeExecutablecpp">trunk/Source/JavaScriptCore/runtime/Executable.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCoreruntimeExecutableh">trunk/Source/JavaScriptCore/runtime/Executable.h</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkSourceJavaScriptCoretestsstressinftlexceptioncheckjs">trunk/Source/JavaScriptCore/tests/stress/in-ftl-exception-check.js</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceJavaScriptCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/ChangeLog (199862 => 199863)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/ChangeLog        2016-04-22 01:48:41 UTC (rev 199862)
+++ trunk/Source/JavaScriptCore/ChangeLog        2016-04-22 02:28:00 UTC (rev 199863)
</span><span class="lines">@@ -1,3 +1,35 @@
</span><ins>+2016-04-21  Keith Miller  &lt;keith_miller@apple.com&gt;
+
+        FTL should handle exceptions in operationInOptimize
+        https://bugs.webkit.org/show_bug.cgi?id=156885
+
+        Reviewed by Michael Saboff.
+
+        For some reasone we didn't handle any exceptions in &quot;in&quot; when we called
+        operationInOptimize in the FTL.
+
+        * bytecode/CodeBlock.cpp:
+        (JSC::CodeBlock::dumpAssumingJITType):
+        * ftl/FTLCapabilities.cpp:
+        (JSC::FTL::canCompile):
+        * ftl/FTLLowerDFGToB3.cpp:
+        (JSC::FTL::DFG::LowerDFGToB3::compileIn):
+        * ftl/FTLPatchpointExceptionHandle.h: Add comments explaining which
+        function to use for different exception types.
+
+        * jsc.cpp:
+        (GlobalObject::finishCreation):
+        (functionNoFTL):
+        * runtime/Executable.cpp:
+        (JSC::ScriptExecutable::ScriptExecutable):
+        * runtime/Executable.h:
+        (JSC::ScriptExecutable::setNeverFTLOptimize):
+        (JSC::ScriptExecutable::neverFTLOptimize):
+        * tests/stress/in-ftl-exception-check.js: Added.
+        (foo):
+        (bar):
+        (catch):
+
</ins><span class="cx"> 2016-04-21  Filip Pizlo  &lt;fpizlo@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         JSC virtual call thunk shouldn't do a structure-&gt;classInfo lookup
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreJavaScriptCorexcodeprojprojectpbxproj"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj (199862 => 199863)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj        2016-04-22 01:48:41 UTC (rev 199862)
+++ trunk/Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj        2016-04-22 02:28:00 UTC (rev 199863)
</span><span class="lines">@@ -1996,13 +1996,13 @@
</span><span class="cx">                 DC17E8181C9C91D9008A6AB3 /* ShadowChicken.h in Headers */ = {isa = PBXBuildFile; fileRef = DC17E8141C9C7FD4008A6AB3 /* ShadowChicken.h */; };
</span><span class="cx">                 DC17E8191C9C91DB008A6AB3 /* ShadowChickenInlines.h in Headers */ = {isa = PBXBuildFile; fileRef = DC17E8151C9C7FD4008A6AB3 /* ShadowChickenInlines.h */; };
</span><span class="cx">                 DC17E81A1C9C91E9008A6AB3 /* CCallHelpers.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DC17E8161C9C802B008A6AB3 /* CCallHelpers.cpp */; };
</span><ins>+                DC2143071CA32E55000A8869 /* ICStats.h in Headers */ = {isa = PBXBuildFile; fileRef = DC2143061CA32E52000A8869 /* ICStats.h */; };
+                DC2143081CA32E58000A8869 /* ICStats.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DC2143051CA32E52000A8869 /* ICStats.cpp */; };
</ins><span class="cx">                 DE26E9031CB5DD0500D2BE82 /* BuiltinExecutableCreator.h in Headers */ = {isa = PBXBuildFile; fileRef = DE26E9021CB5DD0500D2BE82 /* BuiltinExecutableCreator.h */; };
</span><span class="cx">                 DE26E9071CB5DEFB00D2BE82 /* BuiltinExecutableCreator.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DE26E9061CB5DD9600D2BE82 /* BuiltinExecutableCreator.cpp */; };
</span><span class="cx">                 DE5A0A001BA3AC3E003D4424 /* IntrinsicEmitter.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DE5A09FF1BA3AC3E003D4424 /* IntrinsicEmitter.cpp */; };
</span><span class="cx">                 DEA7E2441BBC677200D78440 /* JSTypedArrayViewPrototype.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 53F256E11B87E28000B4B768 /* JSTypedArrayViewPrototype.cpp */; };
</span><span class="cx">                 DEA7E2451BBC677F00D78440 /* JSTypedArrayViewPrototype.h in Headers */ = {isa = PBXBuildFile; fileRef = 53917E7C1B791106000EBD33 /* JSTypedArrayViewPrototype.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><del>-                DC2143071CA32E55000A8869 /* ICStats.h in Headers */ = {isa = PBXBuildFile; fileRef = DC2143061CA32E52000A8869 /* ICStats.h */; };
-                DC2143081CA32E58000A8869 /* ICStats.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DC2143051CA32E52000A8869 /* ICStats.cpp */; };
</del><span class="cx">                 E124A8F70E555775003091F1 /* OpaqueJSString.h in Headers */ = {isa = PBXBuildFile; fileRef = E124A8F50E555775003091F1 /* OpaqueJSString.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="cx">                 E124A8F80E555775003091F1 /* OpaqueJSString.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E124A8F60E555775003091F1 /* OpaqueJSString.cpp */; };
</span><span class="cx">                 E18E3A590DF9278C00D90B34 /* VM.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E18E3A570DF9278C00D90B34 /* VM.cpp */; };
</span><span class="lines">@@ -4204,12 +4204,12 @@
</span><span class="cx">                 D21202280AD4310C00ED79B6 /* DateConversion.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = DateConversion.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 D21202290AD4310C00ED79B6 /* DateConversion.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = DateConversion.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 DC00039019D8BE6F00023EB0 /* DFGPreciseLocalClobberize.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = DFGPreciseLocalClobberize.h; path = dfg/DFGPreciseLocalClobberize.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><del>-                DC2143051CA32E52000A8869 /* ICStats.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ICStats.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
-                DC2143061CA32E52000A8869 /* ICStats.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ICStats.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</del><span class="cx">                 DC17E8131C9C7FD4008A6AB3 /* ShadowChicken.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ShadowChicken.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 DC17E8141C9C7FD4008A6AB3 /* ShadowChicken.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ShadowChicken.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 DC17E8151C9C7FD4008A6AB3 /* ShadowChickenInlines.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ShadowChickenInlines.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 DC17E8161C9C802B008A6AB3 /* CCallHelpers.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CCallHelpers.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><ins>+                DC2143051CA32E52000A8869 /* ICStats.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ICStats.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
+                DC2143061CA32E52000A8869 /* ICStats.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ICStats.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</ins><span class="cx">                 DE26E9021CB5DD0500D2BE82 /* BuiltinExecutableCreator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BuiltinExecutableCreator.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 DE26E9061CB5DD9600D2BE82 /* BuiltinExecutableCreator.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = BuiltinExecutableCreator.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 DE5A09FF1BA3AC3E003D4424 /* IntrinsicEmitter.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = IntrinsicEmitter.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span></span></pre></div>
<a id="trunkSourceJavaScriptCorebytecodeCodeBlockcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/bytecode/CodeBlock.cpp (199862 => 199863)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/bytecode/CodeBlock.cpp        2016-04-22 01:48:41 UTC (rev 199862)
+++ trunk/Source/JavaScriptCore/bytecode/CodeBlock.cpp        2016-04-22 02:28:00 UTC (rev 199863)
</span><span class="lines">@@ -230,6 +230,8 @@
</span><span class="cx">         out.print(&quot; (NeverInline)&quot;);
</span><span class="cx">     if (ownerScriptExecutable()-&gt;neverOptimize())
</span><span class="cx">         out.print(&quot; (NeverOptimize)&quot;);
</span><ins>+    else if (ownerScriptExecutable()-&gt;neverFTLOptimize())
+        out.print(&quot; (NeverFTLOptimize)&quot;);
</ins><span class="cx">     if (ownerScriptExecutable()-&gt;didTryToEnterInLoop())
</span><span class="cx">         out.print(&quot; (DidTryToEnterInLoop)&quot;);
</span><span class="cx">     if (ownerScriptExecutable()-&gt;isStrictMode())
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreftlFTLCapabilitiescpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/ftl/FTLCapabilities.cpp (199862 => 199863)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/ftl/FTLCapabilities.cpp        2016-04-22 01:48:41 UTC (rev 199862)
+++ trunk/Source/JavaScriptCore/ftl/FTLCapabilities.cpp        2016-04-22 02:28:00 UTC (rev 199863)
</span><span class="lines">@@ -439,6 +439,12 @@
</span><span class="cx">             dataLog(&quot;FTL rejecting &quot;, *graph.m_codeBlock, &quot; because it doesn't belong to a function.\n&quot;);
</span><span class="cx">         return CannotCompile;
</span><span class="cx">     }
</span><ins>+
+    if (UNLIKELY(graph.m_codeBlock-&gt;ownerScriptExecutable()-&gt;neverFTLOptimize())) {
+        if (verboseCapabilities())
+            dataLog(&quot;FTL rejecting &quot;, *graph.m_codeBlock, &quot; because it is marked as never FTL compile.\n&quot;);
+        return CannotCompile;
+    }
</ins><span class="cx">     
</span><span class="cx">     CapabilityLevel result = CanCompileAndOSREnter;
</span><span class="cx">     
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreftlFTLLowerDFGToB3cpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/ftl/FTLLowerDFGToB3.cpp (199862 => 199863)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/ftl/FTLLowerDFGToB3.cpp        2016-04-22 01:48:41 UTC (rev 199862)
+++ trunk/Source/JavaScriptCore/ftl/FTLLowerDFGToB3.cpp        2016-04-22 02:28:00 UTC (rev 199863)
</span><span class="lines">@@ -5983,11 +5983,17 @@
</span><span class="cx">                 patchpoint-&gt;append(m_tagTypeNumber, ValueRep::reg(GPRInfo::tagTypeNumberRegister));
</span><span class="cx">                 patchpoint-&gt;clobber(RegisterSet::macroScratchRegisters());
</span><span class="cx"> 
</span><ins>+                RefPtr&lt;PatchpointExceptionHandle&gt; exceptionHandle = preparePatchpointForExceptions(patchpoint);
+
</ins><span class="cx">                 State* state = &amp;m_ftlState;
</span><span class="cx">                 patchpoint-&gt;setGenerator(
</span><span class="cx">                     [=] (CCallHelpers&amp; jit, const StackmapGenerationParams&amp; params) {
</span><span class="cx">                         AllowMacroScratchRegisterUsage allowScratch(jit);
</span><span class="cx"> 
</span><ins>+                        // This is the direct exit target for operation calls. We don't need a JS exceptionHandle because we don't
+                        // cache Proxy objects.
+                        Box&lt;CCallHelpers::JumpList&gt; exceptions = exceptionHandle-&gt;scheduleExitCreation(params)-&gt;jumps(jit);
+
</ins><span class="cx">                         GPRReg baseGPR = params[1].gpr();
</span><span class="cx">                         GPRReg resultGPR = params[0].gpr();
</span><span class="cx"> 
</span><span class="lines">@@ -6011,7 +6017,7 @@
</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,
</span><del>-                                    node-&gt;origin.semantic, nullptr, operationInOptimize,
</del><ins>+                                    node-&gt;origin.semantic, exceptions.get(), operationInOptimize,
</ins><span class="cx">                                     resultGPR, CCallHelpers::TrustedImmPtr(stubInfo), baseGPR,
</span><span class="cx">                                     CCallHelpers::TrustedImmPtr(str)).call();
</span><span class="cx">                                 jit.jump().linkTo(done, &amp;jit);
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreftlFTLPatchpointExceptionHandleh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/ftl/FTLPatchpointExceptionHandle.h (199862 => 199863)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/ftl/FTLPatchpointExceptionHandle.h        2016-04-22 01:48:41 UTC (rev 199862)
+++ trunk/Source/JavaScriptCore/ftl/FTLPatchpointExceptionHandle.h        2016-04-22 02:28:00 UTC (rev 199863)
</span><span class="lines">@@ -78,11 +78,11 @@
</span><span class="cx">     // Schedules the creation of an OSR exit jump destination. You don't know when this will be
</span><span class="cx">     // created, but it will happen before linking. You can link jumps to it during link time. That's
</span><span class="cx">     // why this returns an ExceptionTarget. That will contain the jump destination (target-&gt;label())
</span><del>-    // at link time.
</del><ins>+    // at link time. This function should be used for exceptions from C calls.
</ins><span class="cx">     RefPtr&lt;ExceptionTarget&gt; scheduleExitCreation(const B3::StackmapGenerationParams&amp;);
</span><span class="cx"> 
</span><span class="cx">     // Schedules the creation of an OSR exit jump destination, and ensures that it gets associated
</span><del>-    // with the handler for some callsite index.
</del><ins>+    // with the handler for some callsite index. This function should be used for exceptions from JS.
</ins><span class="cx">     void scheduleExitCreationForUnwind(const B3::StackmapGenerationParams&amp;, CallSiteIndex);
</span><span class="cx"> 
</span><span class="cx"> private:
</span></span></pre></div>
<a id="trunkSourceJavaScriptCorejsccpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/jsc.cpp (199862 => 199863)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/jsc.cpp        2016-04-22 01:48:41 UTC (rev 199862)
+++ trunk/Source/JavaScriptCore/jsc.cpp        2016-04-22 02:28:00 UTC (rev 199863)
</span><span class="lines">@@ -590,6 +590,7 @@
</span><span class="cx"> static EncodedJSValue JSC_HOST_CALL functionPreciseTime(ExecState*);
</span><span class="cx"> static EncodedJSValue JSC_HOST_CALL functionNeverInlineFunction(ExecState*);
</span><span class="cx"> static EncodedJSValue JSC_HOST_CALL functionNoDFG(ExecState*);
</span><ins>+static EncodedJSValue JSC_HOST_CALL functionNoFTL(ExecState*);
</ins><span class="cx"> static EncodedJSValue JSC_HOST_CALL functionOptimizeNextInvocation(ExecState*);
</span><span class="cx"> static EncodedJSValue JSC_HOST_CALL functionNumberOfDFGCompiles(ExecState*);
</span><span class="cx"> static EncodedJSValue JSC_HOST_CALL functionReoptimizationRetryCount(ExecState*);
</span><span class="lines">@@ -766,6 +767,7 @@
</span><span class="cx">         addFunction(vm, &quot;neverInlineFunction&quot;, functionNeverInlineFunction, 1);
</span><span class="cx">         addFunction(vm, &quot;noInline&quot;, functionNeverInlineFunction, 1);
</span><span class="cx">         addFunction(vm, &quot;noDFG&quot;, functionNoDFG, 1);
</span><ins>+        addFunction(vm, &quot;noFTL&quot;, functionNoFTL, 1);
</ins><span class="cx">         addFunction(vm, &quot;numberOfDFGCompiles&quot;, functionNumberOfDFGCompiles, 1);
</span><span class="cx">         addFunction(vm, &quot;optimizeNextInvocation&quot;, functionOptimizeNextInvocation, 1);
</span><span class="cx">         addFunction(vm, &quot;reoptimizationRetryCount&quot;, functionReoptimizationRetryCount, 1);
</span><span class="lines">@@ -1521,6 +1523,16 @@
</span><span class="cx">     return JSValue::encode(setNeverOptimize(exec));
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+EncodedJSValue JSC_HOST_CALL functionNoFTL(ExecState* exec)
+{
+    if (JSFunction* function = jsDynamicCast&lt;JSFunction*&gt;(exec-&gt;argument(0))) {
+        FunctionExecutable* executable = function-&gt;jsExecutable();
+        executable-&gt;setNeverFTLOptimize(true);
+    }
+
+    return JSValue::encode(jsUndefined());
+}
+
</ins><span class="cx"> EncodedJSValue JSC_HOST_CALL functionOptimizeNextInvocation(ExecState* exec)
</span><span class="cx"> {
</span><span class="cx">     return JSValue::encode(optimizeNextInvocation(exec));
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreruntimeExecutablecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/runtime/Executable.cpp (199862 => 199863)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/runtime/Executable.cpp        2016-04-22 01:48:41 UTC (rev 199862)
+++ trunk/Source/JavaScriptCore/runtime/Executable.cpp        2016-04-22 02:28:00 UTC (rev 199863)
</span><span class="lines">@@ -117,6 +117,7 @@
</span><span class="cx">     , m_hasCapturedVariables(false)
</span><span class="cx">     , m_neverInline(false)
</span><span class="cx">     , m_neverOptimize(false)
</span><ins>+    , m_neverFTLOptimize(false)
</ins><span class="cx">     , m_isArrowFunctionContext(isInArrowFunctionContext)
</span><span class="cx">     , m_derivedContextType(static_cast&lt;unsigned&gt;(derivedContextType))
</span><span class="cx">     , m_evalContextType(static_cast&lt;unsigned&gt;(evalContextType))
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreruntimeExecutableh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/runtime/Executable.h (199862 => 199863)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/runtime/Executable.h        2016-04-22 01:48:41 UTC (rev 199862)
+++ trunk/Source/JavaScriptCore/runtime/Executable.h        2016-04-22 02:28:00 UTC (rev 199863)
</span><span class="lines">@@ -357,9 +357,11 @@
</span><span class="cx">         
</span><span class="cx">     void setNeverInline(bool value) { m_neverInline = value; }
</span><span class="cx">     void setNeverOptimize(bool value) { m_neverOptimize = value; }
</span><ins>+    void setNeverFTLOptimize(bool value) { m_neverFTLOptimize = value; }
</ins><span class="cx">     void setDidTryToEnterInLoop(bool value) { m_didTryToEnterInLoop = value; }
</span><span class="cx">     bool neverInline() const { return m_neverInline; }
</span><span class="cx">     bool neverOptimize() const { return m_neverOptimize; }
</span><ins>+    bool neverFTLOptimize() const { return m_neverFTLOptimize; }
</ins><span class="cx">     bool didTryToEnterInLoop() const { return m_didTryToEnterInLoop; }
</span><span class="cx">     bool isInliningCandidate() const { return !neverInline(); }
</span><span class="cx">     bool isOkToOptimize() const { return !neverOptimize(); }
</span><span class="lines">@@ -419,6 +421,7 @@
</span><span class="cx">     bool m_hasCapturedVariables : 1;
</span><span class="cx">     bool m_neverInline : 1;
</span><span class="cx">     bool m_neverOptimize : 1;
</span><ins>+    bool m_neverFTLOptimize : 1;
</ins><span class="cx">     bool m_isArrowFunctionContext : 1;
</span><span class="cx">     unsigned m_derivedContextType : 2; // DerivedContextType
</span><span class="cx">     unsigned m_evalContextType : 2; // EvalContextType
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoretestsstressinftlexceptioncheckjs"></a>
<div class="addfile"><h4>Added: trunk/Source/JavaScriptCore/tests/stress/in-ftl-exception-check.js (0 => 199863)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/tests/stress/in-ftl-exception-check.js                                (rev 0)
+++ trunk/Source/JavaScriptCore/tests/stress/in-ftl-exception-check.js        2016-04-22 02:28:00 UTC (rev 199863)
</span><span class="lines">@@ -0,0 +1,19 @@
</span><ins>+function foo(a) {
+    return bar(a);
+}
+noFTL(foo);
+noInline(foo);
+
+function bar(a) {
+    return &quot;bar&quot; in a;
+}
+noInline(bar);
+
+for (let i = 0; i &lt; 1000000; i++) {
+    if (foo({}))
+        throw new Error(&quot;bad&quot;);
+}
+
+try {
+    foo(&quot;&quot;);
+} catch (e) { }
</ins></span></pre>
</div>
</div>

</body>
</html>