<!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>[207222] 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/207222">207222</a></dd>
<dt>Author</dt> <dd>fpizlo@apple.com</dd>
<dt>Date</dt> <dd>2016-10-12 09:56:34 -0700 (Wed, 12 Oct 2016)</dd>
</dl>

<h3>Log Message</h3>
<pre>Remove JITWriteBarrier.h
https://bugs.webkit.org/show_bug.cgi?id=163334

Reviewed by Mark Lam.
        
I guess that the idea of JITWriteBarrier was to make sure that if you slap some heap pointer
bits into machine code, then you better execute a barrier on the code block. But it's a
complicated piece of code, and I can never remember how it quite works. These days it looks
vestigial, particularly since only the CallLinkInfo patchable callee immediate uses it. It's
not really necessary to have something like this, since our convention is that any pointer
stored in machine code must always be shadowed in the GC heap. I think that convention has
won by overwhelming majority, so we should finally remove JITWriteBarrier.
        
A practical outcome of this change is that it makes it easier to implement DirectCall ICs,
which will have to store the callee in the CallLinkInfo but not in the machine code.

* JavaScriptCore.xcodeproj/project.pbxproj:
* assembler/AbstractMacroAssembler.h:
* bytecode/CallLinkInfo.cpp:
(JSC::CallLinkInfo::setCallee):
(JSC::CallLinkInfo::clearCallee):
* bytecode/CallLinkInfo.h:
(JSC::CallLinkInfo::setCallee): Deleted.
(JSC::CallLinkInfo::clearCallee): Deleted.
* heap/SlotVisitor.h:
* jit/JITWriteBarrier.h: Removed.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceJavaScriptCoreChangeLog">trunk/Source/JavaScriptCore/ChangeLog</a></li>
<li><a href="#trunkSourceJavaScriptCoreJavaScriptCorexcodeprojprojectpbxproj">trunk/Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj</a></li>
<li><a href="#trunkSourceJavaScriptCoreassemblerAbstractMacroAssemblerh">trunk/Source/JavaScriptCore/assembler/AbstractMacroAssembler.h</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="#trunkSourceJavaScriptCoreheapSlotVisitorh">trunk/Source/JavaScriptCore/heap/SlotVisitor.h</a></li>
<li><a href="#trunkSourceJavaScriptCorejitRepatchcpp">trunk/Source/JavaScriptCore/jit/Repatch.cpp</a></li>
</ul>

<h3>Removed Paths</h3>
<ul>
<li><a href="#trunkSourceJavaScriptCorejitJITWriteBarrierh">trunk/Source/JavaScriptCore/jit/JITWriteBarrier.h</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceJavaScriptCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/ChangeLog (207221 => 207222)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/ChangeLog        2016-10-12 16:50:24 UTC (rev 207221)
+++ trunk/Source/JavaScriptCore/ChangeLog        2016-10-12 16:56:34 UTC (rev 207222)
</span><span class="lines">@@ -1,3 +1,32 @@
</span><ins>+2016-10-12  Filip Pizlo  &lt;fpizlo@apple.com&gt;
+
+        Remove JITWriteBarrier.h
+        https://bugs.webkit.org/show_bug.cgi?id=163334
+
+        Reviewed by Mark Lam.
+        
+        I guess that the idea of JITWriteBarrier was to make sure that if you slap some heap pointer
+        bits into machine code, then you better execute a barrier on the code block. But it's a
+        complicated piece of code, and I can never remember how it quite works. These days it looks
+        vestigial, particularly since only the CallLinkInfo patchable callee immediate uses it. It's
+        not really necessary to have something like this, since our convention is that any pointer
+        stored in machine code must always be shadowed in the GC heap. I think that convention has
+        won by overwhelming majority, so we should finally remove JITWriteBarrier.
+        
+        A practical outcome of this change is that it makes it easier to implement DirectCall ICs,
+        which will have to store the callee in the CallLinkInfo but not in the machine code.
+
+        * JavaScriptCore.xcodeproj/project.pbxproj:
+        * assembler/AbstractMacroAssembler.h:
+        * bytecode/CallLinkInfo.cpp:
+        (JSC::CallLinkInfo::setCallee):
+        (JSC::CallLinkInfo::clearCallee):
+        * bytecode/CallLinkInfo.h:
+        (JSC::CallLinkInfo::setCallee): Deleted.
+        (JSC::CallLinkInfo::clearCallee): Deleted.
+        * heap/SlotVisitor.h:
+        * jit/JITWriteBarrier.h: Removed.
+
</ins><span class="cx"> 2016-10-12  Csaba Osztrogonác  &lt;ossy@webkit.org&gt;
</span><span class="cx"> 
</span><span class="cx">         Unreviewed buildfix for GCC 4.9 after r207186.
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreJavaScriptCorexcodeprojprojectpbxproj"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj (207221 => 207222)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj        2016-10-12 16:50:24 UTC (rev 207221)
+++ trunk/Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj        2016-10-12 16:56:34 UTC (rev 207222)
</span><span class="lines">@@ -1769,7 +1769,6 @@
</span><span class="cx">                 A767B5B617A0B9650063D940 /* DFGLoopPreHeaderCreationPhase.h in Headers */ = {isa = PBXBuildFile; fileRef = A767B5B417A0B9650063D940 /* DFGLoopPreHeaderCreationPhase.h */; };
</span><span class="cx">                 A76C51761182748D00715B05 /* JSInterfaceJIT.h in Headers */ = {isa = PBXBuildFile; fileRef = A76C51741182748D00715B05 /* JSInterfaceJIT.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="cx">                 A76F279415F13C9600517D67 /* UnlinkedCodeBlock.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A79E781E15EECBA80047C855 /* UnlinkedCodeBlock.cpp */; };
</span><del>-                A76F54A313B28AAB00EF2BCE /* JITWriteBarrier.h in Headers */ = {isa = PBXBuildFile; fileRef = A76F54A213B28AAB00EF2BCE /* JITWriteBarrier.h */; settings = {ATTRIBUTES = (Private, ); }; };
</del><span class="cx">                 A77A423D17A0BBFD00A8DB81 /* DFGAbstractHeap.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A77A423617A0BBFD00A8DB81 /* DFGAbstractHeap.cpp */; };
</span><span class="cx">                 A77A423E17A0BBFD00A8DB81 /* DFGAbstractHeap.h in Headers */ = {isa = PBXBuildFile; fileRef = A77A423717A0BBFD00A8DB81 /* DFGAbstractHeap.h */; };
</span><span class="cx">                 A77A423F17A0BBFD00A8DB81 /* DFGClobberize.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A77A423817A0BBFD00A8DB81 /* DFGClobberize.cpp */; };
</span><span class="lines">@@ -4077,7 +4076,6 @@
</span><span class="cx">                 A767B5B317A0B9650063D940 /* DFGLoopPreHeaderCreationPhase.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = DFGLoopPreHeaderCreationPhase.cpp; path = dfg/DFGLoopPreHeaderCreationPhase.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 A767B5B417A0B9650063D940 /* DFGLoopPreHeaderCreationPhase.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = DFGLoopPreHeaderCreationPhase.h; path = dfg/DFGLoopPreHeaderCreationPhase.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 A76C51741182748D00715B05 /* JSInterfaceJIT.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSInterfaceJIT.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><del>-                A76F54A213B28AAB00EF2BCE /* JITWriteBarrier.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JITWriteBarrier.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</del><span class="cx">                 A77A423617A0BBFD00A8DB81 /* DFGAbstractHeap.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = DFGAbstractHeap.cpp; path = dfg/DFGAbstractHeap.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 A77A423717A0BBFD00A8DB81 /* DFGAbstractHeap.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = DFGAbstractHeap.h; path = dfg/DFGAbstractHeap.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 A77A423817A0BBFD00A8DB81 /* DFGClobberize.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = DFGClobberize.cpp; path = dfg/DFGClobberize.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="lines">@@ -5279,7 +5277,6 @@
</span><span class="cx">                                 0FC712E117CD878F008CC93C /* JITToDFGDeferredCompilationCallback.h */,
</span><span class="cx">                                 DC0184171D10C1870057B053 /* JITWorklist.cpp */,
</span><span class="cx">                                 DC0184181D10C1870057B053 /* JITWorklist.h */,
</span><del>-                                A76F54A213B28AAB00EF2BCE /* JITWriteBarrier.h */,
</del><span class="cx">                                 A76C51741182748D00715B05 /* JSInterfaceJIT.h */,
</span><span class="cx">                                 792CB3471C4EED5C00D13AF3 /* PCToCodeOriginMap.cpp */,
</span><span class="cx">                                 792CB3481C4EED5C00D13AF3 /* PCToCodeOriginMap.h */,
</span><span class="lines">@@ -7945,7 +7942,6 @@
</span><span class="cx">                                 0F766D2C15A8CC3A008F363E /* JITStubRoutineSet.h in Headers */,
</span><span class="cx">                                 0F5EF91F16878F7D003E5C25 /* JITThunks.h in Headers */,
</span><span class="cx">                                 0FC712E317CD8793008CC93C /* JITToDFGDeferredCompilationCallback.h in Headers */,
</span><del>-                                A76F54A313B28AAB00EF2BCE /* JITWriteBarrier.h in Headers */,
</del><span class="cx">                                 840480131021A1D9008E7F01 /* JSAPIValueWrapper.h in Headers */,
</span><span class="cx">                                 C2CF39C216E15A8100DD69BE /* JSAPIWrapperObject.h in Headers */,
</span><span class="cx">                                 BC18C4170E16F5CD00B34460 /* JSArray.h in Headers */,
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreassemblerAbstractMacroAssemblerh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/assembler/AbstractMacroAssembler.h (207221 => 207222)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/assembler/AbstractMacroAssembler.h        2016-10-12 16:50:24 UTC (rev 207221)
+++ trunk/Source/JavaScriptCore/assembler/AbstractMacroAssembler.h        2016-10-12 16:56:34 UTC (rev 207222)
</span><span class="lines">@@ -52,7 +52,6 @@
</span><span class="cx"> template &lt;class AssemblerType, class MacroAssemblerType&gt;
</span><span class="cx"> class AbstractMacroAssembler {
</span><span class="cx"> public:
</span><del>-    friend class JITWriteBarrierBase;
</del><span class="cx">     typedef AbstractMacroAssembler&lt;AssemblerType, MacroAssemblerType&gt; AbstractMacroAssemblerType;
</span><span class="cx">     typedef AssemblerType AssemblerType_T;
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceJavaScriptCorebytecodeCallLinkInfocpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/bytecode/CallLinkInfo.cpp (207221 => 207222)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/bytecode/CallLinkInfo.cpp        2016-10-12 16:50:24 UTC (rev 207221)
+++ trunk/Source/JavaScriptCore/bytecode/CallLinkInfo.cpp        2016-10-12 16:56:34 UTC (rev 207222)
</span><span class="lines">@@ -1,5 +1,5 @@
</span><span class="cx"> /*
</span><del>- * Copyright (C) 2012, 2013, 2014 Apple Inc. All rights reserved.
</del><ins>+ * Copyright (C) 2012-2014, 2016 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">@@ -30,6 +30,7 @@
</span><span class="cx"> #include &quot;DFGOperations.h&quot;
</span><span class="cx"> #include &quot;DFGThunks.h&quot;
</span><span class="cx"> #include &quot;JSCInlines.h&quot;
</span><ins>+#include &quot;MacroAssembler.h&quot;
</ins><span class="cx"> #include &quot;Opcode.h&quot;
</span><span class="cx"> #include &quot;Repatch.h&quot;
</span><span class="cx"> #include &lt;wtf/ListDump.h&gt;
</span><span class="lines">@@ -97,6 +98,18 @@
</span><span class="cx">         remove();
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void CallLinkInfo::setCallee(VM&amp; vm, JSCell* owner, JSFunction* callee)
+{
+    MacroAssembler::repatchPointer(m_hotPathBegin, callee);
+    m_callee.set(vm, owner, callee);
+}
+
+void CallLinkInfo::clearCallee()
+{
+    MacroAssembler::repatchPointer(m_hotPathBegin, nullptr);
+    m_callee.clear();
+}
+
</ins><span class="cx"> void CallLinkInfo::visitWeak(VM&amp; vm)
</span><span class="cx"> {
</span><span class="cx">     auto handleSpecificCallee = [&amp;] (JSFunction* callee) {
</span></span></pre></div>
<a id="trunkSourceJavaScriptCorebytecodeCallLinkInfoh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/bytecode/CallLinkInfo.h (207221 => 207222)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/bytecode/CallLinkInfo.h        2016-10-12 16:50:24 UTC (rev 207221)
+++ trunk/Source/JavaScriptCore/bytecode/CallLinkInfo.h        2016-10-12 16:56:34 UTC (rev 207222)
</span><span class="lines">@@ -1,5 +1,5 @@
</span><span class="cx"> /*
</span><del>- * Copyright (C) 2012, 2014, 2015 Apple Inc. All rights reserved.
</del><ins>+ * Copyright (C) 2012, 2014-2016 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">@@ -28,7 +28,6 @@
</span><span class="cx"> #include &quot;CallMode.h&quot;
</span><span class="cx"> #include &quot;CodeLocation.h&quot;
</span><span class="cx"> #include &quot;CodeSpecializationKind.h&quot;
</span><del>-#include &quot;JITWriteBarrier.h&quot;
</del><span class="cx"> #include &quot;JSFunction.h&quot;
</span><span class="cx"> #include &quot;PolymorphicCallStubRoutine.h&quot;
</span><span class="cx"> #include &quot;WriteBarrier.h&quot;
</span><span class="lines">@@ -158,15 +157,9 @@
</span><span class="cx">         return m_hotPathOther;
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    void setCallee(VM&amp; vm, CodeLocationDataLabelPtr location, JSCell* owner, JSFunction* callee)
-    {
-        m_callee.set(vm, location, owner, callee);
-    }
</del><ins>+    void setCallee(VM&amp;, JSCell*, JSFunction* callee);
</ins><span class="cx"> 
</span><del>-    void clearCallee()
-    {
-        m_callee.clear();
-    }
</del><ins>+    void clearCallee();
</ins><span class="cx"> 
</span><span class="cx">     JSFunction* callee()
</span><span class="cx">     {
</span><span class="lines">@@ -314,7 +307,7 @@
</span><span class="cx">     CodeLocationNearCall m_callReturnLocation;
</span><span class="cx">     CodeLocationDataLabelPtr m_hotPathBegin;
</span><span class="cx">     CodeLocationNearCall m_hotPathOther;
</span><del>-    JITWriteBarrier&lt;JSFunction&gt; m_callee;
</del><ins>+    WriteBarrier&lt;JSFunction&gt; m_callee;
</ins><span class="cx">     WriteBarrier&lt;JSFunction&gt; m_lastSeenCallee;
</span><span class="cx">     RefPtr&lt;PolymorphicCallStubRoutine&gt; m_stub;
</span><span class="cx">     RefPtr&lt;JITStubRoutine&gt; m_slowStub;
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreheapSlotVisitorh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/heap/SlotVisitor.h (207221 => 207222)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/heap/SlotVisitor.h        2016-10-12 16:50:24 UTC (rev 207221)
+++ trunk/Source/JavaScriptCore/heap/SlotVisitor.h        2016-10-12 16:56:34 UTC (rev 207222)
</span><span class="lines">@@ -37,7 +37,6 @@
</span><span class="cx"> class Heap;
</span><span class="cx"> class HeapCell;
</span><span class="cx"> class HeapSnapshotBuilder;
</span><del>-template&lt;typename T&gt; class JITWriteBarrier;
</del><span class="cx"> class MarkedBlock;
</span><span class="cx"> class UnconditionalFinalizer;
</span><span class="cx"> template&lt;typename T&gt; class Weak;
</span></span></pre></div>
<a id="trunkSourceJavaScriptCorejitJITWriteBarrierh"></a>
<div class="delfile"><h4>Deleted: trunk/Source/JavaScriptCore/jit/JITWriteBarrier.h (207221 => 207222)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/jit/JITWriteBarrier.h        2016-10-12 16:50:24 UTC (rev 207221)
+++ trunk/Source/JavaScriptCore/jit/JITWriteBarrier.h        2016-10-12 16:56:34 UTC (rev 207222)
</span><span class="lines">@@ -1,139 +0,0 @@
</span><del>-/*
- * Copyright (C) 2011, 2016 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#pragma once
-
-#if ENABLE(JIT)
-
-#include &quot;MacroAssembler.h&quot;
-#include &quot;SlotVisitor.h&quot;
-#include &quot;UnusedPointer.h&quot;
-#include &quot;VM.h&quot;
-#include &quot;WriteBarrier.h&quot;
-
-namespace JSC {
-
-class JSCell;
-class VM;
-
-// Needs to be even to appease some of the backends.
-#define JITWriteBarrierFlag ((void*)2)
-class JITWriteBarrierBase {
-public:
-    explicit operator bool() const { return get(); }
-    bool operator!() const { return !get(); }
-
-    void setFlagOnBarrier()
-    {
-        ASSERT(!m_location);
-        m_location = CodeLocationDataLabelPtr(JITWriteBarrierFlag);
-    }
-
-    bool isFlagged() const
-    {
-        return !!m_location;
-    }
-
-    void setLocation(CodeLocationDataLabelPtr location)
-    {
-        ASSERT(!m_location);
-        m_location = location;
-    }
-
-    CodeLocationDataLabelPtr location() const
-    {
-        ASSERT((!!m_location) &amp;&amp; m_location.executableAddress() != JITWriteBarrierFlag);
-        return m_location;
-    }
-    
-    void clear() { clear(0); }
-    void clearToUnusedPointer() { clear(reinterpret_cast&lt;void*&gt;(unusedPointer)); }
-
-protected:
-    JITWriteBarrierBase()
-    {
-    }
-
-    void set(VM&amp; vm, CodeLocationDataLabelPtr location, JSCell* owner, JSCell* value)
-    {
-        vm.heap.writeBarrier(owner, value);
-        m_location = location;
-        ASSERT(((!!m_location) &amp;&amp; m_location.executableAddress() != JITWriteBarrierFlag) || (location.executableAddress() == m_location.executableAddress()));
-        MacroAssembler::repatchPointer(m_location, value);
-        ASSERT(get() == value);
-    }
-
-    JSCell* get() const
-    {
-        if (!m_location || m_location.executableAddress() == JITWriteBarrierFlag)
-            return 0;
-        void* result = static_cast&lt;JSCell*&gt;(MacroAssembler::readPointer(m_location));
-        if (result == reinterpret_cast&lt;void*&gt;(unusedPointer))
-            return 0;
-        return static_cast&lt;JSCell*&gt;(result);
-    }
-
-private:
-    void clear(void* clearedValue)
-    {
-        if (!m_location)
-            return;
-        if (m_location.executableAddress() != JITWriteBarrierFlag)
-            MacroAssembler::repatchPointer(m_location, clearedValue);
-    }
-
-    CodeLocationDataLabelPtr m_location;
-};
-
-#undef JITWriteBarrierFlag
-
-template &lt;typename T&gt; class JITWriteBarrier : public JITWriteBarrierBase {
-public:
-    JITWriteBarrier()
-    {
-    }
-
-    void set(VM&amp; vm, CodeLocationDataLabelPtr location, JSCell* owner, T* value)
-    {
-        validateCell(owner);
-        validateCell(value);
-        JITWriteBarrierBase::set(vm, location, owner, value);
-    }
-    void set(VM&amp; vm, JSCell* owner, T* value)
-    {
-        set(vm, location(), owner, value);
-    }
-    T* get() const
-    {
-        T* result = static_cast&lt;T*&gt;(JITWriteBarrierBase::get());
-        if (result)
-            validateCell(result);
-        return result;
-    }
-};
-
-} // namespace JSC
-
-#endif // ENABLE(JIT)
</del></span></pre></div>
<a id="trunkSourceJavaScriptCorejitRepatchcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/jit/Repatch.cpp (207221 => 207222)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/jit/Repatch.cpp        2016-10-12 16:50:24 UTC (rev 207221)
+++ trunk/Source/JavaScriptCore/jit/Repatch.cpp        2016-10-12 16:56:34 UTC (rev 207222)
</span><span class="lines">@@ -566,7 +566,7 @@
</span><span class="cx">     VM* vm = callerCodeBlock-&gt;vm();
</span><span class="cx">     
</span><span class="cx">     ASSERT(!callLinkInfo.isLinked());
</span><del>-    callLinkInfo.setCallee(exec-&gt;callerFrame()-&gt;vm(), callLinkInfo.hotPathBegin(), callerCodeBlock, callee);
</del><ins>+    callLinkInfo.setCallee(exec-&gt;callerFrame()-&gt;vm(), callerCodeBlock, callee);
</ins><span class="cx">     callLinkInfo.setLastSeenCallee(exec-&gt;callerFrame()-&gt;vm(), callerCodeBlock, callee);
</span><span class="cx">     if (shouldDumpDisassemblyFor(callerCodeBlock))
</span><span class="cx">         dataLog(&quot;Linking call in &quot;, *callerCodeBlock, &quot; at &quot;, callLinkInfo.codeOrigin(), &quot; to &quot;, pointerDump(calleeCodeBlock), &quot;, entrypoint at &quot;, codePtr, &quot;\n&quot;);
</span></span></pre>
</div>
</div>

</body>
</html>