<!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>[208450] 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/208450">208450</a></dd>
<dt>Author</dt> <dd>utatane.tea@gmail.com</dd>
<dt>Date</dt> <dd>2016-11-09 11:10:42 -0800 (Wed, 09 Nov 2016)</dd>
</dl>

<h3>Log Message</h3>
<pre>[JSC] The implementation of 8 bit operation in MacroAssembler should care about uint8_t / int8_t
https://bugs.webkit.org/show_bug.cgi?id=164432

Reviewed by Michael Saboff.

Source/JavaScriptCore:

Except for X86, our supported MacroAssemblers do not have native 8bit instructions.
It means that all the 8bit instructions are converted to 32bit operations by using
scratch registers. For example, ARM64 branch8 implementation is the following.

    Jump branch8(RelationCondition cord, Address left, TrustedImm32 right)
    {
        TrustedImm32 right8(static_cast&lt;int8_t&gt;(right.m_value));
        load8(left, getCachedMemoryTempRegisterIDAndInvalidate());
        return branch32(cone, memoryTempRegister, right8);
    }

The problem is that we exclusively use zero-extended load instruction (load8). Even
for signed RelationConditions, we do not perform sign extension. It makes signed
operations with negative numbers incorrect! Consider the |left| address holds `-1`
in int8_t form. However load8 will load it as 255 into 32bit register. On the other hand,
|right| will be sign extended. If you pass 0 as |right| and LessThan condition, this
branch8 should jump based on the answer of `-1 &lt; 0`. But the current MacroAssembler
performs `255 &lt; 0` in int32_t context and returns the incorrect result.

We should follow the x86 model. So we should select the appropriate load operation and masking
operation based on the RelationCondition. This patch introduces mask8OnCondition and load8OnCondition.
And we use them in 8bit operations including branch8, branchTest8, compare8, and test8.

We intentionally do not change anything on x86 assembler since it has the native signed 8bit operations.

* JavaScriptCore.xcodeproj/project.pbxproj:
* assembler/AbstractMacroAssembler.h:
* assembler/MacroAssembler.h:
(JSC::MacroAssembler::isSigned):
(JSC::MacroAssembler::isUnsigned):
(JSC::MacroAssembler::branchTest8):
* assembler/MacroAssemblerARM.h:
(JSC::MacroAssemblerARM::branch8):
(JSC::MacroAssemblerARM::branchTest8):
(JSC::MacroAssemblerARM::compare8):
(JSC::MacroAssemblerARM::test8):
* assembler/MacroAssemblerARM64.h:
(JSC::MacroAssemblerARM64::load8SignedExtendTo32):
(JSC::MacroAssemblerARM64::branch8):
(JSC::MacroAssemblerARM64::branchTest8):
(JSC::MacroAssemblerARM64::compare8):
(JSC::MacroAssemblerARM64::test8):
* assembler/MacroAssemblerARMv7.h:
(JSC::MacroAssemblerARMv7::branch8):
(JSC::MacroAssemblerARMv7::branchTest8):
(JSC::MacroAssemblerARMv7::compare8):
(JSC::MacroAssemblerARMv7::test8):
* assembler/MacroAssemblerHelpers.h: Added.
(JSC::MacroAssemblerHelpers::isSigned):
(JSC::MacroAssemblerHelpers::isUnsigned):
(JSC::MacroAssemblerHelpers::mask8OnCondition):
(JSC::MacroAssemblerHelpers::load8OnCondition):
* assembler/MacroAssemblerMIPS.h:
(JSC::MacroAssemblerMIPS::branch8):
(JSC::MacroAssemblerMIPS::compare8):
(JSC::MacroAssemblerMIPS::branchTest8):
(JSC::MacroAssemblerMIPS::test8):
* assembler/MacroAssemblerSH4.h:
(JSC::MacroAssemblerSH4::branchTest8):
(JSC::MacroAssemblerSH4::branch8):
(JSC::MacroAssemblerSH4::compare8):
(JSC::MacroAssemblerSH4::test8):
* assembler/MacroAssemblerX86_64.h:
(JSC::MacroAssemblerX86_64::branch8):

LayoutTests:

Use ownerDocument. Once DOMJIT for ownerDocument is landed, this will use branch8.

