<!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>[206739] trunk</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/206739">206739</a></dd>
<dt>Author</dt> <dd>fpizlo@apple.com</dd>
<dt>Date</dt> <dd>2016-10-03 11:36:55 -0700 (Mon, 03 Oct 2016)</dd>
</dl>

<h3>Log Message</h3>
<pre>B3 trapping memory accesses should be documented
https://bugs.webkit.org/show_bug.cgi?id=162845

Reviewed by Geoffrey Garen.
        
Source/JavaScriptCore:

While writing some documentation, I found some small holes in the code.

* b3/B3Effects.cpp:
(JSC::B3::Effects::operator==): Need this to write tests.
(JSC::B3::Effects::operator!=): Need this to write tests.
* b3/B3Effects.h:
* b3/B3HeapRange.h:
* b3/B3MemoryValue.cpp:
(JSC::B3::MemoryValue::dumpMeta): Sometimes the heap range dump won't show you the memory value's actual range. This makes the dump show you the actual range in that case.
* b3/B3Value.cpp:
(JSC::B3::Value::effects): While documenting this, I remembered that trapping also has to imply reading top. I fixed this.
* b3/testb3.cpp:
(JSC::B3::testTrappingLoad): Added checks for the effects of trapping loads.
(JSC::B3::testTrappingStore): Added checks for the effects of trapping stores.
(JSC::B3::testMoveConstants): Made this not crash with validation.

Websites/webkit.org:

Added documentation for the Traps flag, and factored out the documentation of the Chill flag
to a new flags section.

