<!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>[166218] 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/166218">166218</a></dd>
<dt>Author</dt> <dd>fpizlo@apple.com</dd>
<dt>Date</dt> <dd>2014-03-24 20:44:52 -0700 (Mon, 24 Mar 2014)</dd>
</dl>
<h3>Log Message</h3>
<pre>More scaffolding for a stub routine to have a stub recursively embedded inside it
https://bugs.webkit.org/show_bug.cgi?id=130770
Reviewed by Oliver Hunt.
* bytecode/CallLinkInfo.cpp:
(JSC::CallLinkInfo::unlink): VM& argument is superfluous.
(JSC::CallLinkInfo::visitWeak): Factor this out, it used to be in CodeBlock::finalizeUnconditionally().
* bytecode/CallLinkInfo.h:
* bytecode/CodeBlock.cpp:
(JSC::CodeBlock::finalizeUnconditionally): Factor out some functionality into CallLinkInfo::visitWeak(), and make sure we pass RepatchBuffer& in more places.
(JSC::CodeBlock::unlinkCalls):
(JSC::CodeBlock::unlinkIncomingCalls):
* bytecode/PolymorphicGetByIdList.cpp: Pass RepatchBuffer& through and call JITStubRoutine::visitWeak().
(JSC::GetByIdAccess::visitWeak):
(JSC::PolymorphicGetByIdList::visitWeak):
* bytecode/PolymorphicGetByIdList.h:
* bytecode/PolymorphicPutByIdList.cpp: Pass RepatchBuffer& through and call JITStubRoutine::visitWeak().
(JSC::PutByIdAccess::visitWeak):
(JSC::PolymorphicPutByIdList::visitWeak):
* bytecode/PolymorphicPutByIdList.h:
* bytecode/StructureStubInfo.cpp: Pass RepatchBuffer& through.
(JSC::StructureStubInfo::visitWeakReferences):
* bytecode/StructureStubInfo.h:
* jit/ClosureCallStubRoutine.cpp: isClosureCall is unused.
(JSC::ClosureCallStubRoutine::ClosureCallStubRoutine):
* jit/GCAwareJITStubRoutine.cpp:
(JSC::GCAwareJITStubRoutine::GCAwareJITStubRoutine):
(JSC::createJITStubRoutine):
* jit/GCAwareJITStubRoutine.h: Make it easier to construct one of these.
(JSC::GCAwareJITStubRoutine::isClosureCall): Deleted.
* jit/JITStubRoutine.cpp:
(JSC::JITStubRoutine::visitWeak): This will allow future JITStubRoutine subclasses to have stubs recursively embedded inside them.
* jit/JITStubRoutine.h:
* jit/Repatch.cpp:
(JSC::generateGetByIdStub): Fix a possible GC bug where we weren't making the stub routine GC aware.
(JSC::emitCustomSetterStub): Clean up some code.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceJavaScriptCoreChangeLog">trunk/Source/JavaScriptCore/ChangeLog</a></li>
<li><a href="#trunkSourceJavaScriptCorebytecodeCallLinkInfocpp">trunk/Source/JavaScriptCore/bytecode/CallLinkInfo.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCorebytecodeCallLinkInfoh">trunk/Source/JavaScriptCore/bytecode/CallLinkInfo.h</a></li>
<li><a href="#trunkSourceJavaScriptCorebytecodeCodeBlockcpp">trunk/Source/JavaScriptCore/bytecode/CodeBlock.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCorebytecodePolymorphicGetByIdListcpp">trunk/Source/JavaScriptCore/bytecode/PolymorphicGetByIdList.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCorebytecodePolymorphicGetByIdListh">trunk/Source/JavaScriptCore/bytecode/PolymorphicGetByIdList.h</a></li>
<li><a href="#trunkSourceJavaScriptCorebytecodePolymorphicPutByIdListcpp">trunk/Source/JavaScriptCore/bytecode/PolymorphicPutByIdList.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCorebytecodePolymorphicPutByIdListh">trunk/Source/JavaScriptCore/bytecode/PolymorphicPutByIdList.h</a></li>
<li><a href="#trunkSourceJavaScriptCorebytecodeStructureStubInfocpp">trunk/Source/JavaScriptCore/bytecode/StructureStubInfo.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCorebytecodeStructureStubInfoh">trunk/Source/JavaScriptCore/bytecode/StructureStubInfo.h</a></li>
<li><a href="#trunkSourceJavaScriptCorejitClosureCallStubRoutinecpp">trunk/Source/JavaScriptCore/jit/ClosureCallStubRoutine.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCorejitGCAwareJITStubRoutinecpp">trunk/Source/JavaScriptCore/jit/GCAwareJITStubRoutine.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCorejitGCAwareJITStubRoutineh">trunk/Source/JavaScriptCore/jit/GCAwareJITStubRoutine.h</a></li>
<li><a href="#trunkSourceJavaScriptCorejitJITStubRoutinecpp">trunk/Source/JavaScriptCore/jit/JITStubRoutine.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCorejitJITStubRoutineh">trunk/Source/JavaScriptCore/jit/JITStubRoutine.h</a></li>
<li><a href="#trunkSourceJavaScriptCorejitRepatchcpp">trunk/Source/JavaScriptCore/jit/Repatch.cpp</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceJavaScriptCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/ChangeLog (166217 => 166218)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/ChangeLog        2014-03-25 03:27:46 UTC (rev 166217)
+++ trunk/Source/JavaScriptCore/ChangeLog        2014-03-25 03:44:52 UTC (rev 166218)
</span><span class="lines">@@ -1,3 +1,43 @@
</span><ins>+2014-03-24 Filip Pizlo <fpizlo@apple.com>
+
+ More scaffolding for a stub routine to have a stub recursively embedded inside it
+ https://bugs.webkit.org/show_bug.cgi?id=130770
+
+ Reviewed by Oliver Hunt.
+
+ * bytecode/CallLinkInfo.cpp:
+ (JSC::CallLinkInfo::unlink): VM& argument is superfluous.
+ (JSC::CallLinkInfo::visitWeak): Factor this out, it used to be in CodeBlock::finalizeUnconditionally().
+ * bytecode/CallLinkInfo.h:
+ * bytecode/CodeBlock.cpp:
+ (JSC::CodeBlock::finalizeUnconditionally): Factor out some functionality into CallLinkInfo::visitWeak(), and make sure we pass RepatchBuffer& in more places.
+ (JSC::CodeBlock::unlinkCalls):
+ (JSC::CodeBlock::unlinkIncomingCalls):
+ * bytecode/PolymorphicGetByIdList.cpp: Pass RepatchBuffer& through and call JITStubRoutine::visitWeak().
+ (JSC::GetByIdAccess::visitWeak):
+ (JSC::PolymorphicGetByIdList::visitWeak):
+ * bytecode/PolymorphicGetByIdList.h:
+ * bytecode/PolymorphicPutByIdList.cpp: Pass RepatchBuffer& through and call JITStubRoutine::visitWeak().
+ (JSC::PutByIdAccess::visitWeak):
+ (JSC::PolymorphicPutByIdList::visitWeak):
+ * bytecode/PolymorphicPutByIdList.h:
+ * bytecode/StructureStubInfo.cpp: Pass RepatchBuffer& through.
+ (JSC::StructureStubInfo::visitWeakReferences):
+ * bytecode/StructureStubInfo.h:
+ * jit/ClosureCallStubRoutine.cpp: isClosureCall is unused.
+ (JSC::ClosureCallStubRoutine::ClosureCallStubRoutine):
+ * jit/GCAwareJITStubRoutine.cpp:
+ (JSC::GCAwareJITStubRoutine::GCAwareJITStubRoutine):
+ (JSC::createJITStubRoutine):
+ * jit/GCAwareJITStubRoutine.h: Make it easier to construct one of these.
+ (JSC::GCAwareJITStubRoutine::isClosureCall): Deleted.
+ * jit/JITStubRoutine.cpp:
+ (JSC::JITStubRoutine::visitWeak): This will allow future JITStubRoutine subclasses to have stubs recursively embedded inside them.
+ * jit/JITStubRoutine.h:
+ * jit/Repatch.cpp:
+ (JSC::generateGetByIdStub): Fix a possible GC bug where we weren't making the stub routine GC aware.
+ (JSC::emitCustomSetterStub): Clean up some code.
+
</ins><span class="cx"> 2014-03-24 Geoffrey Garen <ggaren@apple.com>
</span><span class="cx">
</span><span class="cx"> Safari crashes in JavaScriptCore: JSC::JSObject::growOutOfLineStorage
</span></span></pre></div>
<a id="trunkSourceJavaScriptCorebytecodeCallLinkInfocpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/bytecode/CallLinkInfo.cpp (166217 => 166218)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/bytecode/CallLinkInfo.cpp        2014-03-25 03:27:46 UTC (rev 166217)
+++ trunk/Source/JavaScriptCore/bytecode/CallLinkInfo.cpp        2014-03-25 03:44:52 UTC (rev 166218)
</span><span class="lines">@@ -35,7 +35,7 @@
</span><span class="cx"> #if ENABLE(JIT)
</span><span class="cx"> namespace JSC {
</span><span class="cx">
</span><del>-void CallLinkInfo::unlink(VM& vm, RepatchBuffer& repatchBuffer)
</del><ins>+void CallLinkInfo::unlink(RepatchBuffer& repatchBuffer)
</ins><span class="cx"> {
</span><span class="cx"> ASSERT(isLinked());
</span><span class="cx">
</span><span class="lines">@@ -45,7 +45,7 @@
</span><span class="cx"> repatchBuffer.revertJumpReplacementToBranchPtrWithPatch(RepatchBuffer::startOfBranchPtrWithPatchOnRegister(hotPathBegin), static_cast<MacroAssembler::RegisterID>(calleeGPR), 0);
</span><span class="cx"> repatchBuffer.relink(
</span><span class="cx"> callReturnLocation,
</span><del>- vm.getCTIStub(linkThunkGeneratorFor(
</del><ins>+ repatchBuffer.codeBlock()->vm()->getCTIStub(linkThunkGeneratorFor(
</ins><span class="cx"> callType == Construct ? CodeForConstruct : CodeForCall,
</span><span class="cx"> isFTL ? MustPreserveRegisters : RegisterPreservationNotRequired)).code());
</span><span class="cx"> hasSeenShouldRepatch = false;
</span><span class="lines">@@ -57,6 +57,35 @@
</span><span class="cx"> remove();
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+void CallLinkInfo::visitWeak(RepatchBuffer& repatchBuffer)
+{
+ if (isLinked()) {
+ if (stub) {
+ if (!Heap::isMarked(stub->structure())
+ || !Heap::isMarked(stub->executable())) {
+ if (Options::verboseOSR()) {
+ dataLog(
+ "Clearing closure call from ", *repatchBuffer.codeBlock(), " to ",
+ stub->executable()->hashFor(specializationKind()),
+ ", stub routine ", RawPointer(stub.get()), ".\n");
+ }
+ unlink(repatchBuffer);
+ }
+ } else if (!Heap::isMarked(callee.get())) {
+ if (Options::verboseOSR()) {
+ dataLog(
+ "Clearing call from ", *repatchBuffer.codeBlock(), " to ",
+ RawPointer(callee.get()), " (",
+ callee.get()->executable()->hashFor(specializationKind()),
+ ").\n");
+ }
+ unlink(repatchBuffer);
+ }
+ }
+ if (!!lastSeenCallee && !Heap::isMarked(lastSeenCallee.get()))
+ lastSeenCallee.clear();
+}
+
</ins><span class="cx"> CallLinkInfo& CallLinkInfo::dummy()
</span><span class="cx"> {
</span><span class="cx"> static NeverDestroyed<CallLinkInfo> dummy;
</span></span></pre></div>
<a id="trunkSourceJavaScriptCorebytecodeCallLinkInfoh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/bytecode/CallLinkInfo.h (166217 => 166218)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/bytecode/CallLinkInfo.h        2014-03-25 03:27:46 UTC (rev 166217)
+++ trunk/Source/JavaScriptCore/bytecode/CallLinkInfo.h        2014-03-25 03:44:52 UTC (rev 166218)
</span><span class="lines">@@ -88,7 +88,7 @@
</span><span class="cx"> CodeOrigin codeOrigin;
</span><span class="cx">
</span><span class="cx"> bool isLinked() { return stub || callee; }
</span><del>- void unlink(VM&, RepatchBuffer&);
</del><ins>+ void unlink(RepatchBuffer&);
</ins><span class="cx">
</span><span class="cx"> bool seenOnce()
</span><span class="cx"> {
</span><span class="lines">@@ -100,6 +100,8 @@
</span><span class="cx"> hasSeenShouldRepatch = true;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+ void visitWeak(RepatchBuffer&);
+
</ins><span class="cx"> static CallLinkInfo& dummy();
</span><span class="cx"> };
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceJavaScriptCorebytecodeCodeBlockcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/bytecode/CodeBlock.cpp (166217 => 166218)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/bytecode/CodeBlock.cpp        2014-03-25 03:27:46 UTC (rev 166217)
+++ trunk/Source/JavaScriptCore/bytecode/CodeBlock.cpp        2014-03-25 03:44:52 UTC (rev 166218)
</span><span class="lines">@@ -2241,39 +2241,14 @@
</span><span class="cx"> // Handle inline caches.
</span><span class="cx"> if (!!jitCode()) {
</span><span class="cx"> RepatchBuffer repatchBuffer(this);
</span><del>- for (auto iter = callLinkInfosBegin(); !!iter; ++iter) {
- CallLinkInfo& info = **iter;
- if (info.isLinked()) {
- if (ClosureCallStubRoutine* stub = info.stub.get()) {
- if (!Heap::isMarked(stub->structure())
- || !Heap::isMarked(stub->executable())) {
- if (Options::verboseOSR()) {
- dataLog(
- "Clearing closure call from ", *this, " to ",
- stub->executable()->hashFor(info.specializationKind()),
- ", stub routine ", RawPointer(stub), ".\n");
- }
- info.unlink(*m_vm, repatchBuffer);
- }
- } else if (!Heap::isMarked(info.callee.get())) {
- if (Options::verboseOSR()) {
- dataLog(
- "Clearing call from ", *this, " to ",
- RawPointer(info.callee.get()), " (",
- info.callee.get()->executable()->hashFor(info.specializationKind()),
- ").\n");
- }
- info.unlink(*m_vm, repatchBuffer);
- }
- }
- if (!!info.lastSeenCallee
- && !Heap::isMarked(info.lastSeenCallee.get()))
- info.lastSeenCallee.clear();
- }
</del><ins>+
+ for (auto iter = callLinkInfosBegin(); !!iter; ++iter)
+ (*iter)->visitWeak(repatchBuffer);
+
</ins><span class="cx"> for (Bag<StructureStubInfo>::iterator iter = m_stubInfos.begin(); !!iter; ++iter) {
</span><span class="cx"> StructureStubInfo& stubInfo = **iter;
</span><span class="cx">
</span><del>- if (stubInfo.visitWeakReferences())
</del><ins>+ if (stubInfo.visitWeakReferences(repatchBuffer))
</ins><span class="cx"> continue;
</span><span class="cx">
</span><span class="cx"> resetStubDuringGCInternal(repatchBuffer, stubInfo);
</span><span class="lines">@@ -2639,7 +2614,7 @@
</span><span class="cx"> CallLinkInfo& info = **iter;
</span><span class="cx"> if (!info.isLinked())
</span><span class="cx"> continue;
</span><del>- info.unlink(*m_vm, repatchBuffer);
</del><ins>+ info.unlink(repatchBuffer);
</ins><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -2661,7 +2636,7 @@
</span><span class="cx"> return;
</span><span class="cx"> RepatchBuffer repatchBuffer(this);
</span><span class="cx"> while (m_incomingCalls.begin() != m_incomingCalls.end())
</span><del>- m_incomingCalls.begin()->unlink(*m_vm, repatchBuffer);
</del><ins>+ m_incomingCalls.begin()->unlink(repatchBuffer);
</ins><span class="cx"> #endif // ENABLE(JIT)
</span><span class="cx"> }
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceJavaScriptCorebytecodePolymorphicGetByIdListcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/bytecode/PolymorphicGetByIdList.cpp (166217 => 166218)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/bytecode/PolymorphicGetByIdList.cpp        2014-03-25 03:27:46 UTC (rev 166217)
+++ trunk/Source/JavaScriptCore/bytecode/PolymorphicGetByIdList.cpp        2014-03-25 03:44:52 UTC (rev 166218)
</span><span class="lines">@@ -83,12 +83,14 @@
</span><span class="cx"> return result;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-bool GetByIdAccess::visitWeak() const
</del><ins>+bool GetByIdAccess::visitWeak(RepatchBuffer& repatchBuffer) const
</ins><span class="cx"> {
</span><span class="cx"> if (m_structure && !Heap::isMarked(m_structure.get()))
</span><span class="cx"> return false;
</span><span class="cx"> if (m_chain && !Heap::isMarked(m_chain.get()))
</span><span class="cx"> return false;
</span><ins>+ if (!m_stubRoutine->visitWeak(repatchBuffer))
+ return false;
</ins><span class="cx"> return true;
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -156,10 +158,10 @@
</span><span class="cx"> return false;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-bool PolymorphicGetByIdList::visitWeak() const
</del><ins>+bool PolymorphicGetByIdList::visitWeak(RepatchBuffer& repatchBuffer) const
</ins><span class="cx"> {
</span><span class="cx"> for (unsigned i = size(); i--;) {
</span><del>- if (!at(i).visitWeak())
</del><ins>+ if (!at(i).visitWeak(repatchBuffer))
</ins><span class="cx"> return false;
</span><span class="cx"> }
</span><span class="cx"> return true;
</span></span></pre></div>
<a id="trunkSourceJavaScriptCorebytecodePolymorphicGetByIdListh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/bytecode/PolymorphicGetByIdList.h (166217 => 166218)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/bytecode/PolymorphicGetByIdList.h        2014-03-25 03:27:46 UTC (rev 166217)
+++ trunk/Source/JavaScriptCore/bytecode/PolymorphicGetByIdList.h        2014-03-25 03:44:52 UTC (rev 166218)
</span><span class="lines">@@ -46,6 +46,7 @@
</span><span class="cx"> SimpleInline, // This is the patched inline access.
</span><span class="cx"> SimpleStub, // This is a stub.
</span><span class="cx"> Getter,
</span><ins>+ CustomGetter
</ins><span class="cx"> };
</span><span class="cx">
</span><span class="cx"> GetByIdAccess()
</span><span class="lines">@@ -80,7 +81,7 @@
</span><span class="cx">
</span><span class="cx"> bool doesCalls() const { return type() == Getter; }
</span><span class="cx">
</span><del>- bool visitWeak() const;
</del><ins>+ bool visitWeak(RepatchBuffer&) const;
</ins><span class="cx">
</span><span class="cx"> private:
</span><span class="cx"> friend class CodeBlock;
</span><span class="lines">@@ -114,7 +115,7 @@
</span><span class="cx">
</span><span class="cx"> bool didSelfPatching() const; // Are any of the accesses SimpleInline?
</span><span class="cx">
</span><del>- bool visitWeak() const;
</del><ins>+ bool visitWeak(RepatchBuffer&) const;
</ins><span class="cx">
</span><span class="cx"> private:
</span><span class="cx"> friend class CodeBlock;
</span></span></pre></div>
<a id="trunkSourceJavaScriptCorebytecodePolymorphicPutByIdListcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/bytecode/PolymorphicPutByIdList.cpp (166217 => 166218)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/bytecode/PolymorphicPutByIdList.cpp        2014-03-25 03:27:46 UTC (rev 166217)
+++ trunk/Source/JavaScriptCore/bytecode/PolymorphicPutByIdList.cpp        2014-03-25 03:44:52 UTC (rev 166218)
</span><span class="lines">@@ -62,7 +62,7 @@
</span><span class="cx"> return result;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-bool PutByIdAccess::visitWeak() const
</del><ins>+bool PutByIdAccess::visitWeak(RepatchBuffer& repatchBuffer) const
</ins><span class="cx"> {
</span><span class="cx"> switch (m_type) {
</span><span class="cx"> case Replace:
</span><span class="lines">@@ -87,6 +87,8 @@
</span><span class="cx"> RELEASE_ASSERT_NOT_REACHED();
</span><span class="cx"> return false;
</span><span class="cx"> }
</span><ins>+ if (!m_stubRoutine->visitWeak(repatchBuffer))
+ return false;
</ins><span class="cx"> return true;
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -139,10 +141,10 @@
</span><span class="cx"> m_list.last() = putByIdAccess;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-bool PolymorphicPutByIdList::visitWeak() const
</del><ins>+bool PolymorphicPutByIdList::visitWeak(RepatchBuffer& repatchBuffer) const
</ins><span class="cx"> {
</span><span class="cx"> for (unsigned i = 0; i < size(); ++i) {
</span><del>- if (!at(i).visitWeak())
</del><ins>+ if (!at(i).visitWeak(repatchBuffer))
</ins><span class="cx"> return false;
</span><span class="cx"> }
</span><span class="cx"> return true;
</span></span></pre></div>
<a id="trunkSourceJavaScriptCorebytecodePolymorphicPutByIdListh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/bytecode/PolymorphicPutByIdList.h (166217 => 166218)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/bytecode/PolymorphicPutByIdList.h        2014-03-25 03:27:46 UTC (rev 166217)
+++ trunk/Source/JavaScriptCore/bytecode/PolymorphicPutByIdList.h        2014-03-25 03:44:52 UTC (rev 166218)
</span><span class="lines">@@ -152,7 +152,7 @@
</span><span class="cx">
</span><span class="cx"> PutPropertySlot::PutValueFunc customSetter() const { ASSERT(isCustom()); return m_customSetter; }
</span><span class="cx">
</span><del>- bool visitWeak() const;
</del><ins>+ bool visitWeak(RepatchBuffer&) const;
</ins><span class="cx">
</span><span class="cx"> private:
</span><span class="cx"> friend class CodeBlock;
</span><span class="lines">@@ -190,7 +190,7 @@
</span><span class="cx">
</span><span class="cx"> PutKind kind() const { return m_kind; }
</span><span class="cx">
</span><del>- bool visitWeak() const;
</del><ins>+ bool visitWeak(RepatchBuffer&) const;
</ins><span class="cx">
</span><span class="cx"> private:
</span><span class="cx"> friend class CodeBlock;
</span></span></pre></div>
<a id="trunkSourceJavaScriptCorebytecodeStructureStubInfocpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/bytecode/StructureStubInfo.cpp (166217 => 166218)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/bytecode/StructureStubInfo.cpp        2014-03-25 03:27:46 UTC (rev 166217)
+++ trunk/Source/JavaScriptCore/bytecode/StructureStubInfo.cpp        2014-03-25 03:44:52 UTC (rev 166218)
</span><span class="lines">@@ -61,7 +61,7 @@
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><del>-bool StructureStubInfo::visitWeakReferences()
</del><ins>+bool StructureStubInfo::visitWeakReferences(RepatchBuffer& repatchBuffer)
</ins><span class="cx"> {
</span><span class="cx"> switch (accessType) {
</span><span class="cx"> case access_get_by_id_self:
</span><span class="lines">@@ -74,7 +74,7 @@
</span><span class="cx"> return false;
</span><span class="cx"> break;
</span><span class="cx"> case access_get_by_id_list: {
</span><del>- if (!u.getByIdList.list->visitWeak())
</del><ins>+ if (!u.getByIdList.list->visitWeak(repatchBuffer))
</ins><span class="cx"> return false;
</span><span class="cx"> break;
</span><span class="cx"> }
</span><span class="lines">@@ -90,7 +90,7 @@
</span><span class="cx"> return false;
</span><span class="cx"> break;
</span><span class="cx"> case access_put_by_id_list:
</span><del>- if (!u.putByIdList.list->visitWeak())
</del><ins>+ if (!u.putByIdList.list->visitWeak(repatchBuffer))
</ins><span class="cx"> return false;
</span><span class="cx"> break;
</span><span class="cx"> case access_in_list: {
</span></span></pre></div>
<a id="trunkSourceJavaScriptCorebytecodeStructureStubInfoh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/bytecode/StructureStubInfo.h (166217 => 166218)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/bytecode/StructureStubInfo.h        2014-03-25 03:27:46 UTC (rev 166217)
+++ trunk/Source/JavaScriptCore/bytecode/StructureStubInfo.h        2014-03-25 03:44:52 UTC (rev 166218)
</span><span class="lines">@@ -167,7 +167,15 @@
</span><span class="cx">
</span><span class="cx"> void deref();
</span><span class="cx">
</span><del>- bool visitWeakReferences();
</del><ins>+ // Check if the stub has weak references that are dead. If there are dead ones that imply
+ // that the stub should be entirely reset, this should return false. If there are dead ones
+ // that can be handled internally by the stub and don't require a full reset, then this
+ // should reset them and return true. If there are no dead weak references, return true.
+ // If this method returns true it means that it has left the stub in a state where all
+ // outgoing GC pointers are known to point to currently marked objects; this method is
+ // allowed to accomplish this by either clearing those pointers somehow or by proving that
+ // they have already been marked. It is not allowed to mark new objects.
+ bool visitWeakReferences(RepatchBuffer&);
</ins><span class="cx">
</span><span class="cx"> bool seenOnce()
</span><span class="cx"> {
</span></span></pre></div>
<a id="trunkSourceJavaScriptCorejitClosureCallStubRoutinecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/jit/ClosureCallStubRoutine.cpp (166217 => 166218)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/jit/ClosureCallStubRoutine.cpp        2014-03-25 03:27:46 UTC (rev 166217)
+++ trunk/Source/JavaScriptCore/jit/ClosureCallStubRoutine.cpp        2014-03-25 03:44:52 UTC (rev 166218)
</span><span class="lines">@@ -40,7 +40,7 @@
</span><span class="cx"> ClosureCallStubRoutine::ClosureCallStubRoutine(
</span><span class="cx"> const MacroAssemblerCodeRef& code, VM& vm, const JSCell* owner,
</span><span class="cx"> Structure* structure, ExecutableBase* executable, const CodeOrigin& codeOrigin)
</span><del>- : GCAwareJITStubRoutine(code, vm, true)
</del><ins>+ : GCAwareJITStubRoutine(code, vm)
</ins><span class="cx"> , m_structure(vm, owner, structure)
</span><span class="cx"> , m_executable(vm, owner, executable)
</span><span class="cx"> , m_codeOrigin(codeOrigin)
</span></span></pre></div>
<a id="trunkSourceJavaScriptCorejitGCAwareJITStubRoutinecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/jit/GCAwareJITStubRoutine.cpp (166217 => 166218)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/jit/GCAwareJITStubRoutine.cpp        2014-03-25 03:27:46 UTC (rev 166217)
+++ trunk/Source/JavaScriptCore/jit/GCAwareJITStubRoutine.cpp        2014-03-25 03:44:52 UTC (rev 166218)
</span><span class="lines">@@ -37,11 +37,10 @@
</span><span class="cx"> namespace JSC {
</span><span class="cx">
</span><span class="cx"> GCAwareJITStubRoutine::GCAwareJITStubRoutine(
</span><del>- const MacroAssemblerCodeRef& code, VM& vm, bool isClosureCall)
</del><ins>+ const MacroAssemblerCodeRef& code, VM& vm)
</ins><span class="cx"> : JITStubRoutine(code)
</span><span class="cx"> , m_mayBeExecuting(false)
</span><span class="cx"> , m_isJettisoned(false)
</span><del>- , m_isClosureCall(isClosureCall)
</del><span class="cx"> {
</span><span class="cx"> vm.heap.m_jitStubRoutines.add(this);
</span><span class="cx"> }
</span><span class="lines">@@ -98,19 +97,6 @@
</span><span class="cx"> PassRefPtr<JITStubRoutine> createJITStubRoutine(
</span><span class="cx"> const MacroAssemblerCodeRef& code,
</span><span class="cx"> VM& vm,
</span><del>- const JSCell*,
- bool makesCalls)
-{
- if (!makesCalls)
- return adoptRef(new JITStubRoutine(code));
-
- return static_pointer_cast<JITStubRoutine>(
- adoptRef(new GCAwareJITStubRoutine(code, vm)));
-}
-
-PassRefPtr<JITStubRoutine> createJITStubRoutine(
- const MacroAssemblerCodeRef& code,
- VM& vm,
</del><span class="cx"> const JSCell* owner,
</span><span class="cx"> bool makesCalls,
</span><span class="cx"> JSCell* object)
</span><span class="lines">@@ -118,6 +104,11 @@
</span><span class="cx"> if (!makesCalls)
</span><span class="cx"> return adoptRef(new JITStubRoutine(code));
</span><span class="cx">
</span><ins>+ if (!object) {
+ return static_pointer_cast<JITStubRoutine>(
+ adoptRef(new GCAwareJITStubRoutine(code, vm)));
+ }
+
</ins><span class="cx"> return static_pointer_cast<JITStubRoutine>(
</span><span class="cx"> adoptRef(new MarkingGCAwareJITStubRoutineWithOneObject(code, vm, owner, object)));
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceJavaScriptCorejitGCAwareJITStubRoutineh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/jit/GCAwareJITStubRoutine.h (166217 => 166218)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/jit/GCAwareJITStubRoutine.h        2014-03-25 03:27:46 UTC (rev 166217)
+++ trunk/Source/JavaScriptCore/jit/GCAwareJITStubRoutine.h        2014-03-25 03:44:52 UTC (rev 166218)
</span><span class="lines">@@ -1,5 +1,5 @@
</span><span class="cx"> /*
</span><del>- * Copyright (C) 2012 Apple Inc. All rights reserved.
</del><ins>+ * Copyright (C) 2012, 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">@@ -52,7 +52,7 @@
</span><span class="cx"> // list which does not get reclaimed all at once).
</span><span class="cx"> class GCAwareJITStubRoutine : public JITStubRoutine {
</span><span class="cx"> public:
</span><del>- GCAwareJITStubRoutine(const MacroAssemblerCodeRef&, VM&, bool isClosureCall = false);
</del><ins>+ GCAwareJITStubRoutine(const MacroAssemblerCodeRef&, VM&);
</ins><span class="cx"> virtual ~GCAwareJITStubRoutine();
</span><span class="cx">
</span><span class="cx"> void markRequiredObjects(SlotVisitor& visitor)
</span><span class="lines">@@ -62,8 +62,6 @@
</span><span class="cx">
</span><span class="cx"> void deleteFromGC();
</span><span class="cx">
</span><del>- bool isClosureCall() const { return m_isClosureCall; }
-
</del><span class="cx"> protected:
</span><span class="cx"> virtual void observeZeroRefCount() override;
</span><span class="cx">
</span><span class="lines">@@ -74,7 +72,6 @@
</span><span class="cx">
</span><span class="cx"> bool m_mayBeExecuting;
</span><span class="cx"> bool m_isJettisoned;
</span><del>- bool m_isClosureCall;
</del><span class="cx"> };
</span><span class="cx">
</span><span class="cx"> // Use this if you want to mark one additional object during GC if your stub
</span><span class="lines">@@ -112,11 +109,14 @@
</span><span class="cx"> // way.
</span><span class="cx">
</span><span class="cx"> PassRefPtr<JITStubRoutine> createJITStubRoutine(
</span><del>- const MacroAssemblerCodeRef&, VM&, const JSCell* owner, bool makesCalls);
-PassRefPtr<JITStubRoutine> createJITStubRoutine(
</del><span class="cx"> const MacroAssemblerCodeRef&, VM&, const JSCell* owner, bool makesCalls,
</span><del>- JSCell*);
</del><ins>+ JSCell* = 0);
</ins><span class="cx">
</span><ins>+// Helper for the creation of simple stub routines that need no help from the GC. Note
+// that codeBlock gets "executed" more than once.
+#define FINALIZE_CODE_FOR_GC_AWARE_STUB(codeBlock, patchBuffer, makesCalls, cell, dataLogFArguments) \
+ (createJITStubRoutine(FINALIZE_CODE_FOR((codeBlock), (patchBuffer), dataLogFArguments), *(codeBlock)->vm(), (codeBlock)->ownerExecutable(), (makesCalls), (cell)))
+
</ins><span class="cx"> } // namespace JSC
</span><span class="cx">
</span><span class="cx"> #endif // ENABLE(JIT)
</span></span></pre></div>
<a id="trunkSourceJavaScriptCorejitJITStubRoutinecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/jit/JITStubRoutine.cpp (166217 => 166218)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/jit/JITStubRoutine.cpp        2014-03-25 03:27:46 UTC (rev 166217)
+++ trunk/Source/JavaScriptCore/jit/JITStubRoutine.cpp        2014-03-25 03:44:52 UTC (rev 166218)
</span><span class="lines">@@ -1,5 +1,5 @@
</span><span class="cx"> /*
</span><del>- * Copyright (C) 2012 Apple Inc. All rights reserved.
</del><ins>+ * Copyright (C) 2012, 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">@@ -36,6 +36,11 @@
</span><span class="cx">
</span><span class="cx"> JITStubRoutine::~JITStubRoutine() { }
</span><span class="cx">
</span><ins>+bool JITStubRoutine::visitWeak(RepatchBuffer&)
+{
+ return true;
+}
+
</ins><span class="cx"> void JITStubRoutine::observeZeroRefCount()
</span><span class="cx"> {
</span><span class="cx"> RELEASE_ASSERT(!m_refCount);
</span></span></pre></div>
<a id="trunkSourceJavaScriptCorejitJITStubRoutineh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/jit/JITStubRoutine.h (166217 => 166218)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/jit/JITStubRoutine.h        2014-03-25 03:27:46 UTC (rev 166217)
+++ trunk/Source/JavaScriptCore/jit/JITStubRoutine.h        2014-03-25 03:44:52 UTC (rev 166218)
</span><span class="lines">@@ -36,6 +36,7 @@
</span><span class="cx"> namespace JSC {
</span><span class="cx">
</span><span class="cx"> class JITStubRoutineSet;
</span><ins>+class RepatchBuffer;
</ins><span class="cx">
</span><span class="cx"> // This is a base-class for JIT stub routines, and also the class you want
</span><span class="cx"> // to instantiate directly if you have a routine that does not need any
</span><span class="lines">@@ -139,6 +140,8 @@
</span><span class="cx">
</span><span class="cx"> return true;
</span><span class="cx"> }
</span><ins>+
+ virtual bool visitWeak(RepatchBuffer&);
</ins><span class="cx">
</span><span class="cx"> protected:
</span><span class="cx"> virtual void observeZeroRefCount();
</span></span></pre></div>
<a id="trunkSourceJavaScriptCorejitRepatchcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/jit/Repatch.cpp (166217 => 166218)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/jit/Repatch.cpp        2014-03-25 03:27:46 UTC (rev 166217)
+++ trunk/Source/JavaScriptCore/jit/Repatch.cpp        2014-03-25 03:44:52 UTC (rev 166218)
</span><span class="lines">@@ -355,8 +355,8 @@
</span><span class="cx"> patchBuffer.link(handlerCall, lookupExceptionHandler);
</span><span class="cx"> }
</span><span class="cx">
</span><del>- stubRoutine = FINALIZE_CODE_FOR_STUB(
- exec->codeBlock(), patchBuffer,
</del><ins>+ stubRoutine = FINALIZE_CODE_FOR_GC_AWARE_STUB(
+ exec->codeBlock(), patchBuffer, true, nullptr,
</ins><span class="cx"> ("Get access stub for %s, return point %p",
</span><span class="cx"> toCString(*exec->codeBlock()).data(), successLabel.executableAddress()));
</span><span class="cx"> }
</span><span class="lines">@@ -966,9 +966,11 @@
</span><span class="cx"> patchBuffer.link(setterCall, FunctionPtr(slot.customSetter()));
</span><span class="cx"> patchBuffer.link(handlerCall, lookupExceptionHandler);
</span><span class="cx">
</span><del>- stubRoutine = createJITStubRoutine(
- FINALIZE_CODE_FOR(exec->codeBlock(), patchBuffer, ("PutById custom setter stub for %s, return point %p",
- toCString(*exec->codeBlock()).data(), stubInfo.callReturnLocation.labelAtOffset(stubInfo.patch.deltaCallToDone).executableAddress())), *vm, exec->codeBlock()->ownerExecutable(), structure);
</del><ins>+ stubRoutine = FINALIZE_CODE_FOR_GC_AWARE_STUB(
+ exec->codeBlock(), patchBuffer, true, nullptr,
+ ("PutById custom setter stub for %s, return point %p",
+ toCString(*exec->codeBlock()).data(),
+ stubInfo.callReturnLocation.labelAtOffset(stubInfo.patch.deltaCallToDone).executableAddress()));
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx">
</span></span></pre>
</div>
</div>
</body>
</html>