[prev in list] [next in list] [prev in thread] [next in thread] 

List:       webkit-changes
Subject:    [webkit-changes] [230106] trunk/Source/JavaScriptCore
From:       mark.lam () apple ! com
Date:       2018-03-30 16:31:06
Message-ID: 20180330163106.BB07110051CC () svn ! webkit ! org
[Download RAW message or body]

[Attachment #2 (text/html)]

<!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>[230106] 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/230106">230106</a></dd> \
<dt>Author</dt> <dd>mark.lam@apple.com</dd> <dt>Date</dt> <dd>2018-03-30 09:31:06 \
-0700 (Fri, 30 Mar 2018)</dd> </dl>

<h3>Log Message</h3>
<pre>Add pointer profiling support to Wasm.
https://bugs.webkit.org/show_bug.cgi?id=184175
&lt;rdar://problem/39027923&gt;

Reviewed by JF Bastien.

* runtime/PtrTag.h:
* wasm/WasmB3IRGenerator.cpp:
(JSC::Wasm::B3IRGenerator::addGrowMemory):
(JSC::Wasm::B3IRGenerator::addCall):
(JSC::Wasm::B3IRGenerator::addCallIndirect):
(JSC::Wasm::B3IRGenerator::addOp&lt;OpType::I32Popcnt&gt;):
(JSC::Wasm::B3IRGenerator::addOp&lt;OpType::I64Popcnt&gt;):
* wasm/WasmBBQPlan.cpp:
(JSC::Wasm::BBQPlan::prepare):
(JSC::Wasm::BBQPlan::complete):
* wasm/WasmBinding.cpp:
(JSC::Wasm::wasmToWasm):
* wasm/WasmBinding.h:
* wasm/WasmFaultSignalHandler.cpp:
(JSC::Wasm::trapHandler):
* wasm/WasmOMGPlan.cpp:
(JSC::Wasm::OMGPlan::work):
* wasm/WasmThunks.cpp:
(JSC::Wasm::throwExceptionFromWasmThunkGenerator):
(JSC::Wasm::throwStackOverflowFromWasmThunkGenerator):
(JSC::Wasm::triggerOMGTierUpThunkGenerator):
* wasm/js/WasmToJS.cpp:
(JSC::Wasm::handleBadI64Use):
(JSC::Wasm::wasmToJS):
* wasm/js/WebAssemblyFunction.cpp:
(JSC::callWebAssemblyFunction):
* wasm/js/WebAssemblyFunction.h:</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceJavaScriptCoreChangeLog">trunk/Source/JavaScriptCore/ChangeLog</a></li>
 <li><a href="#trunkSourceJavaScriptCoreruntimePtrTagh">trunk/Source/JavaScriptCore/runtime/PtrTag.h</a></li>
 <li><a href="#trunkSourceJavaScriptCorewasmWasmB3IRGeneratorcpp">trunk/Source/JavaScriptCore/wasm/WasmB3IRGenerator.cpp</a></li>
 <li><a href="#trunkSourceJavaScriptCorewasmWasmBBQPlancpp">trunk/Source/JavaScriptCore/wasm/WasmBBQPlan.cpp</a></li>
 <li><a href="#trunkSourceJavaScriptCorewasmWasmBindingcpp">trunk/Source/JavaScriptCore/wasm/WasmBinding.cpp</a></li>
 <li><a href="#trunkSourceJavaScriptCorewasmWasmBindingh">trunk/Source/JavaScriptCore/wasm/WasmBinding.h</a></li>
 <li><a href="#trunkSourceJavaScriptCorewasmWasmFaultSignalHandlercpp">trunk/Source/JavaScriptCore/wasm/WasmFaultSignalHandler.cpp</a></li>
 <li><a href="#trunkSourceJavaScriptCorewasmWasmOMGPlancpp">trunk/Source/JavaScriptCore/wasm/WasmOMGPlan.cpp</a></li>
 <li><a href="#trunkSourceJavaScriptCorewasmWasmThunkscpp">trunk/Source/JavaScriptCore/wasm/WasmThunks.cpp</a></li>
 <li><a href="#trunkSourceJavaScriptCorewasmjsWasmToJScpp">trunk/Source/JavaScriptCore/wasm/js/WasmToJS.cpp</a></li>
 <li><a href="#trunkSourceJavaScriptCorewasmjsWebAssemblyFunctioncpp">trunk/Source/JavaScriptCore/wasm/js/WebAssemblyFunction.cpp</a></li>
 <li><a href="#trunkSourceJavaScriptCorewasmjsWebAssemblyFunctionh">trunk/Source/JavaScriptCore/wasm/js/WebAssemblyFunction.h</a></li>
 </ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceJavaScriptCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/ChangeLog (230105 => \
230106)</h4> <pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/ChangeLog	2018-03-30 16:05:22 UTC \
                (rev 230105)
+++ trunk/Source/JavaScriptCore/ChangeLog	2018-03-30 16:31:06 UTC (rev 230106)
</span><span class="lines">@@ -1,3 +1,39 @@
</span><ins>+2018-03-30  Mark Lam  &lt;mark.lam@apple.com&gt;
+
+        Add pointer profiling support to Wasm.
+        https://bugs.webkit.org/show_bug.cgi?id=184175
+        &lt;rdar://problem/39027923&gt;
+
+        Reviewed by JF Bastien.
+
+        * runtime/PtrTag.h:
+        * wasm/WasmB3IRGenerator.cpp:
+        (JSC::Wasm::B3IRGenerator::addGrowMemory):
+        (JSC::Wasm::B3IRGenerator::addCall):
+        (JSC::Wasm::B3IRGenerator::addCallIndirect):
+        (JSC::Wasm::B3IRGenerator::addOp&lt;OpType::I32Popcnt&gt;):
+        (JSC::Wasm::B3IRGenerator::addOp&lt;OpType::I64Popcnt&gt;):
+        * wasm/WasmBBQPlan.cpp:
+        (JSC::Wasm::BBQPlan::prepare):
+        (JSC::Wasm::BBQPlan::complete):
+        * wasm/WasmBinding.cpp:
+        (JSC::Wasm::wasmToWasm):
+        * wasm/WasmBinding.h:
+        * wasm/WasmFaultSignalHandler.cpp:
+        (JSC::Wasm::trapHandler):
+        * wasm/WasmOMGPlan.cpp:
+        (JSC::Wasm::OMGPlan::work):
+        * wasm/WasmThunks.cpp:
+        (JSC::Wasm::throwExceptionFromWasmThunkGenerator):
+        (JSC::Wasm::throwStackOverflowFromWasmThunkGenerator):
+        (JSC::Wasm::triggerOMGTierUpThunkGenerator):
+        * wasm/js/WasmToJS.cpp:
+        (JSC::Wasm::handleBadI64Use):
+        (JSC::Wasm::wasmToJS):
+        * wasm/js/WebAssemblyFunction.cpp:
+        (JSC::callWebAssemblyFunction):
+        * wasm/js/WebAssemblyFunction.h:
+
</ins><span class="cx"> 2018-03-30  Ryan Haddad  &lt;ryanhaddad@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Unreviewed, rolling out r230102.
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreruntimePtrTagh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/runtime/PtrTag.h \
(230105 => 230106)</h4> <pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/runtime/PtrTag.h	2018-03-30 \
                16:05:22 UTC (rev 230105)
+++ trunk/Source/JavaScriptCore/runtime/PtrTag.h	2018-03-30 16:31:06 UTC (rev 230106)
</span><span class="lines">@@ -53,6 +53,9 @@
</span><span class="cx">     v(YarrMatchOnly8BitPtrTag) \
</span><span class="cx">     v(YarrMatchOnly16BitPtrTag) \
</span><span class="cx">     v(YarrBacktrackPtrTag) \
</span><ins>+    \
+    v(WasmCallPtrTag) \
+    v(WasmHelperPtrTag) \
</ins><span class="cx"> 
</span><span class="cx"> 
</span><span class="cx"> enum PtrTag : uintptr_t {
</span></span></pre></div>
<a id="trunkSourceJavaScriptCorewasmWasmB3IRGeneratorcpp"></a>
<div class="modfile"><h4>Modified: \
trunk/Source/JavaScriptCore/wasm/WasmB3IRGenerator.cpp (230105 => 230106)</h4> <pre \
class="diff"><span> <span class="info">--- \
trunk/Source/JavaScriptCore/wasm/WasmB3IRGenerator.cpp	2018-03-30 16:05:22 UTC (rev \
                230105)
+++ trunk/Source/JavaScriptCore/wasm/WasmB3IRGenerator.cpp	2018-03-30 16:31:06 UTC \
(rev 230106) </span><span class="lines">@@ -594,7 +594,7 @@
</span><span class="cx">     };
</span><span class="cx"> 
</span><span class="cx">     result = \
m_currentBlock-&gt;appendNew&lt;CCallValue&gt;(m_proc, Int32, origin(), </span><del>- \
m_currentBlock-&gt;appendNew&lt;ConstPtrValue&gt;(m_proc, origin(), \
bitwise_cast&lt;void*&gt;(growMemory)), </del><ins>+        \
m_currentBlock-&gt;appendNew&lt;ConstPtrValue&gt;(m_proc, origin(), \
tagCFunctionPtr&lt;void*&gt;(growMemory, B3CCallPtrTag)), </ins><span class="cx">     \
m_currentBlock-&gt;appendNew&lt;B3::Value&gt;(m_proc, B3::FramePointer, origin()), \
instanceValue(), delta); </span><span class="cx"> 
</span><span class="cx">     \
restoreWebAssemblyGlobalState(RestoreCachedStackLimit::No, m_info.memory, \
instanceValue(), m_proc, m_currentBlock); </span><span class="lines">@@ -1135,8 \
+1135,9 @@ </span><span class="cx">         if (Options::usePoisoning())
</span><span class="cx">             jumpDestination = \
isEmbedderBlock-&gt;appendNew&lt;Value&gt;(m_proc, BitXor, origin(), jumpDestination, \
isEmbedderBlock-&gt;appendNew&lt;Const64Value&gt;(m_proc, origin(), \
g_JITCodePoison)); </span><span class="cx"> 
</span><ins>+        PtrTag callTag = ptrTag(WasmCallPtrTag, signature.hash());
</ins><span class="cx">         Value* embedderCallResult = \
wasmCallingConvention().setupCall(m_proc, isEmbedderBlock, origin(), args, \
toB3Type(returnType), </span><del>-            [&amp;] (PatchpointValue* patchpoint) \
{ </del><ins>+            [=] (PatchpointValue* patchpoint) {
</ins><span class="cx">                 patchpoint-&gt;effects.writesPinned = true;
</span><span class="cx">                 patchpoint-&gt;effects.readsPinned = true;
</span><span class="cx">                 patchpoint-&gt;append(jumpDestination, \
ValueRep::SomeRegister); </span><span class="lines">@@ -1144,9 +1145,9 @@
</span><span class="cx">                 // We pessimistically assume we could be \
calling to something that is bounds checking. </span><span class="cx">                \
// FIXME: We shouldn't have to do this: \
https://bugs.webkit.org/show_bug.cgi?id=172181 </span><span class="cx">               \
patchpoint-&gt;clobberLate(PinnedRegisterInfo::get().toSave(MemoryMode::BoundsChecking));
 </span><del>-                patchpoint-&gt;setGenerator([returnType] \
(CCallHelpers&amp; jit, const B3::StackmapGenerationParams&amp; params) { \
</del><ins>+                patchpoint-&gt;setGenerator([returnType, callTag] \
(CCallHelpers&amp; jit, const B3::StackmapGenerationParams&amp; params) { </ins><span \
class="cx">                     AllowMacroScratchRegisterUsage allowScratch(jit); \
</span><del>-                    jit.call(params[returnType == Void ? 0 : 1].gpr(), \
NoPtrTag); </del><ins>+                    jit.call(params[returnType == Void ? 0 : \
1].gpr(), callTag); </ins><span class="cx">                 });
</span><span class="cx">             });
</span><span class="cx">         UpsilonValue* embedderCallResultUpsilon = returnType \
== Void ? nullptr : isEmbedderBlock-&gt;appendNew&lt;UpsilonValue&gt;(m_proc, \
origin(), embedderCallResult); </span><span class="lines">@@ -1317,6 +1318,7 @@
</span><span class="cx">         calleeCode = \
m_currentBlock-&gt;appendNew&lt;Value&gt;(m_proc, BitXor, origin(), calleeCode, \
m_currentBlock-&gt;appendNew&lt;Const64Value&gt;(m_proc, origin(), g_JITCodePoison)); \
</span><span class="cx">  </span><span class="cx">     Type returnType = \
signature.returnType(); </span><ins>+    PtrTag callTag = ptrTag(WasmCallPtrTag, \
signature.hash()); </ins><span class="cx">     result = \
wasmCallingConvention().setupCall(m_proc, m_currentBlock, origin(), args, \
toB3Type(returnType), </span><span class="cx">         [=] (PatchpointValue* \
patchpoint) { </span><span class="cx">             \
patchpoint-&gt;effects.writesPinned = true; </span><span class="lines">@@ -1331,7 \
+1333,7 @@ </span><span class="cx">             patchpoint-&gt;append(calleeCode, \
ValueRep::SomeRegister); </span><span class="cx">             \
patchpoint-&gt;setGenerator([=] (CCallHelpers&amp; jit, const \
B3::StackmapGenerationParams&amp; params) { </span><span class="cx">                 \
AllowMacroScratchRegisterUsage allowScratch(jit); </span><del>-                \
jit.call(params[returnType == Void ? 0 : 1].gpr(), NoPtrTag); </del><ins>+            \
jit.call(params[returnType == Void ? 0 : 1].gpr(), callTag); </ins><span class="cx">  \
}); </span><span class="cx">         });
</span><span class="cx"> 
</span><span class="lines">@@ -1582,7 +1584,7 @@
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx">     uint32_t (*popcount)(int32_t) = [] (int32_t value) -&gt; \
uint32_t { return __builtin_popcount(value); }; </span><del>-    Value* funcAddress = \
m_currentBlock-&gt;appendNew&lt;ConstPtrValue&gt;(m_proc, origin(), \
bitwise_cast&lt;void*&gt;(popcount)); </del><ins>+    Value* funcAddress = \
m_currentBlock-&gt;appendNew&lt;ConstPtrValue&gt;(m_proc, origin(), \
tagCFunctionPtr&lt;void*&gt;(popcount, B3CCallPtrTag)); </ins><span class="cx">     \
result = m_currentBlock-&gt;appendNew&lt;CCallValue&gt;(m_proc, Int32, origin(), \
Effects::none(), funcAddress, arg); </span><span class="cx">     return { };
</span><span class="cx"> }
</span><span class="lines">@@ -1604,7 +1606,7 @@
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx">     uint64_t (*popcount)(int64_t) = [] (int64_t value) -&gt; \
uint64_t { return __builtin_popcountll(value); }; </span><del>-    Value* funcAddress \
= m_currentBlock-&gt;appendNew&lt;ConstPtrValue&gt;(m_proc, origin(), \
bitwise_cast&lt;void*&gt;(popcount)); </del><ins>+    Value* funcAddress = \
m_currentBlock-&gt;appendNew&lt;ConstPtrValue&gt;(m_proc, origin(), \
tagCFunctionPtr&lt;void*&gt;(popcount, B3CCallPtrTag)); </ins><span class="cx">     \
result = m_currentBlock-&gt;appendNew&lt;CCallValue&gt;(m_proc, Int64, origin(), \
Effects::none(), funcAddress, arg); </span><span class="cx">     return { };
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceJavaScriptCorewasmWasmBBQPlancpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/wasm/WasmBBQPlan.cpp \
(230105 => 230106)</h4> <pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/wasm/WasmBBQPlan.cpp	2018-03-30 \
                16:05:22 UTC (rev 230105)
+++ trunk/Source/JavaScriptCore/wasm/WasmBBQPlan.cpp	2018-03-30 16:31:06 UTC (rev \
230106) </span><span class="lines">@@ -174,8 +174,10 @@
</span><span class="cx">         if (import-&gt;kind != ExternalKind::Function)
</span><span class="cx">             continue;
</span><span class="cx">         unsigned importFunctionIndex = \
m_wasmToWasmExitStubs.size(); </span><ins>+        SignatureIndex signatureIndex = \
m_moduleInformation-&gt;importFunctionSignatureIndices[importFunctionIndex]; +        \
const Signature&amp; signature = SignatureInformation::get(signatureIndex); \
</ins><span class="cx">         dataLogLnIf(WasmBBQPlanInternal::verbose, \
&quot;Processing import function number &quot;, importFunctionIndex, &quot;: &quot;, \
makeString(import-&gt;module), &quot;: &quot;, makeString(import-&gt;field)); \
</span><del>-        auto binding = wasmToWasm(importFunctionIndex); </del><ins>+     \
auto binding = wasmToWasm(signature, importFunctionIndex); </ins><span class="cx">    \
if (UNLIKELY(!binding)) { </span><span class="cx">             switch \
(binding.error()) { </span><span class="cx">             case \
BindingFailure::OutOfMemory: </span><span class="lines">@@ -300,6 +302,8 @@
</span><span class="cx">         for (uint32_t functionIndex = 0; functionIndex &lt; \
m_moduleInformation-&gt;functionLocationInBinary.size(); functionIndex++) { \
</span><span class="cx">             CompilationContext&amp; context = \
m_compilationContexts[functionIndex]; </span><span class="cx">             \
SignatureIndex signatureIndex = \
m_moduleInformation-&gt;internalFunctionSignatureIndices[functionIndex]; \
</span><ins>+            const Signature&amp; signature = \
SignatureInformation::get(signatureIndex); +            PtrTag callTag = \
ptrTag(WasmCallPtrTag, signature.hash()); </ins><span class="cx">             {
</span><span class="cx">                 LinkBuffer \
linkBuffer(*context.wasmEntrypointJIT, nullptr, JITCompilationCanFail); </span><span \
class="cx">                 if (UNLIKELY(linkBuffer.didFailToAllocate())) { \
</span><span class="lines">@@ -308,7 +312,7 @@ </span><span class="cx">               \
} </span><span class="cx"> 
</span><span class="cx">                 \
m_wasmInternalFunctions[functionIndex]-&gt;entrypoint.compilation = \
std::make_unique&lt;B3::Compilation&gt;( </span><del>-                    \
FINALIZE_CODE(linkBuffer, NoPtrTag, &quot;WebAssembly function[%i] %s&quot;, \
functionIndex, SignatureInformation::get(signatureIndex).toString().ascii().data()), \
</del><ins>+                    FINALIZE_CODE(linkBuffer, callTag, &quot;WebAssembly \
function[%i] %s&quot;, functionIndex, signature.toString().ascii().data()), \
</ins><span class="cx">                     \
WTFMove(context.wasmEntrypointByproducts)); </span><span class="cx">             }
</span><span class="cx"> 
</span><span class="lines">@@ -320,7 +324,7 @@
</span><span class="cx">                 }
</span><span class="cx"> 
</span><span class="cx">                 \
embedderToWasmInternalFunction-&gt;entrypoint.compilation = \
std::make_unique&lt;B3::Compilation&gt;( </span><del>-                    \
FINALIZE_CODE(linkBuffer, NoPtrTag, &quot;Embedder-&gt;WebAssembly entrypoint[%i] \
%s&quot;, functionIndex, \
SignatureInformation::get(signatureIndex).toString().ascii().data()), </del><ins>+    \
FINALIZE_CODE(linkBuffer, CodeEntryPtrTag, &quot;Embedder-&gt;WebAssembly \
entrypoint[%i] %s&quot;, functionIndex, signature.toString().ascii().data()), \
</ins><span class="cx">                     \
WTFMove(context.embedderEntrypointByproducts)); </span><span class="cx">             \
} </span><span class="cx">         }
</span><span class="lines">@@ -333,7 +337,10 @@
</span><span class="cx">                     executableAddress = \
m_wasmToWasmExitStubs.at(call.functionIndexSpace).code(); </span><span class="cx">    \
} else </span><span class="cx">                     executableAddress = \
m_wasmInternalFunctions.at(call.functionIndexSpace - \
m_moduleInformation-&gt;importFunctionCount())-&gt;entrypoint.compilation-&gt;code(); \
</span><del>-                MacroAssembler::repatchNearCall(call.callLocation, \
CodeLocationLabel(executableAddress)); </del><ins>+                SignatureIndex \
signatureIndex = m_moduleInformation-&gt;signatureIndexFromFunctionIndexSpace(call.functionIndexSpace);
 +                const Signature&amp; signature = \
SignatureInformation::get(signatureIndex); +                PtrTag oldTag = \
ptrTag(WasmCallPtrTag, signature.hash()); +                \
MacroAssembler::repatchNearCall(call.callLocation, \
CodeLocationLabel(executableAddress.retagged(oldTag, NearCallPtrTag))); </ins><span \
class="cx">             } </span><span class="cx">         }
</span><span class="cx">     }
</span></span></pre></div>
<a id="trunkSourceJavaScriptCorewasmWasmBindingcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/wasm/WasmBinding.cpp \
(230105 => 230106)</h4> <pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/wasm/WasmBinding.cpp	2018-03-30 \
                16:05:22 UTC (rev 230105)