* js/dom/domjit-accessor-owner-document-type-check-expected.txt: Added.
* js/dom/domjit-accessor-owner-document-type-check.html: Added.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<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="#trunkSourceJavaScriptCoreassemblerMacroAssemblerh">trunk/Source/JavaScriptCore/assembler/MacroAssembler.h</a></li>
<li><a href="#trunkSourceJavaScriptCoreassemblerMacroAssemblerARMh">trunk/Source/JavaScriptCore/assembler/MacroAssemblerARM.h</a></li>
<li><a href="#trunkSourceJavaScriptCoreassemblerMacroAssemblerARM64h">trunk/Source/JavaScriptCore/assembler/MacroAssemblerARM64.h</a></li>
<li><a href="#trunkSourceJavaScriptCoreassemblerMacroAssemblerARMv7h">trunk/Source/JavaScriptCore/assembler/MacroAssemblerARMv7.h</a></li>
<li><a href="#trunkSourceJavaScriptCoreassemblerMacroAssemblerMIPSh">trunk/Source/JavaScriptCore/assembler/MacroAssemblerMIPS.h</a></li>
<li><a href="#trunkSourceJavaScriptCoreassemblerMacroAssemblerSH4h">trunk/Source/JavaScriptCore/assembler/MacroAssemblerSH4.h</a></li>
<li><a href="#trunkSourceJavaScriptCoreassemblerMacroAssemblerX86_64h">trunk/Source/JavaScriptCore/assembler/MacroAssemblerX86_64.h</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsjsdomdomjitaccessorownerdocumenttypecheckexpectedtxt">trunk/LayoutTests/js/dom/domjit-accessor-owner-document-type-check-expected.txt</a></li>
<li><a href="#trunkLayoutTestsjsdomdomjitaccessorownerdocumenttypecheckhtml">trunk/LayoutTests/js/dom/domjit-accessor-owner-document-type-check.html</a></li>
<li><a href="#trunkSourceJavaScriptCoreassemblerMacroAssemblerHelpersh">trunk/Source/JavaScriptCore/assembler/MacroAssemblerHelpers.h</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (208449 => 208450)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2016-11-09 19:10:15 UTC (rev 208449)
+++ trunk/LayoutTests/ChangeLog        2016-11-09 19:10:42 UTC (rev 208450)
</span><span class="lines">@@ -1,3 +1,15 @@
</span><ins>+2016-11-07  Yusuke Suzuki  &lt;utatane.tea@gmail.com&gt;
+
+        [JSC] The implementation of 8 bit operation in MacroAssembler should care about uint8_t / int8_t
+        https://bugs.webkit.org/show_bug.cgi?id=164432
+
+        Reviewed by Michael Saboff.
+
+        Use ownerDocument. Once DOMJIT for ownerDocument is landed, this will use branch8.
+
+        * js/dom/domjit-accessor-owner-document-type-check-expected.txt: Added.
+        * js/dom/domjit-accessor-owner-document-type-check.html: Added.
+
</ins><span class="cx"> 2016-11-08  Antoine Quint  &lt;graouts@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         [Modern Media Controls] UI Library: macOS fullscreen controls
</span></span></pre></div>
<a id="trunkLayoutTestsjsdomdomjitaccessorownerdocumenttypecheckexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/js/dom/domjit-accessor-owner-document-type-check-expected.txt (0 => 208450)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/js/dom/domjit-accessor-owner-document-type-check-expected.txt                                (rev 0)
+++ trunk/LayoutTests/js/dom/domjit-accessor-owner-document-type-check-expected.txt        2016-11-09 19:10:42 UTC (rev 208450)
</span><span class="lines">@@ -0,0 +1,10 @@
</span><ins>+Test DOMJIT ownerDocument accessor works on ARM environments.
+
+On success, you will see a series of &quot;PASS&quot; messages, followed by &quot;TEST COMPLETE&quot;.
+
+
+PASS done
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
</ins></span></pre></div>
<a id="trunkLayoutTestsjsdomdomjitaccessorownerdocumenttypecheckhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/js/dom/domjit-accessor-owner-document-type-check.html (0 => 208450)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/js/dom/domjit-accessor-owner-document-type-check.html                                (rev 0)
+++ trunk/LayoutTests/js/dom/domjit-accessor-owner-document-type-check.html        2016-11-09 19:10:42 UTC (rev 208450)
</span><span class="lines">@@ -0,0 +1,29 @@
</span><ins>+&lt;!DOCTYPE html&gt;
+&lt;html&gt;
+&lt;head&gt;
+&lt;script src=&quot;../../resources/js-test-pre.js&quot;&gt;&lt;/script&gt;
+&lt;/head&gt;
+&lt;body&gt;
+&lt;script&gt;
+description('Test DOMJIT ownerDocument accessor works on ARM environments.');
+
+function runTest()
+{
+    function ownerDocument(doc)
+    {
+        // If DOMJIT is enabled, it will perform Document type check, and it uses branch8 with a number that has MSB.
+        return doc.ownerDocument;
+    }
+    noInline(ownerDocument);
+
+    for (var i = 0; i &lt; 1e4; ++i) {
+        if (null !== ownerDocument(document))
+            throw new Error('Error');
+    }
+    testPassed(&quot;done&quot;);
+}
+runTest();
+&lt;/script&gt;
+&lt;script src=&quot;../../resources/js-test-post.js&quot;&gt;&lt;/script&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkSourceJavaScriptCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/ChangeLog (208449 => 208450)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/ChangeLog        2016-11-09 19:10:15 UTC (rev 208449)
+++ trunk/Source/JavaScriptCore/ChangeLog        2016-11-09 19:10:42 UTC (rev 208450)
</span><span class="lines">@@ -1,3 +1,75 @@
</span><ins>+2016-11-07  Yusuke Suzuki  &lt;utatane.tea@gmail.com&gt;
+
+        [JSC] The implementation of 8 bit operation in MacroAssembler should care about uint8_t / int8_t
+        https://bugs.webkit.org/show_bug.cgi?id=164432
+
+        Reviewed by Michael Saboff.
+
+        Except for X86, our supported MacroAssemblers do not have native 8bit instructions.
+        It means that all the 8bit instructions are converted to 32bit operations by using
+        scratch registers. For example, ARM64 branch8 implementation is the following.
+
+            Jump branch8(RelationCondition cord, Address left, TrustedImm32 right)
+            {
+                TrustedImm32 right8(static_cast&lt;int8_t&gt;(right.m_value));
+                load8(left, getCachedMemoryTempRegisterIDAndInvalidate());
+                return branch32(cone, memoryTempRegister, right8);
+            }
+
+        The problem is that we exclusively use zero-extended load instruction (load8). Even
+        for signed RelationConditions, we do not perform sign extension. It makes signed
+        operations with negative numbers incorrect! Consider the |left| address holds `-1`
+        in int8_t form. However load8 will load it as 255 into 32bit register. On the other hand,
+        |right| will be sign extended. If you pass 0 as |right| and LessThan condition, this
+        branch8 should jump based on the answer of `-1 &lt; 0`. But the current MacroAssembler
+        performs `255 &lt; 0` in int32_t context and returns the incorrect result.
+
+        We should follow the x86 model. So we should select the appropriate load operation and masking
+        operation based on the RelationCondition. This patch introduces mask8OnCondition and load8OnCondition.
+        And we use them in 8bit operations including branch8, branchTest8, compare8, and test8.
+
+        We intentionally do not change anything on x86 assembler since it has the native signed 8bit operations.
+
+        * JavaScriptCore.xcodeproj/project.pbxproj:
+        * assembler/AbstractMacroAssembler.h:
+        * assembler/MacroAssembler.h:
+        (JSC::MacroAssembler::isSigned):
+        (JSC::MacroAssembler::isUnsigned):
+        (JSC::MacroAssembler::branchTest8):
+        * assembler/MacroAssemblerARM.h:
+        (JSC::MacroAssemblerARM::branch8):
+        (JSC::MacroAssemblerARM::branchTest8):
+        (JSC::MacroAssemblerARM::compare8):
+        (JSC::MacroAssemblerARM::test8):
+        * assembler/MacroAssemblerARM64.h:
+        (JSC::MacroAssemblerARM64::load8SignedExtendTo32):
+        (JSC::MacroAssemblerARM64::branch8):
+        (JSC::MacroAssemblerARM64::branchTest8):
+        (JSC::MacroAssemblerARM64::compare8):
+        (JSC::MacroAssemblerARM64::test8):
+        * assembler/MacroAssemblerARMv7.h:
+        (JSC::MacroAssemblerARMv7::branch8):
+        (JSC::MacroAssemblerARMv7::branchTest8):
+        (JSC::MacroAssemblerARMv7::compare8):
+        (JSC::MacroAssemblerARMv7::test8):
+        * assembler/MacroAssemblerHelpers.h: Added.
+        (JSC::MacroAssemblerHelpers::isSigned):
+        (JSC::MacroAssemblerHelpers::isUnsigned):
+        (JSC::MacroAssemblerHelpers::mask8OnCondition):
+        (JSC::MacroAssemblerHelpers::load8OnCondition):
+        * assembler/MacroAssemblerMIPS.h:
+        (JSC::MacroAssemblerMIPS::branch8):
+        (JSC::MacroAssemblerMIPS::compare8):
+        (JSC::MacroAssemblerMIPS::branchTest8):
+        (JSC::MacroAssemblerMIPS::test8):
+        * assembler/MacroAssemblerSH4.h:
+        (JSC::MacroAssemblerSH4::branchTest8):
+        (JSC::MacroAssemblerSH4::branch8):
+        (JSC::MacroAssemblerSH4::compare8):
+        (JSC::MacroAssemblerSH4::test8):
+        * assembler/MacroAssemblerX86_64.h:
+        (JSC::MacroAssemblerX86_64::branch8):
+
</ins><span class="cx"> 2016-11-08  Geoffrey Garen  &lt;ggaren@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         REGRESSION: date-format-tofte.js is super slow
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreJavaScriptCorexcodeprojprojectpbxproj"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj (208449 => 208450)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj        2016-11-09 19:10:15 UTC (rev 208449)
+++ trunk/Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj        2016-11-09 19:10:42 UTC (rev 208450)
</span><span class="lines">@@ -2197,6 +2197,7 @@
</span><span class="cx">                 E328DAE91D38D005001A2529 /* BytecodeGraph.h in Headers */ = {isa = PBXBuildFile; fileRef = E3D264281D38C042000BE174 /* BytecodeGraph.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="cx">                 E328DAEA1D38D005001A2529 /* BytecodeRewriter.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E3D264291D38C042000BE174 /* BytecodeRewriter.cpp */; };
</span><span class="cx">                 E328DAEB1D38D005001A2529 /* BytecodeRewriter.h in Headers */ = {isa = PBXBuildFile; fileRef = E3D2642A1D38C042000BE174 /* BytecodeRewriter.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><ins>+                E32AB2441DCD75F400D7533A /* MacroAssemblerHelpers.h in Headers */ = {isa = PBXBuildFile; fileRef = E380A76B1DCD7195000F89E6 /* MacroAssemblerHelpers.h */; settings = {ATTRIBUTES = (Private, ); }; };
</ins><span class="cx">                 E32FF1EA1DA7571C00A8BF21 /* DOMJITSlowPathCalls.h in Headers */ = {isa = PBXBuildFile; fileRef = E3CB1E241DA7540A00FA1E56 /* DOMJITSlowPathCalls.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="cx">                 E33637A51B63220200EE0840 /* ReflectObject.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E33637A31B63220200EE0840 /* ReflectObject.cpp */; };
</span><span class="cx">                 E33637A61B63220200EE0840 /* ReflectObject.h in Headers */ = {isa = PBXBuildFile; fileRef = E33637A41B63220200EE0840 /* ReflectObject.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="lines">@@ -4665,6 +4666,7 @@
</span><span class="cx">                 E3794E741B77EB97005543AE /* ModuleAnalyzer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ModuleAnalyzer.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 E37AD83A1DA4928000F3D412 /* DOMJITPatchpointParams.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DOMJITPatchpointParams.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 E37AD83B1DA4928000F3D412 /* DOMJITReg.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DOMJITReg.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><ins>+                E380A76B1DCD7195000F89E6 /* MacroAssemblerHelpers.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MacroAssemblerHelpers.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</ins><span class="cx">                 E3963CEC1B73F75000EB4CE5 /* NodesAnalyzeModule.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = NodesAnalyzeModule.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 E39D9D841D39000600667282 /* InterpreterInlines.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InterpreterInlines.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 E39DA4A41B7E8B7C0084F33A /* JSModuleRecord.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSModuleRecord.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="lines">@@ -7064,6 +7066,7 @@
</span><span class="cx">                                 86ADD1440FDDEA980006EEC2 /* MacroAssemblerARMv7.h */,
</span><span class="cx">                                 0F6DB7EB1D617D0F00CDBF8E /* MacroAssemblerCodeRef.cpp */,
</span><span class="cx">                                 863B23DF0FC60E6200703AA4 /* MacroAssemblerCodeRef.h */,
</span><ins>+                                E380A76B1DCD7195000F89E6 /* MacroAssemblerHelpers.h */,
</ins><span class="cx">                                 86C568DE11A213EE0007F7F0 /* MacroAssemblerMIPS.h */,
</span><span class="cx">                                 FE68C6351B90DDD90042BCB3 /* MacroAssemblerPrinter.cpp */,
</span><span class="cx">                                 FE68C6361B90DDD90042BCB3 /* MacroAssemblerPrinter.h */,
</span><span class="lines">@@ -8048,6 +8051,7 @@
</span><span class="cx">                                 0F40E4A81C497F7400A577FA /* AirOpcodeGenerated.h in Headers */,
</span><span class="cx">                                 0F235BEE17178E7300690C7F /* DFGOSRExitPreparation.h in Headers */,
</span><span class="cx">                                 0F6237981AE45CA700D402EA /* DFGPhantomInsertionPhase.h in Headers */,
</span><ins>+                                E32AB2441DCD75F400D7533A /* MacroAssemblerHelpers.h in Headers */,
</ins><span class="cx">                                 0FFFC95C14EF90AF00C72532 /* DFGPhase.h in Headers */,
</span><span class="cx">                                 0F2B9CEB19D0BA7D00B1D1B5 /* DFGPhiChildren.h in Headers */,
</span><span class="cx">                                 A78A977B179738B8009DF744 /* DFGPlan.h in Headers */,
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreassemblerAbstractMacroAssemblerh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/assembler/AbstractMacroAssembler.h (208449 => 208450)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/assembler/AbstractMacroAssembler.h        2016-11-09 19:10:15 UTC (rev 208449)
+++ trunk/Source/JavaScriptCore/assembler/AbstractMacroAssembler.h        2016-11-09 19:10:42 UTC (rev 208450)
</span><span class="lines">@@ -31,6 +31,7 @@
</span><span class="cx"> #include &quot;CPU.h&quot;
</span><span class="cx"> #include &quot;CodeLocation.h&quot;
</span><span class="cx"> #include &quot;MacroAssemblerCodeRef.h&quot;
</span><ins>+#include &quot;MacroAssemblerHelpers.h&quot;
</ins><span class="cx"> #include &quot;Options.h&quot;
</span><span class="cx"> #include &lt;wtf/CryptographicallyRandomNumber.h&gt;
</span><span class="cx"> #include &lt;wtf/Noncopyable.h&gt;
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreassemblerMacroAssemblerh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/assembler/MacroAssembler.h (208449 => 208450)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/assembler/MacroAssembler.h        2016-11-09 19:10:15 UTC (rev 208449)
+++ trunk/Source/JavaScriptCore/assembler/MacroAssembler.h        2016-11-09 19:10:42 UTC (rev 208450)
</span><span class="lines">@@ -65,6 +65,8 @@
</span><span class="cx"> #error &quot;The MacroAssembler is not supported on this platform.&quot;
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><ins>+#include &quot;MacroAssemblerHelpers.h&quot;
+
</ins><span class="cx"> namespace JSC {
</span><span class="cx"> 
</span><span class="cx"> class MacroAssembler : public MacroAssemblerBase {
</span><span class="lines">@@ -140,7 +142,6 @@
</span><span class="cx">     static const double twoToThe32; // This is super useful for some double code.
</span><span class="cx"> 
</span><span class="cx">     // Utilities used by the DFG JIT.
</span><del>-#if ENABLE(DFG_JIT)
</del><span class="cx">     using MacroAssemblerBase::invert;
</span><span class="cx">     
</span><span class="cx">     static DoubleCondition invert(DoubleCondition cond)
</span><span class="lines">@@ -233,45 +234,26 @@
</span><span class="cx">         return Equal;
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    // True if this:
-    //     branch8(cond, value, value)
-    // Is the same as this:
-    //     branch32(cond, signExt8(value), signExt8(value))
</del><span class="cx">     static bool isSigned(RelationalCondition cond)
</span><span class="cx">     {
</span><del>-        switch (cond) {
-        case Equal:
-        case NotEqual:
-        case GreaterThan:
-        case GreaterThanOrEqual:
-        case LessThan:
-        case LessThanOrEqual:
-            return true;
-        default:
-            return false;
-        }
</del><ins>+        return MacroAssemblerHelpers::isSigned&lt;MacroAssembler&gt;(cond);
</ins><span class="cx">     }
</span><span class="cx"> 
</span><del>-    // True if this:
-    //     branch8(cond, value, value)
-    // Is the same as this:
-    //     branch32(cond, zeroExt8(value), zeroExt8(value))
</del><span class="cx">     static bool isUnsigned(RelationalCondition cond)
</span><span class="cx">     {
</span><del>-        switch (cond) {
-        case Equal:
-        case NotEqual:
-        case Above:
-        case AboveOrEqual:
-        case Below:
-        case BelowOrEqual:
-            return true;
-        default:
-            return false;
-        }
</del><ins>+        return MacroAssemblerHelpers::isUnsigned&lt;MacroAssembler&gt;(cond);
</ins><span class="cx">     }
</span><del>-#endif
</del><span class="cx"> 
</span><ins>+    static bool isSigned(ResultCondition cond)
+    {
+        return MacroAssemblerHelpers::isSigned&lt;MacroAssembler&gt;(cond);
+    }
+
+    static bool isUnsigned(ResultCondition cond)
+    {
+        return MacroAssemblerHelpers::isUnsigned&lt;MacroAssembler&gt;(cond);
+    }
+
</ins><span class="cx">     // Platform agnostic convenience functions,
</span><span class="cx">     // described in terms of other macro assembly methods.
</span><span class="cx">     void pop()
</span><span class="lines">@@ -797,8 +779,7 @@
</span><span class="cx">     using MacroAssemblerBase::branchTest8;
</span><span class="cx">     Jump branchTest8(ResultCondition cond, ExtendedAddress address, TrustedImm32 mask = TrustedImm32(-1))
</span><span class="cx">     {
</span><del>-        TrustedImm32 mask8(static_cast&lt;int8_t&gt;(mask.m_value));
-        return MacroAssemblerBase::branchTest8(cond, Address(address.base, address.offset), mask8);
</del><ins>+        return MacroAssemblerBase::branchTest8(cond, Address(address.base, address.offset), mask);
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx"> #else // !CPU(X86_64)
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreassemblerMacroAssemblerARMh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/assembler/MacroAssemblerARM.h (208449 => 208450)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/assembler/MacroAssemblerARM.h        2016-11-09 19:10:15 UTC (rev 208449)
+++ trunk/Source/JavaScriptCore/assembler/MacroAssemblerARM.h        2016-11-09 19:10:42 UTC (rev 208450)
</span><span class="lines">@@ -632,23 +632,23 @@
</span><span class="cx"> 
</span><span class="cx">     Jump branch8(RelationalCondition cond, Address left, TrustedImm32 right)
</span><span class="cx">     {
</span><del>-        TrustedImm32 right8(static_cast&lt;int8_t&gt;(right.m_value));
-        load8(left, ARMRegisters::S1);
</del><ins>+        TrustedImm32 right8 = MacroAssemblerHelpers::mask8OnCondition(*this, cond, right);
+        MacroAssemblerHelpers::load8OnCondition(*this, cond, left, ARMRegisters::S1);
</ins><span class="cx">         return branch32(cond, ARMRegisters::S1, right8);
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     Jump branch8(RelationalCondition cond, BaseIndex left, TrustedImm32 right)
</span><span class="cx">     {
</span><del>-        TrustedImm32 right8(static_cast&lt;int8_t&gt;(right.m_value));
-        load8(left, ARMRegisters::S1);
</del><ins>+        TrustedImm32 right8 = MacroAssemblerHelpers::mask8OnCondition(*this, cond, right);
+        MacroAssemblerHelpers::load8OnCondition(*this, cond, left, ARMRegisters::S1);
</ins><span class="cx">         return branch32(cond, ARMRegisters::S1, right8);
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     Jump branch8(RelationalCondition cond, AbsoluteAddress left, TrustedImm32 right)
</span><span class="cx">     {
</span><del>-        TrustedImm32 right8(static_cast&lt;int8_t&gt;(right.m_value));
</del><ins>+        TrustedImm32 right8 = MacroAssemblerHelpers::mask8OnCondition(*this, cond, right);
</ins><span class="cx">         move(TrustedImmPtr(left.m_ptr), ARMRegisters::S1);
</span><del>-        load8(Address(ARMRegisters::S1), ARMRegisters::S1);
</del><ins>+        MacroAssemblerHelpers::load8OnCondition(*this, cond, Address(ARMRegisters::S1), ARMRegisters::S1);
</ins><span class="cx">         return branch32(cond, ARMRegisters::S1, right8);
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="lines">@@ -702,23 +702,23 @@
</span><span class="cx"> 
</span><span class="cx">     Jump branchTest8(ResultCondition cond, Address address, TrustedImm32 mask = TrustedImm32(-1))
</span><span class="cx">     {
</span><del>-        TrustedImm32 mask8(static_cast&lt;int8_t&gt;(mask.m_value));
-        load8(address, ARMRegisters::S1);
</del><ins>+        TrustedImm32 mask8 = MacroAssemblerHelpers::mask8OnCondition(*this, cond, mask);
+        MacroAssemblerHelpers::load8OnCondition(*this, cond, address, ARMRegisters::S1);
</ins><span class="cx">         return branchTest32(cond, ARMRegisters::S1, mask8);
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     Jump branchTest8(ResultCondition cond, BaseIndex address, TrustedImm32 mask = TrustedImm32(-1))
</span><span class="cx">     {
</span><del>-        TrustedImm32 mask8(static_cast&lt;int8_t&gt;(mask.m_value));
-        load8(address, ARMRegisters::S1);
</del><ins>+        TrustedImm32 mask8 = MacroAssemblerHelpers::mask8OnCondition(*this, cond, mask);
+        MacroAssemblerHelpers::load8OnCondition(*this, cond, address, ARMRegisters::S1);
</ins><span class="cx">         return branchTest32(cond, ARMRegisters::S1, mask8);
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     Jump branchTest8(ResultCondition cond, AbsoluteAddress address, TrustedImm32 mask = TrustedImm32(-1))
</span><span class="cx">     {
</span><del>-        TrustedImm32 mask8(static_cast&lt;int8_t&gt;(mask.m_value));
</del><ins>+        TrustedImm32 mask8 = MacroAssemblerHelpers::mask8OnCondition(*this, cond, mask);
</ins><span class="cx">         move(TrustedImmPtr(address.m_ptr), ARMRegisters::S1);
</span><del>-        load8(Address(ARMRegisters::S1), ARMRegisters::S1);
</del><ins>+        MacroAssemblerHelpers::load8OnCondition(*this, cond, Address(ARMRegisters::S1), ARMRegisters::S1);
</ins><span class="cx">         return branchTest32(cond, ARMRegisters::S1, mask8);
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="lines">@@ -985,8 +985,8 @@
</span><span class="cx"> 
</span><span class="cx">     void compare8(RelationalCondition cond, Address left, TrustedImm32 right, RegisterID dest)
</span><span class="cx">     {
</span><del>-        TrustedImm32 right8(static_cast&lt;int8_t&gt;(right.m_value));
-        load8(left, ARMRegisters::S1);
</del><ins>+        TrustedImm32 right8 = MacroAssemblerHelpers::mask8OnCondition(*this, cond, right);
+        MacroAssemblerHelpers::load8OnCondition(*this, cond, left, ARMRegisters::S1);
</ins><span class="cx">         compare32(cond, ARMRegisters::S1, right8, dest);
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="lines">@@ -1008,8 +1008,8 @@
</span><span class="cx"> 
</span><span class="cx">     void test8(ResultCondition cond, Address address, TrustedImm32 mask, RegisterID dest)
</span><span class="cx">     {
</span><del>-        TrustedImm32 mask8(static_cast&lt;int8_t&gt;(mask.m_value));
-        load8(address, ARMRegisters::S1);
</del><ins>+        TrustedImm32 mask8 = MacroAssemblerHelpers::mask8OnCondition(*this, cond, mask);
+        MacroAssemblerHelpers::load8OnCondition(*this, cond, address, ARMRegisters::S1);
</ins><span class="cx">         test32(cond, ARMRegisters::S1, mask8, dest);
</span><span class="cx">     }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreassemblerMacroAssemblerARM64h"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/assembler/MacroAssemblerARM64.h (208449 => 208450)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/assembler/MacroAssemblerARM64.h        2016-11-09 19:10:15 UTC (rev 208449)
+++ trunk/Source/JavaScriptCore/assembler/MacroAssemblerARM64.h        2016-11-09 19:10:42 UTC (rev 208450)
</span><span class="lines">@@ -1200,6 +1200,14 @@
</span><span class="cx">         m_assembler.ldrsb&lt;32&gt;(dest, address.base, memoryTempRegister);
</span><span class="cx">     }
</span><span class="cx"> 
</span><ins>+    void load8SignedExtendTo32(const void* address, RegisterID dest)
+    {
+        moveToCachedReg(TrustedImmPtr(address), cachedMemoryTempRegister());
+        m_assembler.ldrsb&lt;32&gt;(dest, memoryTempRegister, ARM64Registers::zr);
+        if (dest == memoryTempRegister)
+            cachedMemoryTempRegister().invalidate();
+    }
+
</ins><span class="cx">     void zeroExtend8To32(RegisterID src, RegisterID dest)
</span><span class="cx">     {
</span><span class="cx">         m_assembler.uxtb&lt;32&gt;(dest, src);
</span><span class="lines">@@ -2424,22 +2432,22 @@
</span><span class="cx"> 
</span><span class="cx">     Jump branch8(RelationalCondition cond, Address left, TrustedImm32 right)
</span><span class="cx">     {
</span><del>-        TrustedImm32 right8(static_cast&lt;int8_t&gt;(right.m_value));
-        load8(left, getCachedMemoryTempRegisterIDAndInvalidate());
</del><ins>+        TrustedImm32 right8 = MacroAssemblerHelpers::mask8OnCondition(*this, cond, right);
+        MacroAssemblerHelpers::load8OnCondition(*this, cond, left, getCachedMemoryTempRegisterIDAndInvalidate());
</ins><span class="cx">         return branch32(cond, memoryTempRegister, right8);
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     Jump branch8(RelationalCondition cond, BaseIndex left, TrustedImm32 right)
</span><span class="cx">     {
</span><del>-        TrustedImm32 right8(static_cast&lt;int8_t&gt;(right.m_value));
-        load8(left, getCachedMemoryTempRegisterIDAndInvalidate());
</del><ins>+        TrustedImm32 right8 = MacroAssemblerHelpers::mask8OnCondition(*this, cond, right);
+        MacroAssemblerHelpers::load8OnCondition(*this, cond, left, getCachedMemoryTempRegisterIDAndInvalidate());
</ins><span class="cx">         return branch32(cond, memoryTempRegister, right8);
</span><span class="cx">     }
</span><span class="cx">     
</span><span class="cx">     Jump branch8(RelationalCondition cond, AbsoluteAddress left, TrustedImm32 right)
</span><span class="cx">     {
</span><del>-        TrustedImm32 right8(static_cast&lt;int8_t&gt;(right.m_value));
-        load8(left.m_ptr, getCachedMemoryTempRegisterIDAndInvalidate());
</del><ins>+        TrustedImm32 right8 = MacroAssemblerHelpers::mask8OnCondition(*this, cond, right);
+        MacroAssemblerHelpers::load8OnCondition(*this, cond, left.m_ptr, getCachedMemoryTempRegisterIDAndInvalidate());
</ins><span class="cx">         return branch32(cond, memoryTempRegister, right8);
</span><span class="cx">     }
</span><span class="cx">     
</span><span class="lines">@@ -2583,30 +2591,35 @@
</span><span class="cx"> 
</span><span class="cx">     Jump branchTest8(ResultCondition cond, Address address, TrustedImm32 mask = TrustedImm32(-1))
</span><span class="cx">     {
</span><del>-        TrustedImm32 mask8(static_cast&lt;int8_t&gt;(mask.m_value));
-        load8(address, getCachedDataTempRegisterIDAndInvalidate());
</del><ins>+        TrustedImm32 mask8 = MacroAssemblerHelpers::mask8OnCondition(*this, cond, mask);
+        MacroAssemblerHelpers::load8OnCondition(*this, cond, address, getCachedDataTempRegisterIDAndInvalidate());
</ins><span class="cx">         return branchTest32(cond, dataTempRegister, mask8);
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     Jump branchTest8(ResultCondition cond, AbsoluteAddress address, TrustedImm32 mask = TrustedImm32(-1))
</span><span class="cx">     {
</span><del>-        TrustedImm32 mask8(static_cast&lt;int8_t&gt;(mask.m_value));
-        load8(address.m_ptr, getCachedDataTempRegisterIDAndInvalidate());
</del><ins>+        TrustedImm32 mask8 = MacroAssemblerHelpers::mask8OnCondition(*this, cond, mask);
+        MacroAssemblerHelpers::load8OnCondition(*this, cond, address.m_ptr, getCachedDataTempRegisterIDAndInvalidate());
</ins><span class="cx">         return branchTest32(cond, dataTempRegister, mask8);
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     Jump branchTest8(ResultCondition cond, ExtendedAddress address, TrustedImm32 mask = TrustedImm32(-1))
</span><span class="cx">     {
</span><del>-        TrustedImm32 mask8(static_cast&lt;int8_t&gt;(mask.m_value));
</del><ins>+        TrustedImm32 mask8 = MacroAssemblerHelpers::mask8OnCondition(*this, cond, mask);
</ins><span class="cx">         move(TrustedImmPtr(reinterpret_cast&lt;void*&gt;(address.offset)), getCachedDataTempRegisterIDAndInvalidate());
</span><del>-        m_assembler.ldrb(dataTempRegister, address.base, dataTempRegister);
</del><ins>+
+        if (MacroAssemblerHelpers::isUnsigned&lt;MacroAssemblerARM64&gt;(cond))
+            m_assembler.ldrb(dataTempRegister, address.base, dataTempRegister);
+        else
+            m_assembler.ldrsb&lt;32&gt;(dataTempRegister, address.base, dataTempRegister);
+
</ins><span class="cx">         return branchTest32(cond, dataTempRegister, mask8);
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     Jump branchTest8(ResultCondition cond, BaseIndex address, TrustedImm32 mask = TrustedImm32(-1))
</span><span class="cx">     {
</span><del>-        TrustedImm32 mask8(static_cast&lt;int8_t&gt;(mask.m_value));
-        load8(address, getCachedDataTempRegisterIDAndInvalidate());
</del><ins>+        TrustedImm32 mask8 = MacroAssemblerHelpers::mask8OnCondition(*this, cond, mask);
+        MacroAssemblerHelpers::load8OnCondition(*this, cond, address, getCachedDataTempRegisterIDAndInvalidate());
</ins><span class="cx">         return branchTest32(cond, dataTempRegister, mask8);
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="lines">@@ -3023,8 +3036,8 @@
</span><span class="cx"> 
</span><span class="cx">     void compare8(RelationalCondition cond, Address left, TrustedImm32 right, RegisterID dest)
</span><span class="cx">     {
</span><del>-        TrustedImm32 right8(static_cast&lt;int8_t&gt;(right.m_value));
-        load8(left, getCachedMemoryTempRegisterIDAndInvalidate());
</del><ins>+        TrustedImm32 right8 = MacroAssemblerHelpers::mask8OnCondition(*this, cond, right);
+        MacroAssemblerHelpers::load8OnCondition(*this, cond, left, getCachedMemoryTempRegisterIDAndInvalidate());
</ins><span class="cx">         move(right8, getCachedDataTempRegisterIDAndInvalidate());
</span><span class="cx">         compare32(cond, memoryTempRegister, dataTempRegister, dest);
</span><span class="cx">     }
</span><span class="lines">@@ -3049,8 +3062,8 @@
</span><span class="cx"> 
</span><span class="cx">     void test8(ResultCondition cond, Address address, TrustedImm32 mask, RegisterID dest)
</span><span class="cx">     {
</span><del>-        TrustedImm32 mask8(static_cast&lt;int8_t&gt;(mask.m_value));
-        load8(address, getCachedMemoryTempRegisterIDAndInvalidate());
</del><ins>+        TrustedImm32 mask8 = MacroAssemblerHelpers::mask8OnCondition(*this, cond, mask);
+        MacroAssemblerHelpers::load8OnCondition(*this, cond, address, getCachedMemoryTempRegisterIDAndInvalidate());
</ins><span class="cx">         test32(cond, memoryTempRegister, mask8, dest);
</span><span class="cx">     }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreassemblerMacroAssemblerARMv7h"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/assembler/MacroAssemblerARMv7.h (208449 => 208450)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/assembler/MacroAssemblerARMv7.h        2016-11-09 19:10:15 UTC (rev 208449)
+++ trunk/Source/JavaScriptCore/assembler/MacroAssemblerARMv7.h        2016-11-09 19:10:42 UTC (rev 208450)
</span><span class="lines">@@ -1490,7 +1490,7 @@
</span><span class="cx"> 
</span><span class="cx">     Jump branch8(RelationalCondition cond, RegisterID left, TrustedImm32 right)
</span><span class="cx">     {
</span><del>-        TrustedImm32 right8(static_cast&lt;int8_t&gt;(right.m_value));
</del><ins>+        TrustedImm32 right8 = MacroAssemblerHelpers::mask8OnCondition(*this, cond, right);
</ins><span class="cx">         compare32AndSetFlags(left, right8);
</span><span class="cx">         return Jump(makeBranch(cond));
</span><span class="cx">     }
</span><span class="lines">@@ -1498,8 +1498,8 @@
</span><span class="cx">     Jump branch8(RelationalCondition cond, Address left, TrustedImm32 right)
</span><span class="cx">     {
</span><span class="cx">         // use addressTempRegister incase the branch8 we call uses dataTempRegister. :-/
</span><del>-        TrustedImm32 right8(static_cast&lt;int8_t&gt;(right.m_value));
-        load8(left, addressTempRegister);
</del><ins>+        TrustedImm32 right8 = MacroAssemblerHelpers::mask8OnCondition(*this, cond, right);
+        MacroAssemblerHelpers::load8OnCondition(*this, cond, left, addressTempRegister);
</ins><span class="cx">         return branch8(cond, addressTempRegister, right8);
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="lines">@@ -1506,8 +1506,8 @@
</span><span class="cx">     Jump branch8(RelationalCondition cond, BaseIndex left, TrustedImm32 right)
</span><span class="cx">     {
</span><span class="cx">         // use addressTempRegister incase the branch32 we call uses dataTempRegister. :-/
</span><del>-        TrustedImm32 right8(static_cast&lt;int8_t&gt;(right.m_value));
-        load8(left, addressTempRegister);
</del><ins>+        TrustedImm32 right8 = MacroAssemblerHelpers::mask8OnCondition(*this, cond, right);
+        MacroAssemblerHelpers::load8OnCondition(*this, cond, left, addressTempRegister);
</ins><span class="cx">         return branch32(cond, addressTempRegister, right8);
</span><span class="cx">     }
</span><span class="cx">     
</span><span class="lines">@@ -1514,9 +1514,9 @@
</span><span class="cx">     Jump branch8(RelationalCondition cond, AbsoluteAddress address, TrustedImm32 right)
</span><span class="cx">     {
</span><span class="cx">         // Use addressTempRegister instead of dataTempRegister, since branch32 uses dataTempRegister.
</span><del>-        TrustedImm32 right8(static_cast&lt;int8_t&gt;(right.m_value));
</del><ins>+        TrustedImm32 right8 = MacroAssemblerHelpers::mask8OnCondition(*this, cond, right);
</ins><span class="cx">         move(TrustedImmPtr(address.m_ptr), addressTempRegister);
</span><del>-        load8(Address(addressTempRegister), addressTempRegister);
</del><ins>+        MacroAssemblerHelpers::load8OnCondition(*this, cond, Address(addressTempRegister), addressTempRegister);
</ins><span class="cx">         return branch32(cond, addressTempRegister, right8);
</span><span class="cx">     }
</span><span class="cx">     
</span><span class="lines">@@ -1551,8 +1551,8 @@
</span><span class="cx">     Jump branchTest8(ResultCondition cond, BaseIndex address, TrustedImm32 mask = TrustedImm32(-1))
</span><span class="cx">     {
</span><span class="cx">         // use addressTempRegister incase the branchTest8 we call uses dataTempRegister. :-/
</span><del>-        TrustedImm32 mask8(static_cast&lt;int8_t&gt;(mask.m_value));
-        load8(address, addressTempRegister);
</del><ins>+        TrustedImm32 mask8 = MacroAssemblerHelpers::mask8OnCondition(*this, cond, mask);
+        MacroAssemblerHelpers::load8OnCondition(*this, cond, address, addressTempRegister);
</ins><span class="cx">         return branchTest32(cond, addressTempRegister, mask8);
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="lines">@@ -1559,8 +1559,8 @@
</span><span class="cx">     Jump branchTest8(ResultCondition cond, Address address, TrustedImm32 mask = TrustedImm32(-1))
</span><span class="cx">     {
</span><span class="cx">         // use addressTempRegister incase the branchTest8 we call uses dataTempRegister. :-/
</span><del>-        TrustedImm32 mask8(static_cast&lt;int8_t&gt;(mask.m_value));
-        load8(address, addressTempRegister);
</del><ins>+        TrustedImm32 mask8 = MacroAssemblerHelpers::mask8OnCondition(*this, cond, mask);
+        MacroAssemblerHelpers::load8OnCondition(*this, cond, address, addressTempRegister);
</ins><span class="cx">         return branchTest32(cond, addressTempRegister, mask8);
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="lines">@@ -1567,9 +1567,9 @@
</span><span class="cx">     Jump branchTest8(ResultCondition cond, AbsoluteAddress address, TrustedImm32 mask = TrustedImm32(-1))
</span><span class="cx">     {
</span><span class="cx">         // use addressTempRegister incase the branchTest8 we call uses dataTempRegister. :-/
</span><del>-        TrustedImm32 mask8(static_cast&lt;int8_t&gt;(mask.m_value));
</del><ins>+        TrustedImm32 mask8 = MacroAssemblerHelpers::mask8OnCondition(*this, cond, mask);
</ins><span class="cx">         move(TrustedImmPtr(address.m_ptr), addressTempRegister);
</span><del>-        load8(Address(addressTempRegister), addressTempRegister);
</del><ins>+        MacroAssemblerHelpers::load8OnCondition(*this, cond, Address(addressTempRegister), addressTempRegister);
</ins><span class="cx">         return branchTest32(cond, addressTempRegister, mask8);
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="lines">@@ -1797,8 +1797,8 @@
</span><span class="cx"> 
</span><span class="cx">     void compare8(RelationalCondition cond, Address left, TrustedImm32 right, RegisterID dest)
</span><span class="cx">     {
</span><del>-        TrustedImm32 right8(static_cast&lt;int8_t&gt;(right.m_value));
-        load8(left, addressTempRegister);
</del><ins>+        TrustedImm32 right8 = MacroAssemblerHelpers::mask8OnCondition(*this, cond, right);
+        MacroAssemblerHelpers::load8OnCondition(*this, cond, left, addressTempRegister);
</ins><span class="cx">         compare32(cond, addressTempRegister, right8, dest);
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="lines">@@ -1825,8 +1825,8 @@
</span><span class="cx"> 
</span><span class="cx">     void test8(ResultCondition cond, Address address, TrustedImm32 mask, RegisterID dest)
</span><span class="cx">     {
</span><del>-        TrustedImm32 mask8(static_cast&lt;int8_t&gt;(mask.m_value));
-        load8(address, dataTempRegister);
</del><ins>+        TrustedImm32 mask8 = MacroAssemblerHelpers::mask8OnCondition(*this, cond, mask);
+        MacroAssemblerHelpers::load8OnCondition(*this, cond, address, dataTempRegister);
</ins><span class="cx">         test32(dataTempRegister, mask8);
</span><span class="cx">         m_assembler.it(armV7Condition(cond), false);
</span><span class="cx">         m_assembler.mov(dest, ARMThumbImmediate::makeUInt16(1));
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreassemblerMacroAssemblerHelpersh"></a>
<div class="addfile"><h4>Added: trunk/Source/JavaScriptCore/assembler/MacroAssemblerHelpers.h (0 => 208450)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/assembler/MacroAssemblerHelpers.h                                (rev 0)
+++ trunk/Source/JavaScriptCore/assembler/MacroAssemblerHelpers.h        2016-11-09 19:10:42 UTC (rev 208450)
</span><span class="lines">@@ -0,0 +1,131 @@
</span><ins>+/*
+ * Copyright (C) 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. ``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
+ * 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
+
+namespace JSC {
+namespace MacroAssemblerHelpers {
+
+// True if this:
+//     branch8(cond, value, value)
+// Is the same as this:
+//     branch32(cond, signExt8(value), signExt8(value))
+template&lt;typename MacroAssemblerType&gt;
+inline bool isSigned(typename MacroAssemblerType::RelationalCondition cond)
+{
+    switch (cond) {
+    case MacroAssemblerType::Equal:
+    case MacroAssemblerType::NotEqual:
+    case MacroAssemblerType::GreaterThan:
+    case MacroAssemblerType::GreaterThanOrEqual:
+    case MacroAssemblerType::LessThan:
+    case MacroAssemblerType::LessThanOrEqual:
+        return true;
+    default:
+        return false;
+    }
+}
+
+// True if this:
+//     branch8(cond, value, value)
+// Is the same as this:
+//     branch32(cond, zeroExt8(value), zeroExt8(value))
+template&lt;typename MacroAssemblerType&gt;
+inline bool isUnsigned(typename MacroAssemblerType::RelationalCondition cond)
+{
+    switch (cond) {
+    case MacroAssemblerType::Equal:
+    case MacroAssemblerType::NotEqual:
+    case MacroAssemblerType::Above:
+    case MacroAssemblerType::AboveOrEqual:
+    case MacroAssemblerType::Below:
+    case MacroAssemblerType::BelowOrEqual:
+        return true;
+    default:
+        return false;
+    }
+}
+
+// True if this:
+//     test8(cond, value, value)
+// Is the same as this:
+//     test32(cond, signExt8(value), signExt8(value))
+template&lt;typename MacroAssemblerType&gt;
+inline bool isSigned(typename MacroAssemblerType::ResultCondition cond)
+{
+    switch (cond) {
+    case MacroAssemblerType::Signed:
+    case MacroAssemblerType::PositiveOrZero:
+    case MacroAssemblerType::Zero:
+    case MacroAssemblerType::NonZero:
+        return true;
+    default:
+        return false;
+    }
+}
+
+// True if this:
+//     test8(cond, value, value)
+// Is the same as this:
+//     test32(cond, zeroExt8(value), zeroExt8(value))
+template&lt;typename MacroAssemblerType&gt;
+inline bool isUnsigned(typename MacroAssemblerType::ResultCondition cond)
+{
+    switch (cond) {
+    case MacroAssemblerType::Zero:
+    case MacroAssemblerType::NonZero:
+        return true;
+    default:
+        return false;
+    }
+}
+
+template&lt;typename MacroAssemblerType&gt;
+inline typename MacroAssemblerType::TrustedImm32 mask8OnCondition(MacroAssemblerType&amp;, typename MacroAssemblerType::RelationalCondition cond, typename MacroAssemblerType::TrustedImm32 value)
+{
+    if (isUnsigned&lt;MacroAssemblerType&gt;(cond))
+        return typename MacroAssemblerType::TrustedImm32(static_cast&lt;uint8_t&gt;(value.m_value));
+    return typename MacroAssemblerType::TrustedImm32(static_cast&lt;int8_t&gt;(value.m_value));
+}
+
+template&lt;typename MacroAssemblerType&gt;
+inline typename MacroAssemblerType::TrustedImm32 mask8OnCondition(MacroAssemblerType&amp;, typename MacroAssemblerType::ResultCondition cond, typename MacroAssemblerType::TrustedImm32 value)
+{
+    if (isUnsigned&lt;MacroAssemblerType&gt;(cond))
+        return typename MacroAssemblerType::TrustedImm32(static_cast&lt;uint8_t&gt;(value.m_value));
+    ASSERT_WITH_MESSAGE(cond != MacroAssemblerType::Overflow, &quot;Overflow is not used for 8bit test operations.&quot;);
+    ASSERT(isSigned&lt;MacroAssemblerType&gt;(cond));
+    return typename MacroAssemblerType::TrustedImm32(static_cast&lt;int8_t&gt;(value.m_value));
+}
+
+template&lt;typename MacroAssemblerType, typename Condition, typename ...Args&gt;
+void load8OnCondition(MacroAssemblerType&amp; jit, Condition cond, Args... args)
+{
+    if (isUnsigned&lt;MacroAssemblerType&gt;(cond))
+        return jit.load8(std::forward&lt;Args&gt;(args)...);
+    return jit.load8SignedExtendTo32(std::forward&lt;Args&gt;(args)...);
+}
+
+} } // namespace JSC
</ins></span></pre></div>
<a id="trunkSourceJavaScriptCoreassemblerMacroAssemblerMIPSh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/assembler/MacroAssemblerMIPS.h (208449 => 208450)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/assembler/MacroAssemblerMIPS.h        2016-11-09 19:10:15 UTC (rev 208449)
+++ trunk/Source/JavaScriptCore/assembler/MacroAssemblerMIPS.h        2016-11-09 19:10:42 UTC (rev 208450)
</span><span class="lines">@@ -1445,8 +1445,8 @@
</span><span class="cx"> 
</span><span class="cx">     Jump branch8(RelationalCondition cond, Address left, TrustedImm32 right)
</span><span class="cx">     {
</span><del>-        TrustedImm32 right8(static_cast&lt;int8_t&gt;(right.m_value));
-        load8(left, dataTempRegister);
</del><ins>+        TrustedImm32 right8 = MacroAssemblerHelpers::mask8OnCondition(*this, cond, right);
+        MacroAssemblerHelpers::load8OnCondition(*this, cond, left, dataTempRegister);
</ins><span class="cx">         move(right8, immTempRegister);
</span><span class="cx">         return branch32(cond, dataTempRegister, immTempRegister);
</span><span class="cx">     }
</span><span class="lines">@@ -1453,8 +1453,8 @@
</span><span class="cx"> 
</span><span class="cx">     Jump branch8(RelationalCondition cond, AbsoluteAddress left, TrustedImm32 right)
</span><span class="cx">     {
</span><del>-        TrustedImm32 right8(static_cast&lt;int8_t&gt;(right.m_value));
-        load8(left, dataTempRegister);
</del><ins>+        TrustedImm32 right8 = MacroAssemblerHelpers::mask8OnCondition(*this, cond, right);
+        MacroAssemblerHelpers::load8OnCondition(*this, cond, left, dataTempRegister);
</ins><span class="cx">         move(right8, immTempRegister);
</span><span class="cx">         return branch32(cond, dataTempRegister, immTempRegister);
</span><span class="cx">     }
</span><span class="lines">@@ -1461,8 +1461,8 @@
</span><span class="cx"> 
</span><span class="cx">     void compare8(RelationalCondition cond, Address left, TrustedImm32 right, RegisterID dest)
</span><span class="cx">     {
</span><del>-        TrustedImm32 right8(static_cast&lt;int8_t&gt;(right.m_value));
-        load8(left, dataTempRegister);
</del><ins>+        TrustedImm32 right8 = MacroAssemblerHelpers::mask8OnCondition(*this, cond, right);
+        MacroAssemblerHelpers::load8OnCondition(*this, cond, left, dataTempRegister);
</ins><span class="cx">         move(right8, immTempRegister);
</span><span class="cx">         compare32(cond, dataTempRegister, immTempRegister, dest);
</span><span class="cx">     }
</span><span class="lines">@@ -1469,8 +1469,8 @@
</span><span class="cx"> 
</span><span class="cx">     Jump branch8(RelationalCondition cond, BaseIndex left, TrustedImm32 right)
</span><span class="cx">     {
</span><del>-        TrustedImm32 right8(static_cast&lt;int8_t&gt;(right.m_value));
-        load8(left, dataTempRegister);
</del><ins>+        TrustedImm32 right8 = MacroAssemblerHelpers::mask8OnCondition(*this, cond, right);
+        MacroAssemblerHelpers::load8OnCondition(*this, cond, left, dataTempRegister);
</ins><span class="cx">         // Be careful that the previous load8() uses immTempRegister.
</span><span class="cx">         // So, we need to put move() after load8().
</span><span class="cx">         move(right8, immTempRegister);
</span><span class="lines">@@ -1628,23 +1628,23 @@
</span><span class="cx"> 
</span><span class="cx">     Jump branchTest8(ResultCondition cond, BaseIndex address, TrustedImm32 mask = TrustedImm32(-1))
</span><span class="cx">     {
</span><del>-        TrustedImm32 mask8(static_cast&lt;int8_t&gt;(mask.m_value));
-        load8(address, dataTempRegister);
</del><ins>+        TrustedImm32 mask8 = MacroAssemblerHelpers::mask8OnCondition(*this, cond, mask);
+        MacroAssemblerHelpers::load8OnCondition(*this, cond, address, dataTempRegister);
</ins><span class="cx">         return branchTest32(cond, dataTempRegister, mask8);
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     Jump branchTest8(ResultCondition cond, Address address, TrustedImm32 mask = TrustedImm32(-1))
</span><span class="cx">     {
</span><del>-        TrustedImm32 mask8(static_cast&lt;int8_t&gt;(mask.m_value));
-        load8(address, dataTempRegister);
</del><ins>+        TrustedImm32 mask8 = MacroAssemblerHelpers::mask8OnCondition(*this, cond, mask);
+        MacroAssemblerHelpers::load8OnCondition(*this, cond, address, dataTempRegister);
</ins><span class="cx">         return branchTest32(cond, dataTempRegister, mask8);
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     Jump branchTest8(ResultCondition cond, AbsoluteAddress address, TrustedImm32 mask = TrustedImm32(-1))
</span><span class="cx">     {
</span><del>-        TrustedImm32 mask8(static_cast&lt;int8_t&gt;(mask.m_value));
</del><ins>+        TrustedImm32 mask8 = MacroAssemblerHelpers::mask8OnCondition(*this, cond, mask);
</ins><span class="cx">         move(TrustedImmPtr(address.m_ptr), dataTempRegister);
</span><del>-        load8(Address(dataTempRegister), dataTempRegister);
</del><ins>+        MacroAssemblerHelpers::load8OnCondition(*this, cond, Address(dataTempRegister), dataTempRegister);
</ins><span class="cx">         return branchTest32(cond, dataTempRegister, mask8);
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="lines">@@ -2218,9 +2218,9 @@
</span><span class="cx">     void test8(ResultCondition cond, Address address, TrustedImm32 mask, RegisterID dest)
</span><span class="cx">     {
</span><span class="cx">         ASSERT((cond == Zero) || (cond == NonZero));
</span><del>-        TrustedImm32 mask8(static_cast&lt;int8_t&gt;(mask.m_value));
-        load8(address, dataTempRegister);
-        if (mask8.m_value == -1 &amp;&amp; !m_fixedWidth) {
</del><ins>+        TrustedImm32 mask8 = MacroAssemblerHelpers::mask8OnCondition(*this, cond, mask);
+        MacroAssemblerHelpers::load8OnCondition(*this, cond, address, dataTempRegister);
+        if ((mask8.m_value &amp; 0xff) == 0xff &amp;&amp; !m_fixedWidth) {
</ins><span class="cx">             if (cond == Zero)
</span><span class="cx">                 m_assembler.sltiu(dest, dataTempRegister, 1);
</span><span class="cx">             else
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreassemblerMacroAssemblerSH4h"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/assembler/MacroAssemblerSH4.h (208449 => 208450)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/assembler/MacroAssemblerSH4.h        2016-11-09 19:10:15 UTC (rev 208449)
+++ trunk/Source/JavaScriptCore/assembler/MacroAssemblerSH4.h        2016-11-09 19:10:42 UTC (rev 208450)
</span><span class="lines">@@ -1605,9 +1605,9 @@
</span><span class="cx"> 
</span><span class="cx">     Jump branchTest8(ResultCondition cond, Address address, TrustedImm32 mask = TrustedImm32(-1))
</span><span class="cx">     {
</span><del>-        TrustedImm32 mask8(static_cast&lt;int8_t&gt;(mask.m_value));
</del><ins>+        TrustedImm32 mask8 = MacroAssemblerHelpers::mask8OnCondition(*this, cond, mask);
</ins><span class="cx">         RegisterID addressTempRegister = claimScratch();
</span><del>-        load8(address, addressTempRegister);
</del><ins>+        MacroAssemblerHelpers::load8OnCondition(*this, cond, address, addressTempRegister);
</ins><span class="cx">         Jump jmp = branchTest32(cond, addressTempRegister, mask8);
</span><span class="cx">         releaseScratch(addressTempRegister);
</span><span class="cx">         return jmp;
</span><span class="lines">@@ -1615,9 +1615,9 @@
</span><span class="cx"> 
</span><span class="cx">     Jump branchTest8(ResultCondition cond, BaseIndex address, TrustedImm32 mask = TrustedImm32(-1))
</span><span class="cx">     {
</span><del>-        TrustedImm32 mask8(static_cast&lt;int8_t&gt;(mask.m_value));
</del><ins>+        TrustedImm32 mask8 = MacroAssemblerHelpers::mask8OnCondition(*this, cond, mask);
</ins><span class="cx">         RegisterID addressTempRegister = claimScratch();
</span><del>-        load8(address, addressTempRegister);
</del><ins>+        MacroAssemblerHelpers::load8OnCondition(*this, cond, address, addressTempRegister);
</ins><span class="cx">         Jump jmp = branchTest32(cond, addressTempRegister, mask8);
</span><span class="cx">         releaseScratch(addressTempRegister);
</span><span class="cx">         return jmp;
</span><span class="lines">@@ -1625,10 +1625,10 @@
</span><span class="cx"> 
</span><span class="cx">     Jump branchTest8(ResultCondition cond, AbsoluteAddress address, TrustedImm32 mask = TrustedImm32(-1))
</span><span class="cx">     {
</span><del>-        TrustedImm32 mask8(static_cast&lt;int8_t&gt;(mask.m_value));
</del><ins>+        TrustedImm32 mask8 = MacroAssemblerHelpers::mask8OnCondition(*this, cond, mask);
</ins><span class="cx">         RegisterID addressTempRegister = claimScratch();
</span><span class="cx">         move(TrustedImmPtr(address.m_ptr), addressTempRegister);
</span><del>-        load8(Address(addressTempRegister), addressTempRegister);
</del><ins>+        MacroAssemblerHelpers::load8OnCondition(*this, cond, Address(addressTempRegister), addressTempRegister);
</ins><span class="cx">         Jump jmp = branchTest32(cond, addressTempRegister, mask8);
</span><span class="cx">         releaseScratch(addressTempRegister);
</span><span class="cx">         return jmp;
</span><span class="lines">@@ -1646,9 +1646,9 @@
</span><span class="cx"> 
</span><span class="cx">     Jump branch8(RelationalCondition cond, Address left, TrustedImm32 right)
</span><span class="cx">     {
</span><del>-        TrustedImm32 right8(static_cast&lt;int8_t&gt;(right.m_value));
</del><ins>+        TrustedImm32 right8 = MacroAssemblerHelpers::mask8OnCondition(*this, cond, right);
</ins><span class="cx">         RegisterID addressTempRegister = claimScratch();
</span><del>-        load8(left, addressTempRegister);
</del><ins>+        MacroAssemblerHelpers::load8OnCondition(*this, cond, left, addressTempRegister);
</ins><span class="cx">         Jump jmp = branch32(cond, addressTempRegister, right8);
</span><span class="cx">         releaseScratch(addressTempRegister);
</span><span class="cx">         return jmp;
</span><span class="lines">@@ -1656,9 +1656,9 @@
</span><span class="cx"> 
</span><span class="cx">     Jump branch8(RelationalCondition cond, AbsoluteAddress left, TrustedImm32 right)
</span><span class="cx">     {
</span><del>-        TrustedImm32 right8(static_cast&lt;int8_t&gt;(right.m_value));
</del><ins>+        TrustedImm32 right8 = MacroAssemblerHelpers::mask8OnCondition(*this, cond, right);
</ins><span class="cx">         RegisterID addressTempRegister = claimScratch();
</span><del>-        load8(left, addressTempRegister);
</del><ins>+        MacroAssemblerHelpers::load8OnCondition(*this, cond, left, addressTempRegister);
</ins><span class="cx">         Jump jmp = branch32(cond, addressTempRegister, right8);
</span><span class="cx">         releaseScratch(addressTempRegister);
</span><span class="cx">         return jmp;
</span><span class="lines">@@ -1666,9 +1666,9 @@
</span><span class="cx"> 
</span><span class="cx">     void compare8(RelationalCondition cond, Address left, TrustedImm32 right, RegisterID dest)
</span><span class="cx">     {
</span><del>-        TrustedImm32 right8(static_cast&lt;int8_t&gt;(right.m_value));
</del><ins>+        TrustedImm32 right8 = MacroAssemblerHelpers::mask8OnCondition(*this, cond, right);
</ins><span class="cx">         RegisterID addressTempRegister = claimScratch();
</span><del>-        load8(left, addressTempRegister);
</del><ins>+        MacroAssemblerHelpers::load8OnCondition(*this, cond, left, addressTempRegister);
</ins><span class="cx">         compare32(cond, addressTempRegister, right8, dest);
</span><span class="cx">         releaseScratch(addressTempRegister);
</span><span class="cx">     }
</span><span class="lines">@@ -1841,10 +1841,10 @@
</span><span class="cx">     {
</span><span class="cx">         ASSERT((cond == Zero) || (cond == NonZero));
</span><span class="cx"> 
</span><del>-        TrustedImm32 mask8(static_cast&lt;int8_t&gt;(mask.m_value));
</del><ins>+        TrustedImm32 mask8 = MacroAssemblerHelpers::mask8OnCondition(*this, cond, mask);
</ins><span class="cx"> 
</span><del>-        load8(address, dest);
-        if (mask8.m_value == -1)
</del><ins>+        MacroAssemblerHelpers::load8OnCondition(*this, cond, address, dest);
+        if ((mask8.m_value &amp; 0xff) == 0xff)
</ins><span class="cx">             compare32(0, dest, static_cast&lt;RelationalCondition&gt;(cond));
</span><span class="cx">         else
</span><span class="cx">             testlImm(mask8.m_value, dest);
</span><span class="lines">@@ -1965,12 +1965,12 @@
</span><span class="cx"> 
</span><span class="cx">     Jump branch8(RelationalCondition cond, BaseIndex left, TrustedImm32 right)
</span><span class="cx">     {
</span><del>-        TrustedImm32 right8(static_cast&lt;int8_t&gt;(right.m_value));
</del><ins>+        TrustedImm32 right8 = MacroAssemblerHelpers::mask8OnCondition(*this, cond, right);
</ins><span class="cx">         RegisterID lefttmp = claimScratch();
</span><span class="cx"> 
</span><span class="cx">         loadEffectiveAddress(left, lefttmp);
</span><span class="cx"> 
</span><del>-        load8(lefttmp, lefttmp);
</del><ins>+        MacroAssemblerHelpers::load8OnCondition(*this, cond, lefttmp, lefttmp);
</ins><span class="cx">         RegisterID righttmp = claimScratch();
</span><span class="cx">         m_assembler.loadConstant(right8.m_value, righttmp);
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreassemblerMacroAssemblerX86_64h"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/assembler/MacroAssemblerX86_64.h (208449 => 208450)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/assembler/MacroAssemblerX86_64.h        2016-11-09 19:10:15 UTC (rev 208449)
+++ trunk/Source/JavaScriptCore/assembler/MacroAssemblerX86_64.h        2016-11-09 19:10:42 UTC (rev 208450)
</span><span class="lines">@@ -1220,9 +1220,8 @@
</span><span class="cx">     using MacroAssemblerX86Common::branch8;
</span><span class="cx">     Jump branch8(RelationalCondition cond, AbsoluteAddress left, TrustedImm32 right)
</span><span class="cx">     {
</span><del>-        TrustedImm32 right8(static_cast&lt;int8_t&gt;(right.m_value));
</del><span class="cx">         MacroAssemblerX86Common::move(TrustedImmPtr(left.m_ptr), scratchRegister());
</span><del>-        return MacroAssemblerX86Common::branch8(cond, Address(scratchRegister()), right8);
</del><ins>+        return MacroAssemblerX86Common::branch8(cond, Address(scratchRegister()), right);
</ins><span class="cx">     }
</span><span class="cx">     
</span><span class="cx">     using MacroAssemblerX86Common::branchTest8;
</span></span></pre>
</div>
</div>

</body>
</html>