<!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>[197379] 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/197379">197379</a></dd>
<dt>Author</dt> <dd>commit-queue@webkit.org</dd>
<dt>Date</dt> <dd>2016-02-29 18:07:12 -0800 (Mon, 29 Feb 2016)</dd>
</dl>

<h3>Log Message</h3>
<pre>Add new MethodTable method to get an estimated size for a cell
https://bugs.webkit.org/show_bug.cgi?id=154838

Patch by Joseph Pecoraro &lt;pecoraro@apple.com&gt; on 2016-02-29
Reviewed by Filip Pizlo.

The new class method estimatedSize(JSCell*) estimates the size for a single cell.
As the name implies, this is meant to be an approximation. It is more important
that big objects report a large size, then to get perfect size information for
all objects in the heap.

    Base implementation (JSCell):
      - returns the MarkedBlock bucket size for this cell.
      - This gets us the object size include inline storage. Basically a better sizeof.

    Subclasses with &quot;Extra Memory Cost&quot;:
      - Any class that reports extra memory (reportExtraMemoryVisited) should include that in the estimated size.
      - E.g. CodeBlock, JSGenericTypedArrayView, WeakMapData, etc.

    Subclasses with &quot;Copied Space&quot; storage:
      - Any class with data in copied space (copyBackingStore) should include that in the estimated size.
      - E.g. JSObject, JSGenericTypedArrayView, JSMap, JSSet, DirectArguments, etc.

Add reportExtraMemoryVisited for UnlinkedCodeBlock's compressed unlinked
instructions because this can be larger than 1kb, which is significant.

This has one special case for RegExp generated bytecode / JIT code, which
does not currently fall into the extra memory cost or copied space storage.
In practice I haven't seen this grow to a significant cost.

* runtime/ClassInfo.h:
Add the new estimatedSize method to the table.

* bytecode/UnlinkedCodeBlock.cpp:
(JSC::UnlinkedCodeBlock::visitChildren):
(JSC::UnlinkedCodeBlock::estimatedSize):
(JSC::UnlinkedCodeBlock::setInstructions):
* bytecode/UnlinkedCodeBlock.h:
Report an extra memory cost for unlinked code blocks like
we do for linked code blocks.

* bytecode/CodeBlock.cpp:
(JSC::CodeBlock::estimatedSize):
* bytecode/CodeBlock.h:
* bytecode/UnlinkedInstructionStream.cpp:
(JSC::UnlinkedInstructionStream::sizeInBytes):
* bytecode/UnlinkedInstructionStream.h:
* runtime/DirectArguments.cpp:
(JSC::DirectArguments::estimatedSize):
* runtime/DirectArguments.h:
* runtime/JSCell.cpp:
(JSC::JSCell::estimatedSizeInBytes):
(JSC::JSCell::estimatedSize):
* runtime/JSCell.h:
* runtime/JSGenericTypedArrayView.h:
* runtime/JSGenericTypedArrayViewInlines.h:
(JSC::JSGenericTypedArrayView&lt;Adaptor&gt;::estimatedSize):
* runtime/JSMap.cpp:
(JSC::JSMap::estimatedSize):
* runtime/JSMap.h:
* runtime/JSObject.cpp:
(JSC::JSObject::visitButterfly):
* runtime/JSObject.h:
* runtime/JSSet.cpp:
(JSC::JSSet::estimatedSize):
* runtime/JSSet.h:
* runtime/JSString.cpp:
(JSC::JSString::estimatedSize):
* runtime/JSString.h:
* runtime/MapData.h:
(JSC::MapDataImpl::capacityInBytes):
* runtime/WeakMapData.cpp:
(JSC::WeakMapData::estimatedSize):
(JSC::WeakMapData::visitChildren):
* runtime/WeakMapData.h:
Implement estimated size following the pattern of reporting
extra visited size, or copy space memory.

