<!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>[162811] branches/jsCStack/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/162811">162811</a></dd>
<dt>Author</dt> <dd>fpizlo@apple.com</dd>
<dt>Date</dt> <dd>2014-01-26 14:39:31 -0800 (Sun, 26 Jan 2014)</dd>
</dl>
<h3>Log Message</h3>
<pre>FTL should do polyvariant GetById inlining
https://bugs.webkit.org/show_bug.cgi?id=127639
Not yet reviewed.
This does polyvariant inlining for GetByIds. It's pretty easy to do this, now that we
have all of that infrastructure from polyvariant Call/Construct inlining. Basically we
just keep around the StubInfoMaps of the DFG code block when compiling the FTL code
block.
The combination of Call, Construct, and GetById inlining causes a 17% speed-up on
V8v7/raytrace.
GetById inlining alone appears to be a speed-up on other benchmarks as well.
* bytecode/CallLinkStatus.cpp:
(JSC::CallLinkStatus::computeDFGStatuses):
* bytecode/CodeBlock.cpp:
(JSC::CodeBlock::dumpBytecode):
(JSC::CodeBlock::getStubInfoMap):
(JSC::CodeBlock::addStubInfo):
* bytecode/CodeBlock.h:
* bytecode/GetByIdStatus.cpp:
(JSC::GetByIdStatus::hasExitSite):
(JSC::GetByIdStatus::computeFor):
(JSC::GetByIdStatus::computeForStubInfo):
* bytecode/GetByIdStatus.h:
* dfg/DFGByteCodeParser.cpp:
(JSC::DFG::ByteCodeParser::parseBlock):
(JSC::DFG::ByteCodeParser::parse):
* runtime/Options.h:
* tests/stress/simple-polyvariant-get-by-id-inlining-example.js: Added.
(foo):
(fuzz):
(bar):</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#branchesjsCStackSourceJavaScriptCoreChangeLog">branches/jsCStack/Source/JavaScriptCore/ChangeLog</a></li>
<li><a href="#branchesjsCStackSourceJavaScriptCorebytecodeCallLinkStatuscpp">branches/jsCStack/Source/JavaScriptCore/bytecode/CallLinkStatus.cpp</a></li>
<li><a href="#branchesjsCStackSourceJavaScriptCorebytecodeCodeBlockcpp">branches/jsCStack/Source/JavaScriptCore/bytecode/CodeBlock.cpp</a></li>
<li><a href="#branchesjsCStackSourceJavaScriptCorebytecodeCodeBlockh">branches/jsCStack/Source/JavaScriptCore/bytecode/CodeBlock.h</a></li>
<li><a href="#branchesjsCStackSourceJavaScriptCorebytecodeGetByIdStatuscpp">branches/jsCStack/Source/JavaScriptCore/bytecode/GetByIdStatus.cpp</a></li>
<li><a href="#branchesjsCStackSourceJavaScriptCorebytecodeGetByIdStatush">branches/jsCStack/Source/JavaScriptCore/bytecode/GetByIdStatus.h</a></li>
<li><a href="#branchesjsCStackSourceJavaScriptCoredfgDFGByteCodeParsercpp">branches/jsCStack/Source/JavaScriptCore/dfg/DFGByteCodeParser.cpp</a></li>
<li><a href="#branchesjsCStackSourceJavaScriptCoreruntimeOptionsh">branches/jsCStack/Source/JavaScriptCore/runtime/Options.h</a></li>
</ul>
<h3>Added Paths</h3>
<ul>
<li><a href="#branchesjsCStackSourceJavaScriptCoretestsstresssimplepolyvariantgetbyidinliningexamplejs">branches/jsCStack/Source/JavaScriptCore/tests/stress/simple-polyvariant-get-by-id-inlining-example.js</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="branchesjsCStackSourceJavaScriptCoreChangeLog"></a>
<div class="modfile"><h4>Modified: branches/jsCStack/Source/JavaScriptCore/ChangeLog (162810 => 162811)</h4>
<pre class="diff"><span>
<span class="info">--- branches/jsCStack/Source/JavaScriptCore/ChangeLog        2014-01-26 22:34:13 UTC (rev 162810)
+++ branches/jsCStack/Source/JavaScriptCore/ChangeLog        2014-01-26 22:39:31 UTC (rev 162811)
</span><span class="lines">@@ -1,3 +1,41 @@
</span><ins>+2014-01-26 Filip Pizlo <fpizlo@apple.com>
+
+ FTL should do polyvariant GetById inlining
+ https://bugs.webkit.org/show_bug.cgi?id=127639
+
+ Not yet reviewed.
+
+ This does polyvariant inlining for GetByIds. It's pretty easy to do this, now that we
+ have all of that infrastructure from polyvariant Call/Construct inlining. Basically we
+ just keep around the StubInfoMaps of the DFG code block when compiling the FTL code
+ block.
+
+ The combination of Call, Construct, and GetById inlining causes a 17% speed-up on
+ V8v7/raytrace.
+
+ GetById inlining alone appears to be a speed-up on other benchmarks as well.
+
+ * bytecode/CallLinkStatus.cpp:
+ (JSC::CallLinkStatus::computeDFGStatuses):
+ * bytecode/CodeBlock.cpp:
+ (JSC::CodeBlock::dumpBytecode):
+ (JSC::CodeBlock::getStubInfoMap):
+ (JSC::CodeBlock::addStubInfo):
+ * bytecode/CodeBlock.h:
+ * bytecode/GetByIdStatus.cpp:
+ (JSC::GetByIdStatus::hasExitSite):
+ (JSC::GetByIdStatus::computeFor):
+ (JSC::GetByIdStatus::computeForStubInfo):
+ * bytecode/GetByIdStatus.h:
+ * dfg/DFGByteCodeParser.cpp:
+ (JSC::DFG::ByteCodeParser::parseBlock):
+ (JSC::DFG::ByteCodeParser::parse):
+ * runtime/Options.h:
+ * tests/stress/simple-polyvariant-get-by-id-inlining-example.js: Added.
+ (foo):
+ (fuzz):
+ (bar):
+
</ins><span class="cx"> 2014-01-25 Filip Pizlo <fpizlo@apple.com>
</span><span class="cx">
</span><span class="cx"> StubInfoMap should use CodeOriginApproximateHash
</span></span></pre></div>
<a id="branchesjsCStackSourceJavaScriptCorebytecodeCallLinkStatuscpp"></a>
<div class="modfile"><h4>Modified: branches/jsCStack/Source/JavaScriptCore/bytecode/CallLinkStatus.cpp (162810 => 162811)</h4>
<pre class="diff"><span>
<span class="info">--- branches/jsCStack/Source/JavaScriptCore/bytecode/CallLinkStatus.cpp        2014-01-26 22:34:13 UTC (rev 162810)
+++ branches/jsCStack/Source/JavaScriptCore/bytecode/CallLinkStatus.cpp        2014-01-26 22:39:31 UTC (rev 162811)
</span><span class="lines">@@ -182,10 +182,10 @@
</span><span class="cx"> // challenging because it would require creating a CodeOrigin-based database in
</span><span class="cx"> // baseline CodeBlocks, but those CodeBlocks don't really have a place to put the
</span><span class="cx"> // InlineCallFrames.
</span><ins>+ CodeBlock* currentBaseline =
+ baselineCodeBlockForOriginAndBaselineCodeBlock(codeOrigin, baselineCodeBlock);
</ins><span class="cx"> {
</span><del>- ConcurrentJITLocker locker(baselineCodeBlock->m_lock);
- CodeBlock* currentBaseline =
- baselineCodeBlockForOriginAndBaselineCodeBlock(codeOrigin, baselineCodeBlock);
</del><ins>+ ConcurrentJITLocker locker(currentBaseline->m_lock);
</ins><span class="cx"> takeSlowPath =
</span><span class="cx"> currentBaseline->hasExitSite(locker, DFG::FrequentExitSite(codeOrigin.bytecodeIndex, BadCache, ExitFromFTL))
</span><span class="cx"> || currentBaseline->hasExitSite(locker, DFG::FrequentExitSite(codeOrigin.bytecodeIndex, BadCacheWatchpoint, ExitFromFTL))
</span></span></pre></div>
<a id="branchesjsCStackSourceJavaScriptCorebytecodeCodeBlockcpp"></a>
<div class="modfile"><h4>Modified: branches/jsCStack/Source/JavaScriptCore/bytecode/CodeBlock.cpp (162810 => 162811)</h4>
<pre class="diff"><span>
<span class="info">--- branches/jsCStack/Source/JavaScriptCore/bytecode/CodeBlock.cpp        2014-01-26 22:34:13 UTC (rev 162810)
+++ branches/jsCStack/Source/JavaScriptCore/bytecode/CodeBlock.cpp        2014-01-26 22:39:31 UTC (rev 162811)
</span><span class="lines">@@ -534,12 +534,7 @@
</span><span class="cx"> out.printf("\n");
</span><span class="cx">
</span><span class="cx"> StubInfoMap stubInfos;
</span><del>-#if ENABLE(JIT)
- {
- ConcurrentJITLocker locker(m_lock);
- getStubInfoMap(locker, stubInfos);
- }
-#endif
</del><ins>+ getStubInfoMap(stubInfos);
</ins><span class="cx">
</span><span class="cx"> const Instruction* begin = instructions().begin();
</span><span class="cx"> const Instruction* end = instructions().end();
</span><span class="lines">@@ -2330,16 +2325,26 @@
</span><span class="cx"> #endif
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+void CodeBlock::getStubInfoMap(const ConcurrentJITLocker&, StubInfoMap& result)
+{
</ins><span class="cx"> #if ENABLE(JIT)
</span><del>-StructureStubInfo* CodeBlock::addStubInfo()
</del><ins>+ toHashMap(m_stubInfos, getStructureStubInfoCodeOrigin, result);
+#else
+ UNUSED_PARAM(result);
+#endif
+}
+
+void CodeBlock::getStubInfoMap(StubInfoMap& result)
</ins><span class="cx"> {
</span><span class="cx"> ConcurrentJITLocker locker(m_lock);
</span><del>- return m_stubInfos.add();
</del><ins>+ getStubInfoMap(locker, result);
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-void CodeBlock::getStubInfoMap(const ConcurrentJITLocker&, StubInfoMap& result)
</del><ins>+#if ENABLE(JIT)
+StructureStubInfo* CodeBlock::addStubInfo()
</ins><span class="cx"> {
</span><del>- toHashMap(m_stubInfos, getStructureStubInfoCodeOrigin, result);
</del><ins>+ ConcurrentJITLocker locker(m_lock);
+ return m_stubInfos.add();
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void CodeBlock::resetStub(StructureStubInfo& stubInfo)
</span></span></pre></div>
<a id="branchesjsCStackSourceJavaScriptCorebytecodeCodeBlockh"></a>
<div class="modfile"><h4>Modified: branches/jsCStack/Source/JavaScriptCore/bytecode/CodeBlock.h (162810 => 162811)</h4>
<pre class="diff"><span>
<span class="info">--- branches/jsCStack/Source/JavaScriptCore/bytecode/CodeBlock.h        2014-01-26 22:34:13 UTC (rev 162810)
+++ branches/jsCStack/Source/JavaScriptCore/bytecode/CodeBlock.h        2014-01-26 22:39:31 UTC (rev 162811)
</span><span class="lines">@@ -175,6 +175,9 @@
</span><span class="cx"> void expressionRangeForBytecodeOffset(unsigned bytecodeOffset, int& divot,
</span><span class="cx"> int& startOffset, int& endOffset, unsigned& line, unsigned& column);
</span><span class="cx">
</span><ins>+ void getStubInfoMap(const ConcurrentJITLocker&, StubInfoMap& result);
+ void getStubInfoMap(StubInfoMap& result);
+
</ins><span class="cx"> #if ENABLE(JIT)
</span><span class="cx"> StructureStubInfo* addStubInfo();
</span><span class="cx"> Bag<StructureStubInfo>::iterator begin() { return m_stubInfos.begin(); }
</span><span class="lines">@@ -182,8 +185,6 @@
</span><span class="cx">
</span><span class="cx"> void resetStub(StructureStubInfo&);
</span><span class="cx">
</span><del>- void getStubInfoMap(const ConcurrentJITLocker&, StubInfoMap& result);
-
</del><span class="cx"> ByValInfo& getByValInfo(unsigned bytecodeIndex)
</span><span class="cx"> {
</span><span class="cx"> return *(binarySearch<ByValInfo, unsigned>(m_byValInfos, m_byValInfos.size(), bytecodeIndex, getByValInfoBytecodeIndex));
</span></span></pre></div>
<a id="branchesjsCStackSourceJavaScriptCorebytecodeGetByIdStatuscpp"></a>
<div class="modfile"><h4>Modified: branches/jsCStack/Source/JavaScriptCore/bytecode/GetByIdStatus.cpp (162810 => 162811)</h4>
<pre class="diff"><span>
<span class="info">--- branches/jsCStack/Source/JavaScriptCore/bytecode/GetByIdStatus.cpp        2014-01-26 22:34:13 UTC (rev 162810)
+++ branches/jsCStack/Source/JavaScriptCore/bytecode/GetByIdStatus.cpp        2014-01-26 22:39:31 UTC (rev 162811)
</span><span class="lines">@@ -34,12 +34,12 @@
</span><span class="cx">
</span><span class="cx"> namespace JSC {
</span><span class="cx">
</span><del>-bool GetByIdStatus::hasExitSite(const ConcurrentJITLocker& locker, CodeBlock* profiledBlock, unsigned bytecodeIndex)
</del><ins>+bool GetByIdStatus::hasExitSite(const ConcurrentJITLocker& locker, CodeBlock* profiledBlock, unsigned bytecodeIndex, ExitingJITType jitType)
</ins><span class="cx"> {
</span><del>- return profiledBlock->hasExitSite(locker, DFG::FrequentExitSite(bytecodeIndex, BadCache))
- || profiledBlock->hasExitSite(locker, DFG::FrequentExitSite(bytecodeIndex, BadCacheWatchpoint))
- || profiledBlock->hasExitSite(locker, DFG::FrequentExitSite(bytecodeIndex, BadWeakConstantCache))
- || profiledBlock->hasExitSite(locker, DFG::FrequentExitSite(bytecodeIndex, BadWeakConstantCacheWatchpoint));
</del><ins>+ return profiledBlock->hasExitSite(locker, DFG::FrequentExitSite(bytecodeIndex, BadCache, jitType))
+ || profiledBlock->hasExitSite(locker, DFG::FrequentExitSite(bytecodeIndex, BadCacheWatchpoint, jitType))
+ || profiledBlock->hasExitSite(locker, DFG::FrequentExitSite(bytecodeIndex, BadWeakConstantCache, jitType))
+ || profiledBlock->hasExitSite(locker, DFG::FrequentExitSite(bytecodeIndex, BadWeakConstantCacheWatchpoint, jitType));
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> GetByIdStatus GetByIdStatus::computeFromLLInt(CodeBlock* profiledBlock, unsigned bytecodeIndex, StringImpl* uid)
</span><span class="lines">@@ -128,18 +128,28 @@
</span><span class="cx"> {
</span><span class="cx"> ConcurrentJITLocker locker(profiledBlock->m_lock);
</span><span class="cx">
</span><del>- UNUSED_PARAM(profiledBlock);
- UNUSED_PARAM(bytecodeIndex);
- UNUSED_PARAM(uid);
-#if ENABLE(JIT)
- StructureStubInfo* stubInfo = map.get(CodeOrigin(bytecodeIndex));
- if (!stubInfo || !stubInfo->seen) {
- if (hasExitSite(locker, profiledBlock, bytecodeIndex))
- return GetByIdStatus(TakesSlowPath, true);
</del><ins>+ GetByIdStatus result = computeForStubInfo(
+ locker, profiledBlock, map.get(CodeOrigin(bytecodeIndex)), uid);
</ins><span class="cx">
</span><ins>+ if (!result.takesSlowPath()
+ && (hasExitSite(locker, profiledBlock, bytecodeIndex)
+ || profiledBlock->likelyToTakeSlowCase(bytecodeIndex)))
+ return GetByIdStatus(TakesSlowPath, true);
+
+ if (!result)
</ins><span class="cx"> return computeFromLLInt(profiledBlock, bytecodeIndex, uid);
</span><del>- }
</del><span class="cx">
</span><ins>+ return result;
+}
+
+GetByIdStatus GetByIdStatus::computeForStubInfo(
+ const ConcurrentJITLocker&, CodeBlock* profiledBlock, StructureStubInfo* stubInfo,
+ StringImpl* uid)
+{
+#if ENABLE(JIT)
+ if (!stubInfo || !stubInfo->seen)
+ return GetByIdStatus(NoInformation);
+
</ins><span class="cx"> if (stubInfo->resetByGC)
</span><span class="cx"> return GetByIdStatus(TakesSlowPath, true);
</span><span class="cx">
</span><span class="lines">@@ -164,17 +174,12 @@
</span><span class="cx"> return GetByIdStatus(MakesCalls, true);
</span><span class="cx"> }
</span><span class="cx">
</span><del>- // Next check if it takes slow case, in which case we want to be kind of careful.
- if (profiledBlock->likelyToTakeSlowCase(bytecodeIndex)
- || hasExitSite(locker, profiledBlock, bytecodeIndex))
- return GetByIdStatus(TakesSlowPath, true);
-
</del><span class="cx"> // Finally figure out if we can derive an access strategy.
</span><span class="cx"> GetByIdStatus result;
</span><span class="cx"> result.m_wasSeenInJIT = true; // This is interesting for bytecode dumping only.
</span><span class="cx"> switch (stubInfo->accessType) {
</span><span class="cx"> case access_unset:
</span><del>- return computeFromLLInt(profiledBlock, bytecodeIndex, uid);
</del><ins>+ return GetByIdStatus(NoInformation);
</ins><span class="cx">
</span><span class="cx"> case access_get_by_id_self: {
</span><span class="cx"> Structure* structure = stubInfo->u.getByIdSelf.baseObjectStructure.get();
</span><span class="lines">@@ -275,11 +280,40 @@
</span><span class="cx">
</span><span class="cx"> return result;
</span><span class="cx"> #else // ENABLE(JIT)
</span><del>- UNUSED_PARAM(map);
</del><ins>+ UNUSED_PARAM(profiledBlock);
+ UNUSED_PARAM(stubInfo);
+ UNUSED_PARAM(uid);
</ins><span class="cx"> return GetByIdStatus(NoInformation, false);
</span><span class="cx"> #endif // ENABLE(JIT)
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+GetByIdStatus GetByIdStatus::computeFor(
+ CodeBlock* profiledBlock, CodeBlock* dfgBlock, StubInfoMap& baselineMap,
+ StubInfoMap& dfgMap, CodeOrigin codeOrigin, StringImpl* uid)
+{
+ if (dfgBlock) {
+ GetByIdStatus result;
+ {
+ ConcurrentJITLocker locker(dfgBlock->m_lock);
+ result = computeForStubInfo(locker, dfgBlock, dfgMap.get(codeOrigin), uid);
+ }
+
+ if (result.takesSlowPath())
+ return result;
+
+ {
+ ConcurrentJITLocker locker(profiledBlock->m_lock);
+ if (hasExitSite(locker, profiledBlock, codeOrigin.bytecodeIndex, ExitFromFTL))
+ return GetByIdStatus(TakesSlowPath, true);
+ }
+
+ if (result.isSet())
+ return result;
+ }
+
+ return computeFor(profiledBlock, baselineMap, codeOrigin.bytecodeIndex, uid);
+}
+
</ins><span class="cx"> GetByIdStatus GetByIdStatus::computeFor(VM& vm, Structure* structure, StringImpl* uid)
</span><span class="cx"> {
</span><span class="cx"> // For now we only handle the super simple self access case. We could handle the
</span></span></pre></div>
<a id="branchesjsCStackSourceJavaScriptCorebytecodeGetByIdStatush"></a>
<div class="modfile"><h4>Modified: branches/jsCStack/Source/JavaScriptCore/bytecode/GetByIdStatus.h (162810 => 162811)</h4>
<pre class="diff"><span>
<span class="info">--- branches/jsCStack/Source/JavaScriptCore/bytecode/GetByIdStatus.h        2014-01-26 22:34:13 UTC (rev 162810)
+++ branches/jsCStack/Source/JavaScriptCore/bytecode/GetByIdStatus.h        2014-01-26 22:39:31 UTC (rev 162811)
</span><span class="lines">@@ -26,7 +26,9 @@
</span><span class="cx"> #ifndef GetByIdStatus_h
</span><span class="cx"> #define GetByIdStatus_h
</span><span class="cx">
</span><ins>+#include "CodeOrigin.h"
</ins><span class="cx"> #include "ConcurrentJITLock.h"
</span><ins>+#include "ExitingJITType.h"
</ins><span class="cx"> #include "IntendedStructureChain.h"
</span><span class="cx"> #include "PropertyOffset.h"
</span><span class="cx"> #include "StructureSet.h"
</span><span class="lines">@@ -75,6 +77,8 @@
</span><span class="cx"> static GetByIdStatus computeFor(CodeBlock*, StubInfoMap&, unsigned bytecodeIndex, StringImpl* uid);
</span><span class="cx"> static GetByIdStatus computeFor(VM&, Structure*, StringImpl* uid);
</span><span class="cx">
</span><ins>+ static GetByIdStatus computeFor(CodeBlock* baselineBlock, CodeBlock* dfgBlock, StubInfoMap& baselineMap, StubInfoMap& dfgMap, CodeOrigin, StringImpl* uid);
+
</ins><span class="cx"> State state() const { return m_state; }
</span><span class="cx">
</span><span class="cx"> bool isSet() const { return m_state != NoInformation; }
</span><span class="lines">@@ -91,7 +95,8 @@
</span><span class="cx"> bool wasSeenInJIT() const { return m_wasSeenInJIT; }
</span><span class="cx">
</span><span class="cx"> private:
</span><del>- static bool hasExitSite(const ConcurrentJITLocker&, CodeBlock*, unsigned bytecodeIndex);
</del><ins>+ static bool hasExitSite(const ConcurrentJITLocker&, CodeBlock*, unsigned bytecodeIndex, ExitingJITType = ExitFromAnything);
+ static GetByIdStatus computeForStubInfo(const ConcurrentJITLocker&, CodeBlock*, StructureStubInfo*, StringImpl* uid);
</ins><span class="cx"> static void computeForChain(GetByIdStatus& result, CodeBlock*, StringImpl* uid);
</span><span class="cx"> static GetByIdStatus computeFromLLInt(CodeBlock*, unsigned bytecodeIndex, StringImpl* uid);
</span><span class="cx">
</span></span></pre></div>
<a id="branchesjsCStackSourceJavaScriptCoredfgDFGByteCodeParsercpp"></a>
<div class="modfile"><h4>Modified: branches/jsCStack/Source/JavaScriptCore/dfg/DFGByteCodeParser.cpp (162810 => 162811)</h4>
<pre class="diff"><span>
<span class="info">--- branches/jsCStack/Source/JavaScriptCore/dfg/DFGByteCodeParser.cpp        2014-01-26 22:34:13 UTC (rev 162810)
+++ branches/jsCStack/Source/JavaScriptCore/dfg/DFGByteCodeParser.cpp        2014-01-26 22:39:31 UTC (rev 162811)
</span><span class="lines">@@ -1136,7 +1136,9 @@
</span><span class="cx"> // work-around for the fact that JSValueMap can't handle "empty" values.
</span><span class="cx"> unsigned m_emptyJSValueIndex;
</span><span class="cx">
</span><ins>+ CodeBlock* m_dfgCodeBlock;
</ins><span class="cx"> CallLinkStatus::ContextMap m_callContextMap;
</span><ins>+ StubInfoMap m_dfgStubInfos;
</ins><span class="cx">
</span><span class="cx"> Instruction* m_currentInstruction;
</span><span class="cx"> };
</span><span class="lines">@@ -2518,8 +2520,9 @@
</span><span class="cx">
</span><span class="cx"> StringImpl* uid = m_graph.identifiers()[identifierNumber];
</span><span class="cx"> GetByIdStatus getByIdStatus = GetByIdStatus::computeFor(
</span><del>- m_inlineStackTop->m_profiledBlock, m_inlineStackTop->m_stubInfos,
- m_currentIndex, uid);
</del><ins>+ m_inlineStackTop->m_profiledBlock, m_dfgCodeBlock,
+ m_inlineStackTop->m_stubInfos, m_dfgStubInfos,
+ currentCodeOrigin(), uid);
</ins><span class="cx">
</span><span class="cx"> handleGetById(
</span><span class="cx"> currentInstruction[1].u.operand, prediction, base, identifierNumber, getByIdStatus);
</span><span class="lines">@@ -3717,11 +3720,14 @@
</span><span class="cx"> // Set during construction.
</span><span class="cx"> ASSERT(!m_currentIndex);
</span><span class="cx">
</span><del>- if (isFTL(m_graph.m_plan.mode)
- && !!m_graph.m_plan.profiledDFGCodeBlock
- && Options::enablePolyvariantCallInlining()) {
- CallLinkStatus::computeDFGStatuses(
- m_graph.m_plan.profiledDFGCodeBlock.get(), m_callContextMap);
</del><ins>+ if (isFTL(m_graph.m_plan.mode)) {
+ m_dfgCodeBlock = m_graph.m_plan.profiledDFGCodeBlock.get();
+ if (m_dfgCodeBlock) {
+ if (Options::enablePolyvariantCallInlining())
+ CallLinkStatus::computeDFGStatuses(m_dfgCodeBlock, m_callContextMap);
+ if (Options::enablePolyvariantByIdInlining())
+ m_dfgCodeBlock->getStubInfoMap(m_dfgStubInfos);
+ }
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> if (m_codeBlock->captureCount()) {
</span></span></pre></div>
<a id="branchesjsCStackSourceJavaScriptCoreruntimeOptionsh"></a>
<div class="modfile"><h4>Modified: branches/jsCStack/Source/JavaScriptCore/runtime/Options.h (162810 => 162811)</h4>
<pre class="diff"><span>
<span class="info">--- branches/jsCStack/Source/JavaScriptCore/runtime/Options.h        2014-01-26 22:34:13 UTC (rev 162810)
+++ branches/jsCStack/Source/JavaScriptCore/runtime/Options.h        2014-01-26 22:39:31 UTC (rev 162811)
</span><span class="lines">@@ -1,5 +1,5 @@
</span><span class="cx"> /*
</span><del>- * Copyright (C) 2011, 2012, 2013 Apple Inc. All rights reserved.
</del><ins>+ * Copyright (C) 2011, 2012, 2013, 2014 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">@@ -176,6 +176,7 @@
</span><span class="cx"> v(unsigned, maximumInliningRecursionForMustInline, 3) \
</span><span class="cx"> \
</span><span class="cx"> v(bool, enablePolyvariantCallInlining, true) \
</span><ins>+ v(bool, enablePolyvariantByIdInlining, true) \
</ins><span class="cx"> \
</span><span class="cx"> v(unsigned, maximumBinaryStringSwitchCaseLength, 50) \
</span><span class="cx"> v(unsigned, maximumBinaryStringSwitchTotalLength, 2000) \
</span></span></pre></div>
<a id="branchesjsCStackSourceJavaScriptCoretestsstresssimplepolyvariantgetbyidinliningexamplejs"></a>
<div class="addfile"><h4>Added: branches/jsCStack/Source/JavaScriptCore/tests/stress/simple-polyvariant-get-by-id-inlining-example.js (0 => 162811)</h4>
<pre class="diff"><span>
<span class="info">--- branches/jsCStack/Source/JavaScriptCore/tests/stress/simple-polyvariant-get-by-id-inlining-example.js         (rev 0)
+++ branches/jsCStack/Source/JavaScriptCore/tests/stress/simple-polyvariant-get-by-id-inlining-example.js        2014-01-26 22:39:31 UTC (rev 162811)
</span><span class="lines">@@ -0,0 +1,24 @@
</span><ins>+function foo(o) {
+ return bar(o);
+}
+
+function fuzz(o) {
+ return bar(o);
+}
+
+function bar(o) {
+ return o.f;
+}
+
+noInline(foo);
+noInline(fuzz);
+
+for (var i = 0; i < 100000; ++i) {
+ var result = foo({f:42});
+ if (result != 42)
+ throw "Error: bad result: " + result;
+ var result = fuzz({g:23, f:24});
+ if (result != 24)
+ throw "Error: bad result: " + result;
+}
+
</ins></span></pre>
</div>
</div>
</body>
</html>