<!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>[234984] trunk/Source</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/234984">234984</a></dd>
<dt>Author</dt> <dd>yusukesuzuki@slowstart.org</dd>
<dt>Date</dt> <dd>2018-08-17 08:26:19 -0700 (Fri, 17 Aug 2018)</dd>
</dl>

<h3>Log Message</h3>
<pre>[JSC] Add GPRReg::InvalidGPRReg and FPRReg::InvalidFPRReg
https://bugs.webkit.org/show_bug.cgi?id=188589

Patch by Yusuke Suzuki  <yusukesuzuki@slowstart.org> and Fujii Hironori <Hironori.Fujii@sony.com> on 2018-08-17
Reviewed by Mark Lam.
And reviewed by Yusuke Suzuki for Hironori's change.

Source/JavaScriptCore:

Since GPRReg(RegisterID) and FPRReg(FPRegisterID) do not include -1 in their enum values,
UBSan dumps bunch of warnings "runtime error: load of value 4294967295, which is not a valid value for type 'RegisterID'".

- We add InvalidGPRReg and InvalidFPRReg to enum values of GPRReg and FPRReg to suppress the above warnings.
- We make GPRReg and FPRReg int8_t enums.
- We replace `#define InvalidGPRReg ((JSC::GPRReg)-1)` to `static constexpr GPRReg InvalidGPRReg { GPRReg::InvalidGPRReg };`.
- We add operator+/- definition for RegisterIDs as a MSVC workaround. MSVC fails to resolve operator+ and operator-
  if `enum : int8_t` is used instead of `enum`.

* assembler/ARM64Assembler.h:
* assembler/ARMAssembler.h:
* assembler/ARMv7Assembler.h:
* assembler/MIPSAssembler.h:
* assembler/MacroAssembler.h:
* assembler/X86Assembler.h:
* jit/CCallHelpers.h:
(JSC::CCallHelpers::clampArrayToSize):
* jit/FPRInfo.h:
* jit/GPRInfo.h:
(JSC::JSValueRegs::JSValueRegs):
(JSC::JSValueRegs::tagGPR const):
(JSC::JSValueRegs::payloadGPR const):
(JSC::JSValueSource::JSValueSource):
(JSC::JSValueSource::unboxedCell):
(JSC::JSValueSource::operator bool const):
(JSC::JSValueSource::base const):
(JSC::JSValueSource::tagGPR const):
(JSC::JSValueSource::payloadGPR const):
(JSC::JSValueSource::hasKnownTag const):

Source/WebCore:

* cssjit/FunctionCall.h:
(WebCore::FunctionCall::FunctionCall):
* cssjit/SelectorCompiler.cpp:
(WebCore::SelectorCompiler::SelectorCodeGenerator::modulo):
* html/HTMLKeygenElement.cpp:
Remove `using namespace WebCore` not to introduce `operator+/-` which makes the resolution of `operator+/-` for RegisterID ambiguous.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceJavaScriptCoreChangeLog">trunk/Source/JavaScriptCore/ChangeLog</a></li>
<li><a href="#trunkSourceJavaScriptCoreassemblerARM64Assemblerh">trunk/Source/JavaScriptCore/assembler/ARM64Assembler.h</a></li>
<li><a href="#trunkSourceJavaScriptCoreassemblerARMAssemblerh">trunk/Source/JavaScriptCore/assembler/ARMAssembler.h</a></li>
<li><a href="#trunkSourceJavaScriptCoreassemblerARMv7Assemblerh">trunk/Source/JavaScriptCore/assembler/ARMv7Assembler.h</a></li>
<li><a href="#trunkSourceJavaScriptCoreassemblerMIPSAssemblerh">trunk/Source/JavaScriptCore/assembler/MIPSAssembler.h</a></li>
<li><a href="#trunkSourceJavaScriptCoreassemblerMacroAssemblerh">trunk/Source/JavaScriptCore/assembler/MacroAssembler.h</a></li>
<li><a href="#trunkSourceJavaScriptCoreassemblerX86Assemblerh">trunk/Source/JavaScriptCore/assembler/X86Assembler.h</a></li>
<li><a href="#trunkSourceJavaScriptCorejitCCallHelpersh">trunk/Source/JavaScriptCore/jit/CCallHelpers.h</a></li>
<li><a href="#trunkSourceJavaScriptCorejitFPRInfoh">trunk/Source/JavaScriptCore/jit/FPRInfo.h</a></li>
<li><a href="#trunkSourceJavaScriptCorejitGPRInfoh">trunk/Source/JavaScriptCore/jit/GPRInfo.h</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCorecssjitFunctionCallh">trunk/Source/WebCore/cssjit/FunctionCall.h</a></li>
<li><a href="#trunkSourceWebCorecssjitSelectorCompilercpp">trunk/Source/WebCore/cssjit/SelectorCompiler.cpp</a></li>
<li><a href="#trunkSourceWebCorehtmlHTMLKeygenElementcpp">trunk/Source/WebCore/html/HTMLKeygenElement.cpp</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceJavaScriptCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/ChangeLog (234983 => 234984)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/ChangeLog    2018-08-17 14:07:33 UTC (rev 234983)
+++ trunk/Source/JavaScriptCore/ChangeLog       2018-08-17 15:26:19 UTC (rev 234984)
</span><span class="lines">@@ -1,3 +1,41 @@
</span><ins>+2018-08-17  Yusuke Suzuki  <yusukesuzuki@slowstart.org> and Fujii Hironori  <Hironori.Fujii@sony.com>
+
+        [JSC] Add GPRReg::InvalidGPRReg and FPRReg::InvalidFPRReg
+        https://bugs.webkit.org/show_bug.cgi?id=188589
+
+        Reviewed by Mark Lam.
+        And reviewed by Yusuke Suzuki for Hironori's change.
+
+        Since GPRReg(RegisterID) and FPRReg(FPRegisterID) do not include -1 in their enum values,
+        UBSan dumps bunch of warnings "runtime error: load of value 4294967295, which is not a valid value for type 'RegisterID'".
+
+        - We add InvalidGPRReg and InvalidFPRReg to enum values of GPRReg and FPRReg to suppress the above warnings.
+        - We make GPRReg and FPRReg int8_t enums.
+        - We replace `#define InvalidGPRReg ((JSC::GPRReg)-1)` to `static constexpr GPRReg InvalidGPRReg { GPRReg::InvalidGPRReg };`.
+        - We add operator+/- definition for RegisterIDs as a MSVC workaround. MSVC fails to resolve operator+ and operator-
+          if `enum : int8_t` is used instead of `enum`.
+
+        * assembler/ARM64Assembler.h:
+        * assembler/ARMAssembler.h:
+        * assembler/ARMv7Assembler.h:
+        * assembler/MIPSAssembler.h:
+        * assembler/MacroAssembler.h:
+        * assembler/X86Assembler.h:
+        * jit/CCallHelpers.h:
+        (JSC::CCallHelpers::clampArrayToSize):
+        * jit/FPRInfo.h:
+        * jit/GPRInfo.h:
+        (JSC::JSValueRegs::JSValueRegs):
+        (JSC::JSValueRegs::tagGPR const):
+        (JSC::JSValueRegs::payloadGPR const):
+        (JSC::JSValueSource::JSValueSource):
+        (JSC::JSValueSource::unboxedCell):
+        (JSC::JSValueSource::operator bool const):
+        (JSC::JSValueSource::base const):
+        (JSC::JSValueSource::tagGPR const):
+        (JSC::JSValueSource::payloadGPR const):
+        (JSC::JSValueSource::hasKnownTag const):
+
</ins><span class="cx"> 2018-08-16  Yusuke Suzuki  <yusukesuzuki@slowstart.org>
</span><span class="cx"> 
</span><span class="cx">         [JSC] alignas for RegisterState should respect alignof(RegisterState) too
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreassemblerARM64Assemblerh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/assembler/ARM64Assembler.h (234983 => 234984)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/assembler/ARM64Assembler.h   2018-08-17 14:07:33 UTC (rev 234983)
+++ trunk/Source/JavaScriptCore/assembler/ARM64Assembler.h      2018-08-17 15:26:19 UTC (rev 234984)
</span><span class="lines">@@ -162,7 +162,7 @@
</span><span class="cx"> 
</span><span class="cx"> namespace ARM64Registers {
</span><span class="cx"> 
</span><del>-typedef enum {
</del><ins>+typedef enum : int8_t {
</ins><span class="cx">     // Parameter/result registers.
</span><span class="cx">     x0,
</span><span class="cx">     x1,
</span><span class="lines">@@ -208,9 +208,10 @@
</span><span class="cx">     x29 = fp,
</span><span class="cx">     x30 = lr,
</span><span class="cx">     zr = 0x3f,
</span><ins>+    InvalidGPRReg = -1,
</ins><span class="cx"> } RegisterID;
</span><span class="cx"> 
</span><del>-typedef enum {
</del><ins>+typedef enum : int8_t {
</ins><span class="cx">     pc,
</span><span class="cx">     nzcv,
</span><span class="cx">     fpsr
</span><span class="lines">@@ -219,7 +220,7 @@
</span><span class="cx"> // ARM64 always has 32 FPU registers 128-bits each. See http://llvm.org/devmtg/2012-11/Northover-AArch64.pdf
</span><span class="cx"> // and Section 5.1.2 in http://infocenter.arm.com/help/topic/com.arm.doc.ihi0055b/IHI0055B_aapcs64.pdf.
</span><span class="cx"> // However, we only use them for 64-bit doubles.
</span><del>-typedef enum {
</del><ins>+typedef enum : int8_t {
</ins><span class="cx">     // Parameter/result registers.
</span><span class="cx">     q0,
</span><span class="cx">     q1,
</span><span class="lines">@@ -255,6 +256,7 @@
</span><span class="cx">     q29,
</span><span class="cx">     q30,
</span><span class="cx">     q31,
</span><ins>+    InvalidFPRReg = -1,
</ins><span class="cx"> } FPRegisterID;
</span><span class="cx"> 
</span><span class="cx"> static constexpr bool isSp(RegisterID reg) { return reg == sp; }
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreassemblerARMAssemblerh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/assembler/ARMAssembler.h (234983 => 234984)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/assembler/ARMAssembler.h     2018-08-17 14:07:33 UTC (rev 234983)
+++ trunk/Source/JavaScriptCore/assembler/ARMAssembler.h        2018-08-17 15:26:19 UTC (rev 234984)
</span><span class="lines">@@ -38,7 +38,7 @@
</span><span class="cx"> 
</span><span class="cx">     namespace ARMRegisters {
</span><span class="cx"> 
</span><del>-        typedef enum {
</del><ins>+        typedef enum : int8_t {
</ins><span class="cx">             r0,
</span><span class="cx">             r1,
</span><span class="cx">             r2,
</span><span class="lines">@@ -62,15 +62,16 @@
</span><span class="cx">             r12 = ip, S1 = ip,
</span><span class="cx">             r13 = sp,
</span><span class="cx">             r14 = lr,
</span><del>-            r15 = pc
</del><ins>+            r15 = pc,
+            InvalidGPRReg = -1,
</ins><span class="cx">         } RegisterID;
</span><span class="cx"> 
</span><del>-        typedef enum {
</del><ins>+        typedef enum : int8_t {
</ins><span class="cx">             apsr,
</span><span class="cx">             fpscr
</span><span class="cx">         } SPRegisterID;
</span><span class="cx"> 
</span><del>-        typedef enum {
</del><ins>+        typedef enum : int8_t {
</ins><span class="cx">             d0,
</span><span class="cx">             d1,
</span><span class="cx">             d2,
</span><span class="lines">@@ -105,6 +106,7 @@
</span><span class="cx">             d30,
</span><span class="cx">             d31,
</span><span class="cx"> #endif // CPU(ARM_NEON) || CPU(ARM_VFP_V3_D32)
</span><ins>+            InvalidFPRReg = -1,
</ins><span class="cx">         } FPRegisterID;
</span><span class="cx"> 
</span><span class="cx">     } // namespace ARMRegisters
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreassemblerARMv7Assemblerh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/assembler/ARMv7Assembler.h (234983 => 234984)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/assembler/ARMv7Assembler.h   2018-08-17 14:07:33 UTC (rev 234983)
+++ trunk/Source/JavaScriptCore/assembler/ARMv7Assembler.h      2018-08-17 15:26:19 UTC (rev 234984)
</span><span class="lines">@@ -39,7 +39,7 @@
</span><span class="cx"> 
</span><span class="cx"> namespace ARMRegisters {
</span><span class="cx"> 
</span><del>-    typedef enum {
</del><ins>+    typedef enum : int8_t {
</ins><span class="cx">         r0,
</span><span class="cx">         r1,
</span><span class="cx">         r2,
</span><span class="lines">@@ -63,15 +63,16 @@
</span><span class="cx">         ip = r12,
</span><span class="cx">         sp = r13,
</span><span class="cx">         lr = r14,
</span><del>-        pc = r15
</del><ins>+        pc = r15,
+        InvalidGPRReg = -1,
</ins><span class="cx">     } RegisterID;
</span><span class="cx"> 
</span><del>-    typedef enum {
</del><ins>+    typedef enum : int8_t {
</ins><span class="cx">         apsr,
</span><span class="cx">         fpscr
</span><span class="cx">     } SPRegisterID;
</span><span class="cx"> 
</span><del>-    typedef enum {
</del><ins>+    typedef enum : int8_t {
</ins><span class="cx">         s0,
</span><span class="cx">         s1,
</span><span class="cx">         s2,
</span><span class="lines">@@ -106,7 +107,7 @@
</span><span class="cx">         s31,
</span><span class="cx">     } FPSingleRegisterID;
</span><span class="cx"> 
</span><del>-    typedef enum {
</del><ins>+    typedef enum : int8_t {
</ins><span class="cx">         d0,
</span><span class="cx">         d1,
</span><span class="cx">         d2,
</span><span class="lines">@@ -141,10 +142,11 @@
</span><span class="cx">         d30,
</span><span class="cx">         d31,
</span><span class="cx"> #endif // CPU(ARM_NEON) || CPU(ARM_VFP_V3_D32)
</span><ins>+        InvalidFPRReg = -1,
</ins><span class="cx">     } FPDoubleRegisterID;
</span><span class="cx"> 
</span><span class="cx"> #if CPU(ARM_NEON)
</span><del>-    typedef enum {
</del><ins>+    typedef enum : int8_t {
</ins><span class="cx">         q0,
</span><span class="cx">         q1,
</span><span class="cx">         q2,
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreassemblerMIPSAssemblerh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/assembler/MIPSAssembler.h (234983 => 234984)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/assembler/MIPSAssembler.h    2018-08-17 14:07:33 UTC (rev 234983)
+++ trunk/Source/JavaScriptCore/assembler/MIPSAssembler.h       2018-08-17 15:26:19 UTC (rev 234984)
</span><span class="lines">@@ -41,7 +41,7 @@
</span><span class="cx"> typedef uint32_t MIPSWord;
</span><span class="cx"> 
</span><span class="cx"> namespace MIPSRegisters {
</span><del>-typedef enum {
</del><ins>+typedef enum : int8_t {
</ins><span class="cx">     r0 = 0,
</span><span class="cx">     r1,
</span><span class="cx">     r2,
</span><span class="lines">@@ -105,10 +105,11 @@
</span><span class="cx">     gp = r28,
</span><span class="cx">     sp = r29,
</span><span class="cx">     fp = r30,
</span><del>-    ra = r31
</del><ins>+    ra = r31,
+    InvalidGPRReg = -1,
</ins><span class="cx"> } RegisterID;
</span><span class="cx"> 
</span><del>-typedef enum {
</del><ins>+typedef enum : int8_t {
</ins><span class="cx">     fir = 0,
</span><span class="cx">     fccr = 25,
</span><span class="cx">     fexr = 26,
</span><span class="lines">@@ -117,7 +118,7 @@
</span><span class="cx">     pc
</span><span class="cx"> } SPRegisterID;
</span><span class="cx"> 
</span><del>-typedef enum {
</del><ins>+typedef enum : int8_t {
</ins><span class="cx">     f0,
</span><span class="cx">     f1,
</span><span class="cx">     f2,
</span><span class="lines">@@ -149,7 +150,8 @@
</span><span class="cx">     f28,
</span><span class="cx">     f29,
</span><span class="cx">     f30,
</span><del>-    f31
</del><ins>+    f31,
+    InvalidFPRReg = -1,
</ins><span class="cx"> } FPRegisterID;
</span><span class="cx"> 
</span><span class="cx"> } // namespace MIPSRegisters
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreassemblerMacroAssemblerh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/assembler/MacroAssembler.h (234983 => 234984)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/assembler/MacroAssembler.h   2018-08-17 14:07:33 UTC (rev 234983)
+++ trunk/Source/JavaScriptCore/assembler/MacroAssembler.h      2018-08-17 15:26:19 UTC (rev 234984)
</span><span class="lines">@@ -1997,8 +1997,8 @@
</span><span class="cx">     
</span><span class="cx"> public:
</span><span class="cx">     
</span><del>-    enum RegisterID { NoRegister };
-    enum FPRegisterID { NoFPRegister };
</del><ins>+    enum RegisterID : int8_t { NoRegister, InvalidGPRReg = -1 };
+    enum FPRegisterID : int8_t { NoFPRegister, InvalidFPRReg = -1 };
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> } // namespace JSC
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreassemblerX86Assemblerh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/assembler/X86Assembler.h (234983 => 234984)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/assembler/X86Assembler.h     2018-08-17 14:07:33 UTC (rev 234983)
+++ trunk/Source/JavaScriptCore/assembler/X86Assembler.h        2018-08-17 15:26:19 UTC (rev 234984)
</span><span class="lines">@@ -41,7 +41,7 @@
</span><span class="cx"> 
</span><span class="cx"> namespace X86Registers {
</span><span class="cx"> 
</span><del>-typedef enum {
</del><ins>+typedef enum : int8_t {
</ins><span class="cx">     eax,
</span><span class="cx">     ecx,
</span><span class="cx">     edx,
</span><span class="lines">@@ -58,16 +58,17 @@
</span><span class="cx">     r12,
</span><span class="cx">     r13,
</span><span class="cx">     r14,
</span><del>-    r15
</del><ins>+    r15,
</ins><span class="cx"> #endif
</span><ins>+    InvalidGPRReg = -1,
</ins><span class="cx"> } RegisterID;
</span><span class="cx"> 
</span><del>-typedef enum {
</del><ins>+typedef enum : int8_t {
</ins><span class="cx">     eip,
</span><span class="cx">     eflags
</span><span class="cx"> } SPRegisterID;
</span><span class="cx"> 
</span><del>-typedef enum {
</del><ins>+typedef enum : int8_t {
</ins><span class="cx">     xmm0,
</span><span class="cx">     xmm1,
</span><span class="cx">     xmm2,
</span><span class="lines">@@ -84,8 +85,9 @@
</span><span class="cx">     xmm12,
</span><span class="cx">     xmm13,
</span><span class="cx">     xmm14,
</span><del>-    xmm15
</del><ins>+    xmm15,
</ins><span class="cx"> #endif
</span><ins>+    InvalidFPRReg = -1,
</ins><span class="cx"> } XMMRegisterID;
</span><span class="cx"> 
</span><span class="cx"> } // namespace X86Register
</span></span></pre></div>
<a id="trunkSourceJavaScriptCorejitCCallHelpersh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/jit/CCallHelpers.h (234983 => 234984)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/jit/CCallHelpers.h   2018-08-17 14:07:33 UTC (rev 234983)
+++ trunk/Source/JavaScriptCore/jit/CCallHelpers.h      2018-08-17 15:26:19 UTC (rev 234984)
</span><span class="lines">@@ -314,7 +314,7 @@
</span><span class="cx">         std::array<RegType, TargetSize> result { };
</span><span class="cx"> 
</span><span class="cx">         for (unsigned i = 0; i < TargetSize; i++) {
</span><del>-            ASSERT(sourceArray[i] != InfoTypeForReg<RegType>::InvalidIndex);
</del><ins>+            ASSERT(sourceArray[i] != static_cast<int32_t>(InfoTypeForReg<RegType>::InvalidIndex));
</ins><span class="cx">             result[i] = sourceArray[i];
</span><span class="cx">         }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceJavaScriptCorejitFPRInfoh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/jit/FPRInfo.h (234983 => 234984)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/jit/FPRInfo.h        2018-08-17 14:07:33 UTC (rev 234983)
+++ trunk/Source/JavaScriptCore/jit/FPRInfo.h   2018-08-17 15:26:19 UTC (rev 234984)
</span><span class="lines">@@ -31,7 +31,7 @@
</span><span class="cx"> namespace JSC {
</span><span class="cx"> 
</span><span class="cx"> typedef MacroAssembler::FPRegisterID FPRReg;
</span><del>-#define InvalidFPRReg ((::JSC::FPRReg)-1)
</del><ins>+static constexpr FPRReg InvalidFPRReg { FPRReg::InvalidFPRReg };
</ins><span class="cx"> 
</span><span class="cx"> #if ENABLE(JIT)
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceJavaScriptCorejitGPRInfoh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/jit/GPRInfo.h (234983 => 234984)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/jit/GPRInfo.h        2018-08-17 14:07:33 UTC (rev 234983)
+++ trunk/Source/JavaScriptCore/jit/GPRInfo.h   2018-08-17 15:26:19 UTC (rev 234984)
</span><span class="lines">@@ -39,7 +39,7 @@
</span><span class="cx"> // top of the LowLevelInterpreter.asm file.
</span><span class="cx"> 
</span><span class="cx"> typedef MacroAssembler::RegisterID GPRReg;
</span><del>-#define InvalidGPRReg ((::JSC::GPRReg)-1)
</del><ins>+static constexpr GPRReg InvalidGPRReg { GPRReg::InvalidGPRReg };
</ins><span class="cx"> 
</span><span class="cx"> #if ENABLE(JIT)
</span><span class="cx"> 
</span><span class="lines">@@ -161,8 +161,8 @@
</span><span class="cx"> class JSValueRegs {
</span><span class="cx"> public:
</span><span class="cx">     JSValueRegs()
</span><del>-        : m_tagGPR(static_cast<int8_t>(InvalidGPRReg))
-        , m_payloadGPR(static_cast<int8_t>(InvalidGPRReg))
</del><ins>+        : m_tagGPR(InvalidGPRReg)
+        , m_payloadGPR(InvalidGPRReg)
</ins><span class="cx">     {
</span><span class="cx">     }
</span><span class="cx">     
</span><span class="lines">@@ -196,8 +196,8 @@
</span><span class="cx">     }
</span><span class="cx">     bool operator!=(JSValueRegs other) const { return !(*this == other); }
</span><span class="cx">     
</span><del>-    GPRReg tagGPR() const { return static_cast<GPRReg>(m_tagGPR); }
-    GPRReg payloadGPR() const { return static_cast<GPRReg>(m_payloadGPR); }
</del><ins>+    GPRReg tagGPR() const { return m_tagGPR; }
+    GPRReg payloadGPR() const { return m_payloadGPR; }
</ins><span class="cx">     GPRReg gpr(WhichValueWord which) const
</span><span class="cx">     {
</span><span class="cx">         switch (which) {
</span><span class="lines">@@ -215,8 +215,8 @@
</span><span class="cx">     void dump(PrintStream&) const;
</span><span class="cx">     
</span><span class="cx"> private:
</span><del>-    int8_t m_tagGPR;
-    int8_t m_payloadGPR;
</del><ins>+    GPRReg m_tagGPR;
+    GPRReg m_payloadGPR;
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> class JSValueSource {
</span><span class="lines">@@ -223,8 +223,8 @@
</span><span class="cx"> public:
</span><span class="cx">     JSValueSource()
</span><span class="cx">         : m_offset(notAddress())
</span><del>-        , m_baseOrTag(static_cast<int8_t>(InvalidGPRReg))
-        , m_payload(static_cast<int8_t>(InvalidGPRReg))
</del><ins>+        , m_baseOrTag(InvalidGPRReg)
+        , m_payload(InvalidGPRReg)
</ins><span class="cx">         , m_tagType(0)
</span><span class="cx">     {
</span><span class="cx">     }
</span><span class="lines">@@ -239,8 +239,8 @@
</span><span class="cx">     
</span><span class="cx">     JSValueSource(GPRReg tagGPR, GPRReg payloadGPR)
</span><span class="cx">         : m_offset(notAddress())
</span><del>-        , m_baseOrTag(static_cast<int8_t>(tagGPR))
-        , m_payload(static_cast<int8_t>(payloadGPR))
</del><ins>+        , m_baseOrTag(tagGPR)
+        , m_payload(payloadGPR)
</ins><span class="cx">         , m_tagType(0)
</span><span class="cx">     {
</span><span class="cx">     }
</span><span class="lines">@@ -247,12 +247,12 @@
</span><span class="cx">     
</span><span class="cx">     JSValueSource(MacroAssembler::Address address)
</span><span class="cx">         : m_offset(address.offset)
</span><del>-        , m_baseOrTag(static_cast<int8_t>(address.base))
-        , m_payload(static_cast<int8_t>(InvalidGPRReg))
</del><ins>+        , m_baseOrTag(address.base)
+        , m_payload(InvalidGPRReg)
</ins><span class="cx">         , m_tagType(0)
</span><span class="cx">     {
</span><span class="cx">         ASSERT(m_offset != notAddress());
</span><del>-        ASSERT(static_cast<GPRReg>(m_baseOrTag) != InvalidGPRReg);
</del><ins>+        ASSERT(m_baseOrTag != InvalidGPRReg);
</ins><span class="cx">     }
</span><span class="cx">     
</span><span class="cx">     static JSValueSource unboxedCell(GPRReg payloadGPR)
</span><span class="lines">@@ -259,8 +259,8 @@
</span><span class="cx">     {
</span><span class="cx">         JSValueSource result;
</span><span class="cx">         result.m_offset = notAddress();
</span><del>-        result.m_baseOrTag = static_cast<int8_t>(InvalidGPRReg);
-        result.m_payload = static_cast<int8_t>(payloadGPR);
</del><ins>+        result.m_baseOrTag = InvalidGPRReg;
+        result.m_payload = payloadGPR;
</ins><span class="cx">         result.m_tagType = static_cast<int8_t>(JSValue::CellTag);
</span><span class="cx">         return result;
</span><span class="cx">     }
</span><span class="lines">@@ -268,8 +268,7 @@
</span><span class="cx">     bool operator!() const { return !static_cast<bool>(*this); }
</span><span class="cx">     explicit operator bool() const
</span><span class="cx">     {
</span><del>-        return static_cast<GPRReg>(m_baseOrTag) != InvalidGPRReg
-            || static_cast<GPRReg>(m_payload) != InvalidGPRReg;
</del><ins>+        return m_baseOrTag != InvalidGPRReg || m_payload != InvalidGPRReg;
</ins><span class="cx">     }
</span><span class="cx">     
</span><span class="cx">     bool isAddress() const
</span><span class="lines">@@ -287,19 +286,19 @@
</span><span class="cx">     GPRReg base() const
</span><span class="cx">     {
</span><span class="cx">         ASSERT(isAddress());
</span><del>-        return static_cast<GPRReg>(m_baseOrTag);
</del><ins>+        return m_baseOrTag;
</ins><span class="cx">     }
</span><span class="cx">     
</span><span class="cx">     GPRReg tagGPR() const
</span><span class="cx">     {
</span><del>-        ASSERT(!isAddress() && static_cast<GPRReg>(m_baseOrTag) != InvalidGPRReg);
-        return static_cast<GPRReg>(m_baseOrTag);
</del><ins>+        ASSERT(!isAddress() && m_baseOrTag != InvalidGPRReg);
+        return m_baseOrTag;
</ins><span class="cx">     }
</span><span class="cx">     
</span><span class="cx">     GPRReg payloadGPR() const
</span><span class="cx">     {
</span><span class="cx">         ASSERT(!isAddress());
</span><del>-        return static_cast<GPRReg>(m_payload);
</del><ins>+        return m_payload;
</ins><span class="cx">     }
</span><span class="cx">     
</span><span class="cx">     bool hasKnownTag() const
</span><span class="lines">@@ -306,7 +305,7 @@
</span><span class="cx">     {
</span><span class="cx">         ASSERT(!!*this);
</span><span class="cx">         ASSERT(!isAddress());
</span><del>-        return static_cast<GPRReg>(m_baseOrTag) == InvalidGPRReg;
</del><ins>+        return m_baseOrTag == InvalidGPRReg;
</ins><span class="cx">     }
</span><span class="cx">     
</span><span class="cx">     uint32_t tag() const
</span><span class="lines">@@ -325,8 +324,8 @@
</span><span class="cx">     static inline int32_t notAddress() { return 0x80000000; }     
</span><span class="cx">           
</span><span class="cx">     int32_t m_offset;
</span><del>-    int8_t m_baseOrTag;
-    int8_t m_payload; 
</del><ins>+    GPRReg m_baseOrTag;
+    GPRReg m_payload;
</ins><span class="cx">     int8_t m_tagType; // Contains the low bits of the tag.
</span><span class="cx"> };
</span><span class="cx"> #endif // USE(JSVALUE32_64)
</span></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (234983 => 234984)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog   2018-08-17 14:07:33 UTC (rev 234983)
+++ trunk/Source/WebCore/ChangeLog      2018-08-17 15:26:19 UTC (rev 234984)
</span><span class="lines">@@ -1,3 +1,18 @@
</span><ins>+2018-08-17  Yusuke Suzuki  <yusukesuzuki@slowstart.org> and Fujii Hironori  <Hironori.Fujii@sony.com>
+
+        [JSC] Add GPRReg::InvalidGPRReg and FPRReg::InvalidFPRReg
+        https://bugs.webkit.org/show_bug.cgi?id=188589
+
+        Reviewed by Mark Lam.
+        And reviewed by Yusuke Suzuki for Hironori's change.
+
+        * cssjit/FunctionCall.h:
+        (WebCore::FunctionCall::FunctionCall):
+        * cssjit/SelectorCompiler.cpp:
+        (WebCore::SelectorCompiler::SelectorCodeGenerator::modulo):
+        * html/HTMLKeygenElement.cpp:
+        Remove `using namespace WebCore` not to introduce `operator+/-` which makes the resolution of `operator+/-` for RegisterID ambiguous.
+
</ins><span class="cx"> 2018-08-17  Philippe Normand  <philn@igalia.com>
</span><span class="cx"> 
</span><span class="cx">         [GStreamer] reduce position queries frequency
</span></span></pre></div>
<a id="trunkSourceWebCorecssjitFunctionCallh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/cssjit/FunctionCall.h (234983 => 234984)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/cssjit/FunctionCall.h       2018-08-17 14:07:33 UTC (rev 234983)
+++ trunk/Source/WebCore/cssjit/FunctionCall.h  2018-08-17 15:26:19 UTC (rev 234984)
</span><span class="lines">@@ -43,8 +43,8 @@
</span><span class="cx">         , m_stackAllocator(stackAllocator)
</span><span class="cx">         , m_callRegistry(callRegistry)
</span><span class="cx">         , m_argumentCount(0)
</span><del>-        , m_firstArgument(InvalidGPRReg)
-        , m_secondArgument(InvalidGPRReg)
</del><ins>+        , m_firstArgument(JSC::InvalidGPRReg)
+        , m_secondArgument(JSC::InvalidGPRReg)
</ins><span class="cx">     {
</span><span class="cx">     }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCorecssjitSelectorCompilercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/cssjit/SelectorCompiler.cpp (234983 => 234984)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/cssjit/SelectorCompiler.cpp 2018-08-17 14:07:33 UTC (rev 234983)
+++ trunk/Source/WebCore/cssjit/SelectorCompiler.cpp    2018-08-17 15:26:19 UTC (rev 234984)
</span><span class="lines">@@ -2378,7 +2378,7 @@
</span><span class="cx">     Assembler::RegisterID dividend = JSC::X86Registers::eax;
</span><span class="cx">     RegisterAllocationType dividendAllocation = RegisterAllocationType::External;
</span><span class="cx">     StackAllocator::StackReference temporaryDividendStackReference;
</span><del>-    Assembler::RegisterID temporaryDividendCopy = InvalidGPRReg;
</del><ins>+    Assembler::RegisterID temporaryDividendCopy = JSC::InvalidGPRReg;
</ins><span class="cx">     if (inputDividend != dividend) {
</span><span class="cx">         bool registerIsInUse = m_registerAllocator.allocatedRegisters().contains(dividend);
</span><span class="cx">         if (registerIsInUse) {
</span><span class="lines">@@ -2400,7 +2400,7 @@
</span><span class="cx">     Assembler::RegisterID remainder = JSC::X86Registers::edx;
</span><span class="cx">     RegisterAllocationType remainderAllocation = RegisterAllocationType::External;
</span><span class="cx">     StackAllocator::StackReference temporaryRemainderStackReference;
</span><del>-    Assembler::RegisterID temporaryRemainderCopy = InvalidGPRReg;
</del><ins>+    Assembler::RegisterID temporaryRemainderCopy = JSC::InvalidGPRReg;
</ins><span class="cx">     if (inputDividend != remainder) {
</span><span class="cx">         bool registerIsInUse = m_registerAllocator.allocatedRegisters().contains(remainder);
</span><span class="cx">         if (registerIsInUse) {
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlHTMLKeygenElementcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/HTMLKeygenElement.cpp (234983 => 234984)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/HTMLKeygenElement.cpp  2018-08-17 14:07:33 UTC (rev 234983)
+++ trunk/Source/WebCore/html/HTMLKeygenElement.cpp     2018-08-17 15:26:19 UTC (rev 234984)
</span><span class="lines">@@ -39,8 +39,6 @@
</span><span class="cx"> #include <wtf/NeverDestroyed.h>
</span><span class="cx"> #include <wtf/StdLibExtras.h>
</span><span class="cx"> 
</span><del>-using namespace WebCore;
-
</del><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><span class="cx"> WTF_MAKE_ISO_ALLOCATED_IMPL(HTMLKeygenElement);
</span></span></pre>
</div>
</div>

</body>
</html>