+++ trunk/Source/JavaScriptCore/wasm/WasmBinding.cpp	2018-03-30 16:31:06 UTC (rev \
230106) </span><span class="lines">@@ -37,8 +37,11 @@
</span><span class="cx"> 
</span><span class="cx"> using JIT = CCallHelpers;
</span><span class="cx"> 
</span><del>-Expected&lt;MacroAssemblerCodeRef, BindingFailure&gt; \
wasmToWasm(unsigned importIndex) </del><ins>+Expected&lt;MacroAssemblerCodeRef, \
BindingFailure&gt; wasmToWasm(const Signature&amp; signature, unsigned importIndex) \
</ins><span class="cx"> { </span><ins>+    // FIXME: Consider uniquify the stubs \
based on signature + index to see if this saves memory. +    // \
https://bugs.webkit.org/show_bug.cgi?id=184157 +
</ins><span class="cx">     const PinnedRegisterInfo&amp; pinnedRegs = \
PinnedRegisterInfo::get(); </span><span class="cx">     JIT jit;
</span><span class="cx"> 
</span><span class="lines">@@ -78,13 +81,14 @@
</span><span class="cx">     jit.loadPtr(scratch, scratch);
</span><span class="cx">     if (Options::usePoisoning())
</span><span class="cx">         jit.xorPtr(JIT::TrustedImmPtr(g_JITCodePoison), \
scratch); </span><del>-    jit.jump(scratch, NoPtrTag);
</del><ins>+    PtrTag tag = ptrTag(WasmCallPtrTag, signature.hash());
+    jit.jump(scratch, tag);
</ins><span class="cx"> 
</span><span class="cx">     LinkBuffer patchBuffer(jit, GLOBAL_THUNK_ID, \
JITCompilationCanFail); </span><span class="cx">     if \
(UNLIKELY(patchBuffer.didFailToAllocate())) </span><span class="cx">         return \
makeUnexpected(BindingFailure::OutOfMemory); </span><span class="cx"> 
</span><del>-    return FINALIZE_CODE(patchBuffer, NoPtrTag, \
&quot;WebAssembly-&gt;WebAssembly import[%i]&quot;, importIndex); </del><ins>+    \
return FINALIZE_CODE(patchBuffer, tag, &quot;WebAssembly-&gt;WebAssembly \
import[%i]&quot;, importIndex); </ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> } } // namespace JSC::Wasm
</span></span></pre></div>
<a id="trunkSourceJavaScriptCorewasmWasmBindingh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/wasm/WasmBinding.h \
(230105 => 230106)</h4> <pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/wasm/WasmBinding.h	2018-03-30 \
                16:05:22 UTC (rev 230105)
