<!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>[224564] 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/224564">224564</a></dd>
<dt>Author</dt> <dd>sbarati@apple.com</dd>
<dt>Date</dt> <dd>2017-11-07 22:29:31 -0800 (Tue, 07 Nov 2017)</dd>
</dl>

<h3>Log Message</h3>
<pre>Only cage double butterfly accesses
https://bugs.webkit.org/show_bug.cgi?id=179202

Reviewed by Mark Lam.

This patch removes caging from all butterfly accesses except double loads/stores.
This is a performance vs security tradeoff. Double loads/stores are the only butterfly
loads/stores that can write arbitrary bit patterns, so we choose to keep them safe
by caging. The other load/stores we are no longer caging to get back performance on
various benchmarks.

* bytecode/AccessCase.cpp:
(JSC::AccessCase::generateImpl):
* bytecode/InlineAccess.cpp:
(JSC::InlineAccess::dumpCacheSizesAndCrash):
(JSC::InlineAccess::generateSelfPropertyAccess):
(JSC::InlineAccess::generateSelfPropertyReplace):
(JSC::InlineAccess::generateArrayLength):
* dfg/DFGFixedButterflyAccessUncagingPhase.cpp:
* dfg/DFGSpeculativeJIT.cpp:
(JSC::DFG::SpeculativeJIT::compileCreateRest):
(JSC::DFG::SpeculativeJIT::compileSpread):
(JSC::DFG::SpeculativeJIT::compileNewArrayWithSpread):
* dfg/DFGSpeculativeJIT64.cpp:
(JSC::DFG::SpeculativeJIT::compile):
* ftl/FTLLowerDFGToB3.cpp:
(JSC::FTL::DFG::LowerDFGToB3::compileGetDirectPname):
* jit/JITPropertyAccess.cpp:
(JSC::JIT::emitContiguousLoad):
(JSC::JIT::emitArrayStorageLoad):
(JSC::JIT::emitGenericContiguousPutByVal):
(JSC::JIT::emitArrayStoragePutByVal):
(JSC::JIT::emit_op_get_from_scope):
(JSC::JIT::emit_op_put_to_scope):
* llint/LowLevelInterpreter64.asm:
* runtime/AuxiliaryBarrier.h:
(JSC::AuxiliaryBarrier::operator-> const):
* runtime/Butterfly.h:
(JSC::Butterfly::caged):
(JSC::Butterfly::contiguousDouble):
* runtime/JSArray.cpp:
(JSC::JSArray::setLength):
(JSC::JSArray::pop):
(JSC::JSArray::shiftCountWithAnyIndexingType):
(JSC::JSArray::unshiftCountWithAnyIndexingType):
(JSC::JSArray::fillArgList):
(JSC::JSArray::copyToArguments):
* runtime/JSArrayInlines.h:
(JSC::JSArray::pushInline):
* runtime/JSObject.cpp:
(JSC::JSObject::heapSnapshot):
(JSC::JSObject::createInitialIndexedStorage):
(JSC::JSObject::createArrayStorage):
(JSC::JSObject::convertUndecidedToInt32):
(JSC::JSObject::ensureLengthSlow):
(JSC::JSObject::reallocateAndShrinkButterfly):
(JSC::JSObject::allocateMoreOutOfLineStorage):
* runtime/JSObject.h:
(JSC::JSObject::canGetIndexQuickly):
(JSC::JSObject::getIndexQuickly):
(JSC::JSObject::tryGetIndexQuickly const):
(JSC::JSObject::canSetIndexQuickly):
(JSC::JSObject::butterfly const):
(JSC::JSObject::butterfly):</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceJavaScriptCoreChangeLog">trunk/Source/JavaScriptCore/ChangeLog</a></li>
<li><a href="#trunkSourceJavaScriptCorebytecodeAccessCasecpp">trunk/Source/JavaScriptCore/bytecode/AccessCase.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCorebytecodeInlineAccesscpp">trunk/Source/JavaScriptCore/bytecode/InlineAccess.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCoredfgDFGFixedButterflyAccessUncagingPhasecpp">trunk/Source/JavaScriptCore/dfg/DFGFixedButterflyAccessUncagingPhase.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCoredfgDFGSpeculativeJITcpp">trunk/Source/JavaScriptCore/dfg/DFGSpeculativeJIT.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCoredfgDFGSpeculativeJIT64cpp">trunk/Source/JavaScriptCore/dfg/DFGSpeculativeJIT64.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCoreftlFTLLowerDFGToB3cpp">trunk/Source/JavaScriptCore/ftl/FTLLowerDFGToB3.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCorejitJITPropertyAccesscpp">trunk/Source/JavaScriptCore/jit/JITPropertyAccess.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCorellintLowLevelInterpreter64asm">trunk/Source/JavaScriptCore/llint/LowLevelInterpreter64.asm</a></li>
<li><a href="#trunkSourceJavaScriptCoreruntimeAuxiliaryBarrierh">trunk/Source/JavaScriptCore/runtime/AuxiliaryBarrier.h</a></li>
<li><a href="#trunkSourceJavaScriptCoreruntimeButterflyh">trunk/Source/JavaScriptCore/runtime/Butterfly.h</a></li>
<li><a href="#trunkSourceJavaScriptCoreruntimeButterflyInlinesh">trunk/Source/JavaScriptCore/runtime/ButterflyInlines.h</a></li>
<li><a href="#trunkSourceJavaScriptCoreruntimeJSArraycpp">trunk/Source/JavaScriptCore/runtime/JSArray.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCoreruntimeJSArrayInlinesh">trunk/Source/JavaScriptCore/runtime/JSArrayInlines.h</a></li>
<li><a href="#trunkSourceJavaScriptCoreruntimeJSObjectcpp">trunk/Source/JavaScriptCore/runtime/JSObject.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCoreruntimeJSObjecth">trunk/Source/JavaScriptCore/runtime/JSObject.h</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceJavaScriptCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/ChangeLog (224563 => 224564)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/ChangeLog    2017-11-08 05:41:30 UTC (rev 224563)
+++ trunk/Source/JavaScriptCore/ChangeLog       2017-11-08 06:29:31 UTC (rev 224564)
</span><span class="lines">@@ -1,3 +1,70 @@
</span><ins>+2017-11-07  Saam Barati  <sbarati@apple.com>
+
+        Only cage double butterfly accesses
+        https://bugs.webkit.org/show_bug.cgi?id=179202
+
+        Reviewed by Mark Lam.
+
+        This patch removes caging from all butterfly accesses except double loads/stores.
+        This is a performance vs security tradeoff. Double loads/stores are the only butterfly
+        loads/stores that can write arbitrary bit patterns, so we choose to keep them safe
+        by caging. The other load/stores we are no longer caging to get back performance on
+        various benchmarks.
+
+        * bytecode/AccessCase.cpp:
+        (JSC::AccessCase::generateImpl):
+        * bytecode/InlineAccess.cpp:
+        (JSC::InlineAccess::dumpCacheSizesAndCrash):
+        (JSC::InlineAccess::generateSelfPropertyAccess):
+        (JSC::InlineAccess::generateSelfPropertyReplace):
+        (JSC::InlineAccess::generateArrayLength):
+        * dfg/DFGFixedButterflyAccessUncagingPhase.cpp:
+        * dfg/DFGSpeculativeJIT.cpp:
+        (JSC::DFG::SpeculativeJIT::compileCreateRest):
+        (JSC::DFG::SpeculativeJIT::compileSpread):
+        (JSC::DFG::SpeculativeJIT::compileNewArrayWithSpread):
+        * dfg/DFGSpeculativeJIT64.cpp:
+        (JSC::DFG::SpeculativeJIT::compile):
+        * ftl/FTLLowerDFGToB3.cpp:
+        (JSC::FTL::DFG::LowerDFGToB3::compileGetDirectPname):
+        * jit/JITPropertyAccess.cpp:
+        (JSC::JIT::emitContiguousLoad):
+        (JSC::JIT::emitArrayStorageLoad):
+        (JSC::JIT::emitGenericContiguousPutByVal):
+        (JSC::JIT::emitArrayStoragePutByVal):
+        (JSC::JIT::emit_op_get_from_scope):
+        (JSC::JIT::emit_op_put_to_scope):
+        * llint/LowLevelInterpreter64.asm:
+        * runtime/AuxiliaryBarrier.h:
+        (JSC::AuxiliaryBarrier::operator-> const):
+        * runtime/Butterfly.h:
+        (JSC::Butterfly::caged):
+        (JSC::Butterfly::contiguousDouble):
+        * runtime/JSArray.cpp:
+        (JSC::JSArray::setLength):
+        (JSC::JSArray::pop):
+        (JSC::JSArray::shiftCountWithAnyIndexingType):
+        (JSC::JSArray::unshiftCountWithAnyIndexingType):
+        (JSC::JSArray::fillArgList):
+        (JSC::JSArray::copyToArguments):
+        * runtime/JSArrayInlines.h:
+        (JSC::JSArray::pushInline):
+        * runtime/JSObject.cpp:
+        (JSC::JSObject::heapSnapshot):
+        (JSC::JSObject::createInitialIndexedStorage):
+        (JSC::JSObject::createArrayStorage):
+        (JSC::JSObject::convertUndecidedToInt32):
+        (JSC::JSObject::ensureLengthSlow):
+        (JSC::JSObject::reallocateAndShrinkButterfly):
+        (JSC::JSObject::allocateMoreOutOfLineStorage):
+        * runtime/JSObject.h:
+        (JSC::JSObject::canGetIndexQuickly):
+        (JSC::JSObject::getIndexQuickly):
+        (JSC::JSObject::tryGetIndexQuickly const):
+        (JSC::JSObject::canSetIndexQuickly):
+        (JSC::JSObject::butterfly const):
+        (JSC::JSObject::butterfly):
+
</ins><span class="cx"> 2017-11-07  Mark Lam  <mark.lam@apple.com>
</span><span class="cx"> 
</span><span class="cx">         Introduce a default RegisterSet constructor so that we can use { } notation.
</span></span></pre></div>
<a id="trunkSourceJavaScriptCorebytecodeAccessCasecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/bytecode/AccessCase.cpp (224563 => 224564)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/bytecode/AccessCase.cpp      2017-11-08 05:41:30 UTC (rev 224563)
+++ trunk/Source/JavaScriptCore/bytecode/AccessCase.cpp 2017-11-08 06:29:31 UTC (rev 224564)
</span><span class="lines">@@ -624,7 +624,6 @@
</span><span class="cx">                 jit.loadPtr(
</span><span class="cx">                     CCallHelpers::Address(baseForAccessGPR, JSObject::butterflyOffset()),
</span><span class="cx">                     loadedValueGPR);
</span><del>-                jit.cage(Gigacage::JSValue, loadedValueGPR);
</del><span class="cx">                 storageGPR = loadedValueGPR;
</span><span class="cx">             }
</span><span class="cx"> 
</span><span class="lines">@@ -975,7 +974,6 @@
</span><span class="cx">                     // already had out-of-line property storage).
</span><span class="cx"> 
</span><span class="cx">                     jit.loadPtr(CCallHelpers::Address(baseGPR, JSObject::butterflyOffset()), scratchGPR3);
</span><del>-                    jit.cage(Gigacage::JSValue, scratchGPR3);
</del><span class="cx"> 
</span><span class="cx">                     // We have scratchGPR = new storage, scratchGPR3 = old storage,
</span><span class="cx">                     // scratchGPR2 = available
</span><span class="lines">@@ -1056,10 +1054,8 @@
</span><span class="cx">                     JSObject::offsetOfInlineStorage() +
</span><span class="cx">                     offsetInInlineStorage(m_offset) * sizeof(JSValue)));
</span><span class="cx">         } else {
</span><del>-            if (!allocating) {
</del><ins>+            if (!allocating)
</ins><span class="cx">                 jit.loadPtr(CCallHelpers::Address(baseGPR, JSObject::butterflyOffset()), scratchGPR);
</span><del>-                jit.cage(Gigacage::JSValue, scratchGPR);
-            }
</del><span class="cx">             jit.storeValue(
</span><span class="cx">                 valueRegs,
</span><span class="cx">                 CCallHelpers::Address(scratchGPR, offsetInButterfly(m_offset) * sizeof(JSValue)));
</span><span class="lines">@@ -1095,7 +1091,6 @@
</span><span class="cx">         
</span><span class="cx">     case ArrayLength: {
</span><span class="cx">         jit.loadPtr(CCallHelpers::Address(baseGPR, JSObject::butterflyOffset()), scratchGPR);
</span><del>-        jit.cage(Gigacage::JSValue, scratchGPR);
</del><span class="cx">         jit.load32(CCallHelpers::Address(scratchGPR, ArrayStorage::lengthOffset()), scratchGPR);
</span><span class="cx">         state.failAndIgnore.append(
</span><span class="cx">             jit.branch32(CCallHelpers::LessThan, scratchGPR, CCallHelpers::TrustedImm32(0)));
</span></span></pre></div>
<a id="trunkSourceJavaScriptCorebytecodeInlineAccesscpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/bytecode/InlineAccess.cpp (224563 => 224564)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/bytecode/InlineAccess.cpp    2017-11-08 05:41:30 UTC (rev 224563)
+++ trunk/Source/JavaScriptCore/bytecode/InlineAccess.cpp       2017-11-08 06:29:31 UTC (rev 224564)
</span><span class="lines">@@ -57,7 +57,6 @@
</span><span class="cx">         jit.patchableBranch32(
</span><span class="cx">             CCallHelpers::NotEqual, value, CCallHelpers::TrustedImm32(IsArray | ContiguousShape));
</span><span class="cx">         jit.loadPtr(CCallHelpers::Address(base, JSObject::butterflyOffset()), value);
</span><del>-        jit.cage(Gigacage::JSValue, value);
</del><span class="cx">         jit.load32(CCallHelpers::Address(value, ArrayStorage::lengthOffset()), value);
</span><span class="cx">         jit.boxInt32(scratchGPR, regs);
</span><span class="cx"> 
</span><span class="lines">@@ -74,7 +73,6 @@
</span><span class="cx">         jit.loadPtr(
</span><span class="cx">             CCallHelpers::Address(base, JSObject::butterflyOffset()),
</span><span class="cx">             value);
</span><del>-        jit.cage(Gigacage::JSValue, value);
</del><span class="cx">         GPRReg storageGPR = value;
</span><span class="cx">         jit.loadValue(
</span><span class="cx">             CCallHelpers::Address(storageGPR, 0x000ab21ca), regs);
</span><span class="lines">@@ -118,7 +116,6 @@
</span><span class="cx">             MacroAssembler::TrustedImm32(0x000ab21ca));
</span><span class="cx"> 
</span><span class="cx">         jit.loadPtr(MacroAssembler::Address(base, JSObject::butterflyOffset()), value);
</span><del>-        jit.cage(Gigacage::JSValue, value);
</del><span class="cx">         jit.storeValue(
</span><span class="cx">             regs,
</span><span class="cx">             MacroAssembler::Address(base, 120342));
</span><span class="lines">@@ -173,7 +170,6 @@
</span><span class="cx">         storage = base;
</span><span class="cx">     else {
</span><span class="cx">         jit.loadPtr(CCallHelpers::Address(base, JSObject::butterflyOffset()), value.payloadGPR());
</span><del>-        jit.cage(Gigacage::JSValue, value.payloadGPR());
</del><span class="cx">         storage = value.payloadGPR();
</span><span class="cx">     }
</span><span class="cx">     
</span><span class="lines">@@ -235,7 +231,6 @@
</span><span class="cx">         storage = getScratchRegister(stubInfo);
</span><span class="cx">         ASSERT(storage != InvalidGPRReg);
</span><span class="cx">         jit.loadPtr(CCallHelpers::Address(base, JSObject::butterflyOffset()), storage);
</span><del>-        jit.cage(Gigacage::JSValue, storage);
</del><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     jit.storeValue(
</span><span class="lines">@@ -274,7 +269,6 @@
</span><span class="cx">     auto branchToSlowPath = jit.patchableBranch32(
</span><span class="cx">         CCallHelpers::NotEqual, scratch, CCallHelpers::TrustedImm32(array->indexingType()));
</span><span class="cx">     jit.loadPtr(CCallHelpers::Address(base, JSObject::butterflyOffset()), value.payloadGPR());
</span><del>-    jit.cage(Gigacage::JSValue, value.payloadGPR());
</del><span class="cx">     jit.load32(CCallHelpers::Address(value.payloadGPR(), ArrayStorage::lengthOffset()), value.payloadGPR());
</span><span class="cx">     jit.boxInt32(value.payloadGPR(), value);
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoredfgDFGFixedButterflyAccessUncagingPhasecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/dfg/DFGFixedButterflyAccessUncagingPhase.cpp (224563 => 224564)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/dfg/DFGFixedButterflyAccessUncagingPhase.cpp 2017-11-08 05:41:30 UTC (rev 224563)
+++ trunk/Source/JavaScriptCore/dfg/DFGFixedButterflyAccessUncagingPhase.cpp    2017-11-08 06:29:31 UTC (rev 224564)
</span><span class="lines">@@ -75,11 +75,38 @@
</span><span class="cx">                         // https://bugs.webkit.org/show_bug.cgi?id=174926
</span><span class="cx">                         if (!accessesOverlap(m_graph, node, Heap))
</span><span class="cx">                             break;
</span><del>-                    
</del><ins>+                        
+                        Node* toExclude = nullptr;
+                        if (node->hasArrayMode() && node->arrayMode().type() != Array::Double) {
+                            switch (node->op()) {
+                            case ArrayPush:
+                                toExclude = m_graph.varArgChild(node, 0).node();
+                                break;
+                            case ArrayIndexOf:
+                                toExclude = m_graph.varArgChild(node, node->numChildren() == 3 ? 2 : 3).node();
+                                break;
+                            case ArrayPop:
+                                toExclude = node->child2().node();
+                                break;
+                            case HasIndexedProperty:
+                                toExclude = node->child3().node();
+                                break;
+                            case GetByVal:
+                                toExclude = node->child3().node();
+                                break;
+                            case PutByVal:
+                                toExclude = m_graph.varArgChild(node, 3).node();
+                                break;
+                            default:
+                                break;
+                            }
+                        }
+
</ins><span class="cx">                         m_graph.doToChildren(
</span><span class="cx">                             node,
</span><span class="cx">                             [&] (Edge& edge) {
</span><del>-                                changed |= needCaging.add(edge.node());
</del><ins>+                                if (edge.node() != toExclude)
+                                    changed |= needCaging.add(edge.node());
</ins><span class="cx">                             });
</span><span class="cx">                         break;
</span><span class="cx">                     }
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoredfgDFGSpeculativeJITcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/dfg/DFGSpeculativeJIT.cpp (224563 => 224564)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/dfg/DFGSpeculativeJIT.cpp    2017-11-08 05:41:30 UTC (rev 224563)
+++ trunk/Source/JavaScriptCore/dfg/DFGSpeculativeJIT.cpp       2017-11-08 06:29:31 UTC (rev 224564)
</span><span class="lines">@@ -7269,7 +7269,6 @@
</span><span class="cx">         GPRReg butterflyGPR = butterfly.gpr();
</span><span class="cx"> 
</span><span class="cx">         m_jit.loadPtr(MacroAssembler::Address(arrayResultGPR, JSObject::butterflyOffset()), butterflyGPR);
</span><del>-        m_jit.cage(Gigacage::JSValue, butterflyGPR);
</del><span class="cx"> 
</span><span class="cx">         CCallHelpers::Jump skipLoop = m_jit.branch32(MacroAssembler::Equal, arrayLengthGPR, TrustedImm32(0));
</span><span class="cx">         m_jit.zeroExtend32ToPtr(arrayLengthGPR, currentLengthGPR);
</span><span class="lines">@@ -7339,7 +7338,7 @@
</span><span class="cx">         slowPath.append(m_jit.branch32(MacroAssembler::Above, scratch1GPR, TrustedImm32(ContiguousShape - Int32Shape)));
</span><span class="cx"> 
</span><span class="cx">         m_jit.loadPtr(MacroAssembler::Address(argument, JSObject::butterflyOffset()), lengthGPR);
</span><del>-        m_jit.cage(Gigacage::JSValue, lengthGPR);
</del><ins>+        m_jit.cage(Gigacage::JSValue, lengthGPR); // We may do a double memcpy loop below, so we conservatively cage.
</ins><span class="cx">         m_jit.load32(MacroAssembler::Address(lengthGPR, Butterfly::offsetOfPublicLength()), lengthGPR);
</span><span class="cx">         static_assert(sizeof(JSValue) == 8 && 1 << 3 == 8, "This is strongly assumed in the code below.");
</span><span class="cx">         m_jit.move(lengthGPR, scratch1GPR);
</span><span class="lines">@@ -7350,7 +7349,7 @@
</span><span class="cx">         m_jit.store32(lengthGPR, MacroAssembler::Address(resultGPR, JSFixedArray::offsetOfSize()));
</span><span class="cx"> 
</span><span class="cx">         m_jit.loadPtr(MacroAssembler::Address(argument, JSObject::butterflyOffset()), scratch1GPR);
</span><del>-        m_jit.cage(Gigacage::JSValue, scratch1GPR);
</del><ins>+        m_jit.cage(Gigacage::JSValue, scratch1GPR); // We may do a double memcpy loop below, so we conservatively cage.
</ins><span class="cx"> 
</span><span class="cx">         MacroAssembler::JumpList done;
</span><span class="cx"> 
</span><span class="lines">@@ -7373,7 +7372,6 @@
</span><span class="cx"> 
</span><span class="cx">         isDoubleArray.link(&m_jit);
</span><span class="cx">         {
</span><del>-
</del><span class="cx">             done.append(m_jit.branchTest32(MacroAssembler::Zero, lengthGPR));
</span><span class="cx">             auto loopStart = m_jit.label();
</span><span class="cx">             m_jit.sub32(TrustedImm32(1), lengthGPR);
</span><span class="lines">@@ -7460,7 +7458,6 @@
</span><span class="cx"> 
</span><span class="cx">         m_jit.move(TrustedImm32(0), indexGPR);
</span><span class="cx">         m_jit.loadPtr(MacroAssembler::Address(resultGPR, JSObject::butterflyOffset()), storageGPR);
</span><del>-        m_jit.cage(Gigacage::JSValue, storageGPR);
</del><span class="cx"> 
</span><span class="cx">         for (unsigned i = 0; i < node->numChildren(); ++i) {
</span><span class="cx">             Edge use = m_jit.graph().varArgChild(node, i);
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoredfgDFGSpeculativeJIT64cpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/dfg/DFGSpeculativeJIT64.cpp (224563 => 224564)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/dfg/DFGSpeculativeJIT64.cpp  2017-11-08 05:41:30 UTC (rev 224563)
+++ trunk/Source/JavaScriptCore/dfg/DFGSpeculativeJIT64.cpp     2017-11-08 06:29:31 UTC (rev 224564)
</span><span class="lines">@@ -5783,7 +5783,6 @@
</span><span class="cx">         // Otherwise it's out of line
</span><span class="cx">         outOfLineAccess.link(&m_jit);
</span><span class="cx">         m_jit.loadPtr(MacroAssembler::Address(baseGPR, JSObject::butterflyOffset()), scratch2GPR);
</span><del>-        m_jit.cage(Gigacage::JSValue, scratch2GPR);
</del><span class="cx">         m_jit.move(indexGPR, scratch1GPR);
</span><span class="cx">         m_jit.sub32(MacroAssembler::Address(enumeratorGPR, JSPropertyNameEnumerator::cachedInlineCapacityOffset()), scratch1GPR);
</span><span class="cx">         m_jit.neg32(scratch1GPR);
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreftlFTLLowerDFGToB3cpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/ftl/FTLLowerDFGToB3.cpp (224563 => 224564)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/ftl/FTLLowerDFGToB3.cpp      2017-11-08 05:41:30 UTC (rev 224563)
+++ trunk/Source/JavaScriptCore/ftl/FTLLowerDFGToB3.cpp 2017-11-08 06:29:31 UTC (rev 224564)
</span><span class="lines">@@ -9349,7 +9349,7 @@
</span><span class="cx">             m_out.neg(m_out.sub(index, m_out.load32(enumerator, m_heaps.JSPropertyNameEnumerator_cachedInlineCapacity))));
</span><span class="cx">         int32_t offsetOfFirstProperty = static_cast<int32_t>(offsetInButterfly(firstOutOfLineOffset)) * sizeof(EncodedJSValue);
</span><span class="cx">         ValueFromBlock outOfLineResult = m_out.anchor(
</span><del>-            m_out.load64(m_out.baseIndex(m_heaps.properties.atAnyNumber(), caged(Gigacage::JSValue, storage), realIndex, ScaleEight, offsetOfFirstProperty)));
</del><ins>+            m_out.load64(m_out.baseIndex(m_heaps.properties.atAnyNumber(), storage, realIndex, ScaleEight, offsetOfFirstProperty)));
</ins><span class="cx">         m_out.jump(continuation);
</span><span class="cx"> 
</span><span class="cx">         m_out.appendTo(slowCase, continuation);
</span></span></pre></div>
<a id="trunkSourceJavaScriptCorejitJITPropertyAccesscpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/jit/JITPropertyAccess.cpp (224563 => 224564)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/jit/JITPropertyAccess.cpp    2017-11-08 05:41:30 UTC (rev 224563)
+++ trunk/Source/JavaScriptCore/jit/JITPropertyAccess.cpp       2017-11-08 06:29:31 UTC (rev 224564)
</span><span class="lines">@@ -187,7 +187,6 @@
</span><span class="cx">     
</span><span class="cx">     badType = patchableBranch32(NotEqual, regT2, TrustedImm32(expectedShape));
</span><span class="cx">     loadPtr(Address(regT0, JSObject::butterflyOffset()), regT2);
</span><del>-    cage(Gigacage::JSValue, regT2);
</del><span class="cx">     slowCases.append(branch32(AboveOrEqual, regT1, Address(regT2, Butterfly::offsetOfPublicLength())));
</span><span class="cx">     load64(BaseIndex(regT2, regT1, TimesEight), regT0);
</span><span class="cx">     slowCases.append(branchTest64(Zero, regT0));
</span><span class="lines">@@ -203,7 +202,6 @@
</span><span class="cx">     badType = patchableBranch32(Above, regT3, TrustedImm32(SlowPutArrayStorageShape - ArrayStorageShape));
</span><span class="cx"> 
</span><span class="cx">     loadPtr(Address(regT0, JSObject::butterflyOffset()), regT2);
</span><del>-    cage(Gigacage::JSValue, regT2);
</del><span class="cx">     slowCases.append(branch32(AboveOrEqual, regT1, Address(regT2, ArrayStorage::vectorLengthOffset())));
</span><span class="cx"> 
</span><span class="cx">     load64(BaseIndex(regT2, regT1, TimesEight, ArrayStorage::vectorOffset()), regT0);
</span><span class="lines">@@ -345,7 +343,8 @@
</span><span class="cx">     badType = patchableBranch32(NotEqual, regT2, TrustedImm32(indexingShape));
</span><span class="cx">     
</span><span class="cx">     loadPtr(Address(regT0, JSObject::butterflyOffset()), regT2);
</span><del>-    cage(Gigacage::JSValue, regT2);
</del><ins>+    if (indexingShape == DoubleShape)
+        cage(Gigacage::JSValue, regT2);
</ins><span class="cx">     Jump outOfBounds = branch32(AboveOrEqual, regT1, Address(regT2, Butterfly::offsetOfPublicLength()));
</span><span class="cx"> 
</span><span class="cx">     Label storeResult = label();
</span><span class="lines">@@ -401,7 +400,6 @@
</span><span class="cx">     
</span><span class="cx">     badType = patchableBranch32(NotEqual, regT2, TrustedImm32(ArrayStorageShape));
</span><span class="cx">     loadPtr(Address(regT0, JSObject::butterflyOffset()), regT2);
</span><del>-    cage(Gigacage::JSValue, regT2);
</del><span class="cx">     slowCases.append(branch32(AboveOrEqual, regT1, Address(regT2, ArrayStorage::vectorLengthOffset())));
</span><span class="cx"> 
</span><span class="cx">     Jump empty = branchTest64(Zero, BaseIndex(regT2, regT1, TimesEight, ArrayStorage::vectorOffset()));
</span><span class="lines">@@ -877,7 +875,6 @@
</span><span class="cx">                 isOutOfLine.link(this);
</span><span class="cx">             }
</span><span class="cx">             loadPtr(Address(base, JSObject::butterflyOffset()), scratch);
</span><del>-            cage(Gigacage::JSValue, scratch);
</del><span class="cx">             neg32(offset);
</span><span class="cx">             signExtend32ToPtr(offset, offset);
</span><span class="cx">             load64(BaseIndex(scratch, offset, TimesEight, (firstOutOfLineOffset - 2) * sizeof(EncodedJSValue)), result);
</span><span class="lines">@@ -997,7 +994,6 @@
</span><span class="cx">             emitGetVirtualRegister(value, regT2);
</span><span class="cx">             
</span><span class="cx">             loadPtr(Address(regT0, JSObject::butterflyOffset()), regT0);
</span><del>-            cage(Gigacage::JSValue, regT0);
</del><span class="cx">             loadPtr(operandSlot, regT1);
</span><span class="cx">             negPtr(regT1);
</span><span class="cx">             storePtr(regT2, BaseIndex(regT0, regT1, TimesEight, (firstOutOfLineOffset - 2) * sizeof(EncodedJSValue)));
</span></span></pre></div>
<a id="trunkSourceJavaScriptCorellintLowLevelInterpreter64asm"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/llint/LowLevelInterpreter64.asm (224563 => 224564)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/llint/LowLevelInterpreter64.asm      2017-11-08 05:41:30 UTC (rev 224563)
+++ trunk/Source/JavaScriptCore/llint/LowLevelInterpreter64.asm 2017-11-08 06:29:31 UTC (rev 224564)
</span><span class="lines">@@ -1224,7 +1224,7 @@
</span><span class="cx"> 
</span><span class="cx"> macro loadPropertyAtVariableOffset(propertyOffsetAsInt, objectAndStorage, value)
</span><span class="cx">     bilt propertyOffsetAsInt, firstOutOfLineOffset, .isInline
</span><del>-    loadCaged(_g_gigacageBasePtrs + Gigacage::BasePtrs::jsValue, constexpr JSVALUE_GIGACAGE_MASK, JSObject::m_butterfly[objectAndStorage], objectAndStorage, value)
</del><ins>+    loadp JSObject::m_butterfly[objectAndStorage], objectAndStorage
</ins><span class="cx">     negi propertyOffsetAsInt
</span><span class="cx">     sxi2q propertyOffsetAsInt, propertyOffsetAsInt
</span><span class="cx">     jmp .ready
</span><span class="lines">@@ -1235,9 +1235,9 @@
</span><span class="cx"> end
</span><span class="cx"> 
</span><span class="cx"> 
</span><del>-macro storePropertyAtVariableOffset(propertyOffsetAsInt, objectAndStorage, value, scratch)
</del><ins>+macro storePropertyAtVariableOffset(propertyOffsetAsInt, objectAndStorage, value)
</ins><span class="cx">     bilt propertyOffsetAsInt, firstOutOfLineOffset, .isInline
</span><del>-    loadCaged(_g_gigacageBasePtrs + Gigacage::BasePtrs::jsValue, constexpr JSVALUE_GIGACAGE_MASK, JSObject::m_butterfly[objectAndStorage], objectAndStorage, scratch)
</del><ins>+    loadp JSObject::m_butterfly[objectAndStorage], objectAndStorage
</ins><span class="cx">     negi propertyOffsetAsInt
</span><span class="cx">     sxi2q propertyOffsetAsInt, propertyOffsetAsInt
</span><span class="cx">     jmp .ready
</span><span class="lines">@@ -1460,7 +1460,7 @@
</span><span class="cx">     loadisFromInstruction(3, t1)
</span><span class="cx">     loadConstantOrVariable(t1, t2)
</span><span class="cx">     loadisFromInstruction(5, t1)
</span><del>-    storePropertyAtVariableOffset(t1, t0, t2, t3)
</del><ins>+    storePropertyAtVariableOffset(t1, t0, t2)
</ins><span class="cx">     writeBarrierOnOperands(1, 3)
</span><span class="cx">     dispatch(constexpr op_put_by_id_length)
</span><span class="cx"> 
</span><span class="lines">@@ -2321,7 +2321,7 @@
</span><span class="cx">     loadisFromInstruction(3, t1)
</span><span class="cx">     loadConstantOrVariable(t1, t2)
</span><span class="cx">     loadisFromInstruction(6, t1)
</span><del>-    storePropertyAtVariableOffset(t1, t0, t2, t3)
</del><ins>+    storePropertyAtVariableOffset(t1, t0, t2)
</ins><span class="cx"> end
</span><span class="cx"> 
</span><span class="cx"> macro putGlobalVariable()
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreruntimeAuxiliaryBarrierh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/runtime/AuxiliaryBarrier.h (224563 => 224564)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/runtime/AuxiliaryBarrier.h   2017-11-08 05:41:30 UTC (rev 224563)
+++ trunk/Source/JavaScriptCore/runtime/AuxiliaryBarrier.h      2017-11-08 06:29:31 UTC (rev 224564)
</span><span class="lines">@@ -56,6 +56,8 @@
</span><span class="cx">     
</span><span class="cx">     template<typename U>
</span><span class="cx">     void setWithoutBarrier(U&& value) { m_value = std::forward<U>(value); }
</span><ins>+
+    T operator->() const { return get(); }
</ins><span class="cx">     
</span><span class="cx"> private:
</span><span class="cx">     T m_value;
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreruntimeButterflyh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/runtime/Butterfly.h (224563 => 224564)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/runtime/Butterfly.h  2017-11-08 05:41:30 UTC (rev 224563)
+++ trunk/Source/JavaScriptCore/runtime/Butterfly.h     2017-11-08 06:29:31 UTC (rev 224564)
</span><span class="lines">@@ -27,6 +27,7 @@
</span><span class="cx"> 
</span><span class="cx"> #include "IndexingHeader.h"
</span><span class="cx"> #include "PropertyStorage.h"
</span><ins>+#include <wtf/Gigacage.h>
</ins><span class="cx"> #include <wtf/Noncopyable.h>
</span><span class="cx"> 
</span><span class="cx"> namespace JSC {
</span><span class="lines">@@ -102,6 +103,7 @@
</span><span class="cx">     }
</span><span class="cx">     
</span><span class="cx">     char* pointer() { return reinterpret_cast<char*>(this); }
</span><ins>+    Butterfly* caged() { return Gigacage::caged(Gigacage::JSValue, this); }
</ins><span class="cx">     
</span><span class="cx">     static ptrdiff_t offsetOfIndexingHeader() { return IndexingHeader::offsetOfIndexingHeader(); }
</span><span class="cx">     static ptrdiff_t offsetOfArrayBuffer() { return offsetOfIndexingHeader() + IndexingHeader::offsetOfArrayBuffer(); }
</span><span class="lines">@@ -129,7 +131,7 @@
</span><span class="cx">     ArrayStorage* arrayStorage() { return indexingPayload<ArrayStorage>(); }
</span><span class="cx">     ContiguousJSValues contiguousInt32() { return ContiguousJSValues(indexingPayload<WriteBarrier<Unknown>>(), vectorLength()); }
</span><span class="cx"> 
</span><del>-    ContiguousDoubles contiguousDouble() { return ContiguousDoubles(indexingPayload<double>(), vectorLength()); }
</del><ins>+    ContiguousDoubles contiguousDouble() { return ContiguousDoubles(caged()->indexingPayload<double>(), vectorLength()); }
</ins><span class="cx">     ContiguousJSValues contiguous() { return ContiguousJSValues(indexingPayload<WriteBarrier<Unknown>>(), vectorLength()); }
</span><span class="cx">     
</span><span class="cx">     static Butterfly* fromContiguous(WriteBarrier<Unknown>* contiguous)
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreruntimeButterflyInlinesh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/runtime/ButterflyInlines.h (224563 => 224564)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/runtime/ButterflyInlines.h   2017-11-08 05:41:30 UTC (rev 224563)
+++ trunk/Source/JavaScriptCore/runtime/ButterflyInlines.h      2017-11-08 06:29:31 UTC (rev 224564)
</span><span class="lines">@@ -107,6 +107,8 @@
</span><span class="cx">     if (!oldButterfly)
</span><span class="cx">         return create(vm, intendedOwner, 0, newPropertyCapacity, false, IndexingHeader(), 0);
</span><span class="cx"> 
</span><ins>+    oldButterfly = oldButterfly->caged();
+
</ins><span class="cx">     size_t preCapacity = oldButterfly->indexingHeader()->preCapacity(structure);
</span><span class="cx">     size_t indexingPayloadSizeInBytes = oldButterfly->indexingHeader()->indexingPayloadSizeInBytes(structure);
</span><span class="cx">     bool hasIndexingHeader = structure->hasIndexingHeader(intendedOwner);
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreruntimeJSArraycpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/runtime/JSArray.cpp (224563 => 224564)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/runtime/JSArray.cpp  2017-11-08 05:41:30 UTC (rev 224563)
+++ trunk/Source/JavaScriptCore/runtime/JSArray.cpp     2017-11-08 06:29:31 UTC (rev 224564)
</span><span class="lines">@@ -558,7 +558,7 @@
</span><span class="cx">     VM& vm = exec->vm();
</span><span class="cx">     auto scope = DECLARE_THROW_SCOPE(vm);
</span><span class="cx"> 
</span><del>-    Butterfly* butterfly = m_butterfly.getMayBeNull();
</del><ins>+    Butterfly* butterfly = this->butterfly();
</ins><span class="cx">     switch (indexingType()) {
</span><span class="cx">     case ArrayClass:
</span><span class="cx">         if (!newLength)
</span><span class="lines">@@ -628,7 +628,7 @@
</span><span class="cx">     VM& vm = exec->vm();
</span><span class="cx">     auto scope = DECLARE_THROW_SCOPE(vm);
</span><span class="cx"> 
</span><del>-    Butterfly* butterfly = m_butterfly.getMayBeNull();
</del><ins>+    Butterfly* butterfly = this->butterfly();
</ins><span class="cx">     
</span><span class="cx">     switch (indexingType()) {
</span><span class="cx">     case ArrayClass:
</span><span class="lines">@@ -879,7 +879,7 @@
</span><span class="cx">     VM& vm = exec->vm();
</span><span class="cx">     RELEASE_ASSERT(count > 0);
</span><span class="cx"> 
</span><del>-    Butterfly* butterfly = m_butterfly.getMayBeNull();
</del><ins>+    Butterfly* butterfly = this->butterfly();
</ins><span class="cx">     
</span><span class="cx">     switch (indexingType()) {
</span><span class="cx">     case ArrayClass:
</span><span class="lines">@@ -1035,7 +1035,7 @@
</span><span class="cx">     VM& vm = exec->vm();
</span><span class="cx">     auto scope = DECLARE_THROW_SCOPE(vm);
</span><span class="cx"> 
</span><del>-    Butterfly* butterfly = m_butterfly.getMayBeNull();
</del><ins>+    Butterfly* butterfly = this->butterfly();
</ins><span class="cx">     
</span><span class="cx">     switch (indexingType()) {
</span><span class="cx">     case ArrayClass:
</span><span class="lines">@@ -1058,7 +1058,7 @@
</span><span class="cx">             throwOutOfMemoryError(exec, scope);
</span><span class="cx">             return false;
</span><span class="cx">         }
</span><del>-        butterfly = m_butterfly.getMayBeNull();
</del><ins>+        butterfly = this->butterfly();
</ins><span class="cx"> 
</span><span class="cx">         // We have to check for holes before we start moving things around so that we don't get halfway 
</span><span class="cx">         // through shifting and then realize we should have been in ArrayStorage mode.
</span><span class="lines">@@ -1102,7 +1102,7 @@
</span><span class="cx">             throwOutOfMemoryError(exec, scope);
</span><span class="cx">             return false;
</span><span class="cx">         }
</span><del>-        butterfly = m_butterfly.getMayBeNull();
</del><ins>+        butterfly = this->butterfly();
</ins><span class="cx">         
</span><span class="cx">         // We have to check for holes before we start moving things around so that we don't get halfway 
</span><span class="cx">         // through shifting and then realize we should have been in ArrayStorage mode.
</span><span class="lines">@@ -1145,7 +1145,7 @@
</span><span class="cx">     unsigned vectorEnd;
</span><span class="cx">     WriteBarrier<Unknown>* vector;
</span><span class="cx"> 
</span><del>-    Butterfly* butterfly = m_butterfly.getMayBeNull();
</del><ins>+    Butterfly* butterfly = this->butterfly();
</ins><span class="cx">     
</span><span class="cx">     switch (indexingType()) {
</span><span class="cx">     case ArrayClass:
</span><span class="lines">@@ -1218,7 +1218,7 @@
</span><span class="cx">     // FIXME: What prevents this from being called with a RuntimeArray? The length function will always return 0 in that case.
</span><span class="cx">     ASSERT(length == this->length());
</span><span class="cx"> 
</span><del>-    Butterfly* butterfly = m_butterfly.getMayBeNull();
</del><ins>+    Butterfly* butterfly = this->butterfly();
</ins><span class="cx">     switch (indexingType()) {
</span><span class="cx">     case ArrayClass:
</span><span class="cx">         return;
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreruntimeJSArrayInlinesh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/runtime/JSArrayInlines.h (224563 => 224564)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/runtime/JSArrayInlines.h     2017-11-08 05:41:30 UTC (rev 224563)
+++ trunk/Source/JavaScriptCore/runtime/JSArrayInlines.h        2017-11-08 06:29:31 UTC (rev 224564)
</span><span class="lines">@@ -88,7 +88,7 @@
</span><span class="cx">     VM& vm = exec->vm();
</span><span class="cx">     auto scope = DECLARE_THROW_SCOPE(vm);
</span><span class="cx"> 
</span><del>-    Butterfly* butterfly = m_butterfly.getMayBeNull();
</del><ins>+    Butterfly* butterfly = this->butterfly();
</ins><span class="cx"> 
</span><span class="cx">     switch (indexingType()) {
</span><span class="cx">     case ArrayClass: {
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreruntimeJSObjectcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/runtime/JSObject.cpp (224563 => 224564)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/runtime/JSObject.cpp 2017-11-08 05:41:30 UTC (rev 224563)
+++ trunk/Source/JavaScriptCore/runtime/JSObject.cpp    2017-11-08 06:29:31 UTC (rev 224564)
</span><span class="lines">@@ -462,7 +462,7 @@
</span><span class="cx">             builder.appendPropertyNameEdge(thisObject, toValue.asCell(), entry.key);
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    Butterfly* butterfly = thisObject->m_butterfly.getMayBeNull();
</del><ins>+    Butterfly* butterfly = thisObject->butterfly();
</ins><span class="cx">     if (butterfly) {
</span><span class="cx">         WriteBarrier<Unknown>* data = nullptr;
</span><span class="cx">         uint32_t count = 0;
</span><span class="lines">@@ -1026,7 +1026,7 @@
</span><span class="cx">     unsigned propertyCapacity = structure->outOfLineCapacity();
</span><span class="cx">     unsigned vectorLength = Butterfly::optimalContiguousVectorLength(propertyCapacity, length);
</span><span class="cx">     Butterfly* newButterfly = Butterfly::createOrGrowArrayRight(
</span><del>-        m_butterfly.getMayBeNull(), vm, this, structure, propertyCapacity, false, 0,
</del><ins>+        butterfly(), vm, this, structure, propertyCapacity, false, 0,
</ins><span class="cx">         sizeof(EncodedJSValue) * vectorLength);
</span><span class="cx">     newButterfly->setPublicLength(length);
</span><span class="cx">     newButterfly->setVectorLength(vectorLength);
</span><span class="lines">@@ -1114,7 +1114,7 @@
</span><span class="cx">     IndexingType oldType = indexingType();
</span><span class="cx">     ASSERT_UNUSED(oldType, !hasIndexedProperties(oldType));
</span><span class="cx"> 
</span><del>-    Butterfly* newButterfly = createArrayStorageButterfly(vm, this, oldStructure, length, vectorLength, m_butterfly.getMayBeNull());
</del><ins>+    Butterfly* newButterfly = createArrayStorageButterfly(vm, this, oldStructure, length, vectorLength, butterfly());
</ins><span class="cx">     ArrayStorage* result = newButterfly->arrayStorage();
</span><span class="cx">     Structure* newStructure = Structure::nonPropertyTransition(vm, oldStructure, suggestedArrayStorageTransition());
</span><span class="cx">     nukeStructureAndSetButterfly(vm, oldStructureID, newButterfly);
</span><span class="lines">@@ -1132,7 +1132,7 @@
</span><span class="cx"> {
</span><span class="cx">     ASSERT(hasUndecided(indexingType()));
</span><span class="cx"> 
</span><del>-    Butterfly* butterfly = m_butterfly.getMayBeNull();
</del><ins>+    Butterfly* butterfly = this->butterfly();
</ins><span class="cx">     for (unsigned i = butterfly->vectorLength(); i--;)
</span><span class="cx">         butterfly->contiguousInt32()[i].setWithoutWriteBarrier(JSValue());
</span><span class="cx"> 
</span><span class="lines">@@ -3173,7 +3173,7 @@
</span><span class="cx"> 
</span><span class="cx"> bool JSObject::ensureLengthSlow(VM& vm, unsigned length)
</span><span class="cx"> {
</span><del>-    Butterfly* butterfly = m_butterfly.get();
</del><ins>+    Butterfly* butterfly = this->butterfly()->caged();
</ins><span class="cx">     
</span><span class="cx">     ASSERT(length <= MAX_STORAGE_VECTOR_LENGTH);
</span><span class="cx">     ASSERT(hasContiguous(indexingType()) || hasInt32(indexingType()) || hasDouble(indexingType()) || hasUndecided(indexingType()));
</span><span class="lines">@@ -3233,7 +3233,7 @@
</span><span class="cx">     ASSERT(!m_butterfly->indexingHeader()->preCapacity(structure()));
</span><span class="cx"> 
</span><span class="cx">     DeferGC deferGC(vm.heap);
</span><del>-    Butterfly* newButterfly = m_butterfly->resizeArray(vm, this, structure(), 0, ArrayStorage::sizeFor(length));
</del><ins>+    Butterfly* newButterfly = butterfly()->caged()->resizeArray(vm, this, structure(), 0, ArrayStorage::sizeFor(length));
</ins><span class="cx">     newButterfly->setVectorLength(length);
</span><span class="cx">     newButterfly->setPublicLength(length);
</span><span class="cx">     WTF::storeStoreFence();
</span><span class="lines">@@ -3247,7 +3247,7 @@
</span><span class="cx">     // It's important that this function not rely on structure(), for the property
</span><span class="cx">     // capacity, since we might have already mutated the structure in-place.
</span><span class="cx"> 
</span><del>-    return Butterfly::createOrGrowPropertyStorage(m_butterfly.getMayBeNull(), vm, this, structure(vm), oldSize, newSize);
</del><ins>+    return Butterfly::createOrGrowPropertyStorage(butterfly(), vm, this, structure(vm), oldSize, newSize);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> static JSCustomGetterSetterFunction* getCustomGetterSetterFunctionForGetterSetter(ExecState* exec, PropertyName propertyName, CustomGetterSetter* getterSetter, JSCustomGetterSetterFunction::Type type)
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreruntimeJSObjecth"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/runtime/JSObject.h (224563 => 224564)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/runtime/JSObject.h   2017-11-08 05:41:30 UTC (rev 224563)
+++ trunk/Source/JavaScriptCore/runtime/JSObject.h      2017-11-08 06:29:31 UTC (rev 224564)
</span><span class="lines">@@ -255,7 +255,7 @@
</span><span class="cx">     
</span><span class="cx">     bool canGetIndexQuickly(unsigned i)
</span><span class="cx">     {
</span><del>-        Butterfly* butterfly = m_butterfly.getMayBeNull();
</del><ins>+        Butterfly* butterfly = this->butterfly();
</ins><span class="cx">         switch (indexingType()) {
</span><span class="cx">         case ALL_BLANK_INDEXING_TYPES:
</span><span class="cx">         case ALL_UNDECIDED_INDEXING_TYPES:
</span><span class="lines">@@ -281,7 +281,7 @@
</span><span class="cx">         
</span><span class="cx">     JSValue getIndexQuickly(unsigned i)
</span><span class="cx">     {
</span><del>-        Butterfly* butterfly = m_butterfly.get();
</del><ins>+        Butterfly* butterfly = this->butterfly();
</ins><span class="cx">         switch (indexingType()) {
</span><span class="cx">         case ALL_INT32_INDEXING_TYPES:
</span><span class="cx">             return jsNumber(butterfly->contiguous()[i].get().asInt32());
</span><span class="lines">@@ -299,7 +299,7 @@
</span><span class="cx">         
</span><span class="cx">     JSValue tryGetIndexQuickly(unsigned i) const
</span><span class="cx">     {
</span><del>-        Butterfly* butterfly = m_butterfly.getMayBeNull();
</del><ins>+        Butterfly* butterfly = const_cast<JSObject*>(this)->butterfly();
</ins><span class="cx">         switch (indexingType()) {
</span><span class="cx">         case ALL_BLANK_INDEXING_TYPES:
</span><span class="cx">         case ALL_UNDECIDED_INDEXING_TYPES:
</span><span class="lines">@@ -353,7 +353,7 @@
</span><span class="cx">         
</span><span class="cx">     bool canSetIndexQuickly(unsigned i)
</span><span class="cx">     {
</span><del>-        Butterfly* butterfly = m_butterfly.getMayBeNull();
</del><ins>+        Butterfly* butterfly = this->butterfly();
</ins><span class="cx">         switch (indexingType()) {
</span><span class="cx">         case ALL_BLANK_INDEXING_TYPES:
</span><span class="cx">         case ALL_UNDECIDED_INDEXING_TYPES:
</span><span class="lines">@@ -669,8 +669,8 @@
</span><span class="cx">         return inlineStorageUnsafe();
</span><span class="cx">     }
</span><span class="cx">         
</span><del>-    const Butterfly* butterfly() const { return m_butterfly.getMayBeNull(); }
-    Butterfly* butterfly() { return m_butterfly.getMayBeNull(); }
</del><ins>+    const Butterfly* butterfly() const { return m_butterfly.get(); }
+    Butterfly* butterfly() { return m_butterfly.get(); }
</ins><span class="cx">     
</span><span class="cx">     ConstPropertyStorage outOfLineStorage() const { return m_butterfly->propertyStorage(); }
</span><span class="cx">     PropertyStorage outOfLineStorage() { return m_butterfly->propertyStorage(); }
</span><span class="lines">@@ -1052,7 +1052,7 @@
</span><span class="cx">     PropertyOffset prepareToPutDirectWithoutTransition(VM&, PropertyName, unsigned attributes, StructureID, Structure*);
</span><span class="cx"> 
</span><span class="cx"> protected:
</span><del>-    CagedBarrierPtr<Gigacage::JSValue, Butterfly> m_butterfly;
</del><ins>+    AuxiliaryBarrier<Butterfly*> m_butterfly;
</ins><span class="cx"> #if USE(JSVALUE32_64)
</span><span class="cx"> private:
</span><span class="cx">     uint32_t m_padding;
</span></span></pre>
</div>
</div>

</body>
</html>