<!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>[188849] 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/188849">188849</a></dd>
<dt>Author</dt> <dd>benjamin@webkit.org</dd>
<dt>Date</dt> <dd>2015-08-23 23:18:42 -0700 (Sun, 23 Aug 2015)</dd>
</dl>
<h3>Log Message</h3>
<pre>[JSC] Reduce the memory usage of BytecodeLivenessAnalysis
https://bugs.webkit.org/show_bug.cgi?id=148353
Patch by Benjamin Poulain <bpoulain@apple.com> on 2015-08-23
Reviewed by Darin Adler.
BytecodeLivenessAnalysis easily takes kilobytes of memory for
non trivial blocks and that memory sticks around because
it stored on CodeBlock.
This patch reduces that memory use a bit.
Most of the memory is in the array of BytecodeBasicBlock.
BytecodeBasicBlock is shrunk by:
-Making it not ref-counted.
-Removing m_predecessors, it was only used for debugging and
is usually big.
-Added a shrinkToFit() phase to shrink the vectors once we are
done building the BytecodeBasicBlock.
There are more things we should do in the future:
-Store all the BytecodeBasicBlock direclty in the array.
We know the size ahead of time, this would be a pure win.
The only tricky part is changing m_successors to have the
index of the successor instead of a pointer.
-Stop putting duplicates in m_successors.
* bytecode/BytecodeBasicBlock.cpp:
(JSC::computeBytecodeBasicBlocks):
(JSC::BytecodeBasicBlock::shrinkToFit): Deleted.
(JSC::linkBlocks): Deleted.
* bytecode/BytecodeBasicBlock.h:
(JSC::BytecodeBasicBlock::addSuccessor):
(JSC::BytecodeBasicBlock::addPredecessor): Deleted.
(JSC::BytecodeBasicBlock::predecessors): Deleted.
* bytecode/BytecodeLivenessAnalysis.cpp:
(JSC::getLeaderOffsetForBasicBlock):
(JSC::findBasicBlockWithLeaderOffset):
(JSC::findBasicBlockForBytecodeOffset):
(JSC::stepOverInstruction):
(JSC::computeLocalLivenessForBytecodeOffset):
(JSC::computeLocalLivenessForBlock):
(JSC::BytecodeLivenessAnalysis::dumpResults): Deleted.
* bytecode/BytecodeLivenessAnalysis.h:</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceJavaScriptCoreChangeLog">trunk/Source/JavaScriptCore/ChangeLog</a></li>
<li><a href="#trunkSourceJavaScriptCorebytecodeBytecodeBasicBlockcpp">trunk/Source/JavaScriptCore/bytecode/BytecodeBasicBlock.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCorebytecodeBytecodeBasicBlockh">trunk/Source/JavaScriptCore/bytecode/BytecodeBasicBlock.h</a></li>
<li><a href="#trunkSourceJavaScriptCorebytecodeBytecodeLivenessAnalysiscpp">trunk/Source/JavaScriptCore/bytecode/BytecodeLivenessAnalysis.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCorebytecodeBytecodeLivenessAnalysish">trunk/Source/JavaScriptCore/bytecode/BytecodeLivenessAnalysis.h</a></li>
<li><a href="#trunkSourceJavaScriptCorebytecodePreciseJumpTargetscpp">trunk/Source/JavaScriptCore/bytecode/PreciseJumpTargets.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCorebytecodePreciseJumpTargetsh">trunk/Source/JavaScriptCore/bytecode/PreciseJumpTargets.h</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceJavaScriptCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/ChangeLog (188848 => 188849)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/ChangeLog        2015-08-24 05:33:42 UTC (rev 188848)
+++ trunk/Source/JavaScriptCore/ChangeLog        2015-08-24 06:18:42 UTC (rev 188849)
</span><span class="lines">@@ -1,3 +1,49 @@
</span><ins>+2015-08-23 Benjamin Poulain <bpoulain@apple.com>
+
+ [JSC] Reduce the memory usage of BytecodeLivenessAnalysis
+ https://bugs.webkit.org/show_bug.cgi?id=148353
+
+ Reviewed by Darin Adler.
+
+ BytecodeLivenessAnalysis easily takes kilobytes of memory for
+ non trivial blocks and that memory sticks around because
+ it stored on CodeBlock.
+
+ This patch reduces that memory use a bit.
+
+ Most of the memory is in the array of BytecodeBasicBlock.
+ BytecodeBasicBlock is shrunk by:
+ -Making it not ref-counted.
+ -Removing m_predecessors, it was only used for debugging and
+ is usually big.
+ -Added a shrinkToFit() phase to shrink the vectors once we are
+ done building the BytecodeBasicBlock.
+
+ There are more things we should do in the future:
+ -Store all the BytecodeBasicBlock direclty in the array.
+ We know the size ahead of time, this would be a pure win.
+ The only tricky part is changing m_successors to have the
+ index of the successor instead of a pointer.
+ -Stop putting duplicates in m_successors.
+
+ * bytecode/BytecodeBasicBlock.cpp:
+ (JSC::computeBytecodeBasicBlocks):
+ (JSC::BytecodeBasicBlock::shrinkToFit): Deleted.
+ (JSC::linkBlocks): Deleted.
+ * bytecode/BytecodeBasicBlock.h:
+ (JSC::BytecodeBasicBlock::addSuccessor):
+ (JSC::BytecodeBasicBlock::addPredecessor): Deleted.
+ (JSC::BytecodeBasicBlock::predecessors): Deleted.
+ * bytecode/BytecodeLivenessAnalysis.cpp:
+ (JSC::getLeaderOffsetForBasicBlock):
+ (JSC::findBasicBlockWithLeaderOffset):
+ (JSC::findBasicBlockForBytecodeOffset):
+ (JSC::stepOverInstruction):
+ (JSC::computeLocalLivenessForBytecodeOffset):
+ (JSC::computeLocalLivenessForBlock):
+ (JSC::BytecodeLivenessAnalysis::dumpResults): Deleted.
+ * bytecode/BytecodeLivenessAnalysis.h:
+
</ins><span class="cx"> 2015-08-23 Geoffrey Garen <ggaren@apple.com>
</span><span class="cx">
</span><span class="cx"> Unreviewed, rolling back in r188792.
</span></span></pre></div>
<a id="trunkSourceJavaScriptCorebytecodeBytecodeBasicBlockcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/bytecode/BytecodeBasicBlock.cpp (188848 => 188849)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/bytecode/BytecodeBasicBlock.cpp        2015-08-24 05:33:42 UTC (rev 188848)
+++ trunk/Source/JavaScriptCore/bytecode/BytecodeBasicBlock.cpp        2015-08-24 06:18:42 UTC (rev 188849)
</span><span class="lines">@@ -1,5 +1,5 @@
</span><span class="cx"> /*
</span><del>- * Copyright (C) 2013 Apple Inc. All rights reserved.
</del><ins>+ * Copyright (C) 2013, 2015 Apple Inc. All rights reserved.
</ins><span class="cx"> *
</span><span class="cx"> * Redistribution and use in source and binary forms, with or without
</span><span class="cx"> * modification, are permitted provided that the following conditions
</span><span class="lines">@@ -32,6 +32,12 @@
</span><span class="cx">
</span><span class="cx"> namespace JSC {
</span><span class="cx">
</span><ins>+void BytecodeBasicBlock::shrinkToFit()
+{
+ m_bytecodeOffsets.shrinkToFit();
+ m_successors.shrinkToFit();
+}
+
</ins><span class="cx"> static bool isBranch(OpcodeID opcodeID)
</span><span class="cx"> {
</span><span class="cx"> switch (opcodeID) {
</span><span class="lines">@@ -91,39 +97,37 @@
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><del>-static bool isJumpTarget(OpcodeID opcodeID, Vector<unsigned, 32>& jumpTargets, unsigned bytecodeOffset)
</del><ins>+static bool isJumpTarget(OpcodeID opcodeID, const Vector<unsigned, 32>& jumpTargets, unsigned bytecodeOffset)
</ins><span class="cx"> {
</span><span class="cx"> if (opcodeID == op_catch)
</span><span class="cx"> return true;
</span><span class="cx">
</span><del>- for (unsigned i = 0; i < jumpTargets.size(); i++) {
- if (bytecodeOffset == jumpTargets[i])
- return true;
- }
- return false;
</del><ins>+ return std::binary_search(jumpTargets.begin(), jumpTargets.end(), bytecodeOffset);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> static void linkBlocks(BytecodeBasicBlock* predecessor, BytecodeBasicBlock* successor)
</span><span class="cx"> {
</span><span class="cx"> predecessor->addSuccessor(successor);
</span><del>- successor->addPredecessor(predecessor);
</del><span class="cx"> }
</span><span class="cx">
</span><del>-void computeBytecodeBasicBlocks(CodeBlock* codeBlock, Vector<RefPtr<BytecodeBasicBlock> >& basicBlocks)
</del><ins>+void computeBytecodeBasicBlocks(CodeBlock* codeBlock, Vector<std::unique_ptr<BytecodeBasicBlock>>& basicBlocks)
</ins><span class="cx"> {
</span><span class="cx"> Vector<unsigned, 32> jumpTargets;
</span><span class="cx"> computePreciseJumpTargets(codeBlock, jumpTargets);
</span><span class="cx">
</span><span class="cx"> // Create the entry and exit basic blocks.
</span><del>- BytecodeBasicBlock* entry = new BytecodeBasicBlock(BytecodeBasicBlock::EntryBlock);
- basicBlocks.append(adoptRef(entry));
- BytecodeBasicBlock* exit = new BytecodeBasicBlock(BytecodeBasicBlock::ExitBlock);
</del><ins>+ basicBlocks.reserveCapacity(jumpTargets.size() + 2);
</ins><span class="cx">
</span><del>- // Find basic block boundaries.
- BytecodeBasicBlock* current = new BytecodeBasicBlock(0, 0);
- linkBlocks(entry, current);
- basicBlocks.append(adoptRef(current));
</del><ins>+ auto entry = std::make_unique<BytecodeBasicBlock>(BytecodeBasicBlock::EntryBlock);
+ auto firstBlock = std::make_unique<BytecodeBasicBlock>(0, 0);
+ linkBlocks(entry.get(), firstBlock.get());
</ins><span class="cx">
</span><ins>+ basicBlocks.append(WTF::move(entry));
+ BytecodeBasicBlock* current = firstBlock.get();
+ basicBlocks.append(WTF::move(firstBlock));
+
+ auto exit = std::make_unique<BytecodeBasicBlock>(BytecodeBasicBlock::ExitBlock);
+
</ins><span class="cx"> bool nextInstructionIsLeader = false;
</span><span class="cx">
</span><span class="cx"> Interpreter* interpreter = codeBlock->vm()->interpreter;
</span><span class="lines">@@ -136,9 +140,9 @@
</span><span class="cx"> bool createdBlock = false;
</span><span class="cx"> // If the current bytecode is a jump target, then it's the leader of its own basic block.
</span><span class="cx"> if (isJumpTarget(opcodeID, jumpTargets, bytecodeOffset) || nextInstructionIsLeader) {
</span><del>- BytecodeBasicBlock* block = new BytecodeBasicBlock(bytecodeOffset, opcodeLength);
- basicBlocks.append(adoptRef(block));
- current = block;
</del><ins>+ auto newBlock = std::make_unique<BytecodeBasicBlock>(bytecodeOffset, opcodeLength);
+ current = newBlock.get();
+ basicBlocks.append(WTF::move(newBlock));
</ins><span class="cx"> createdBlock = true;
</span><span class="cx"> nextInstructionIsLeader = false;
</span><span class="cx"> bytecodeOffset += opcodeLength;
</span><span class="lines">@@ -171,7 +175,7 @@
</span><span class="cx"> // If we found a terminal bytecode, link to the exit block.
</span><span class="cx"> if (isTerminal(opcodeID)) {
</span><span class="cx"> ASSERT(bytecodeOffset + opcodeLength == block->leaderBytecodeOffset() + block->totalBytecodeLength());
</span><del>- linkBlocks(block, exit);
</del><ins>+ linkBlocks(block, exit.get());
</ins><span class="cx"> fallsThrough = false;
</span><span class="cx"> break;
</span><span class="cx"> }
</span><span class="lines">@@ -184,7 +188,7 @@
</span><span class="cx"> HandlerInfo* handler = codeBlock->handlerForBytecodeOffset(bytecodeOffset);
</span><span class="cx"> fallsThrough = false;
</span><span class="cx"> if (!handler) {
</span><del>- linkBlocks(block, exit);
</del><ins>+ linkBlocks(block, exit.get());
</ins><span class="cx"> break;
</span><span class="cx"> }
</span><span class="cx"> for (unsigned i = 0; i < basicBlocks.size(); i++) {
</span><span class="lines">@@ -225,7 +229,10 @@
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><del>- basicBlocks.append(adoptRef(exit));
</del><ins>+ basicBlocks.append(WTF::move(exit));
+
+ for (auto& basicBlock : basicBlocks)
+ basicBlock->shrinkToFit();
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> } // namespace JSC
</span></span></pre></div>
<a id="trunkSourceJavaScriptCorebytecodeBytecodeBasicBlockh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/bytecode/BytecodeBasicBlock.h (188848 => 188849)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/bytecode/BytecodeBasicBlock.h        2015-08-24 05:33:42 UTC (rev 188848)
+++ trunk/Source/JavaScriptCore/bytecode/BytecodeBasicBlock.h        2015-08-24 06:18:42 UTC (rev 188849)
</span><span class="lines">@@ -1,5 +1,5 @@
</span><span class="cx"> /*
</span><del>- * Copyright (C) 2013 Apple Inc. All rights reserved.
</del><ins>+ * Copyright (C) 2013, 2015 Apple Inc. All rights reserved.
</ins><span class="cx"> *
</span><span class="cx"> * Redistribution and use in source and binary forms, with or without
</span><span class="cx"> * modification, are permitted provided that the following conditions
</span><span class="lines">@@ -36,11 +36,13 @@
</span><span class="cx">
</span><span class="cx"> class CodeBlock;
</span><span class="cx">
</span><del>-class BytecodeBasicBlock : public RefCounted<BytecodeBasicBlock> {
</del><ins>+class BytecodeBasicBlock {
+ WTF_MAKE_FAST_ALLOCATED;
</ins><span class="cx"> public:
</span><span class="cx"> enum SpecialBlockType { EntryBlock, ExitBlock };
</span><span class="cx"> BytecodeBasicBlock(unsigned start, unsigned length);
</span><span class="cx"> BytecodeBasicBlock(SpecialBlockType);
</span><ins>+ void shrinkToFit();
</ins><span class="cx">
</span><span class="cx"> bool isEntryBlock() { return !m_leaderBytecodeOffset && !m_totalBytecodeLength; }
</span><span class="cx"> bool isExitBlock() { return m_leaderBytecodeOffset == UINT_MAX && m_totalBytecodeLength == UINT_MAX; }
</span><span class="lines">@@ -51,12 +53,9 @@
</span><span class="cx"> Vector<unsigned>& bytecodeOffsets() { return m_bytecodeOffsets; }
</span><span class="cx"> void addBytecodeLength(unsigned);
</span><span class="cx">
</span><del>- void addPredecessor(BytecodeBasicBlock* block) { m_predecessors.append(block); }
</del><ins>+ Vector<BytecodeBasicBlock*>& successors() { return m_successors; }
</ins><span class="cx"> void addSuccessor(BytecodeBasicBlock* block) { m_successors.append(block); }
</span><span class="cx">
</span><del>- Vector<BytecodeBasicBlock*>& predecessors() { return m_predecessors; }
- Vector<BytecodeBasicBlock*>& successors() { return m_successors; }
-
</del><span class="cx"> FastBitVector& in() { return m_in; }
</span><span class="cx"> FastBitVector& out() { return m_out; }
</span><span class="cx">
</span><span class="lines">@@ -65,15 +64,13 @@
</span><span class="cx"> unsigned m_totalBytecodeLength;
</span><span class="cx">
</span><span class="cx"> Vector<unsigned> m_bytecodeOffsets;
</span><del>-
- Vector<BytecodeBasicBlock*> m_predecessors;
</del><span class="cx"> Vector<BytecodeBasicBlock*> m_successors;
</span><span class="cx">
</span><span class="cx"> FastBitVector m_in;
</span><span class="cx"> FastBitVector m_out;
</span><span class="cx"> };
</span><span class="cx">
</span><del>-void computeBytecodeBasicBlocks(CodeBlock*, Vector<RefPtr<BytecodeBasicBlock> >&);
</del><ins>+void computeBytecodeBasicBlocks(CodeBlock*, Vector<std::unique_ptr<BytecodeBasicBlock>>&);
</ins><span class="cx">
</span><span class="cx"> inline BytecodeBasicBlock::BytecodeBasicBlock(unsigned start, unsigned length)
</span><span class="cx"> : m_leaderBytecodeOffset(start)
</span></span></pre></div>
<a id="trunkSourceJavaScriptCorebytecodeBytecodeLivenessAnalysiscpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/bytecode/BytecodeLivenessAnalysis.cpp (188848 => 188849)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/bytecode/BytecodeLivenessAnalysis.cpp        2015-08-24 05:33:42 UTC (rev 188848)
+++ trunk/Source/JavaScriptCore/bytecode/BytecodeLivenessAnalysis.cpp        2015-08-24 06:18:42 UTC (rev 188849)
</span><span class="lines">@@ -51,14 +51,14 @@
</span><span class="cx"> return virtualReg.isLocal();
</span><span class="cx"> }
</span><span class="cx">
</span><del>-static unsigned getLeaderOffsetForBasicBlock(RefPtr<BytecodeBasicBlock>* basicBlock)
</del><ins>+static unsigned getLeaderOffsetForBasicBlock(std::unique_ptr<BytecodeBasicBlock>* basicBlock)
</ins><span class="cx"> {
</span><span class="cx"> return (*basicBlock)->leaderBytecodeOffset();
</span><span class="cx"> }
</span><span class="cx">
</span><del>-static BytecodeBasicBlock* findBasicBlockWithLeaderOffset(Vector<RefPtr<BytecodeBasicBlock> >& basicBlocks, unsigned leaderOffset)
</del><ins>+static BytecodeBasicBlock* findBasicBlockWithLeaderOffset(Vector<std::unique_ptr<BytecodeBasicBlock>>& basicBlocks, unsigned leaderOffset)
</ins><span class="cx"> {
</span><del>- return (*tryBinarySearch<RefPtr<BytecodeBasicBlock>, unsigned>(basicBlocks, basicBlocks.size(), leaderOffset, getLeaderOffsetForBasicBlock)).get();
</del><ins>+ return (*tryBinarySearch<std::unique_ptr<BytecodeBasicBlock>, unsigned>(basicBlocks, basicBlocks.size(), leaderOffset, getLeaderOffsetForBasicBlock)).get();
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> static bool blockContainsBytecodeOffset(BytecodeBasicBlock* block, unsigned bytecodeOffset)
</span><span class="lines">@@ -67,7 +67,7 @@
</span><span class="cx"> return bytecodeOffset >= leaderOffset && bytecodeOffset < leaderOffset + block->totalBytecodeLength();
</span><span class="cx"> }
</span><span class="cx">
</span><del>-static BytecodeBasicBlock* findBasicBlockForBytecodeOffset(Vector<RefPtr<BytecodeBasicBlock> >& basicBlocks, unsigned bytecodeOffset)
</del><ins>+static BytecodeBasicBlock* findBasicBlockForBytecodeOffset(Vector<std::unique_ptr<BytecodeBasicBlock>>& basicBlocks, unsigned bytecodeOffset)
</ins><span class="cx"> {
</span><span class="cx"> /*
</span><span class="cx"> for (unsigned i = 0; i < basicBlocks.size(); i++) {
</span><span class="lines">@@ -76,7 +76,7 @@
</span><span class="cx"> }
</span><span class="cx"> return 0;
</span><span class="cx"> */
</span><del>- RefPtr<BytecodeBasicBlock>* basicBlock = approximateBinarySearch<RefPtr<BytecodeBasicBlock>, unsigned>(
</del><ins>+ std::unique_ptr<BytecodeBasicBlock>* basicBlock = approximateBinarySearch<std::unique_ptr<BytecodeBasicBlock>, unsigned>(
</ins><span class="cx"> basicBlocks, basicBlocks.size(), bytecodeOffset, getLeaderOffsetForBasicBlock);
</span><span class="cx"> // We found the block we were looking for.
</span><span class="cx"> if (blockContainsBytecodeOffset((*basicBlock).get(), bytecodeOffset))
</span><span class="lines">@@ -98,7 +98,7 @@
</span><span class="cx"> // Simplified interface to bytecode use/def, which determines defs first and then uses, and includes
</span><span class="cx"> // exception handlers in the uses.
</span><span class="cx"> template<typename UseFunctor, typename DefFunctor>
</span><del>-static void stepOverInstruction(CodeBlock* codeBlock, Vector<RefPtr<BytecodeBasicBlock>>& basicBlocks, unsigned bytecodeOffset, const UseFunctor& use, const DefFunctor& def)
</del><ins>+static void stepOverInstruction(CodeBlock* codeBlock, Vector<std::unique_ptr<BytecodeBasicBlock>>& basicBlocks, unsigned bytecodeOffset, const UseFunctor& use, const DefFunctor& def)
</ins><span class="cx"> {
</span><span class="cx"> // This abstractly execute the instruction in reverse. Instructions logically first use operands and
</span><span class="cx"> // then define operands. This logical ordering is necessary for operations that use and def the same
</span><span class="lines">@@ -138,7 +138,7 @@
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><del>-static void stepOverInstruction(CodeBlock* codeBlock, Vector<RefPtr<BytecodeBasicBlock>>& basicBlocks, unsigned bytecodeOffset, FastBitVector& out)
</del><ins>+static void stepOverInstruction(CodeBlock* codeBlock, Vector<std::unique_ptr<BytecodeBasicBlock>>& basicBlocks, unsigned bytecodeOffset, FastBitVector& out)
</ins><span class="cx"> {
</span><span class="cx"> stepOverInstruction(
</span><span class="cx"> codeBlock, basicBlocks, bytecodeOffset,
</span><span class="lines">@@ -152,7 +152,7 @@
</span><span class="cx"> });
</span><span class="cx"> }
</span><span class="cx">
</span><del>-static void computeLocalLivenessForBytecodeOffset(CodeBlock* codeBlock, BytecodeBasicBlock* block, Vector<RefPtr<BytecodeBasicBlock> >& basicBlocks, unsigned targetOffset, FastBitVector& result)
</del><ins>+static void computeLocalLivenessForBytecodeOffset(CodeBlock* codeBlock, BytecodeBasicBlock* block, Vector<std::unique_ptr<BytecodeBasicBlock>>& basicBlocks, unsigned targetOffset, FastBitVector& result)
</ins><span class="cx"> {
</span><span class="cx"> ASSERT(!block->isExitBlock());
</span><span class="cx"> ASSERT(!block->isEntryBlock());
</span><span class="lines">@@ -170,7 +170,7 @@
</span><span class="cx"> result.set(out);
</span><span class="cx"> }
</span><span class="cx">
</span><del>-static void computeLocalLivenessForBlock(CodeBlock* codeBlock, BytecodeBasicBlock* block, Vector<RefPtr<BytecodeBasicBlock> >& basicBlocks)
</del><ins>+static void computeLocalLivenessForBlock(CodeBlock* codeBlock, BytecodeBasicBlock* block, Vector<std::unique_ptr<BytecodeBasicBlock>>& basicBlocks)
</ins><span class="cx"> {
</span><span class="cx"> if (block->isExitBlock() || block->isEntryBlock())
</span><span class="cx"> return;
</span><span class="lines">@@ -294,12 +294,6 @@
</span><span class="cx"> for (unsigned i = 0; i < m_basicBlocks.size(); i++) {
</span><span class="cx"> BytecodeBasicBlock* block = m_basicBlocks[i].get();
</span><span class="cx"> dataLogF("\nBytecode basic block %u: %p (offset: %u, length: %u)\n", i, block, block->leaderBytecodeOffset(), block->totalBytecodeLength());
</span><del>- dataLogF("Predecessors: ");
- for (unsigned j = 0; j < block->predecessors().size(); j++) {
- BytecodeBasicBlock* predecessor = block->predecessors()[j];
- dataLogF("%p ", predecessor);
- }
- dataLogF("\n");
</del><span class="cx"> dataLogF("Successors: ");
</span><span class="cx"> for (unsigned j = 0; j < block->successors().size(); j++) {
</span><span class="cx"> BytecodeBasicBlock* successor = block->successors()[j];
</span></span></pre></div>
<a id="trunkSourceJavaScriptCorebytecodeBytecodeLivenessAnalysish"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/bytecode/BytecodeLivenessAnalysis.h (188848 => 188849)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/bytecode/BytecodeLivenessAnalysis.h        2015-08-24 05:33:42 UTC (rev 188848)
+++ trunk/Source/JavaScriptCore/bytecode/BytecodeLivenessAnalysis.h        2015-08-24 06:18:42 UTC (rev 188849)
</span><span class="lines">@@ -39,6 +39,7 @@
</span><span class="cx">
</span><span class="cx"> class BytecodeLivenessAnalysis {
</span><span class="cx"> WTF_MAKE_FAST_ALLOCATED;
</span><ins>+ WTF_MAKE_NONCOPYABLE(BytecodeLivenessAnalysis);
</ins><span class="cx"> public:
</span><span class="cx"> BytecodeLivenessAnalysis(CodeBlock*);
</span><span class="cx">
</span><span class="lines">@@ -56,7 +57,7 @@
</span><span class="cx"> void getLivenessInfoAtBytecodeOffset(unsigned bytecodeOffset, FastBitVector&);
</span><span class="cx">
</span><span class="cx"> CodeBlock* m_codeBlock;
</span><del>- Vector<RefPtr<BytecodeBasicBlock> > m_basicBlocks;
</del><ins>+ Vector<std::unique_ptr<BytecodeBasicBlock>> m_basicBlocks;
</ins><span class="cx"> };
</span><span class="cx">
</span><span class="cx"> inline bool operandIsAlwaysLive(int operand);
</span></span></pre></div>
<a id="trunkSourceJavaScriptCorebytecodePreciseJumpTargetscpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/bytecode/PreciseJumpTargets.cpp (188848 => 188849)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/bytecode/PreciseJumpTargets.cpp        2015-08-24 05:33:42 UTC (rev 188848)
+++ trunk/Source/JavaScriptCore/bytecode/PreciseJumpTargets.cpp        2015-08-24 06:18:42 UTC (rev 188849)
</span><span class="lines">@@ -119,6 +119,7 @@
</span><span class="cx"> lastValue = value;
</span><span class="cx"> }
</span><span class="cx"> out.resize(toIndex);
</span><ins>+ out.shrinkToFit();
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void findJumpTargetsForBytecodeOffset(CodeBlock* codeBlock, unsigned bytecodeOffset, Vector<unsigned, 1>& out)
</span></span></pre></div>
<a id="trunkSourceJavaScriptCorebytecodePreciseJumpTargetsh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/bytecode/PreciseJumpTargets.h (188848 => 188849)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/bytecode/PreciseJumpTargets.h        2015-08-24 05:33:42 UTC (rev 188848)
+++ trunk/Source/JavaScriptCore/bytecode/PreciseJumpTargets.h        2015-08-24 06:18:42 UTC (rev 188849)
</span><span class="lines">@@ -30,7 +30,9 @@
</span><span class="cx">
</span><span class="cx"> namespace JSC {
</span><span class="cx">
</span><ins>+// Return a sorted list of bytecode index that are the destination of a jump.
</ins><span class="cx"> void computePreciseJumpTargets(CodeBlock*, Vector<unsigned, 32>& out);
</span><ins>+
</ins><span class="cx"> void findJumpTargetsForBytecodeOffset(CodeBlock*, unsigned bytecodeOffset, Vector<unsigned, 1>& out);
</span><span class="cx">
</span><span class="cx"> } // namespace JSC
</span></span></pre>
</div>
</div>
</body>
</html>