* runtime/RegExp.cpp:
(JSC::RegExp::estimatedSize):
* runtime/RegExp.h:
* yarr/YarrInterpreter.h:
(JSC::Yarr::ByteDisjunction::estimatedSizeInBytes):
(JSC::Yarr::BytecodePattern::estimatedSizeInBytes):
* yarr/YarrJIT.h:
(JSC::Yarr::YarrCodeBlock::size):
Include generated bytecode / JITCode to a RegExp's size.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceJavaScriptCoreChangeLog">trunk/Source/JavaScriptCore/ChangeLog</a></li>
<li><a href="#trunkSourceJavaScriptCorebytecodeCodeBlockcpp">trunk/Source/JavaScriptCore/bytecode/CodeBlock.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCorebytecodeCodeBlockh">trunk/Source/JavaScriptCore/bytecode/CodeBlock.h</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>
<li><a href="#trunkSourceJavaScriptCorebytecodeUnlinkedInstructionStreamcpp">trunk/Source/JavaScriptCore/bytecode/UnlinkedInstructionStream.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCorebytecodeUnlinkedInstructionStreamh">trunk/Source/JavaScriptCore/bytecode/UnlinkedInstructionStream.h</a></li>
<li><a href="#trunkSourceJavaScriptCoreruntimeClassInfoh">trunk/Source/JavaScriptCore/runtime/ClassInfo.h</a></li>
<li><a href="#trunkSourceJavaScriptCoreruntimeDirectArgumentscpp">trunk/Source/JavaScriptCore/runtime/DirectArguments.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCoreruntimeDirectArgumentsh">trunk/Source/JavaScriptCore/runtime/DirectArguments.h</a></li>
<li><a href="#trunkSourceJavaScriptCoreruntimeJSCellcpp">trunk/Source/JavaScriptCore/runtime/JSCell.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCoreruntimeJSCellh">trunk/Source/JavaScriptCore/runtime/JSCell.h</a></li>
<li><a href="#trunkSourceJavaScriptCoreruntimeJSGenericTypedArrayViewh">trunk/Source/JavaScriptCore/runtime/JSGenericTypedArrayView.h</a></li>
<li><a href="#trunkSourceJavaScriptCoreruntimeJSGenericTypedArrayViewInlinesh">trunk/Source/JavaScriptCore/runtime/JSGenericTypedArrayViewInlines.h</a></li>
<li><a href="#trunkSourceJavaScriptCoreruntimeJSMapcpp">trunk/Source/JavaScriptCore/runtime/JSMap.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCoreruntimeJSMaph">trunk/Source/JavaScriptCore/runtime/JSMap.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>
<li><a href="#trunkSourceJavaScriptCoreruntimeJSSetcpp">trunk/Source/JavaScriptCore/runtime/JSSet.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCoreruntimeJSSeth">trunk/Source/JavaScriptCore/runtime/JSSet.h</a></li>
<li><a href="#trunkSourceJavaScriptCoreruntimeJSStringcpp">trunk/Source/JavaScriptCore/runtime/JSString.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCoreruntimeJSStringh">trunk/Source/JavaScriptCore/runtime/JSString.h</a></li>
<li><a href="#trunkSourceJavaScriptCoreruntimeMapDatah">trunk/Source/JavaScriptCore/runtime/MapData.h</a></li>
<li><a href="#trunkSourceJavaScriptCoreruntimeRegExpcpp">trunk/Source/JavaScriptCore/runtime/RegExp.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCoreruntimeRegExph">trunk/Source/JavaScriptCore/runtime/RegExp.h</a></li>
<li><a href="#trunkSourceJavaScriptCoreruntimeWeakMapDatacpp">trunk/Source/JavaScriptCore/runtime/WeakMapData.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCoreruntimeWeakMapDatah">trunk/Source/JavaScriptCore/runtime/WeakMapData.h</a></li>
<li><a href="#trunkSourceJavaScriptCoreyarrYarrInterpreterh">trunk/Source/JavaScriptCore/yarr/YarrInterpreter.h</a></li>
<li><a href="#trunkSourceJavaScriptCoreyarrYarrJITh">trunk/Source/JavaScriptCore/yarr/YarrJIT.h</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceJavaScriptCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/ChangeLog (197378 => 197379)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/ChangeLog        2016-03-01 01:36:09 UTC (rev 197378)
+++ trunk/Source/JavaScriptCore/ChangeLog        2016-03-01 02:07:12 UTC (rev 197379)
</span><span class="lines">@@ -1,3 +1,92 @@
</span><ins>+2016-02-29  Joseph Pecoraro  &lt;pecoraro@apple.com&gt;
+
+        Add new MethodTable method to get an estimated size for a cell
+        https://bugs.webkit.org/show_bug.cgi?id=154838
+
+        Reviewed by Filip Pizlo.
+
+        The new class method estimatedSize(JSCell*) estimates the size for a single cell.
+        As the name implies, this is meant to be an approximation. It is more important
+        that big objects report a large size, then to get perfect size information for
+        all objects in the heap.
+
+            Base implementation (JSCell):
+              - returns the MarkedBlock bucket size for this cell.
+              - This gets us the object size include inline storage. Basically a better sizeof.
+
+            Subclasses with &quot;Extra Memory Cost&quot;:
+              - Any class that reports extra memory (reportExtraMemoryVisited) should include that in the estimated size.
+              - E.g. CodeBlock, JSGenericTypedArrayView, WeakMapData, etc.
+
+            Subclasses with &quot;Copied Space&quot; storage:
+              - Any class with data in copied space (copyBackingStore) should include that in the estimated size.
+              - E.g. JSObject, JSGenericTypedArrayView, JSMap, JSSet, DirectArguments, etc.
+
+        Add reportExtraMemoryVisited for UnlinkedCodeBlock's compressed unlinked
+        instructions because this can be larger than 1kb, which is significant.
+
+        This has one special case for RegExp generated bytecode / JIT code, which
+        does not currently fall into the extra memory cost or copied space storage.
+        In practice I haven't seen this grow to a significant cost.
+
+        * runtime/ClassInfo.h:
+        Add the new estimatedSize method to the table.
+
+        * bytecode/UnlinkedCodeBlock.cpp:
+        (JSC::UnlinkedCodeBlock::visitChildren):
+        (JSC::UnlinkedCodeBlock::estimatedSize):
+        (JSC::UnlinkedCodeBlock::setInstructions):
+        * bytecode/UnlinkedCodeBlock.h:
+        Report an extra memory cost for unlinked code blocks like
+        we do for linked code blocks.
+
+        * bytecode/CodeBlock.cpp:
+        (JSC::CodeBlock::estimatedSize):
+        * bytecode/CodeBlock.h:
+        * bytecode/UnlinkedInstructionStream.cpp:
+        (JSC::UnlinkedInstructionStream::sizeInBytes):
+        * bytecode/UnlinkedInstructionStream.h:
+        * runtime/DirectArguments.cpp:
+        (JSC::DirectArguments::estimatedSize):
+        * runtime/DirectArguments.h:
+        * runtime/JSCell.cpp:
+        (JSC::JSCell::estimatedSizeInBytes):
+        (JSC::JSCell::estimatedSize):
+        * runtime/JSCell.h:
+        * runtime/JSGenericTypedArrayView.h:
+        * runtime/JSGenericTypedArrayViewInlines.h:
+        (JSC::JSGenericTypedArrayView&lt;Adaptor&gt;::estimatedSize):
+        * runtime/JSMap.cpp:
+        (JSC::JSMap::estimatedSize):
+        * runtime/JSMap.h:
+        * runtime/JSObject.cpp:
+        (JSC::JSObject::visitButterfly):
+        * runtime/JSObject.h:
+        * runtime/JSSet.cpp:
+        (JSC::JSSet::estimatedSize):
+        * runtime/JSSet.h:
+        * runtime/JSString.cpp:
+        (JSC::JSString::estimatedSize):
+        * runtime/JSString.h:
+        * runtime/MapData.h:
+        (JSC::MapDataImpl::capacityInBytes):
+        * runtime/WeakMapData.cpp:
+        (JSC::WeakMapData::estimatedSize):
+        (JSC::WeakMapData::visitChildren):
+        * runtime/WeakMapData.h:
+        Implement estimated size following the pattern of reporting
+        extra visited size, or copy space memory.
+
+        * runtime/RegExp.cpp:
+        (JSC::RegExp::estimatedSize):
+        * runtime/RegExp.h:
+        * yarr/YarrInterpreter.h:
+        (JSC::Yarr::ByteDisjunction::estimatedSizeInBytes):
+        (JSC::Yarr::BytecodePattern::estimatedSizeInBytes):
+        * yarr/YarrJIT.h:
+        (JSC::Yarr::YarrCodeBlock::size):
+        Include generated bytecode / JITCode to a RegExp's size.
+
</ins><span class="cx"> 2016-02-29  Filip Pizlo  &lt;fpizlo@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         SpeculatedType should be easier to edit
</span></span></pre></div>
<a id="trunkSourceJavaScriptCorebytecodeCodeBlockcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/bytecode/CodeBlock.cpp (197378 => 197379)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/bytecode/CodeBlock.cpp        2016-03-01 01:36:09 UTC (rev 197378)
+++ trunk/Source/JavaScriptCore/bytecode/CodeBlock.cpp        2016-03-01 02:07:12 UTC (rev 197379)
</span><span class="lines">@@ -2462,6 +2462,15 @@
</span><span class="cx"> #endif // ENABLE(DFG_JIT)
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+size_t CodeBlock::estimatedSize(JSCell* cell)
+{
+    CodeBlock* thisObject = jsCast&lt;CodeBlock*&gt;(cell);
+    size_t extraMemoryAllocated = thisObject-&gt;m_instructions.size() * sizeof(Instruction);
+    if (thisObject-&gt;m_jitCode)
+        extraMemoryAllocated += thisObject-&gt;m_jitCode-&gt;size();
+    return Base::estimatedSize(cell) + extraMemoryAllocated;
+}
+
</ins><span class="cx"> void CodeBlock::visitChildren(JSCell* cell, SlotVisitor&amp; visitor)
</span><span class="cx"> {
</span><span class="cx">     CodeBlock* thisObject = jsCast&lt;CodeBlock*&gt;(cell);
</span></span></pre></div>
<a id="trunkSourceJavaScriptCorebytecodeCodeBlockh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/bytecode/CodeBlock.h (197378 => 197379)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/bytecode/CodeBlock.h        2016-03-01 01:36:09 UTC (rev 197378)
+++ trunk/Source/JavaScriptCore/bytecode/CodeBlock.h        2016-03-01 02:07:12 UTC (rev 197379)
</span><span class="lines">@@ -179,6 +179,7 @@
</span><span class="cx">     // https://bugs.webkit.org/show_bug.cgi?id=123677
</span><span class="cx">     CodeBlock* baselineVersion();
</span><span class="cx"> 
</span><ins>+    static size_t estimatedSize(JSCell*);
</ins><span class="cx">     static void visitChildren(JSCell*, SlotVisitor&amp;);
</span><span class="cx">     void visitChildren(SlotVisitor&amp;);
</span><span class="cx">     void visitWeakly(SlotVisitor&amp;);
</span></span></pre></div>
<a id="trunkSourceJavaScriptCorebytecodeUnlinkedCodeBlockcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/bytecode/UnlinkedCodeBlock.cpp (197378 => 197379)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/bytecode/UnlinkedCodeBlock.cpp        2016-03-01 01:36:09 UTC (rev 197378)
+++ trunk/Source/JavaScriptCore/bytecode/UnlinkedCodeBlock.cpp        2016-03-01 02:07:12 UTC (rev 197379)
</span><span class="lines">@@ -99,12 +99,21 @@
</span><span class="cx">     for (FunctionExpressionVector::iterator ptr = thisObject-&gt;m_functionExprs.begin(), end = thisObject-&gt;m_functionExprs.end(); ptr != end; ++ptr)
</span><span class="cx">         visitor.append(ptr);
</span><span class="cx">     visitor.appendValues(thisObject-&gt;m_constantRegisters.data(), thisObject-&gt;m_constantRegisters.size());
</span><ins>+    if (thisObject-&gt;m_unlinkedInstructions)
+        visitor.reportExtraMemoryVisited(thisObject-&gt;m_unlinkedInstructions-&gt;sizeInBytes());
</ins><span class="cx">     if (thisObject-&gt;m_rareData) {
</span><span class="cx">         for (size_t i = 0, end = thisObject-&gt;m_rareData-&gt;m_regexps.size(); i != end; i++)
</span><span class="cx">             visitor.append(&amp;thisObject-&gt;m_rareData-&gt;m_regexps[i]);
</span><span class="cx">     }
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+size_t UnlinkedCodeBlock::estimatedSize(JSCell* cell)
+{
+    UnlinkedCodeBlock* thisObject = jsCast&lt;UnlinkedCodeBlock*&gt;(cell);
+    size_t extraSize = thisObject-&gt;m_unlinkedInstructions ? thisObject-&gt;m_unlinkedInstructions-&gt;sizeInBytes() : 0;
+    return Base::estimatedSize(cell) + extraSize;
+}
+
</ins><span class="cx"> int UnlinkedCodeBlock::lineNumberForBytecodeOffset(unsigned bytecodeOffset)
</span><span class="cx"> {
</span><span class="cx">     ASSERT(bytecodeOffset &lt; instructions().count());
</span><span class="lines">@@ -343,7 +352,9 @@
</span><span class="cx"> 
</span><span class="cx"> void UnlinkedCodeBlock::setInstructions(std::unique_ptr&lt;UnlinkedInstructionStream&gt; instructions)
</span><span class="cx"> {
</span><ins>+    ASSERT(instructions);
</ins><span class="cx">     m_unlinkedInstructions = WTFMove(instructions);
</span><ins>+    Heap::heap(this)-&gt;reportExtraMemoryAllocated(m_unlinkedInstructions-&gt;sizeInBytes());
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> const UnlinkedInstructionStream&amp; UnlinkedCodeBlock::instructions() const
</span></span></pre></div>
<a id="trunkSourceJavaScriptCorebytecodeUnlinkedCodeBlockh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/bytecode/UnlinkedCodeBlock.h (197378 => 197379)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/bytecode/UnlinkedCodeBlock.h        2016-03-01 01:36:09 UTC (rev 197378)
+++ trunk/Source/JavaScriptCore/bytecode/UnlinkedCodeBlock.h        2016-03-01 02:07:12 UTC (rev 197379)
</span><span class="lines">@@ -454,6 +454,7 @@
</span><span class="cx"> 
</span><span class="cx"> protected:
</span><span class="cx">     static void visitChildren(JSCell*, SlotVisitor&amp;);
</span><ins>+    static size_t estimatedSize(JSCell*);
</ins><span class="cx"> 
</span><span class="cx"> public:
</span><span class="cx">     DECLARE_INFO;
</span></span></pre></div>
<a id="trunkSourceJavaScriptCorebytecodeUnlinkedInstructionStreamcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/bytecode/UnlinkedInstructionStream.cpp (197378 => 197379)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/bytecode/UnlinkedInstructionStream.cpp        2016-03-01 01:36:09 UTC (rev 197378)
+++ trunk/Source/JavaScriptCore/bytecode/UnlinkedInstructionStream.cpp        2016-03-01 02:07:12 UTC (rev 197379)
</span><span class="lines">@@ -102,6 +102,11 @@
</span><span class="cx">     m_data = RefCountedArray&lt;unsigned char&gt;(buffer);
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+size_t UnlinkedInstructionStream::sizeInBytes() const
+{
+    return m_data.size() * sizeof(unsigned char);
+}
+
</ins><span class="cx"> #ifndef NDEBUG
</span><span class="cx"> const RefCountedArray&lt;UnlinkedInstruction&gt;&amp; UnlinkedInstructionStream::unpackForDebugging() const
</span><span class="cx"> {
</span></span></pre></div>
<a id="trunkSourceJavaScriptCorebytecodeUnlinkedInstructionStreamh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/bytecode/UnlinkedInstructionStream.h (197378 => 197379)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/bytecode/UnlinkedInstructionStream.h        2016-03-01 01:36:09 UTC (rev 197378)
+++ trunk/Source/JavaScriptCore/bytecode/UnlinkedInstructionStream.h        2016-03-01 02:07:12 UTC (rev 197379)
</span><span class="lines">@@ -38,6 +38,7 @@
</span><span class="cx">     explicit UnlinkedInstructionStream(const Vector&lt;UnlinkedInstruction, 0, UnsafeVectorOverflow&gt;&amp;);
</span><span class="cx"> 
</span><span class="cx">     unsigned count() const { return m_instructionCount; }
</span><ins>+    size_t sizeInBytes() const;
</ins><span class="cx"> 
</span><span class="cx">     class Reader {
</span><span class="cx">     public:
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreruntimeClassInfoh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/runtime/ClassInfo.h (197378 => 197379)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/runtime/ClassInfo.h        2016-03-01 01:36:09 UTC (rev 197378)
+++ trunk/Source/JavaScriptCore/runtime/ClassInfo.h        2016-03-01 02:07:12 UTC (rev 197379)
</span><span class="lines">@@ -105,6 +105,9 @@
</span><span class="cx"> 
</span><span class="cx">     typedef void (*DumpToStreamFunctionPtr)(const JSCell*, PrintStream&amp;);
</span><span class="cx">     DumpToStreamFunctionPtr dumpToStream;
</span><ins>+
+    typedef size_t (*EstimatedSizeFunctionPtr)(JSCell*);
+    EstimatedSizeFunctionPtr estimatedSize;
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> #define CREATE_MEMBER_CHECKER(member) \
</span><span class="lines">@@ -151,7 +154,8 @@
</span><span class="cx">         &amp;ClassName::defineOwnProperty, \
</span><span class="cx">         &amp;ClassName::slowDownAndWasteMemory, \
</span><span class="cx">         &amp;ClassName::getTypedArrayImpl, \
</span><del>-        &amp;ClassName::dumpToStream \
</del><ins>+        &amp;ClassName::dumpToStream, \
+        &amp;ClassName::estimatedSize \
</ins><span class="cx">     }, \
</span><span class="cx">     ClassName::TypedArrayStorageType
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreruntimeDirectArgumentscpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/runtime/DirectArguments.cpp (197378 => 197379)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/runtime/DirectArguments.cpp        2016-03-01 01:36:09 UTC (rev 197378)
+++ trunk/Source/JavaScriptCore/runtime/DirectArguments.cpp        2016-03-01 02:07:12 UTC (rev 197379)
</span><span class="lines">@@ -85,6 +85,13 @@
</span><span class="cx">     return result;
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+size_t DirectArguments::estimatedSize(JSCell* cell)
+{
+    DirectArguments* thisObject = jsCast&lt;DirectArguments*&gt;(cell);
+    size_t overridesSize = thisObject-&gt;m_overrides ? thisObject-&gt;overridesSize() : 0;
+    return Base::estimatedSize(cell) + overridesSize;
+}
+
</ins><span class="cx"> void DirectArguments::visitChildren(JSCell* thisCell, SlotVisitor&amp; visitor)
</span><span class="cx"> {
</span><span class="cx">     DirectArguments* thisObject = static_cast&lt;DirectArguments*&gt;(thisCell);
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreruntimeDirectArgumentsh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/runtime/DirectArguments.h (197378 => 197379)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/runtime/DirectArguments.h        2016-03-01 01:36:09 UTC (rev 197378)
+++ trunk/Source/JavaScriptCore/runtime/DirectArguments.h        2016-03-01 02:07:12 UTC (rev 197379)
</span><span class="lines">@@ -55,7 +55,8 @@
</span><span class="cx">     
</span><span class="cx">     // Creates an arguments object by copying the argumnets from the stack.
</span><span class="cx">     static DirectArguments* createByCopying(ExecState*);
</span><del>-    
</del><ins>+
+    static size_t estimatedSize(JSCell*);
</ins><span class="cx">     static void visitChildren(JSCell*, SlotVisitor&amp;);
</span><span class="cx">     static void copyBackingStore(JSCell*, CopyVisitor&amp;, CopyToken);
</span><span class="cx">     
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreruntimeJSCellcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/runtime/JSCell.cpp (197378 => 197379)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/runtime/JSCell.cpp        2016-03-01 01:36:09 UTC (rev 197378)
+++ trunk/Source/JavaScriptCore/runtime/JSCell.cpp        2016-03-01 02:07:12 UTC (rev 197379)
</span><span class="lines">@@ -51,6 +51,16 @@
</span><span class="cx">     out.printf(&quot;&lt;%p, %s&gt;&quot;, cell, cell-&gt;className());
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+size_t JSCell::estimatedSizeInBytes() const
+{
+    return methodTable()-&gt;estimatedSize(const_cast&lt;JSCell*&gt;(this));
+}
+
+size_t JSCell::estimatedSize(JSCell* cell)
+{
+    return MarkedBlock::blockFor(cell)-&gt;cellSize();
+}
+
</ins><span class="cx"> void JSCell::copyBackingStore(JSCell*, CopyVisitor&amp;, CopyToken)
</span><span class="cx"> {
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreruntimeJSCellh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/runtime/JSCell.h (197378 => 197379)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/runtime/JSCell.h        2016-03-01 01:36:09 UTC (rev 197378)
+++ trunk/Source/JavaScriptCore/runtime/JSCell.h        2016-03-01 02:07:12 UTC (rev 197379)
</span><span class="lines">@@ -134,6 +134,10 @@
</span><span class="cx"> 
</span><span class="cx">     void dump(PrintStream&amp;) const;
</span><span class="cx">     JS_EXPORT_PRIVATE static void dumpToStream(const JSCell*, PrintStream&amp;);
</span><ins>+
+    size_t estimatedSizeInBytes() const;
+    JS_EXPORT_PRIVATE static size_t estimatedSize(JSCell*);
+
</ins><span class="cx">     static void visitChildren(JSCell*, SlotVisitor&amp;);
</span><span class="cx">     JS_EXPORT_PRIVATE static void copyBackingStore(JSCell*, CopyVisitor&amp;, CopyToken);
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreruntimeJSGenericTypedArrayViewh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/runtime/JSGenericTypedArrayView.h (197378 => 197379)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/runtime/JSGenericTypedArrayView.h        2016-03-01 01:36:09 UTC (rev 197378)
+++ trunk/Source/JavaScriptCore/runtime/JSGenericTypedArrayView.h        2016-03-01 02:07:12 UTC (rev 197379)
</span><span class="lines">@@ -283,7 +283,8 @@
</span><span class="cx">     static bool deletePropertyByIndex(JSCell*, ExecState*, unsigned propertyName);
</span><span class="cx">     
</span><span class="cx">     static void getOwnPropertyNames(JSObject*, ExecState*, PropertyNameArray&amp;, EnumerationMode);
</span><del>-    
</del><ins>+
+    static size_t estimatedSize(JSCell*);
</ins><span class="cx">     static void visitChildren(JSCell*, SlotVisitor&amp;);
</span><span class="cx">     static void copyBackingStore(JSCell*, CopyVisitor&amp;, CopyToken);
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreruntimeJSGenericTypedArrayViewInlinesh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/runtime/JSGenericTypedArrayViewInlines.h (197378 => 197379)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/runtime/JSGenericTypedArrayViewInlines.h        2016-03-01 01:36:09 UTC (rev 197378)
+++ trunk/Source/JavaScriptCore/runtime/JSGenericTypedArrayViewInlines.h        2016-03-01 02:07:12 UTC (rev 197379)
</span><span class="lines">@@ -406,6 +406,19 @@
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> template&lt;typename Adaptor&gt;
</span><ins>+size_t JSGenericTypedArrayView&lt;Adaptor&gt;::estimatedSize(JSCell* cell)
+{
+    JSGenericTypedArrayView* thisObject = jsCast&lt;JSGenericTypedArrayView*&gt;(cell);
+
+    if (thisObject-&gt;m_mode == OversizeTypedArray)
+        return Base::estimatedSize(thisObject) + thisObject-&gt;byteSize();
+    if (thisObject-&gt;m_mode == FastTypedArray &amp;&amp; thisObject-&gt;m_vector)
+        return Base::estimatedSize(thisObject) + thisObject-&gt;byteSize();
+
+    return Base::estimatedSize(thisObject);
+}
+
+template&lt;typename Adaptor&gt;
</ins><span class="cx"> void JSGenericTypedArrayView&lt;Adaptor&gt;::visitChildren(JSCell* cell, SlotVisitor&amp; visitor)
</span><span class="cx"> {
</span><span class="cx">     JSGenericTypedArrayView* thisObject = jsCast&lt;JSGenericTypedArrayView*&gt;(cell);
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreruntimeJSMapcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/runtime/JSMap.cpp (197378 => 197379)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/runtime/JSMap.cpp        2016-03-01 01:36:09 UTC (rev 197378)
+++ trunk/Source/JavaScriptCore/runtime/JSMap.cpp        2016-03-01 02:07:12 UTC (rev 197379)
</span><span class="lines">@@ -43,6 +43,13 @@
</span><span class="cx">     thisObject-&gt;JSMap::~JSMap();
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+size_t JSMap::estimatedSize(JSCell* cell)
+{
+    JSMap* thisObject = jsCast&lt;JSMap*&gt;(cell);
+    size_t mapDataSize = thisObject-&gt;m_mapData.capacityInBytes();
+    return Base::estimatedSize(cell) + mapDataSize;
+}
+
</ins><span class="cx"> void JSMap::visitChildren(JSCell* cell, SlotVisitor&amp; visitor)
</span><span class="cx"> {
</span><span class="cx">     Base::visitChildren(cell, visitor);
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreruntimeJSMaph"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/runtime/JSMap.h (197378 => 197379)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/runtime/JSMap.h        2016-03-01 01:36:09 UTC (rev 197378)
+++ trunk/Source/JavaScriptCore/runtime/JSMap.h        2016-03-01 02:07:12 UTC (rev 197379)
</span><span class="lines">@@ -122,6 +122,7 @@
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     static void destroy(JSCell*);
</span><ins>+    static size_t estimatedSize(JSCell*);
</ins><span class="cx">     static void visitChildren(JSCell*, SlotVisitor&amp;);
</span><span class="cx">     static void copyBackingStore(JSCell*, CopyVisitor&amp;, CopyToken);
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreruntimeJSObjectcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/runtime/JSObject.cpp (197378 => 197379)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/runtime/JSObject.cpp        2016-03-01 01:36:09 UTC (rev 197378)
+++ trunk/Source/JavaScriptCore/runtime/JSObject.cpp        2016-03-01 02:07:12 UTC (rev 197379)
</span><span class="lines">@@ -197,6 +197,13 @@
</span><span class="cx">     }
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+size_t JSObject::estimatedSize(JSCell* cell)
+{
+    JSObject* thisObject = jsCast&lt;JSObject*&gt;(cell);
+    size_t butterflyOutOfLineSize = thisObject-&gt;m_butterfly ? thisObject-&gt;structure()-&gt;outOfLineSize() : 0;
+    return Base::estimatedSize(cell) + butterflyOutOfLineSize;
+}
+
</ins><span class="cx"> void JSObject::visitChildren(JSCell* cell, SlotVisitor&amp; visitor)
</span><span class="cx"> {
</span><span class="cx">     JSObject* thisObject = jsCast&lt;JSObject*&gt;(cell);
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreruntimeJSObjecth"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/runtime/JSObject.h (197378 => 197379)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/runtime/JSObject.h        2016-03-01 01:36:09 UTC (rev 197378)
+++ trunk/Source/JavaScriptCore/runtime/JSObject.h        2016-03-01 02:07:12 UTC (rev 197379)
</span><span class="lines">@@ -94,7 +94,8 @@
</span><span class="cx"> 
</span><span class="cx"> public:
</span><span class="cx">     typedef JSCell Base;
</span><del>-        
</del><ins>+
+    JS_EXPORT_PRIVATE static size_t estimatedSize(JSCell*);
</ins><span class="cx">     JS_EXPORT_PRIVATE static void visitChildren(JSCell*, SlotVisitor&amp;);
</span><span class="cx">     JS_EXPORT_PRIVATE static void copyBackingStore(JSCell*, CopyVisitor&amp;, CopyToken);
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreruntimeJSSetcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/runtime/JSSet.cpp (197378 => 197379)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/runtime/JSSet.cpp        2016-03-01 01:36:09 UTC (rev 197378)
+++ trunk/Source/JavaScriptCore/runtime/JSSet.cpp        2016-03-01 02:07:12 UTC (rev 197379)
</span><span class="lines">@@ -43,6 +43,13 @@
</span><span class="cx">     thisObject-&gt;JSSet::~JSSet();
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+size_t JSSet::estimatedSize(JSCell* cell)
+{
+    JSSet* thisObject = jsCast&lt;JSSet*&gt;(cell);
+    size_t setDataSize = thisObject-&gt;m_setData.capacityInBytes();
+    return Base::estimatedSize(cell) + setDataSize;
+}
+
</ins><span class="cx"> void JSSet::visitChildren(JSCell* cell, SlotVisitor&amp; visitor)
</span><span class="cx"> {
</span><span class="cx">     Base::visitChildren(cell, visitor);
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreruntimeJSSeth"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/runtime/JSSet.h (197378 => 197379)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/runtime/JSSet.h        2016-03-01 01:36:09 UTC (rev 197378)
+++ trunk/Source/JavaScriptCore/runtime/JSSet.h        2016-03-01 02:07:12 UTC (rev 197379)
</span><span class="lines">@@ -117,6 +117,7 @@
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     static void destroy(JSCell*);
</span><ins>+    static size_t estimatedSize(JSCell*);
</ins><span class="cx">     static void visitChildren(JSCell*, SlotVisitor&amp;);
</span><span class="cx">     static void copyBackingStore(JSCell*, CopyVisitor&amp;, CopyToken);
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreruntimeJSStringcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/runtime/JSString.cpp (197378 => 197379)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/runtime/JSString.cpp        2016-03-01 01:36:09 UTC (rev 197378)
+++ trunk/Source/JavaScriptCore/runtime/JSString.cpp        2016-03-01 02:07:12 UTC (rev 197379)
</span><span class="lines">@@ -72,6 +72,14 @@
</span><span class="cx">     out.printf(&quot;&gt;&quot;);
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+size_t JSString::estimatedSize(JSCell* cell)
+{
+    JSString* thisObject = jsCast&lt;JSString*&gt;(cell);
+    if (thisObject-&gt;isRope())
+        return Base::estimatedSize(cell);
+    return Base::estimatedSize(cell) + thisObject-&gt;m_value.impl()-&gt;costDuringGC();
+}
+
</ins><span class="cx"> void JSString::visitChildren(JSCell* cell, SlotVisitor&amp; visitor)
</span><span class="cx"> {
</span><span class="cx">     JSString* thisObject = jsCast&lt;JSString*&gt;(cell);
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreruntimeJSStringh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/runtime/JSString.h (197378 => 197379)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/runtime/JSString.h        2016-03-01 01:36:09 UTC (rev 197378)
+++ trunk/Source/JavaScriptCore/runtime/JSString.h        2016-03-01 02:07:12 UTC (rev 197379)
</span><span class="lines">@@ -181,6 +181,7 @@
</span><span class="cx">     DECLARE_EXPORT_INFO;
</span><span class="cx"> 
</span><span class="cx">     static void dumpToStream(const JSCell*, PrintStream&amp;);
</span><ins>+    static size_t estimatedSize(JSCell*);
</ins><span class="cx">     static void visitChildren(JSCell*, SlotVisitor&amp;);
</span><span class="cx"> 
</span><span class="cx">     enum {
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreruntimeMapDatah"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/runtime/MapData.h (197378 => 197379)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/runtime/MapData.h        2016-03-01 01:36:09 UTC (rev 197378)
+++ trunk/Source/JavaScriptCore/runtime/MapData.h        2016-03-01 02:07:12 UTC (rev 197379)
</span><span class="lines">@@ -111,6 +111,8 @@
</span><span class="cx">     void visitChildren(JSCell* owner, SlotVisitor&amp;);
</span><span class="cx">     void copyBackingStore(CopyVisitor&amp;, CopyToken);
</span><span class="cx"> 
</span><ins>+    size_t capacityInBytes() const { return m_capacity * sizeof(Entry); }
+
</ins><span class="cx"> private:
</span><span class="cx">     typedef WTF::UnsignedWithZeroKeyHashTraits&lt;int32_t&gt; IndexTraits;
</span><span class="cx"> 
</span><span class="lines">@@ -119,8 +121,6 @@
</span><span class="cx">     typedef HashMap&lt;StringImpl*, int32_t, typename WTF::DefaultHash&lt;StringImpl*&gt;::Hash, WTF::HashTraits&lt;StringImpl*&gt;, IndexTraits&gt; StringKeyedMap;
</span><span class="cx">     typedef HashMap&lt;SymbolImpl*, int32_t, typename WTF::PtrHash&lt;SymbolImpl*&gt;, WTF::HashTraits&lt;SymbolImpl*&gt;, IndexTraits&gt; SymbolKeyedMap;
</span><span class="cx"> 
</span><del>-    size_t capacityInBytes() { return m_capacity * sizeof(Entry); }
-
</del><span class="cx">     ALWAYS_INLINE Entry* find(ExecState*, KeyType);
</span><span class="cx">     ALWAYS_INLINE Entry* add(ExecState*, JSCell* owner, KeyType);
</span><span class="cx">     template &lt;typename Map, typename Key&gt; ALWAYS_INLINE Entry* add(ExecState*, JSCell* owner, Map&amp;, Key, KeyType);
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreruntimeRegExpcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/runtime/RegExp.cpp (197378 => 197379)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/runtime/RegExp.cpp        2016-03-01 01:36:09 UTC (rev 197378)
+++ trunk/Source/JavaScriptCore/runtime/RegExp.cpp        2016-03-01 02:07:12 UTC (rev 197379)
</span><span class="lines">@@ -256,6 +256,16 @@
</span><span class="cx">     thisObject-&gt;RegExp::~RegExp();
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+size_t RegExp::estimatedSize(JSCell* cell)
+{
+    RegExp* thisObject = static_cast&lt;RegExp*&gt;(cell);
+    size_t regexDataSize = thisObject-&gt;m_regExpBytecode ? thisObject-&gt;m_regExpBytecode-&gt;estimatedSizeInBytes() : 0;
+#if ENABLE(YARR_JIT)
+    regexDataSize += thisObject-&gt;m_regExpJITCode.size();
+#endif
+    return Base::estimatedSize(cell) + regexDataSize;
+}
+
</ins><span class="cx"> RegExp* RegExp::createWithoutCaching(VM&amp; vm, const String&amp; patternString, RegExpFlags flags)
</span><span class="cx"> {
</span><span class="cx">     RegExp* regExp = new (NotNull, allocateCell&lt;RegExp&gt;(vm.heap)) RegExp(vm, patternString, flags);
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreruntimeRegExph"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/runtime/RegExp.h (197378 => 197379)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/runtime/RegExp.h        2016-03-01 01:36:09 UTC (rev 197378)
+++ trunk/Source/JavaScriptCore/runtime/RegExp.h        2016-03-01 02:07:12 UTC (rev 197379)
</span><span class="lines">@@ -50,6 +50,7 @@
</span><span class="cx">     JS_EXPORT_PRIVATE static RegExp* create(VM&amp;, const String&amp; pattern, RegExpFlags);
</span><span class="cx">     static const bool needsDestruction = true;
</span><span class="cx">     static void destroy(JSCell*);
</span><ins>+    static size_t estimatedSize(JSCell*);
</ins><span class="cx"> 
</span><span class="cx">     bool global() const { return m_flags &amp; FlagGlobal; }
</span><span class="cx">     bool ignoreCase() const { return m_flags &amp; FlagIgnoreCase; }
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreruntimeWeakMapDatacpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/runtime/WeakMapData.cpp (197378 => 197379)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/runtime/WeakMapData.cpp        2016-03-01 01:36:09 UTC (rev 197378)
+++ trunk/Source/JavaScriptCore/runtime/WeakMapData.cpp        2016-03-01 02:07:12 UTC (rev 197379)
</span><span class="lines">@@ -54,6 +54,12 @@
</span><span class="cx">     static_cast&lt;WeakMapData*&gt;(cell)-&gt;~WeakMapData();
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+size_t WeakMapData::estimatedSize(JSCell* cell)
+{
+    WeakMapData* thisObj = jsCast&lt;WeakMapData*&gt;(cell);
+    return Base::estimatedSize(cell) + (thisObj-&gt;m_map.capacity() * (sizeof(JSObject*) + sizeof(WriteBarrier&lt;Unknown&gt;)));
+}
+
</ins><span class="cx"> void WeakMapData::visitChildren(JSCell* cell, SlotVisitor&amp; visitor)
</span><span class="cx"> {
</span><span class="cx">     Base::visitChildren(cell, visitor);
</span><span class="lines">@@ -63,7 +69,7 @@
</span><span class="cx"> 
</span><span class="cx">     // Rough approximation of the external storage needed for the hashtable.
</span><span class="cx">     // This isn't exact, but it is close enough, and proportional to the actual
</span><del>-    // external mermory usage.
</del><ins>+    // external memory usage.
</ins><span class="cx">     visitor.reportExtraMemoryVisited(thisObj-&gt;m_map.capacity() * (sizeof(JSObject*) + sizeof(WriteBarrier&lt;Unknown&gt;)));
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreruntimeWeakMapDatah"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/runtime/WeakMapData.h (197378 => 197379)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/runtime/WeakMapData.h        2016-03-01 01:36:09 UTC (rev 197378)
+++ trunk/Source/JavaScriptCore/runtime/WeakMapData.h        2016-03-01 02:07:12 UTC (rev 197379)
</span><span class="lines">@@ -70,6 +70,7 @@
</span><span class="cx"> private:
</span><span class="cx">     WeakMapData(VM&amp;);
</span><span class="cx">     static void destroy(JSCell*);
</span><ins>+    static size_t estimatedSize(JSCell*);
</ins><span class="cx">     static void visitChildren(JSCell*, SlotVisitor&amp;);
</span><span class="cx">     void finishCreation(VM&amp;);
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreyarrYarrInterpreterh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/yarr/YarrInterpreter.h (197378 => 197379)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/yarr/YarrInterpreter.h        2016-03-01 01:36:09 UTC (rev 197378)
+++ trunk/Source/JavaScriptCore/yarr/YarrInterpreter.h        2016-03-01 02:07:12 UTC (rev 197379)
</span><span class="lines">@@ -327,6 +327,8 @@
</span><span class="cx">     {
</span><span class="cx">     }
</span><span class="cx"> 
</span><ins>+    size_t estimatedSizeInBytes() const { return terms.capacity() * sizeof(ByteTerm); }
+
</ins><span class="cx">     Vector&lt;ByteTerm&gt; terms;
</span><span class="cx">     unsigned m_numSubpatterns;
</span><span class="cx">     unsigned m_frameSize;
</span><span class="lines">@@ -353,6 +355,8 @@
</span><span class="cx">         m_userCharacterClasses.shrinkToFit();
</span><span class="cx">     }
</span><span class="cx"> 
</span><ins>+    size_t estimatedSizeInBytes() const { return m_body-&gt;estimatedSizeInBytes(); }
+
</ins><span class="cx">     std::unique_ptr&lt;ByteDisjunction&gt; m_body;
</span><span class="cx">     bool m_ignoreCase;
</span><span class="cx">     bool m_multiline;
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreyarrYarrJITh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/yarr/YarrJIT.h (197378 => 197379)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/yarr/YarrJIT.h        2016-03-01 01:36:09 UTC (rev 197378)
+++ trunk/Source/JavaScriptCore/yarr/YarrJIT.h        2016-03-01 02:07:12 UTC (rev 197379)
</span><span class="lines">@@ -141,6 +141,11 @@
</span><span class="cx">     }
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><ins>+    size_t size() const
+    {
+        return m_ref8.size() + m_ref16.size() + m_matchOnly8.size() + m_matchOnly16.size();
+    }
+
</ins><span class="cx">     void clear()
</span><span class="cx">     {
</span><span class="cx">         m_ref8 = MacroAssemblerCodeRef();
</span></span></pre>
</div>
</div>

</body>
</html>