* docs/b3/intermediate-representation.html:</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceJavaScriptCoreChangeLog">trunk/Source/JavaScriptCore/ChangeLog</a></li>
<li><a href="#trunkSourceJavaScriptCoreb3B3Effectscpp">trunk/Source/JavaScriptCore/b3/B3Effects.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCoreb3B3Effectsh">trunk/Source/JavaScriptCore/b3/B3Effects.h</a></li>
<li><a href="#trunkSourceJavaScriptCoreb3B3HeapRangeh">trunk/Source/JavaScriptCore/b3/B3HeapRange.h</a></li>
<li><a href="#trunkSourceJavaScriptCoreb3B3MemoryValuecpp">trunk/Source/JavaScriptCore/b3/B3MemoryValue.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCoreb3B3Valuecpp">trunk/Source/JavaScriptCore/b3/B3Value.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCoreb3testb3cpp">trunk/Source/JavaScriptCore/b3/testb3.cpp</a></li>
<li><a href="#trunkWebsiteswebkitorgChangeLog">trunk/Websites/webkit.org/ChangeLog</a></li>
<li><a href="#trunkWebsiteswebkitorgdocsb3intermediaterepresentationhtml">trunk/Websites/webkit.org/docs/b3/intermediate-representation.html</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceJavaScriptCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/ChangeLog (206738 => 206739)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/ChangeLog        2016-10-03 18:36:12 UTC (rev 206738)
+++ trunk/Source/JavaScriptCore/ChangeLog        2016-10-03 18:36:55 UTC (rev 206739)
</span><span class="lines">@@ -1,3 +1,26 @@
</span><ins>+2016-10-03  Filip Pizlo  &lt;fpizlo@apple.com&gt;
+
+        B3 trapping memory accesses should be documented
+        https://bugs.webkit.org/show_bug.cgi?id=162845
+
+        Reviewed by Geoffrey Garen.
+        
+        While writing some documentation, I found some small holes in the code.
+
+        * b3/B3Effects.cpp:
+        (JSC::B3::Effects::operator==): Need this to write tests.
+        (JSC::B3::Effects::operator!=): Need this to write tests.
+        * b3/B3Effects.h:
+        * b3/B3HeapRange.h:
+        * b3/B3MemoryValue.cpp:
+        (JSC::B3::MemoryValue::dumpMeta): Sometimes the heap range dump won't show you the memory value's actual range. This makes the dump show you the actual range in that case.
+        * b3/B3Value.cpp:
+        (JSC::B3::Value::effects): While documenting this, I remembered that trapping also has to imply reading top. I fixed this.
+        * b3/testb3.cpp:
+        (JSC::B3::testTrappingLoad): Added checks for the effects of trapping loads.
+        (JSC::B3::testTrappingStore): Added checks for the effects of trapping stores.
+        (JSC::B3::testMoveConstants): Made this not crash with validation.
+
</ins><span class="cx"> 2016-10-03  Yusuke Suzuki  &lt;utatane.tea@gmail.com&gt;
</span><span class="cx"> 
</span><span class="cx">         [ES6] GeneratorFunction (a.k.a. GeneratorWrapperFunction)'s prototype object does not have constructor property
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreb3B3Effectscpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/b3/B3Effects.cpp (206738 => 206739)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/b3/B3Effects.cpp        2016-10-03 18:36:12 UTC (rev 206738)
+++ trunk/Source/JavaScriptCore/b3/B3Effects.cpp        2016-10-03 18:36:55 UTC (rev 206739)
</span><span class="lines">@@ -1,5 +1,5 @@
</span><span class="cx"> /*
</span><del>- * Copyright (C) 2015 Apple Inc. All rights reserved.
</del><ins>+ * Copyright (C) 2015-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">@@ -76,6 +76,22 @@
</span><span class="cx">         || reads.overlaps(other.writes);
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+bool Effects::operator==(const Effects&amp; other) const
+{
+    return terminal == other.terminal
+        &amp;&amp; exitsSideways == other.exitsSideways
+        &amp;&amp; controlDependent == other.controlDependent
+        &amp;&amp; writesLocalState == other.writesLocalState
+        &amp;&amp; readsLocalState == other.readsLocalState
+        &amp;&amp; writes == other.writes
+        &amp;&amp; reads == other.reads;
+}
+
+bool Effects::operator!=(const Effects&amp; other) const
+{
+    return !(*this == other);
+}
+
</ins><span class="cx"> void Effects::dump(PrintStream&amp; out) const
</span><span class="cx"> {
</span><span class="cx">     CommaPrinter comma(&quot;|&quot;);
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreb3B3Effectsh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/b3/B3Effects.h (206738 => 206739)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/b3/B3Effects.h        2016-10-03 18:36:12 UTC (rev 206738)
+++ trunk/Source/JavaScriptCore/b3/B3Effects.h        2016-10-03 18:36:55 UTC (rev 206739)
</span><span class="lines">@@ -86,8 +86,11 @@
</span><span class="cx">     // Returns true if reordering instructions with these respective effects would change program
</span><span class="cx">     // behavior in an observable way.
</span><span class="cx">     bool interferes(const Effects&amp;) const;
</span><ins>+    
+    JS_EXPORT_PRIVATE bool operator==(const Effects&amp;) const;
+    JS_EXPORT_PRIVATE bool operator!=(const Effects&amp;) const;
</ins><span class="cx"> 
</span><del>-    void dump(PrintStream&amp; out) const;
</del><ins>+    JS_EXPORT_PRIVATE void dump(PrintStream&amp; out) const;
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> } } // namespace JSC::B3
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreb3B3HeapRangeh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/b3/B3HeapRange.h (206738 => 206739)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/b3/B3HeapRange.h        2016-10-03 18:36:12 UTC (rev 206738)
+++ trunk/Source/JavaScriptCore/b3/B3HeapRange.h        2016-10-03 18:36:55 UTC (rev 206739)
</span><span class="lines">@@ -98,7 +98,7 @@
</span><span class="cx">         return WTF::rangesOverlap(m_begin, m_end, other.m_begin, other.m_end);
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    void dump(PrintStream&amp; out) const;
</del><ins>+    JS_EXPORT_PRIVATE void dump(PrintStream&amp; out) const;
</ins><span class="cx"> 
</span><span class="cx"> private:
</span><span class="cx">     unsigned m_begin;
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreb3B3MemoryValuecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/b3/B3MemoryValue.cpp (206738 => 206739)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/b3/B3MemoryValue.cpp        2016-10-03 18:36:12 UTC (rev 206738)
+++ trunk/Source/JavaScriptCore/b3/B3MemoryValue.cpp        2016-10-03 18:36:55 UTC (rev 206739)
</span><span class="lines">@@ -59,6 +59,9 @@
</span><span class="cx"> {
</span><span class="cx">     if (m_offset)
</span><span class="cx">         out.print(comma, &quot;offset = &quot;, m_offset);
</span><ins>+    if ((isLoad() &amp;&amp; effects().reads != range())
+        || (isStore() &amp;&amp; effects().writes != range()))
+        out.print(comma, &quot;range = &quot;, range());
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> Value* MemoryValue::cloneImpl() const
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreb3B3Valuecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/b3/B3Value.cpp (206738 => 206739)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/b3/B3Value.cpp        2016-10-03 18:36:12 UTC (rev 206738)
+++ trunk/Source/JavaScriptCore/b3/B3Value.cpp        2016-10-03 18:36:55 UTC (rev 206739)
</span><span class="lines">@@ -635,7 +635,10 @@
</span><span class="cx">         result.terminal = true;
</span><span class="cx">         break;
</span><span class="cx">     }
</span><del>-    result.exitsSideways |= traps();
</del><ins>+    if (traps()) {
+        result.exitsSideways = true;
+        result.reads = HeapRange::top();
+    }
</ins><span class="cx">     return result;
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreb3testb3cpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/b3/testb3.cpp (206738 => 206739)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/b3/testb3.cpp        2016-10-03 18:36:12 UTC (rev 206738)
+++ trunk/Source/JavaScriptCore/b3/testb3.cpp        2016-10-03 18:36:55 UTC (rev 206739)
</span><span class="lines">@@ -13113,11 +13113,19 @@
</span><span class="cx">     Procedure proc;
</span><span class="cx">     BasicBlock* root = proc.addBlock();
</span><span class="cx">     int x = 42;
</span><del>-    root-&gt;appendNew&lt;Value&gt;(
-        proc, Return, Origin(),
-        root-&gt;appendNew&lt;MemoryValue&gt;(
-            proc, trapping(Load), Int32, Origin(),
-            root-&gt;appendNew&lt;ConstPtrValue&gt;(proc, Origin(), &amp;x)));
</del><ins>+    MemoryValue* value = root-&gt;appendNew&lt;MemoryValue&gt;(
+        proc, trapping(Load), Int32, Origin(),
+        root-&gt;appendNew&lt;ConstPtrValue&gt;(proc, Origin(), &amp;x));
+    Effects expectedEffects;
+    expectedEffects.exitsSideways = true;
+    expectedEffects.controlDependent= true;
+    expectedEffects.reads = HeapRange::top();
+    CHECK_EQ(value-&gt;range(), HeapRange::top());
+    CHECK_EQ(value-&gt;effects(), expectedEffects);
+    value-&gt;setRange(HeapRange(0));
+    CHECK_EQ(value-&gt;range(), HeapRange(0));
+    CHECK_EQ(value-&gt;effects(), expectedEffects); // We still reads top!
+    root-&gt;appendNew&lt;Value&gt;(proc, Return, Origin(), value);
</ins><span class="cx">     CHECK_EQ(compileAndRun&lt;int&gt;(proc), 42);
</span><span class="cx">     unsigned trapsCount = 0;
</span><span class="cx">     for (Air::BasicBlock* block : proc.code()) {
</span><span class="lines">@@ -13134,10 +13142,21 @@
</span><span class="cx">     Procedure proc;
</span><span class="cx">     BasicBlock* root = proc.addBlock();
</span><span class="cx">     int x = 42;
</span><del>-    root-&gt;appendNew&lt;MemoryValue&gt;(
</del><ins>+    MemoryValue* value = root-&gt;appendNew&lt;MemoryValue&gt;(
</ins><span class="cx">         proc, trapping(Store), Origin(),
</span><span class="cx">         root-&gt;appendNew&lt;Const32Value&gt;(proc, Origin(), 111),
</span><span class="cx">         root-&gt;appendNew&lt;ConstPtrValue&gt;(proc, Origin(), &amp;x));
</span><ins>+    Effects expectedEffects;
+    expectedEffects.exitsSideways = true;
+    expectedEffects.controlDependent= true;
+    expectedEffects.reads = HeapRange::top();
+    expectedEffects.writes = HeapRange::top();
+    CHECK_EQ(value-&gt;range(), HeapRange::top());
+    CHECK_EQ(value-&gt;effects(), expectedEffects);
+    value-&gt;setRange(HeapRange(0));
+    CHECK_EQ(value-&gt;range(), HeapRange(0));
+    expectedEffects.writes = HeapRange(0);
+    CHECK_EQ(value-&gt;effects(), expectedEffects); // We still reads top!
</ins><span class="cx">     root-&gt;appendNew&lt;Value&gt;(proc, Return, Origin());
</span><span class="cx">     compileAndRun&lt;int&gt;(proc);
</span><span class="cx">     CHECK_EQ(x, 111);
</span><span class="lines">@@ -13258,10 +13277,10 @@
</span><span class="cx">         Procedure proc;
</span><span class="cx">         BasicBlock* root = proc.addBlock();
</span><span class="cx">         Value* a = root-&gt;appendNew&lt;MemoryValue&gt;(
</span><del>-            proc, Load, Int32, Origin(), 
</del><ins>+            proc, Load, pointerType(), Origin(), 
</ins><span class="cx">             root-&gt;appendNew&lt;ConstPtrValue&gt;(proc, Origin(), 0x123412341234));
</span><span class="cx">         Value* b = root-&gt;appendNew&lt;MemoryValue&gt;(
</span><del>-            proc, Load, Int32, Origin(),
</del><ins>+            proc, Load, pointerType(), Origin(),
</ins><span class="cx">             root-&gt;appendNew&lt;ConstPtrValue&gt;(proc, Origin(), 0x123412341334));
</span><span class="cx">         root-&gt;appendNew&lt;CCallValue&gt;(proc, Void, Origin(), a, b);
</span><span class="cx">         root-&gt;appendNew&lt;Value&gt;(proc, Return, Origin());
</span></span></pre></div>
<a id="trunkWebsiteswebkitorgChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Websites/webkit.org/ChangeLog (206738 => 206739)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Websites/webkit.org/ChangeLog        2016-10-03 18:36:12 UTC (rev 206738)
+++ trunk/Websites/webkit.org/ChangeLog        2016-10-03 18:36:55 UTC (rev 206739)
</span><span class="lines">@@ -1,3 +1,15 @@
</span><ins>+2016-10-03  Filip Pizlo  &lt;fpizlo@apple.com&gt;
+
+        B3 trapping memory accesses should be documented
+        https://bugs.webkit.org/show_bug.cgi?id=162845
+
+        Reviewed by Geoffrey Garen.
+        
+        Added documentation for the Traps flag, and factored out the documentation of the Chill flag
+        to a new flags section.
+
+        * docs/b3/intermediate-representation.html:
+
</ins><span class="cx"> 2016-09-30  Filip Pizlo  &lt;fpizlo@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Air should have a way of expressing additional instruction flags
</span></span></pre></div>
<a id="trunkWebsiteswebkitorgdocsb3intermediaterepresentationhtml"></a>
<div class="modfile"><h4>Modified: trunk/Websites/webkit.org/docs/b3/intermediate-representation.html (206738 => 206739)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Websites/webkit.org/docs/b3/intermediate-representation.html        2016-10-03 18:36:12 UTC (rev 206738)
+++ trunk/Websites/webkit.org/docs/b3/intermediate-representation.html        2016-10-03 18:36:55 UTC (rev 206739)
</span><span class="lines">@@ -84,7 +84,8 @@
</span><span class="cx">     
</span><span class="cx">     &lt;p&gt;The value kind is a combination of an opcode and optional flags. The flags allow a single
</span><span class="cx">       opcode to have many variants. For example, Div and Mod may have the Chill flag set to indicate
</span><del>-      that they should not trap on corner cases.&lt;/p&gt;
</del><ins>+      that they should not trap on corner cases. Alternatively, Load/Store opcodes may have the
+      Traps flag set to indicate that they should trap deterministically.&lt;/p&gt;
</ins><span class="cx">     
</span><span class="cx">     &lt;p&gt;Values also have a unique 32-bit index that is used as the name.&lt;/p&gt;
</span><span class="cx">     
</span><span class="lines">@@ -162,6 +163,9 @@
</span><span class="cx">       T)&quot;.  This means that the value must take two children of the same type and returns a
</span><span class="cx">       value of that type.  We use the type IntPtr to mean either Int32, or Int64, depending on
</span><span class="cx">       the platform.&lt;/p&gt;
</span><ins>+    
+    &lt;p&gt;Some opcodes can have some flags set. A description of flags follows the description of
+      opcodes.&lt;/p&gt;
</ins><span class="cx"> 
</span><span class="cx">     &lt;h3&gt;Opcode descriptions&lt;/h3&gt;
</span><span class="cx"> 
</span><span class="lines">@@ -236,30 +240,16 @@
</span><span class="cx">         according to the IEEE 854 spec.&lt;/dd&gt;
</span><span class="cx"> 
</span><span class="cx">       &lt;dt&gt;T Div(T, T)&lt;/dt&gt;
</span><del>-      &lt;dd&gt;
-        &lt;p&gt;Works with any type except Void.  For integer types, this represents signed
-          division with round-to-zero.  By default, its behavior is undefined for x/0 or
-          -2&lt;sup&gt;31&lt;/sup&gt;/-1.  For floating point types, this represents division according
-          to the IEEE 854 spec.&lt;/p&gt;
-        &lt;p&gt;Integer Div may have the Chill flag set. You can create a Chill Div by saying
-          &lt;code&gt;chill(Div)&lt;/code&gt; instead of &lt;code&gt;Div&lt;/code&gt;; the former creates a Kind
-          that has Div as the opcode and has the Chill bit set. An operation is said to be
-          chill if it returns a sensible value whenever its non-chill form would have had
-          undefined behavior. Chill Div turns x/0 into 0 and -2&lt;sup&gt;31&lt;/sup&gt;/-1 into
-          -2&lt;sup&gt;31&lt;/sup&gt;. We recognize this in IR because it's exactly the semantics of
-          division on ARM64, and it's also exactly the semantics that JavaScript wants for
-          &quot;(x/y)|0&quot;.&lt;/p&gt;
-      &lt;/dd&gt;
</del><ins>+      &lt;dd&gt;Works with any type except Void.  For integer types, this represents signed
+        division with round-to-zero.  By default, its behavior is undefined for x/0 or
+        -2&lt;sup&gt;31&lt;/sup&gt;/-1.  For floating point types, this represents division according
+        to the IEEE 854 spec. Integer Div may have the Chill flag set.&lt;/dd&gt;
</ins><span class="cx"> 
</span><span class="cx">       &lt;dt&gt;T Mod(T, T)&lt;/dt&gt;
</span><del>-      &lt;dd&gt;
-        &lt;p&gt;Works with any type except Void.  For integer types, this represents signed
-          modulo. By default, its behavior is undefined for x%0 or -2&lt;sup&gt;31&lt;/sup&gt;%-1.  For
-          floating point types, this represents modulo according to &quot;fmod()&quot;.&lt;/p&gt;
-        &lt;p&gt;Integer Mod may have the Chill flag set. You can create a Chill Mod by saying
-          &lt;code&gt;chill(Mod)&lt;/code&gt;. Chill Mod turns x%0 into 0 and -2&lt;sup&gt;31&lt;/sup&gt;%-1 into
-          0.&lt;/p&gt;
-      &lt;/dd&gt;
</del><ins>+      &lt;dd&gt;Works with any type except Void.  For integer types, this represents signed
+        modulo. By default, its behavior is undefined for x%0 or -2&lt;sup&gt;31&lt;/sup&gt;%-1.  For
+        floating point types, this represents modulo according to &quot;fmod()&quot;. Integer Mod may have the
+        Chill flag set.&lt;/dd&gt;
</ins><span class="cx"> 
</span><span class="cx">       &lt;dt&gt;T Neg(T)&lt;/dt&gt;
</span><span class="cx">       &lt;dd&gt;Works with any type except Void.  For integer types, this represents twos-complement
</span><span class="lines">@@ -394,43 +384,45 @@
</span><span class="cx">       &lt;dt&gt;Int32 Load8Z(IntPtr, offset)&lt;/dt&gt;
</span><span class="cx">       &lt;dd&gt;Loads a byte from the address, which is computed by adding the compile-time 32-bit
</span><span class="cx">         signed integer offset to the child value.  Zero extends the loaded byte, so the high 24
</span><del>-        bits are all zero.  Must use the MemoryValue class.&lt;/dd&gt;
</del><ins>+        bits are all zero.  Must use the MemoryValue class.  May have the Traps flag set.&lt;/dd&gt;
</ins><span class="cx"> 
</span><span class="cx">       &lt;dt&gt;Int32 Load8S(IntPtr, offset)&lt;/dt&gt;
</span><span class="cx">       &lt;dd&gt;Loads a byte from the address, which is computed by adding the compile-time 32-bit
</span><span class="cx">         signed integer offset to the child value.  Sign extends the loaded byte.  Must use the
</span><del>-        MemoryValue class.&lt;/dd&gt;
</del><ins>+        MemoryValue class.  May have the Traps flag set.&lt;/dd&gt;
</ins><span class="cx"> 
</span><span class="cx">       &lt;dt&gt;Int32 Load16Z(IntPtr, offset)&lt;/dt&gt;
</span><span class="cx">       &lt;dd&gt;Loads a 16-bit integer from the address, which is computed by adding the compile-time
</span><span class="cx">         32-bit signed integer offset to the child value.  Zero extends the loaded 16-bit
</span><span class="cx">         integer, so the high 16 bits are all zero.  Misaligned loads are not penalized.  Must
</span><del>-        use the MemoryValue class.&lt;/dd&gt;
</del><ins>+        use the MemoryValue class.  May have the Traps flag set.&lt;/dd&gt;
</ins><span class="cx"> 
</span><span class="cx">       &lt;dt&gt;Int32 Load16S(IntPtr, offset)&lt;/dt&gt;
</span><span class="cx">       &lt;dd&gt;Loads a 16-bit integer from the address, which is computed by adding the compile-time
</span><span class="cx">         32-bit signed integer offset to the child value.  Sign extends the loaded 16-bit
</span><del>-        integer.  Misaligned loads are not penalized.  Must use the MemoryValue class.&lt;/dd&gt;
</del><ins>+        integer.  Misaligned loads are not penalized.  Must use the MemoryValue class.  May have the
+        Traps flag set.&lt;/dd&gt;
</ins><span class="cx"> 
</span><span class="cx">       &lt;dt&gt;T Load(IntPtr, offset)&lt;/dt&gt;
</span><span class="cx">       &lt;dd&gt;Valid for any type except Void.  Loads a value of that type from the address, which is
</span><span class="cx">         computed by adding the compile-time 32-bit signed integer offset to the child value.
</span><del>-        Misaligned loads are not penalized.  Must use the MemoryValue class.&lt;/dd&gt;
</del><ins>+        Misaligned loads are not penalized.  Must use the MemoryValue class.  May have the Traps
+        flag set.&lt;/dd&gt;
</ins><span class="cx"> 
</span><span class="cx">       &lt;dt&gt;Void Store8(Int32, IntPtr, offset)&lt;/dt&gt;
</span><span class="cx">       &lt;dd&gt;Stores a the low byte of the first child into the address computed by adding the
</span><span class="cx">         compile-time 32-bit signed integer offset to the second child.  Must use the MemoryValue
</span><del>-        class.&lt;/dd&gt;
</del><ins>+        class.  May have the Traps flag set.&lt;/dd&gt;
</ins><span class="cx"> 
</span><span class="cx">       &lt;dt&gt;Void Store16(Int32, IntPtr, offset)&lt;/dt&gt;
</span><span class="cx">       &lt;dd&gt;Stores a the low 16 bits of the first child into the address computed by adding the
</span><span class="cx">         compile-time 32-bit signed integer offset to the second child.  Misaligned stores are
</span><del>-        not penalized.  Must use the MemoryValue class.&lt;/dd&gt;
</del><ins>+        not penalized.  Must use the MemoryValue class.  May have the Traps flag set.&lt;/dd&gt;
</ins><span class="cx"> 
</span><span class="cx">       &lt;dt&gt;Void Store(T, IntPtr, offset)&lt;/dt&gt;
</span><span class="cx">       &lt;dd&gt;Stores the value in the first child into the address computed by adding the
</span><span class="cx">         compile-time 32-bit signed integer offset to the second child.  Misaligned stores are
</span><del>-        not penalized.  Must use the MemoryValue class.&lt;/dd&gt;
</del><ins>+        not penalized.  Must use the MemoryValue class.  May have the Traps flag set.&lt;/dd&gt;
</ins><span class="cx">       
</span><span class="cx">       &lt;dt&gt;Void Fence()&lt;/dt&gt;
</span><span class="cx">       &lt;dd&gt;Abstracts standalone data fences on x86 and ARM. Must use the FenceValue class, which has
</span><span class="lines">@@ -634,7 +626,46 @@
</span><span class="cx">         at the end of the basic block.  The block must have zero successors. Note that we also use
</span><span class="cx">         the Oops opcode to mean &quot;no such opcode&quot; in some B3 transformations.&lt;/dd&gt;
</span><span class="cx">     &lt;/dl&gt;
</span><del>-
</del><ins>+    
+    &lt;h2&gt;Flags&lt;/h2&gt;
+    
+    &lt;p&gt;This section describes flags. These may be set in
+      &lt;a href=&quot;http://trac.webkit.org/browser/trunk/Source/JavaScriptCore/b3/B3Kind.h&quot;&gt;&lt;code&gt;Kind&lt;/code&gt;&lt;/a&gt;.&lt;/p&gt;
+    
+    &lt;dl&gt;
+      &lt;dt&gt;Chill&lt;/dt&gt;
+      &lt;dd&gt;&lt;i&gt;Applies to: Div, Mod.&lt;/i&gt; You can create a chill Div/Mod by saying
+        &lt;code&gt;chill(Div)&lt;/code&gt;. This creates a Kind that has the Chill flag set. This can only be
+        used with interer types. An operation is said to be chill if it returns a sensible value
+        whenever its non-chill form would have had undefined behavior. Chill Div turns x/0 into 0
+        and -2&lt;sup&gt;31&lt;/sup&gt;/-1 into -2&lt;sup&gt;31&lt;/sup&gt;. We recognize this in IR because it's exactly
+        the semantics of division on ARM64, and it's also exactly the semantics that JavaScript
+        wants for &quot;(x/y)|0&quot;. Chill Mod turns x%0 into 0 and -2&lt;sup&gt;31&lt;/sup&gt;%-1 into 0. This matches
+        the semantics of JavaScript &quot;(x%y)|0&quot;.&lt;/dd&gt;
+      
+      &lt;dt&gt;Traps&lt;/dt&gt;
+      &lt;dd&gt;&lt;i&gt;Applies to: Load8Z, Load8S, Load16Z, Load16S, Load, Store8, Store16, Store.&lt;/i&gt; You can
+        create a trapping Kind from an opcode by saying &lt;code&gt;trapping(opcode)&lt;/code&gt;. For example,
+        &lt;code&gt;trapping(Load)&lt;/code&gt;. An operation is said to be trapping if it will cause a page
+        fault when used on an invalid pointer and this page fault will be observed. This means that
+        the compiler cannot fudge when the page fault happens. This is logically equivalent to what
+        B3 calls &lt;code&gt;Effects::exitsSideways&lt;/code&gt;, but further implies that if any of the B3
+        values used to fuse an Air instruction were trapping, then the Air instruction must have its
+        &lt;code&gt;Air::Kind::traps&lt;/code&gt; flag set. The compiler won't help you identify where you
+        trapped. Even if you use the compiler's origin facility to track down the trap location, you
+        may get the origin of any B3 value that was incorporated into the fused instruction that
+        caused the trap. For example, &quot;Add(Load&amp;lt;Traps&amp;gt;(ptr), $1)&quot; may claim to trap at the Add
+        rather than the Load on x86, because this pattern is a perfect candidate for add-load
+        fusion. Nevertheless, you are guaranteed to get the trap and the trap will be observed at
+        the point you intended. For example, the compiler will not hoist a trapping load past any
+        effects, even those outside of its read range, because the trap is presumed to read top. The
+        compiler will not attempt to DCE a trapping load. The compiler will not attempt to sink or
+        eliminate any trapping stores, even if they are dead because of a guaranteed subsequent
+        store to the same address, because we conservatively assume that the store was done for the
+        trap effect. This feature is meant to support high throughput memory safety checks in
+        WebAssembly.&lt;/dd&gt;
+    &lt;/dl&gt;
+    
</ins><span class="cx">   &lt;/div&gt;
</span><span class="cx"> &lt;/body&gt;
</span><span class="cx"> &lt;/html&gt;
</span></span></pre>
</div>
</div>

</body>
</html>