+++ trunk/Source/JavaScriptCore/wasm/WasmBinding.h	2018-03-30 16:31:06 UTC (rev \
230106) </span><span class="lines">@@ -1,5 +1,5 @@
</span><span class="cx"> /*
</span><del>- * Copyright (C) 2016-2017 Apple Inc. All rights reserved.
</del><ins>+ * Copyright (C) 2016-2018 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">@@ -41,7 +41,7 @@
</span><span class="cx">     OutOfMemory,
</span><span class="cx"> };
</span><span class="cx"> 
</span><del>-Expected&lt;MacroAssemblerCodeRef, BindingFailure&gt; \
wasmToWasm(unsigned importIndex); </del><ins>+Expected&lt;MacroAssemblerCodeRef, \
BindingFailure&gt; wasmToWasm(const Signature&amp;, unsigned importIndex); \
</ins><span class="cx">  </span><span class="cx"> } } // namespace JSC::Wasm
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceJavaScriptCorewasmWasmFaultSignalHandlercpp"></a>
<div class="modfile"><h4>Modified: \
trunk/Source/JavaScriptCore/wasm/WasmFaultSignalHandler.cpp (230105 => 230106)</h4> \
<pre class="diff"><span> <span class="info">--- \
trunk/Source/JavaScriptCore/wasm/WasmFaultSignalHandler.cpp	2018-03-30 16:05:22 UTC \
                (rev 230105)
+++ trunk/Source/JavaScriptCore/wasm/WasmFaultSignalHandler.cpp	2018-03-30 16:31:06 \
UTC (rev 230106) </span><span class="lines">@@ -1,5 +1,5 @@
</span><span class="cx"> /*
</span><del>- * Copyright (C) 2017 Apple Inc. All rights reserved.
</del><ins>+ * Copyright (C) 2017-2018 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">@@ -62,6 +62,7 @@
</span><span class="cx">     dataLogLnIf(WasmFaultSignalHandlerInternal::verbose, \
&quot;JIT memory start: &quot;, \
RawPointer(reinterpret_cast&lt;void*&gt;(startOfFixedExecutableMemoryPool)), &quot; \
end: &quot;, RawPointer(reinterpret_cast&lt;void*&gt;(endOfFixedExecutableMemoryPool)));
 </span><span class="cx">     // First we need to make sure we are in JIT code before \
we can aquire any locks. Otherwise, </span><span class="cx">     // we might have \
crashed in code that is already holding one of the locks we want to aquire. \
</span><ins>+    assertIsNotTagged(faultingInstruction); </ins><span class="cx">     \
if (isJITPC(faultingInstruction)) { </span><span class="cx">         bool \
faultedInActiveFastMemory = false; </span><span class="cx">         {
</span></span></pre></div>
<a id="trunkSourceJavaScriptCorewasmWasmOMGPlancpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/wasm/WasmOMGPlan.cpp \
(230105 => 230106)</h4> <pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/wasm/WasmOMGPlan.cpp	2018-03-30 \
                16:05:22 UTC (rev 230105)
+++ trunk/Source/JavaScriptCore/wasm/WasmOMGPlan.cpp	2018-03-30 16:31:06 UTC (rev \
230106) </span><span class="lines">@@ -97,8 +97,9 @@
</span><span class="cx">         return;
</span><span class="cx">     }
</span><span class="cx"> 
</span><ins>+    PtrTag callTag = ptrTag(WasmCallPtrTag, signature.hash());
</ins><span class="cx">     omgEntrypoint.compilation = \
std::make_unique&lt;B3::Compilation&gt;( </span><del>-        \
FINALIZE_CODE(linkBuffer, NoPtrTag, &quot;WebAssembly OMG function[%i] %s&quot;, \
m_functionIndex, SignatureInformation::get(signatureIndex).toString().ascii().data()),
 </del><ins>+        FINALIZE_CODE(linkBuffer, callTag, &quot;WebAssembly OMG \
function[%i] %s&quot;, m_functionIndex, signature.toString().ascii().data()), \
</ins><span class="cx">         WTFMove(context.wasmEntrypointByproducts)); \
</span><span class="cx">  </span><span class="cx">     \
omgEntrypoint.calleeSaveRegisters = \
WTFMove(parseAndCompileResult.value()-&gt;entrypoint.calleeSaveRegisters); \
</span><span class="lines">@@ -125,7 +126,10 @@ </span><span class="cx">             \
else </span><span class="cx">                 entrypoint = \
m_codeBlock-&gt;wasmEntrypointCalleeFromFunctionIndexSpace(call.functionIndexSpace).entrypoint();
 </span><span class="cx"> 
</span><del>-            MacroAssembler::repatchNearCall(call.callLocation, \
CodeLocationLabel(entrypoint)); </del><ins>+            SignatureIndex signatureIndex \
= m_moduleInformation-&gt;signatureIndexFromFunctionIndexSpace(call.functionIndexSpace);
 +            const Signature&amp; signature = \
SignatureInformation::get(signatureIndex); +            PtrTag oldTag = \
ptrTag(WasmCallPtrTag, signature.hash()); +            \
MacroAssembler::repatchNearCall(call.callLocation, \
CodeLocationLabel(entrypoint.retagged(oldTag, NearCallPtrTag))); </ins><span \
class="cx">         } </span><span class="cx">         unlinkedCalls = \
std::exchange(m_codeBlock-&gt;m_wasmToWasmCallsites[m_functionIndex], unlinkedCalls); \
</span><span class="cx">     } </span><span class="lines">@@ -145,7 +149,10 @@
</span><span class="cx">                 dataLogLnIf(WasmOMGPlanInternal::verbose, \
&quot;Considering repatching call at: &quot;, \
RawPointer(call.callLocation.dataLocation()), &quot; that targets &quot;, \
call.functionIndexSpace); </span><span class="cx">                 if \
(call.functionIndexSpace == functionIndexSpace) { </span><span class="cx">            \
dataLogLnIf(WasmOMGPlanInternal::verbose, &quot;Repatching call at: &quot;, \
RawPointer(call.callLocation.dataLocation()), &quot; to &quot;, \
RawPointer(entrypoint.executableAddress())); </span><del>-                    \
MacroAssembler::repatchNearCall(call.callLocation, CodeLocationLabel(entrypoint)); \
</del><ins>+                    SignatureIndex signatureIndex = \
m_moduleInformation-&gt;signatureIndexFromFunctionIndexSpace(call.functionIndexSpace);
 +                    const Signature&amp; signature = \
SignatureInformation::get(signatureIndex); +                    PtrTag oldTag = \
ptrTag(WasmCallPtrTag, signature.hash()); +                    \
MacroAssembler::repatchNearCall(call.callLocation, \
CodeLocationLabel(entrypoint.retagged(oldTag, NearCallPtrTag))); </ins><span \
class="cx">                 } </span><span class="cx">             }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceJavaScriptCorewasmWasmThunkscpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/wasm/WasmThunks.cpp \
(230105 => 230106)</h4> <pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/wasm/WasmThunks.cpp	2018-03-30 \
                16:05:22 UTC (rev 230105)
+++ trunk/Source/JavaScriptCore/wasm/WasmThunks.cpp	2018-03-30 16:31:06 UTC (rev \
230106) </span><span class="lines">@@ -51,15 +51,17 @@
</span><span class="cx">     \
jit.loadPtr(CCallHelpers::Address(GPRInfo::argumentGPR0), GPRInfo::argumentGPR0); \
</span><span class="cx">     \
jit.copyCalleeSavesToEntryFrameCalleeSavesBuffer(GPRInfo::argumentGPR0); </span><span \
class="cx">     jit.move(GPRInfo::callFrameRegister, GPRInfo::argumentGPR0); \
                </span><del>-    CCallHelpers::Call call = jit.call(NoPtrTag);
-    jit.jump(GPRInfo::returnValueGPR, NoPtrTag);
</del><ins>+
+    PtrTag tag = ptrTag(WasmHelperPtrTag, nextPtrTagID());
+    CCallHelpers::Call call = jit.call(tag);
+    jit.jump(GPRInfo::returnValueGPR, ExceptionHandlerPtrTag);
</ins><span class="cx">     jit.breakpoint(); // We should not reach this.
</span><span class="cx"> 
</span><span class="cx">     ThrowWasmException throwWasmException = \
Thunks::singleton().throwWasmException(); </span><span class="cx">     \
RELEASE_ASSERT(throwWasmException); </span><span class="cx">     LinkBuffer \
linkBuffer(jit, GLOBAL_THUNK_ID); </span><del>-    linkBuffer.link(call, \
                FunctionPtr(throwWasmException));
-    return FINALIZE_CODE(linkBuffer, NoPtrTag, &quot;Throw exception from \
Wasm&quot;); </del><ins>+    linkBuffer.link(call, FunctionPtr(throwWasmException, \
tag)); +    return FINALIZE_CODE(linkBuffer, NearCallPtrTag, &quot;Throw exception \
from Wasm&quot;); </ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> MacroAssemblerCodeRef \
throwStackOverflowFromWasmThunkGenerator(const AbstractLocker&amp; locker) \
</span><span class="lines">@@ -73,7 +75,7 @@ </span><span class="cx">     auto \
jumpToExceptionHandler = jit.jump(); </span><span class="cx">     LinkBuffer \
linkBuffer(jit, GLOBAL_THUNK_ID); </span><span class="cx">     \
linkBuffer.link(jumpToExceptionHandler, \
CodeLocationLabel(Thunks::singleton().stub(locker, \
throwExceptionFromWasmThunkGenerator).code())); </span><del>-    return \
FINALIZE_CODE(linkBuffer, NoPtrTag, &quot;Throw stack overflow from Wasm&quot;); \
</del><ins>+    return FINALIZE_CODE(linkBuffer, NearJumpPtrTag, &quot;Throw stack \
overflow from Wasm&quot;); </ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> MacroAssemblerCodeRef triggerOMGTierUpThunkGenerator(const \
AbstractLocker&amp;) </span><span class="lines">@@ -91,8 +93,9 @@
</span><span class="cx">     jit.loadWasmContextInstance(GPRInfo::argumentGPR0);
</span><span class="cx">     typedef void (*Run)(Instance*, uint32_t);
</span><span class="cx">     Run run = OMGPlan::runForIndex;
</span><del>-    jit.move(MacroAssembler::TrustedImmPtr(reinterpret_cast&lt;void*&gt;(run)), \
                GPRInfo::argumentGPR2);
-    jit.call(GPRInfo::argumentGPR2, NoPtrTag);
</del><ins>+    PtrTag tag = ptrTag(WasmHelperPtrTag, nextPtrTagID());
+    jit.move(MacroAssembler::TrustedImmPtr(tagCFunctionPtr(run, tag)), \
GPRInfo::argumentGPR2); +    jit.call(GPRInfo::argumentGPR2, tag);
</ins><span class="cx"> 
</span><span class="cx">     \
ScratchRegisterAllocator::restoreRegistersFromStackForCall(jit, registersToSpill, \
RegisterSet(), numberOfStackBytesUsedForRegisterPreservation, extraPaddingBytes); \
</span><span class="cx">  </span><span class="lines">@@ -99,7 +102,7 @@
</span><span class="cx">     jit.emitFunctionEpilogue();
</span><span class="cx">     jit.ret();
</span><span class="cx">     LinkBuffer linkBuffer(jit, GLOBAL_THUNK_ID);
</span><del>-    return FINALIZE_CODE(linkBuffer, NoPtrTag, &quot;Trigger OMG tier \
up&quot;); </del><ins>+    return FINALIZE_CODE(linkBuffer, NearCallPtrTag, \
&quot;Trigger OMG tier up&quot;); </ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> static Thunks* thunks;
</span></span></pre></div>
<a id="trunkSourceJavaScriptCorewasmjsWasmToJScpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/wasm/js/WasmToJS.cpp \
(230105 => 230106)</h4> <pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/wasm/js/WasmToJS.cpp	2018-03-30 \
                16:05:22 UTC (rev 230105)
+++ trunk/Source/JavaScriptCore/wasm/js/WasmToJS.cpp	2018-03-30 16:31:06 UTC (rev \
230106) </span><span class="lines">@@ -93,7 +93,8 @@
</span><span class="cx">         // Let's be paranoid on the exception path and zero \
out the poison instead of leaving it in an argument GPR. </span><span class="cx">     \
jit.move(CCallHelpers::TrustedImm32(0), GPRInfo::argumentGPR3); </span><span \
class="cx">  </span><del>-        auto call = jit.call(NoPtrTag);
</del><ins>+        PtrTag callTag = ptrTag(WasmHelperPtrTag, nextPtrTagID());
+        auto call = jit.call(callTag);
</ins><span class="cx">         jit.jumpToExceptionHandler(*vm);
</span><span class="cx"> 
</span><span class="cx">         void (*throwBadI64)(ExecState*, \
JSWebAssemblyInstance*) = [] (ExecState* exec, JSWebAssemblyInstance* instance) -&gt; \
void { </span><span class="lines">@@ -115,8 +116,9 @@
</span><span class="cx">         if (UNLIKELY(linkBuffer.didFailToAllocate()))
</span><span class="cx">             return \
makeUnexpected(BindingFailure::OutOfMemory); </span><span class="cx"> 
</span><del>-        linkBuffer.link(call, throwBadI64);
-        return FINALIZE_CODE(linkBuffer, NoPtrTag, &quot;WebAssembly-&gt;JavaScript \
invalid i64 use in import[%i]&quot;, importIndex); </del><ins>+        \
linkBuffer.link(call, FunctionPtr(throwBadI64, callTag)); +        PtrTag tag = \
ptrTag(WasmCallPtrTag, signature.hash()); +        return FINALIZE_CODE(linkBuffer, \
tag, &quot;WebAssembly-&gt;JavaScript invalid i64 use in import[%i]&quot;, \
importIndex); </ins><span class="cx">     }
</span><span class="cx">     
</span><span class="cx">     return MacroAssemblerCodeRef();
</span><span class="lines">@@ -300,9 +302,12 @@
</span><span class="cx">         // Let's be paranoid before the call and zero out \
the poison instead of leaving it in an argument GPR. </span><span class="cx">         \
jit.move(CCallHelpers::TrustedImm32(0), GPRInfo::argumentGPR3); </span><span \
class="cx">  </span><ins>+        PtrTag callTag = ptrTag(WasmHelperPtrTag, \
nextPtrTagID()); +        PtrTag doUnwindingTag = ptrTag(WasmHelperPtrTag, \
nextPtrTagID()); +
</ins><span class="cx">         static_assert(GPRInfo::numberOfArgumentRegisters \
&gt;= 4, &quot;We rely on this with the call below.&quot;); </span><span class="cx">  \
jit.setupArguments&lt;decltype(callFunc)&gt;(GPRInfo::argumentGPR1, \
CCallHelpers::TrustedImm32(signatureIndex), CCallHelpers::TrustedImmPtr(buffer)); \
</span><del>-        auto call = jit.call(NoPtrTag); </del><ins>+        auto call = \
jit.call(callTag); </ins><span class="cx">         auto noException = \
jit.emitExceptionCheck(*vm, AssemblyHelpers::InvertedExceptionCheck); </span><span \
class="cx">  </span><span class="cx">         // Exception here.
</span><span class="lines">@@ -314,7 +319,7 @@
</span><span class="cx">             genericUnwind(vm, exec);
</span><span class="cx">             ASSERT(!!vm-&gt;callFrameForCatch);
</span><span class="cx">         };
</span><del>-        auto exceptionCall = jit.call(NoPtrTag);
</del><ins>+        auto exceptionCall = jit.call(doUnwindingTag);
</ins><span class="cx">         jit.jumpToExceptionHandler(*vm);
</span><span class="cx"> 
</span><span class="cx">         noException.link(&amp;jit);
</span><span class="lines">@@ -339,10 +344,11 @@
</span><span class="cx">         if (UNLIKELY(linkBuffer.didFailToAllocate()))
</span><span class="cx">             return \
makeUnexpected(BindingFailure::OutOfMemory); </span><span class="cx"> 
</span><del>-        linkBuffer.link(call, callFunc);
-        linkBuffer.link(exceptionCall, doUnwinding);
</del><ins>+        linkBuffer.link(call, FunctionPtr(callFunc, callTag));
+        linkBuffer.link(exceptionCall, FunctionPtr(doUnwinding, doUnwindingTag));
</ins><span class="cx"> 
</span><del>-        return FINALIZE_CODE(linkBuffer, NoPtrTag, \
&quot;WebAssembly-&gt;JavaScript import[%i] %s&quot;, importIndex, \
signature.toString().ascii().data()); </del><ins>+        PtrTag tag = \
ptrTag(WasmCallPtrTag, signature.hash()); +        return FINALIZE_CODE(linkBuffer, \
tag, &quot;WebAssembly-&gt;JavaScript import[%i] %s&quot;, importIndex, \
signature.toString().ascii().data()); </ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     // Note: We don't need to perform a stack check here \
since WasmB3IRGenerator </span><span class="lines">@@ -544,13 +550,14 @@
</span><span class="cx">         jit.zeroExtend32ToPtr(GPRInfo::returnValueGPR, \
GPRInfo::returnValueGPR); </span><span class="cx">         done.append(jit.jump());
</span><span class="cx"> 
</span><ins>+        PtrTag tag = ptrTag(WasmHelperPtrTag, nextPtrTagID());
</ins><span class="cx">         slowPath.link(&amp;jit);
</span><span class="cx">         \
jit.setupArguments&lt;decltype(convertToI32)&gt;(GPRInfo::returnValueGPR); \
</span><del>-        auto call = jit.call(NoPtrTag); </del><ins>+        auto call = \
jit.call(tag); </ins><span class="cx">         \
exceptionChecks.append(jit.emitJumpIfException(*vm)); </span><span class="cx"> 
</span><span class="cx">         jit.addLinkTask([=] (LinkBuffer&amp; linkBuffer) {
</span><del>-            linkBuffer.link(call, convertToI32);
</del><ins>+            linkBuffer.link(call, FunctionPtr(convertToI32, tag));
</ins><span class="cx">         });
</span><span class="cx"> 
</span><span class="cx">         done.link(&amp;jit);
</span><span class="lines">@@ -579,13 +586,14 @@
</span><span class="cx">         jit.convertDoubleToFloat(FPRInfo::returnValueFPR, \
FPRInfo::returnValueFPR); </span><span class="cx">         done.append(jit.jump());
</span><span class="cx"> 
</span><ins>+        PtrTag tag = ptrTag(WasmHelperPtrTag, nextPtrTagID());
</ins><span class="cx">         notANumber.link(&amp;jit);
</span><span class="cx">         \
jit.setupArguments&lt;decltype(convertToF32)&gt;(GPRInfo::returnValueGPR); \
</span><del>-        auto call = jit.call(NoPtrTag); </del><ins>+        auto call = \
jit.call(tag); </ins><span class="cx">         \
exceptionChecks.append(jit.emitJumpIfException(*vm)); </span><span class="cx"> 
</span><span class="cx">         jit.addLinkTask([=] (LinkBuffer&amp; linkBuffer) {
</span><del>-            linkBuffer.link(call, convertToF32);
</del><ins>+            linkBuffer.link(call, FunctionPtr(convertToF32, tag));
</ins><span class="cx">         });
</span><span class="cx"> 
</span><span class="cx">         done.link(&amp;jit);
</span><span class="lines">@@ -613,13 +621,14 @@
</span><span class="cx">         jit.move64ToDouble(GPRInfo::returnValueGPR, \
FPRInfo::returnValueFPR); </span><span class="cx">         done.append(jit.jump());
</span><span class="cx"> 
</span><ins>+        PtrTag tag = ptrTag(WasmHelperPtrTag, nextPtrTagID());
</ins><span class="cx">         notANumber.link(&amp;jit);
</span><span class="cx">         \
jit.setupArguments&lt;decltype(convertToF64)&gt;(GPRInfo::returnValueGPR); \
</span><del>-        auto call = jit.call(NoPtrTag); </del><ins>+        auto call = \
jit.call(tag); </ins><span class="cx">         \
exceptionChecks.append(jit.emitJumpIfException(*vm)); </span><span class="cx"> 
</span><span class="cx">         jit.addLinkTask([=] (LinkBuffer&amp; linkBuffer) {
</span><del>-            linkBuffer.link(call, convertToF64);
</del><ins>+            linkBuffer.link(call, FunctionPtr(convertToF64, tag));
</ins><span class="cx">         });
</span><span class="cx"> 
</span><span class="cx">         done.link(&amp;jit);
</span><span class="lines">@@ -631,10 +640,11 @@
</span><span class="cx">     jit.ret();
</span><span class="cx"> 
</span><span class="cx">     if (!exceptionChecks.empty()) {
</span><ins>+        PtrTag tag = ptrTag(WasmHelperPtrTag, nextPtrTagID());
</ins><span class="cx">         exceptionChecks.link(&amp;jit);
</span><span class="cx">         \
jit.copyCalleeSavesToEntryFrameCalleeSavesBuffer(vm-&gt;topEntryFrame); </span><span \
class="cx">         jit.move(GPRInfo::callFrameRegister, GPRInfo::argumentGPR0); \
</span><del>-        auto call = jit.call(NoPtrTag); </del><ins>+        auto call = \
jit.call(tag); </ins><span class="cx">         jit.jumpToExceptionHandler(*vm);
</span><span class="cx"> 
</span><span class="cx">         void (*doUnwinding)(ExecState*) = [] (ExecState* \
exec) -&gt; void { </span><span class="lines">@@ -645,7 +655,7 @@
</span><span class="cx">         };
</span><span class="cx"> 
</span><span class="cx">         jit.addLinkTask([=] (LinkBuffer&amp; linkBuffer) {
</span><del>-            linkBuffer.link(call, doUnwinding);
</del><ins>+            linkBuffer.link(call, FunctionPtr(doUnwinding, tag));
</ins><span class="cx">         });
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="lines">@@ -659,7 +669,8 @@
</span><span class="cx">     CodeLocationNearCall hotPathOther = \
patchBuffer.locationOfNearCall(fastCall); </span><span class="cx">     \
callLinkInfo-&gt;setCallLocations(callReturnLocation, hotPathBegin, hotPathOther); \
</span><span class="cx">  </span><del>-    return FINALIZE_CODE(patchBuffer, \
NoPtrTag, &quot;WebAssembly-&gt;JavaScript import[%i] %s&quot;, importIndex, \
signature.toString().ascii().data()); </del><ins>+    PtrTag tag = \
ptrTag(WasmCallPtrTag, signature.hash()); +    return FINALIZE_CODE(patchBuffer, tag, \
&quot;WebAssembly-&gt;JavaScript import[%i] %s&quot;, importIndex, \
signature.toString().ascii().data()); </ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void* wasmToJSException(ExecState* exec, Wasm::ExceptionType \
type, Instance* wasmInstance) </span></span></pre></div>
<a id="trunkSourceJavaScriptCorewasmjsWebAssemblyFunctioncpp"></a>
<div class="modfile"><h4>Modified: \
trunk/Source/JavaScriptCore/wasm/js/WebAssemblyFunction.cpp (230105 => 230106)</h4> \
<pre class="diff"><span> <span class="info">--- \
trunk/Source/JavaScriptCore/wasm/js/WebAssemblyFunction.cpp	2018-03-30 16:05:22 UTC \
                (rev 230105)
+++ trunk/Source/JavaScriptCore/wasm/js/WebAssemblyFunction.cpp	2018-03-30 16:31:06 \
UTC (rev 230106) </span><span class="lines">@@ -141,7 +141,7 @@
</span><span class="cx">     vm.wasmContext.store(wasmInstance, vm.softStackLimit());
</span><span class="cx">     ASSERT(wasmFunction-&gt;instance());
</span><span class="cx">     ASSERT(&amp;wasmFunction-&gt;instance()-&gt;instance() \
== vm.wasmContext.load()); </span><del>-    EncodedJSValue rawResult = \
vmEntryToWasm(wasmFunction-&gt;jsEntrypoint().executableAddress(), &amp;vm, \
&amp;protoCallFrame); </del><ins>+    EncodedJSValue rawResult = \
vmEntryToWasm(wasmFunction-&gt;jsEntrypoint(MustCheckArity).executableAddress(), \
&amp;vm, &amp;protoCallFrame); </ins><span class="cx">     // We need to make sure \
this is in a register or on the stack since it's stored in Vector&lt;JSValue&gt;. \
</span><span class="cx">     // This probably isn't strictly necessary, since the \
WebAssemblyFunction* should keep the instance </span><span class="cx">     // alive. \
But it's good hygiene. </span></span></pre></div>
<a id="trunkSourceJavaScriptCorewasmjsWebAssemblyFunctionh"></a>
<div class="modfile"><h4>Modified: \
trunk/Source/JavaScriptCore/wasm/js/WebAssemblyFunction.h (230105 => 230106)</h4> \
<pre class="diff"><span> <span class="info">--- \
trunk/Source/JavaScriptCore/wasm/js/WebAssemblyFunction.h	2018-03-30 16:05:22 UTC \
                (rev 230105)
+++ trunk/Source/JavaScriptCore/wasm/js/WebAssemblyFunction.h	2018-03-30 16:31:06 UTC \
(rev 230106) </span><span class="lines">@@ -64,7 +64,13 @@
</span><span class="cx">     WasmToWasmImportableFunction::LoadLocation \
entrypointLoadLocation() const { return m_importableFunction.entrypointLoadLocation; \
} </span><span class="cx">     WasmToWasmImportableFunction importableFunction() \
const { return m_importableFunction; } </span><span class="cx"> 
</span><del>-    MacroAssemblerCodePtr jsEntrypoint() { return m_jsEntrypoint; }
</del><ins>+    MacroAssemblerCodePtr jsEntrypoint(ArityCheckMode arity)
+    {
+        if (arity == ArityCheckNotRequired)
+            return m_jsEntrypoint;
+        ASSERT(arity == MustCheckArity);
+        return m_jsEntrypoint.retagged(CodeEntryPtrTag, \
CodeEntryWithArityCheckPtrTag); +    }
</ins><span class="cx"> 
</span><span class="cx">     static ptrdiff_t offsetOfEntrypointLoadLocation() { \
return OBJECT_OFFSETOF(WebAssemblyFunction, m_importableFunction) + \
WasmToWasmImportableFunction::offsetOfEntrypointLoadLocation(); } </span><span \
class="cx">  </span></span></pre>
</div>
</div>

</body>
</html>



_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic