<!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>[160246] trunk</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/160246">160246</a></dd>
<dt>Author</dt> <dd>fpizlo@apple.com</dd>
<dt>Date</dt> <dd>2013-12-06 14:05:10 -0800 (Fri, 06 Dec 2013)</dd>
</dl>

<h3>Log Message</h3>
<pre>FTL should support hole/OOB array accesses
https://bugs.webkit.org/show_bug.cgi?id=118077

Reviewed by Oliver Hunt and Mark Hahnenberg.

Source/JavaScriptCore: 

* ftl/FTLCapabilities.cpp:
(JSC::FTL::canCompile):
* ftl/FTLIntrinsicRepository.h:
* ftl/FTLLowerDFGToLLVM.cpp:
(JSC::FTL::LowerDFGToLLVM::compileGetByVal):
(JSC::FTL::LowerDFGToLLVM::baseIndex):

LayoutTests: 

* js/regress/double-get-by-val-out-of-bounds-expected.txt: Added.
* js/regress/double-get-by-val-out-of-bounds.html: Added.
* js/regress/get-by-val-out-of-bounds-expected.txt: Added.
* js/regress/get-by-val-out-of-bounds.html: Added.
* js/regress/script-tests/double-get-by-val-out-of-bounds.js: Added.
(foo):
* js/regress/script-tests/get-by-val-out-of-bounds.js: Added.
(foo):</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkSourceJavaScriptCoreChangeLog">trunk/Source/JavaScriptCore/ChangeLog</a></li>
<li><a href="#trunkSourceJavaScriptCoreftlFTLCapabilitiescpp">trunk/Source/JavaScriptCore/ftl/FTLCapabilities.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCoreftlFTLIntrinsicRepositoryh">trunk/Source/JavaScriptCore/ftl/FTLIntrinsicRepository.h</a></li>
<li><a href="#trunkSourceJavaScriptCoreftlFTLLowerDFGToLLVMcpp">trunk/Source/JavaScriptCore/ftl/FTLLowerDFGToLLVM.cpp</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsjsregressdoublegetbyvaloutofboundsexpectedtxt">trunk/LayoutTests/js/regress/double-get-by-val-out-of-bounds-expected.txt</a></li>
<li><a href="#trunkLayoutTestsjsregressdoublegetbyvaloutofboundshtml">trunk/LayoutTests/js/regress/double-get-by-val-out-of-bounds.html</a></li>
<li><a href="#trunkLayoutTestsjsregressgetbyvaloutofboundsexpectedtxt">trunk/LayoutTests/js/regress/get-by-val-out-of-bounds-expected.txt</a></li>
<li><a href="#trunkLayoutTestsjsregressgetbyvaloutofboundshtml">trunk/LayoutTests/js/regress/get-by-val-out-of-bounds.html</a></li>
<li><a href="#trunkLayoutTestsjsregressscripttestsdoublegetbyvaloutofboundsjs">trunk/LayoutTests/js/regress/script-tests/double-get-by-val-out-of-bounds.js</a></li>
<li><a href="#trunkLayoutTestsjsregressscripttestsgetbyvaloutofboundsjs">trunk/LayoutTests/js/regress/script-tests/get-by-val-out-of-bounds.js</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (160245 => 160246)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2013-12-06 21:40:34 UTC (rev 160245)
+++ trunk/LayoutTests/ChangeLog        2013-12-06 22:05:10 UTC (rev 160246)
</span><span class="lines">@@ -1,3 +1,19 @@
</span><ins>+2013-12-06  Filip Pizlo  &lt;fpizlo@apple.com&gt;
+
+        FTL should support hole/OOB array accesses
+        https://bugs.webkit.org/show_bug.cgi?id=118077
+
+        Reviewed by Oliver Hunt and Mark Hahnenberg.
+
+        * js/regress/double-get-by-val-out-of-bounds-expected.txt: Added.
+        * js/regress/double-get-by-val-out-of-bounds.html: Added.
+        * js/regress/get-by-val-out-of-bounds-expected.txt: Added.
+        * js/regress/get-by-val-out-of-bounds.html: Added.
+        * js/regress/script-tests/double-get-by-val-out-of-bounds.js: Added.
+        (foo):
+        * js/regress/script-tests/get-by-val-out-of-bounds.js: Added.
+        (foo):
+
</ins><span class="cx"> 2013-12-06  Rob Buis  &lt;rob.buis@samsung.com&gt;
</span><span class="cx"> 
</span><span class="cx">         [CSS Shapes] ShapeOutsideInfo needs to use the parent's writing mode when calculating offsets
</span></span></pre></div>
<a id="trunkLayoutTestsjsregressdoublegetbyvaloutofboundsexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/js/regress/double-get-by-val-out-of-bounds-expected.txt (0 => 160246)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/js/regress/double-get-by-val-out-of-bounds-expected.txt                                (rev 0)
+++ trunk/LayoutTests/js/regress/double-get-by-val-out-of-bounds-expected.txt        2013-12-06 22:05:10 UTC (rev 160246)
</span><span class="lines">@@ -0,0 +1,10 @@
</span><ins>+JSRegress/double-get-by-val-out-of-bounds
+
+On success, you will see a series of &quot;PASS&quot; messages, followed by &quot;TEST COMPLETE&quot;.
+
+
+PASS no exception thrown
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
</ins></span></pre></div>
<a id="trunkLayoutTestsjsregressdoublegetbyvaloutofboundshtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/js/regress/double-get-by-val-out-of-bounds.html (0 => 160246)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/js/regress/double-get-by-val-out-of-bounds.html                                (rev 0)
+++ trunk/LayoutTests/js/regress/double-get-by-val-out-of-bounds.html        2013-12-06 22:05:10 UTC (rev 160246)
</span><span class="lines">@@ -0,0 +1,12 @@
</span><ins>+&lt;!DOCTYPE HTML PUBLIC &quot;-//IETF//DTD HTML//EN&quot;&gt;
+&lt;html&gt;
+&lt;head&gt;
+&lt;script src=&quot;../../resources/js-test-pre.js&quot;&gt;&lt;/script&gt;
+&lt;/head&gt;
+&lt;body&gt;
+&lt;script src=&quot;resources/regress-pre.js&quot;&gt;&lt;/script&gt;
+&lt;script src=&quot;script-tests/double-get-by-val-out-of-bounds.js&quot;&gt;&lt;/script&gt;
+&lt;script src=&quot;resources/regress-post.js&quot;&gt;&lt;/script&gt;
+&lt;script src=&quot;../../resources/js-test-post.js&quot;&gt;&lt;/script&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestsjsregressgetbyvaloutofboundsexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/js/regress/get-by-val-out-of-bounds-expected.txt (0 => 160246)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/js/regress/get-by-val-out-of-bounds-expected.txt                                (rev 0)
+++ trunk/LayoutTests/js/regress/get-by-val-out-of-bounds-expected.txt        2013-12-06 22:05:10 UTC (rev 160246)
</span><span class="lines">@@ -0,0 +1,10 @@
</span><ins>+JSRegress/get-by-val-out-of-bounds
+
+On success, you will see a series of &quot;PASS&quot; messages, followed by &quot;TEST COMPLETE&quot;.
+
+
+PASS no exception thrown
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
</ins></span></pre></div>
<a id="trunkLayoutTestsjsregressgetbyvaloutofboundshtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/js/regress/get-by-val-out-of-bounds.html (0 => 160246)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/js/regress/get-by-val-out-of-bounds.html                                (rev 0)
+++ trunk/LayoutTests/js/regress/get-by-val-out-of-bounds.html        2013-12-06 22:05:10 UTC (rev 160246)
</span><span class="lines">@@ -0,0 +1,12 @@
</span><ins>+&lt;!DOCTYPE HTML PUBLIC &quot;-//IETF//DTD HTML//EN&quot;&gt;
+&lt;html&gt;
+&lt;head&gt;
+&lt;script src=&quot;../../resources/js-test-pre.js&quot;&gt;&lt;/script&gt;
+&lt;/head&gt;
+&lt;body&gt;
+&lt;script src=&quot;resources/regress-pre.js&quot;&gt;&lt;/script&gt;
+&lt;script src=&quot;script-tests/get-by-val-out-of-bounds.js&quot;&gt;&lt;/script&gt;
+&lt;script src=&quot;resources/regress-post.js&quot;&gt;&lt;/script&gt;
+&lt;script src=&quot;../../resources/js-test-post.js&quot;&gt;&lt;/script&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestsjsregressscripttestsdoublegetbyvaloutofboundsjs"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/js/regress/script-tests/double-get-by-val-out-of-bounds.js (0 => 160246)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/js/regress/script-tests/double-get-by-val-out-of-bounds.js                                (rev 0)
+++ trunk/LayoutTests/js/regress/script-tests/double-get-by-val-out-of-bounds.js        2013-12-06 22:05:10 UTC (rev 160246)
</span><span class="lines">@@ -0,0 +1,11 @@
</span><ins>+function foo(a) {
+    return a[1];
+}
+
+noInline(foo);
+
+for (var i = 0; i &lt; 100000; ++i) {
+    var result = foo([42.5]);
+    if (result !== void 0)
+        throw &quot;Error: bad value: &quot; + result;
+}
</ins></span></pre></div>
<a id="trunkLayoutTestsjsregressscripttestsgetbyvaloutofboundsjs"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/js/regress/script-tests/get-by-val-out-of-bounds.js (0 => 160246)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/js/regress/script-tests/get-by-val-out-of-bounds.js                                (rev 0)
+++ trunk/LayoutTests/js/regress/script-tests/get-by-val-out-of-bounds.js        2013-12-06 22:05:10 UTC (rev 160246)
</span><span class="lines">@@ -0,0 +1,11 @@
</span><ins>+function foo(a) {
+    return a[1];
+}
+
+noInline(foo);
+
+for (var i = 0; i &lt; 100000; ++i) {
+    var result = foo([42]);
+    if (result !== void 0)
+        throw &quot;Error: bad value: &quot; + result;
+}
</ins></span></pre></div>
<a id="trunkSourceJavaScriptCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/ChangeLog (160245 => 160246)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/ChangeLog        2013-12-06 21:40:34 UTC (rev 160245)
+++ trunk/Source/JavaScriptCore/ChangeLog        2013-12-06 22:05:10 UTC (rev 160246)
</span><span class="lines">@@ -1,3 +1,17 @@
</span><ins>+2013-12-06  Filip Pizlo  &lt;fpizlo@apple.com&gt;
+
+        FTL should support hole/OOB array accesses
+        https://bugs.webkit.org/show_bug.cgi?id=118077
+
+        Reviewed by Oliver Hunt and Mark Hahnenberg.
+
+        * ftl/FTLCapabilities.cpp:
+        (JSC::FTL::canCompile):
+        * ftl/FTLIntrinsicRepository.h:
+        * ftl/FTLLowerDFGToLLVM.cpp:
+        (JSC::FTL::LowerDFGToLLVM::compileGetByVal):
+        (JSC::FTL::LowerDFGToLLVM::baseIndex):
+
</ins><span class="cx"> 2013-12-06  Michael Saboff  &lt;msaboff@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Split sizing of VarArgs frames from loading arguments for the frame
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreftlFTLCapabilitiescpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/ftl/FTLCapabilities.cpp (160245 => 160246)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/ftl/FTLCapabilities.cpp        2013-12-06 21:40:34 UTC (rev 160245)
+++ trunk/Source/JavaScriptCore/ftl/FTLCapabilities.cpp        2013-12-06 22:05:10 UTC (rev 160246)
</span><span class="lines">@@ -158,13 +158,6 @@
</span><span class="cx">                 return CanCompileAndOSREnter;
</span><span class="cx">             return CannotCompile;
</span><span class="cx">         }
</span><del>-        switch (node-&gt;arrayMode().speculation()) {
-        case Array::SaneChain:
-        case Array::InBounds:
-            break;
-        default:
-            return CannotCompile;
-        }
</del><span class="cx">         break;
</span><span class="cx">     case PutByVal:
</span><span class="cx">     case PutByValAlias:
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreftlFTLIntrinsicRepositoryh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/ftl/FTLIntrinsicRepository.h (160245 => 160246)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/ftl/FTLIntrinsicRepository.h        2013-12-06 21:40:34 UTC (rev 160245)
+++ trunk/Source/JavaScriptCore/ftl/FTLIntrinsicRepository.h        2013-12-06 22:05:10 UTC (rev 160246)
</span><span class="lines">@@ -54,6 +54,7 @@
</span><span class="cx">     macro(C_JITOperation_ESt, functionType(intPtr, intPtr, intPtr)) \
</span><span class="cx">     macro(I_JITOperation_EJss, functionType(intPtr, intPtr, intPtr)) \
</span><span class="cx">     macro(J_JITOperation_E, functionType(int64, intPtr)) \
</span><ins>+    macro(J_JITOperation_EAZ, functionType(int64, intPtr, intPtr, int32)) \
</ins><span class="cx">     macro(J_JITOperation_EJssZ, functionType(int64, intPtr, intPtr, int32)) \
</span><span class="cx">     macro(J_JITOperation_ESsiJI, functionType(int64, intPtr, intPtr, int64, intPtr)) \
</span><span class="cx">     macro(Jss_JITOperation_EZ, functionType(intPtr, intPtr, int32)) \
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreftlFTLLowerDFGToLLVMcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/ftl/FTLLowerDFGToLLVM.cpp (160245 => 160246)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/ftl/FTLLowerDFGToLLVM.cpp        2013-12-06 21:40:34 UTC (rev 160245)
+++ trunk/Source/JavaScriptCore/ftl/FTLLowerDFGToLLVM.cpp        2013-12-06 22:05:10 UTC (rev 160246)
</span><span class="lines">@@ -1482,25 +1482,45 @@
</span><span class="cx">             LValue index = lowInt32(m_node-&gt;child2());
</span><span class="cx">             LValue storage = lowStorage(m_node-&gt;child3());
</span><span class="cx">             
</span><ins>+            IndexedAbstractHeap&amp; heap = m_node-&gt;arrayMode().type() == Array::Int32 ?
+                m_heaps.indexedInt32Properties : m_heaps.indexedContiguousProperties;
+            
</ins><span class="cx">             if (m_node-&gt;arrayMode().isInBounds()) {
</span><span class="cx">                 speculate(
</span><span class="cx">                     OutOfBounds, noValue(), 0,
</span><span class="cx">                     m_out.aboveOrEqual(
</span><span class="cx">                         index, m_out.load32(storage, m_heaps.Butterfly_publicLength)));
</span><span class="cx">                 
</span><del>-                LValue result = m_out.load64(m_out.baseIndex(
-                    m_node-&gt;arrayMode().type() == Array::Int32 ?
-                        m_heaps.indexedInt32Properties : m_heaps.indexedContiguousProperties,
-                    storage, m_out.zeroExt(index, m_out.intPtr),
-                    m_state.forNode(m_node-&gt;child2()).m_value));
</del><ins>+                LValue result = m_out.load64(baseIndex(heap, storage, index, m_node-&gt;child2()));
</ins><span class="cx">                 speculate(LoadFromHole, noValue(), 0, m_out.isZero64(result));
</span><span class="cx">                 setJSValue(result);
</span><span class="cx">                 return;
</span><span class="cx">             }
</span><span class="cx">             
</span><del>-            // FIXME: Implement hole/OOB loads in the FTL.
-            // https://bugs.webkit.org/show_bug.cgi?id=118077
-            RELEASE_ASSERT_NOT_REACHED();
</del><ins>+            LValue base = lowCell(m_node-&gt;child1());
+            
+            LBasicBlock fastCase = FTL_NEW_BLOCK(m_out, (&quot;GetByVal int/contiguous fast case&quot;));
+            LBasicBlock slowCase = FTL_NEW_BLOCK(m_out, (&quot;GetByVal int/contiguous slow case&quot;));
+            LBasicBlock continuation = FTL_NEW_BLOCK(m_out, (&quot;GetByVal int/contiguous continuation&quot;));
+            
+            m_out.branch(
+                m_out.aboveOrEqual(
+                    index, m_out.load32(storage, m_heaps.Butterfly_publicLength)),
+                slowCase, fastCase);
+            
+            LBasicBlock lastNext = m_out.appendTo(fastCase, slowCase);
+            
+            ValueFromBlock fastResult = m_out.anchor(
+                m_out.load64(baseIndex(heap, storage, index, m_node-&gt;child2())));
+            m_out.branch(m_out.isZero64(fastResult.value()), slowCase, continuation);
+            
+            m_out.appendTo(slowCase, continuation);
+            ValueFromBlock slowResult = m_out.anchor(
+                vmCall(m_out.operation(operationGetByValArrayInt), m_callFrame, base, index));
+            m_out.jump(continuation);
+            
+            m_out.appendTo(continuation, lastNext);
+            setJSValue(m_out.phi(m_out.int64, fastResult, slowResult));
</ins><span class="cx">             return;
</span><span class="cx">         }
</span><span class="cx">             
</span><span class="lines">@@ -1508,16 +1528,16 @@
</span><span class="cx">             LValue index = lowInt32(m_node-&gt;child2());
</span><span class="cx">             LValue storage = lowStorage(m_node-&gt;child3());
</span><span class="cx">             
</span><ins>+            IndexedAbstractHeap&amp; heap = m_heaps.indexedDoubleProperties;
+            
</ins><span class="cx">             if (m_node-&gt;arrayMode().isInBounds()) {
</span><span class="cx">                 speculate(
</span><span class="cx">                     OutOfBounds, noValue(), 0,
</span><span class="cx">                     m_out.aboveOrEqual(
</span><span class="cx">                         index, m_out.load32(storage, m_heaps.Butterfly_publicLength)));
</span><span class="cx">                 
</span><del>-                LValue result = m_out.loadDouble(m_out.baseIndex(
-                    m_heaps.indexedDoubleProperties,
-                    storage, m_out.zeroExt(index, m_out.intPtr),
-                    m_state.forNode(m_node-&gt;child2()).m_value));
</del><ins>+                LValue result = m_out.loadDouble(
+                    baseIndex(heap, storage, index, m_node-&gt;child2()));
</ins><span class="cx">                 
</span><span class="cx">                 if (!m_node-&gt;arrayMode().isSaneChain()) {
</span><span class="cx">                     speculate(
</span><span class="lines">@@ -1528,9 +1548,35 @@
</span><span class="cx">                 break;
</span><span class="cx">             }
</span><span class="cx">             
</span><del>-            // FIXME: Implement hole/OOB loads in the FTL.
-            // https://bugs.webkit.org/show_bug.cgi?id=118077
-            RELEASE_ASSERT_NOT_REACHED();
</del><ins>+            LValue base = lowCell(m_node-&gt;child1());
+            
+            LBasicBlock inBounds = FTL_NEW_BLOCK(m_out, (&quot;GetByVal double in bounds&quot;));
+            LBasicBlock boxPath = FTL_NEW_BLOCK(m_out, (&quot;GetByVal double boxing&quot;));
+            LBasicBlock slowCase = FTL_NEW_BLOCK(m_out, (&quot;GetByVal double slow case&quot;));
+            LBasicBlock continuation = FTL_NEW_BLOCK(m_out, (&quot;GetByVal double continuation&quot;));
+            
+            m_out.branch(
+                m_out.aboveOrEqual(
+                    index, m_out.load32(storage, m_heaps.Butterfly_publicLength)),
+                slowCase, inBounds);
+            
+            LBasicBlock lastNext = m_out.appendTo(inBounds, boxPath);
+            LValue doubleValue = m_out.loadDouble(
+                baseIndex(heap, storage, index, m_node-&gt;child2()));
+            m_out.branch(
+                m_out.doubleNotEqualOrUnordered(doubleValue, doubleValue), slowCase, boxPath);
+            
+            m_out.appendTo(boxPath, slowCase);
+            ValueFromBlock fastResult = m_out.anchor(boxDouble(doubleValue));
+            m_out.jump(continuation);
+            
+            m_out.appendTo(slowCase, continuation);
+            ValueFromBlock slowResult = m_out.anchor(
+                vmCall(m_out.operation(operationGetByValArrayInt), m_callFrame, base, index));
+            m_out.jump(continuation);
+            
+            m_out.appendTo(continuation, lastNext);
+            setJSValue(m_out.phi(m_out.int64, fastResult, slowResult));
</ins><span class="cx">             return;
</span><span class="cx">         }
</span><span class="cx">             
</span><span class="lines">@@ -2715,6 +2761,13 @@
</span><span class="cx">         info.m_isInvalidationPoint = true;
</span><span class="cx">     }
</span><span class="cx">     
</span><ins>+    TypedPointer baseIndex(IndexedAbstractHeap&amp; heap, LValue storage, LValue index, Edge edge)
+    {
+        return m_out.baseIndex(
+            heap, storage, m_out.zeroExt(index, m_out.intPtr),
+            m_state.forNode(edge).m_value);
+    }
+    
</ins><span class="cx">     LValue allocateCell(LValue allocator, LValue structure, LBasicBlock slowPath)
</span><span class="cx">     {
</span><span class="cx">         LBasicBlock success = FTL_NEW_BLOCK(m_out, (&quot;object allocation success&quot;));
</span></span></pre>
</div>
</div>

</body>
</html>