<!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>[197303] 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/197303">197303</a></dd>
<dt>Author</dt> <dd>akling@apple.com</dd>
<dt>Date</dt> <dd>2016-02-28 14:21:54 -0800 (Sun, 28 Feb 2016)</dd>
</dl>

<h3>Log Message</h3>
<pre>Shrink UnlinkedCodeBlock a bit.
&lt;https://webkit.org/b/154797&gt;

Reviewed by Anders Carlsson.

Move profiler-related members of UnlinkedCodeBlock into its RareData
structure, saving 40 bytes, and then reorder the other members of
UnlinkedCodeBlock to save another 24 bytes, netting a nice total 64.

The VM member was removed entirely since UnlinkedCodeBlock is a cell
and can retrieve its VM through MarkedBlock header lookup.

* bytecode/UnlinkedCodeBlock.cpp:
(JSC::UnlinkedCodeBlock::vm):
(JSC::UnlinkedCodeBlock::typeProfilerExpressionInfoForBytecodeOffset):
(JSC::UnlinkedCodeBlock::addTypeProfilerExpressionInfo):
(JSC::UnlinkedCodeBlock::UnlinkedCodeBlock): Deleted.
* bytecode/UnlinkedCodeBlock.h:
(JSC::UnlinkedCodeBlock::addRegExp):
(JSC::UnlinkedCodeBlock::addConstant):
(JSC::UnlinkedCodeBlock::addFunctionDecl):
(JSC::UnlinkedCodeBlock::addFunctionExpr):
(JSC::UnlinkedCodeBlock::addOpProfileControlFlowBytecodeOffset):
(JSC::UnlinkedCodeBlock::opProfileControlFlowBytecodeOffsets):
(JSC::UnlinkedCodeBlock::vm): Deleted.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceJavaScriptCoreChangeLog">trunk/Source/JavaScriptCore/ChangeLog</a></li>
<li><a href="#trunkSourceJavaScriptCorebytecodeUnlinkedCodeBlockcpp">trunk/Source/JavaScriptCore/bytecode/UnlinkedCodeBlock.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCorebytecodeUnlinkedCodeBlockh">trunk/Source/JavaScriptCore/bytecode/UnlinkedCodeBlock.h</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceJavaScriptCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/ChangeLog (197302 => 197303)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/ChangeLog        2016-02-28 21:56:44 UTC (rev 197302)
+++ trunk/Source/JavaScriptCore/ChangeLog        2016-02-28 22:21:54 UTC (rev 197303)
</span><span class="lines">@@ -1,3 +1,31 @@
</span><ins>+2016-02-28  Andreas Kling  &lt;akling@apple.com&gt;
+
+        Shrink UnlinkedCodeBlock a bit.
+        &lt;https://webkit.org/b/154797&gt;
+
+        Reviewed by Anders Carlsson.
+
+        Move profiler-related members of UnlinkedCodeBlock into its RareData
+        structure, saving 40 bytes, and then reorder the other members of
+        UnlinkedCodeBlock to save another 24 bytes, netting a nice total 64.
+
+        The VM member was removed entirely since UnlinkedCodeBlock is a cell
+        and can retrieve its VM through MarkedBlock header lookup.
+
+        * bytecode/UnlinkedCodeBlock.cpp:
+        (JSC::UnlinkedCodeBlock::vm):
+        (JSC::UnlinkedCodeBlock::typeProfilerExpressionInfoForBytecodeOffset):
+        (JSC::UnlinkedCodeBlock::addTypeProfilerExpressionInfo):
+        (JSC::UnlinkedCodeBlock::UnlinkedCodeBlock): Deleted.
+        * bytecode/UnlinkedCodeBlock.h:
+        (JSC::UnlinkedCodeBlock::addRegExp):
+        (JSC::UnlinkedCodeBlock::addConstant):
+        (JSC::UnlinkedCodeBlock::addFunctionDecl):
+        (JSC::UnlinkedCodeBlock::addFunctionExpr):
+        (JSC::UnlinkedCodeBlock::addOpProfileControlFlowBytecodeOffset):
+        (JSC::UnlinkedCodeBlock::opProfileControlFlowBytecodeOffsets):
+        (JSC::UnlinkedCodeBlock::vm): Deleted.
+
</ins><span class="cx"> 2016-02-27  Filip Pizlo  &lt;fpizlo@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         FTL should lower its abstract heaps to B3 heap ranges
</span></span></pre></div>
<a id="trunkSourceJavaScriptCorebytecodeUnlinkedCodeBlockcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/bytecode/UnlinkedCodeBlock.cpp (197302 => 197303)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/bytecode/UnlinkedCodeBlock.cpp        2016-02-28 21:56:44 UTC (rev 197302)
+++ trunk/Source/JavaScriptCore/bytecode/UnlinkedCodeBlock.cpp        2016-02-28 22:21:54 UTC (rev 197303)
</span><span class="lines">@@ -56,7 +56,6 @@
</span><span class="cx">     , m_numVars(0)
</span><span class="cx">     , m_numCalleeLocals(0)
</span><span class="cx">     , m_numParameters(0)
</span><del>-    , m_vm(vm)
</del><span class="cx">     , m_globalObjectRegister(VirtualRegister())
</span><span class="cx">     , m_usesEval(info.usesEval())
</span><span class="cx">     , m_isStrictMode(info.isStrictMode())
</span><span class="lines">@@ -85,6 +84,11 @@
</span><span class="cx">     ASSERT(m_constructorKind == static_cast&lt;unsigned&gt;(info.constructorKind()));
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+VM* UnlinkedCodeBlock::vm() const
+{
+    return MarkedBlock::blockFor(this)-&gt;vm();
+}
+
</ins><span class="cx"> void UnlinkedCodeBlock::visitChildren(JSCell* cell, SlotVisitor&amp; visitor)
</span><span class="cx"> {
</span><span class="cx">     UnlinkedCodeBlock* thisObject = jsCast&lt;UnlinkedCodeBlock*&gt;(cell);
</span><span class="lines">@@ -261,9 +265,10 @@
</span><span class="cx"> 
</span><span class="cx"> bool UnlinkedCodeBlock::typeProfilerExpressionInfoForBytecodeOffset(unsigned bytecodeOffset, unsigned&amp; startDivot, unsigned&amp; endDivot)
</span><span class="cx"> {
</span><ins>+    ASSERT(m_rareData);
</ins><span class="cx">     static const bool verbose = false;
</span><del>-    auto iter = m_typeProfilerInfoMap.find(bytecodeOffset);
-    if (iter == m_typeProfilerInfoMap.end()) {
</del><ins>+    auto iter = m_rareData-&gt;m_typeProfilerInfoMap.find(bytecodeOffset);
+    if (iter == m_rareData-&gt;m_typeProfilerInfoMap.end()) {
</ins><span class="cx">         if (verbose)
</span><span class="cx">             dataLogF(&quot;Don't have assignment info for offset:%u\n&quot;, bytecodeOffset);
</span><span class="cx">         startDivot = UINT_MAX;
</span><span class="lines">@@ -271,7 +276,7 @@
</span><span class="cx">         return false;
</span><span class="cx">     }
</span><span class="cx">     
</span><del>-    TypeProfilerExpressionRange&amp; range = iter-&gt;value;
</del><ins>+    RareData::TypeProfilerExpressionRange&amp; range = iter-&gt;value;
</ins><span class="cx">     startDivot = range.m_startDivot;
</span><span class="cx">     endDivot = range.m_endDivot;
</span><span class="cx">     return true;
</span><span class="lines">@@ -279,10 +284,11 @@
</span><span class="cx"> 
</span><span class="cx"> void UnlinkedCodeBlock::addTypeProfilerExpressionInfo(unsigned instructionOffset, unsigned startDivot, unsigned endDivot)
</span><span class="cx"> {
</span><del>-    TypeProfilerExpressionRange range;
</del><ins>+    createRareDataIfNecessary();
+    RareData::TypeProfilerExpressionRange range;
</ins><span class="cx">     range.m_startDivot = startDivot;
</span><span class="cx">     range.m_endDivot = endDivot;
</span><del>-    m_typeProfilerInfoMap.set(instructionOffset, range);  
</del><ins>+    m_rareData-&gt;m_typeProfilerInfoMap.set(instructionOffset, range);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void UnlinkedProgramCodeBlock::visitChildren(JSCell* cell, SlotVisitor&amp; visitor)
</span></span></pre></div>
<a id="trunkSourceJavaScriptCorebytecodeUnlinkedCodeBlockh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/bytecode/UnlinkedCodeBlock.h (197302 => 197303)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/bytecode/UnlinkedCodeBlock.h        2016-02-28 21:56:44 UTC (rev 197302)
+++ trunk/Source/JavaScriptCore/bytecode/UnlinkedCodeBlock.h        2016-02-28 22:21:54 UTC (rev 197303)
</span><span class="lines">@@ -148,7 +148,7 @@
</span><span class="cx">     {
</span><span class="cx">         createRareDataIfNecessary();
</span><span class="cx">         unsigned size = m_rareData-&gt;m_regexps.size();
</span><del>-        m_rareData-&gt;m_regexps.append(WriteBarrier&lt;RegExp&gt;(*m_vm, this, r));
</del><ins>+        m_rareData-&gt;m_regexps.append(WriteBarrier&lt;RegExp&gt;(*vm(), this, r));
</ins><span class="cx">         return size;
</span><span class="cx">     }
</span><span class="cx">     unsigned numberOfRegExps() const
</span><span class="lines">@@ -170,7 +170,7 @@
</span><span class="cx">     {
</span><span class="cx">         unsigned result = m_constantRegisters.size();
</span><span class="cx">         m_constantRegisters.append(WriteBarrier&lt;Unknown&gt;());
</span><del>-        m_constantRegisters.last().set(*m_vm, this, v);
</del><ins>+        m_constantRegisters.last().set(*vm(), this, v);
</ins><span class="cx">         m_constantsSourceCodeRepresentation.append(sourceCodeRepresentation);
</span><span class="cx">         return result;
</span><span class="cx">     }
</span><span class="lines">@@ -249,7 +249,7 @@
</span><span class="cx">     {
</span><span class="cx">         unsigned size = m_functionDecls.size();
</span><span class="cx">         m_functionDecls.append(WriteBarrier&lt;UnlinkedFunctionExecutable&gt;());
</span><del>-        m_functionDecls.last().set(*m_vm, this, n);
</del><ins>+        m_functionDecls.last().set(*vm(), this, n);
</ins><span class="cx">         return size;
</span><span class="cx">     }
</span><span class="cx">     UnlinkedFunctionExecutable* functionDecl(int index) { return m_functionDecls[index].get(); }
</span><span class="lines">@@ -258,7 +258,7 @@
</span><span class="cx">     {
</span><span class="cx">         unsigned size = m_functionExprs.size();
</span><span class="cx">         m_functionExprs.append(WriteBarrier&lt;UnlinkedFunctionExecutable&gt;());
</span><del>-        m_functionExprs.last().set(*m_vm, this, n);
</del><ins>+        m_functionExprs.last().set(*vm(), this, n);
</ins><span class="cx">         return size;
</span><span class="cx">     }
</span><span class="cx">     UnlinkedFunctionExecutable* functionExpr(int index) { return m_functionExprs[index].get(); }
</span><span class="lines">@@ -269,7 +269,7 @@
</span><span class="cx">     void addExceptionHandler(const UnlinkedHandlerInfo&amp; handler) { createRareDataIfNecessary(); return m_rareData-&gt;m_exceptionHandlers.append(handler); }
</span><span class="cx">     UnlinkedHandlerInfo&amp; exceptionHandler(int index) { ASSERT(m_rareData); return m_rareData-&gt;m_exceptionHandlers[index]; }
</span><span class="cx"> 
</span><del>-    VM* vm() const { return m_vm; }
</del><ins>+    VM* vm() const;
</ins><span class="cx"> 
</span><span class="cx">     UnlinkedArrayProfile addArrayProfile() { return m_arrayProfileCount++; }
</span><span class="cx">     unsigned numberOfArrayProfiles() { return m_arrayProfileCount; }
</span><span class="lines">@@ -345,8 +345,16 @@
</span><span class="cx">     ALWAYS_INLINE unsigned startColumn() const { return 0; }
</span><span class="cx">     unsigned endColumn() const { return m_endColumn; }
</span><span class="cx"> 
</span><del>-    void addOpProfileControlFlowBytecodeOffset(size_t offset) { m_opProfileControlFlowBytecodeOffsets.append(offset); }
-    const Vector&lt;size_t&gt;&amp; opProfileControlFlowBytecodeOffsets() const { return m_opProfileControlFlowBytecodeOffsets; }
</del><ins>+    void addOpProfileControlFlowBytecodeOffset(size_t offset)
+    {
+        createRareDataIfNecessary();
+        m_rareData-&gt;m_opProfileControlFlowBytecodeOffsets.append(offset);
+    }
+    const Vector&lt;size_t&gt;&amp; opProfileControlFlowBytecodeOffsets() const
+    {
+        ASSERT(m_rareData);
+        return m_rareData-&gt;m_opProfileControlFlowBytecodeOffsets;
+    }
</ins><span class="cx"> 
</span><span class="cx">     void dumpExpressionRangeInfo(); // For debugging purpose only.
</span><span class="cx"> 
</span><span class="lines">@@ -369,11 +377,10 @@
</span><span class="cx"> 
</span><span class="cx">     void getLineAndColumn(ExpressionRangeInfo&amp;, unsigned&amp; line, unsigned&amp; column);
</span><span class="cx"> 
</span><ins>+    int m_numParameters;
+
</ins><span class="cx">     std::unique_ptr&lt;UnlinkedInstructionStream&gt; m_unlinkedInstructions;
</span><span class="cx"> 
</span><del>-    int m_numParameters;
-    VM* m_vm;
-
</del><span class="cx">     VirtualRegister m_thisRegister;
</span><span class="cx">     VirtualRegister m_scopeRegister;
</span><span class="cx">     VirtualRegister m_globalObjectRegister;
</span><span class="lines">@@ -398,17 +405,17 @@
</span><span class="cx"> 
</span><span class="cx">     Vector&lt;unsigned&gt; m_jumpTargets;
</span><span class="cx"> 
</span><ins>+    Vector&lt;unsigned&gt; m_propertyAccessInstructions;
+
</ins><span class="cx">     // Constant Pools
</span><span class="cx">     Vector&lt;Identifier&gt; m_identifiers;
</span><span class="cx">     Vector&lt;WriteBarrier&lt;Unknown&gt;&gt; m_constantRegisters;
</span><span class="cx">     Vector&lt;SourceCodeRepresentation&gt; m_constantsSourceCodeRepresentation;
</span><del>-    std::array&lt;unsigned, LinkTimeConstantCount&gt; m_linkTimeConstants;
</del><span class="cx">     typedef Vector&lt;WriteBarrier&lt;UnlinkedFunctionExecutable&gt;&gt; FunctionExpressionVector;
</span><span class="cx">     FunctionExpressionVector m_functionDecls;
</span><span class="cx">     FunctionExpressionVector m_functionExprs;
</span><ins>+    std::array&lt;unsigned, LinkTimeConstantCount&gt; m_linkTimeConstants;
</ins><span class="cx"> 
</span><del>-    Vector&lt;unsigned&gt; m_propertyAccessInstructions;
-
</del><span class="cx">     unsigned m_arrayProfileCount;
</span><span class="cx">     unsigned m_arrayAllocationProfileCount;
</span><span class="cx">     unsigned m_objectAllocationProfileCount;
</span><span class="lines">@@ -432,17 +439,18 @@
</span><span class="cx">         Vector&lt;UnlinkedStringJumpTable&gt; m_stringSwitchJumpTables;
</span><span class="cx"> 
</span><span class="cx">         Vector&lt;ExpressionRangeInfo::FatPosition&gt; m_expressionInfoFatPositions;
</span><ins>+
+        struct TypeProfilerExpressionRange {
+            unsigned m_startDivot;
+            unsigned m_endDivot;
+        };
+        HashMap&lt;unsigned, TypeProfilerExpressionRange&gt; m_typeProfilerInfoMap;
+        Vector&lt;size_t&gt; m_opProfileControlFlowBytecodeOffsets;
</ins><span class="cx">     };
</span><span class="cx"> 
</span><span class="cx"> private:
</span><span class="cx">     std::unique_ptr&lt;RareData&gt; m_rareData;
</span><span class="cx">     Vector&lt;ExpressionRangeInfo&gt; m_expressionInfo;
</span><del>-    struct TypeProfilerExpressionRange {
-        unsigned m_startDivot;
-        unsigned m_endDivot;
-    };
-    HashMap&lt;unsigned, TypeProfilerExpressionRange&gt; m_typeProfilerInfoMap;
-    Vector&lt;size_t&gt; m_opProfileControlFlowBytecodeOffsets;
</del><span class="cx"> 
</span><span class="cx"> protected:
</span><span class="cx">     static void visitChildren(JSCell*, SlotVisitor&amp;);
</span></span></pre>
</div>
</div>

</body>
</html>