<!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>[181343] trunk/Source/JavaScriptCore</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/181343">181343</a></dd>
<dt>Author</dt> <dd>mark.lam@apple.com</dd>
<dt>Date</dt> <dd>2015-03-10 13:18:24 -0700 (Tue, 10 Mar 2015)</dd>
</dl>

<h3>Log Message</h3>
<pre>Use std::numeric_limits&lt;unsigned&gt;::max() instead of (unsigned)-1.
&lt;https://webkit.org/b/142539&gt;

Reviewed by Benjamin Poulain.

* jit/JIT.cpp:
(JSC::JIT::JIT):
(JSC::JIT::privateCompileMainPass):
(JSC::JIT::privateCompileSlowCases):
(JSC::JIT::privateCompile):
(JSC::JIT::privateCompileExceptionHandlers):
* jit/JITInlines.h:
(JSC::JIT::emitNakedCall):
(JSC::JIT::addSlowCase):
(JSC::JIT::addJump):
(JSC::JIT::emitJumpSlowToHot):
(JSC::JIT::emitGetVirtualRegister):
* jit/SlowPathCall.h:
(JSC::JITSlowPathCall::call):
* yarr/Yarr.h:</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceJavaScriptCoreChangeLog">trunk/Source/JavaScriptCore/ChangeLog</a></li>
<li><a href="#trunkSourceJavaScriptCorejitJITcpp">trunk/Source/JavaScriptCore/jit/JIT.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCorejitJITInlinesh">trunk/Source/JavaScriptCore/jit/JITInlines.h</a></li>
<li><a href="#trunkSourceJavaScriptCorejitSlowPathCallh">trunk/Source/JavaScriptCore/jit/SlowPathCall.h</a></li>
<li><a href="#trunkSourceJavaScriptCoreyarrYarrh">trunk/Source/JavaScriptCore/yarr/Yarr.h</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceJavaScriptCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/ChangeLog (181342 => 181343)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/ChangeLog        2015-03-10 20:11:37 UTC (rev 181342)
+++ trunk/Source/JavaScriptCore/ChangeLog        2015-03-10 20:18:24 UTC (rev 181343)
</span><span class="lines">@@ -1,5 +1,28 @@
</span><span class="cx"> 2015-03-10  Mark Lam  &lt;mark.lam@apple.com&gt;
</span><span class="cx"> 
</span><ins>+        Use std::numeric_limits&lt;unsigned&gt;::max() instead of (unsigned)-1.
+        &lt;https://webkit.org/b/142539&gt;
+
+        Reviewed by Benjamin Poulain.
+
+        * jit/JIT.cpp:
+        (JSC::JIT::JIT):
+        (JSC::JIT::privateCompileMainPass):
+        (JSC::JIT::privateCompileSlowCases):
+        (JSC::JIT::privateCompile):
+        (JSC::JIT::privateCompileExceptionHandlers):
+        * jit/JITInlines.h:
+        (JSC::JIT::emitNakedCall):
+        (JSC::JIT::addSlowCase):
+        (JSC::JIT::addJump):
+        (JSC::JIT::emitJumpSlowToHot):
+        (JSC::JIT::emitGetVirtualRegister):
+        * jit/SlowPathCall.h:
+        (JSC::JITSlowPathCall::call):
+        * yarr/Yarr.h:
+
+2015-03-10  Mark Lam  &lt;mark.lam@apple.com&gt;
+
</ins><span class="cx">         [Win] JSC Build Warnings Need to be Resolved.
</span><span class="cx">         &lt;https://webkit.org/b/142366&gt;
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceJavaScriptCorejitJITcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/jit/JIT.cpp (181342 => 181343)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/jit/JIT.cpp        2015-03-10 20:11:37 UTC (rev 181342)
+++ trunk/Source/JavaScriptCore/jit/JIT.cpp        2015-03-10 20:18:24 UTC (rev 181343)
</span><span class="lines">@@ -75,7 +75,7 @@
</span><span class="cx">     : JSInterfaceJIT(vm, codeBlock)
</span><span class="cx">     , m_interpreter(vm-&gt;interpreter)
</span><span class="cx">     , m_labels(codeBlock ? codeBlock-&gt;numberOfInstructions() : 0)
</span><del>-    , m_bytecodeOffset((unsigned)-1)
</del><ins>+    , m_bytecodeOffset(std::numeric_limits&lt;unsigned&gt;::max())
</ins><span class="cx">     , m_getByIdIndex(UINT_MAX)
</span><span class="cx">     , m_putByIdIndex(UINT_MAX)
</span><span class="cx">     , m_byValInstructionIndex(UINT_MAX)
</span><span class="lines">@@ -317,7 +317,7 @@
</span><span class="cx"> 
</span><span class="cx"> #ifndef NDEBUG
</span><span class="cx">     // Reset this, in order to guard its use with ASSERTs.
</span><del>-    m_bytecodeOffset = (unsigned)-1;
</del><ins>+    m_bytecodeOffset = std::numeric_limits&lt;unsigned&gt;::max();
</ins><span class="cx"> #endif
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -450,7 +450,7 @@
</span><span class="cx"> 
</span><span class="cx"> #ifndef NDEBUG
</span><span class="cx">     // Reset this, in order to guard its use with ASSERTs.
</span><del>-    m_bytecodeOffset = (unsigned)-1;
</del><ins>+    m_bytecodeOffset = std::numeric_limits&lt;unsigned&gt;::max();
</ins><span class="cx"> #endif
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -518,7 +518,7 @@
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx">     if (m_codeBlock-&gt;codeType() == FunctionCode) {
</span><del>-        ASSERT(m_bytecodeOffset == (unsigned)-1);
</del><ins>+        ASSERT(m_bytecodeOffset == std::numeric_limits&lt;unsigned&gt;::max());
</ins><span class="cx">         if (shouldEmitProfiling()) {
</span><span class="cx">             for (int argument = 0; argument &lt; m_codeBlock-&gt;numParameters(); ++argument) {
</span><span class="cx">                 // If this is a constructor, then we want to put in a dummy profiling site (to
</span><span class="lines">@@ -587,7 +587,7 @@
</span><span class="cx">         emitNakedCall(m_vm-&gt;getCTIStub(arityFixupGenerator).code());
</span><span class="cx"> 
</span><span class="cx"> #if !ASSERT_DISABLED
</span><del>-        m_bytecodeOffset = (unsigned)-1; // Reset this, in order to guard its use with ASSERTs.
</del><ins>+        m_bytecodeOffset = std::numeric_limits&lt;unsigned&gt;::max(); // Reset this, in order to guard its use with ASSERTs.
</ins><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx">         jump(beginLabel);
</span><span class="lines">@@ -719,7 +719,7 @@
</span><span class="cx">         poke(GPRInfo::argumentGPR0);
</span><span class="cx">         poke(GPRInfo::argumentGPR1, 1);
</span><span class="cx"> #endif
</span><del>-        m_calls.append(CallRecord(call(), (unsigned)-1, FunctionPtr(lookupExceptionHandlerFromCallerFrame).value()));
</del><ins>+        m_calls.append(CallRecord(call(), std::numeric_limits&lt;unsigned&gt;::max(), FunctionPtr(lookupExceptionHandlerFromCallerFrame).value()));
</ins><span class="cx">         jumpToExceptionHandler();
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="lines">@@ -735,7 +735,7 @@
</span><span class="cx">         poke(GPRInfo::argumentGPR0);
</span><span class="cx">         poke(GPRInfo::argumentGPR1, 1);
</span><span class="cx"> #endif
</span><del>-        m_calls.append(CallRecord(call(), (unsigned)-1, FunctionPtr(lookupExceptionHandler).value()));
</del><ins>+        m_calls.append(CallRecord(call(), std::numeric_limits&lt;unsigned&gt;::max(), FunctionPtr(lookupExceptionHandler).value()));
</ins><span class="cx">         jumpToExceptionHandler();
</span><span class="cx">     }
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceJavaScriptCorejitJITInlinesh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/jit/JITInlines.h (181342 => 181343)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/jit/JITInlines.h        2015-03-10 20:11:37 UTC (rev 181342)
+++ trunk/Source/JavaScriptCore/jit/JITInlines.h        2015-03-10 20:18:24 UTC (rev 181343)
</span><span class="lines">@@ -119,7 +119,7 @@
</span><span class="cx"> 
</span><span class="cx"> ALWAYS_INLINE JIT::Call JIT::emitNakedCall(CodePtr function)
</span><span class="cx"> {
</span><del>-    ASSERT(m_bytecodeOffset != (unsigned)-1); // This method should only be called during hot/cold path generation, so that m_bytecodeOffset is set.
</del><ins>+    ASSERT(m_bytecodeOffset != std::numeric_limits&lt;unsigned&gt;::max()); // This method should only be called during hot/cold path generation, so that m_bytecodeOffset is set.
</ins><span class="cx">     Call nakedCall = nearCall();
</span><span class="cx">     m_calls.append(CallRecord(nakedCall, m_bytecodeOffset, function.executableAddress()));
</span><span class="cx">     return nakedCall;
</span><span class="lines">@@ -648,14 +648,14 @@
</span><span class="cx"> 
</span><span class="cx"> ALWAYS_INLINE void JIT::addSlowCase(Jump jump)
</span><span class="cx"> {
</span><del>-    ASSERT(m_bytecodeOffset != (unsigned)-1); // This method should only be called during hot/cold path generation, so that m_bytecodeOffset is set.
</del><ins>+    ASSERT(m_bytecodeOffset != std::numeric_limits&lt;unsigned&gt;::max()); // This method should only be called during hot/cold path generation, so that m_bytecodeOffset is set.
</ins><span class="cx"> 
</span><span class="cx">     m_slowCases.append(SlowCaseEntry(jump, m_bytecodeOffset));
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> ALWAYS_INLINE void JIT::addSlowCase(JumpList jumpList)
</span><span class="cx"> {
</span><del>-    ASSERT(m_bytecodeOffset != (unsigned)-1); // This method should only be called during hot/cold path generation, so that m_bytecodeOffset is set.
</del><ins>+    ASSERT(m_bytecodeOffset != std::numeric_limits&lt;unsigned&gt;::max()); // This method should only be called during hot/cold path generation, so that m_bytecodeOffset is set.
</ins><span class="cx"> 
</span><span class="cx">     const JumpList::JumpVector&amp; jumpVector = jumpList.jumps();
</span><span class="cx">     size_t size = jumpVector.size();
</span><span class="lines">@@ -665,7 +665,7 @@
</span><span class="cx"> 
</span><span class="cx"> ALWAYS_INLINE void JIT::addSlowCase()
</span><span class="cx"> {
</span><del>-    ASSERT(m_bytecodeOffset != (unsigned)-1); // This method should only be called during hot/cold path generation, so that m_bytecodeOffset is set.
</del><ins>+    ASSERT(m_bytecodeOffset != std::numeric_limits&lt;unsigned&gt;::max()); // This method should only be called during hot/cold path generation, so that m_bytecodeOffset is set.
</ins><span class="cx">     
</span><span class="cx">     Jump emptyJump; // Doing it this way to make Windows happy.
</span><span class="cx">     m_slowCases.append(SlowCaseEntry(emptyJump, m_bytecodeOffset));
</span><span class="lines">@@ -673,14 +673,14 @@
</span><span class="cx"> 
</span><span class="cx"> ALWAYS_INLINE void JIT::addJump(Jump jump, int relativeOffset)
</span><span class="cx"> {
</span><del>-    ASSERT(m_bytecodeOffset != (unsigned)-1); // This method should only be called during hot/cold path generation, so that m_bytecodeOffset is set.
</del><ins>+    ASSERT(m_bytecodeOffset != std::numeric_limits&lt;unsigned&gt;::max()); // This method should only be called during hot/cold path generation, so that m_bytecodeOffset is set.
</ins><span class="cx"> 
</span><span class="cx">     m_jmpTable.append(JumpTable(jump, m_bytecodeOffset + relativeOffset));
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> ALWAYS_INLINE void JIT::emitJumpSlowToHot(Jump jump, int relativeOffset)
</span><span class="cx"> {
</span><del>-    ASSERT(m_bytecodeOffset != (unsigned)-1); // This method should only be called during hot/cold path generation, so that m_bytecodeOffset is set.
</del><ins>+    ASSERT(m_bytecodeOffset != std::numeric_limits&lt;unsigned&gt;::max()); // This method should only be called during hot/cold path generation, so that m_bytecodeOffset is set.
</ins><span class="cx"> 
</span><span class="cx">     jump.linkTo(m_labels[m_bytecodeOffset + relativeOffset], this);
</span><span class="cx"> }
</span><span class="lines">@@ -1018,7 +1018,7 @@
</span><span class="cx"> // get arg puts an arg from the SF register array into a h/w register
</span><span class="cx"> ALWAYS_INLINE void JIT::emitGetVirtualRegister(int src, RegisterID dst)
</span><span class="cx"> {
</span><del>-    ASSERT(m_bytecodeOffset != (unsigned)-1); // This method should only be called during hot/cold path generation, so that m_bytecodeOffset is set.
</del><ins>+    ASSERT(m_bytecodeOffset != std::numeric_limits&lt;unsigned&gt;::max()); // This method should only be called during hot/cold path generation, so that m_bytecodeOffset is set.
</ins><span class="cx"> 
</span><span class="cx">     // TODO: we want to reuse values that are already in registers if we can - add a register allocator!
</span><span class="cx">     if (m_codeBlock-&gt;isConstantRegisterIndex(src)) {
</span></span></pre></div>
<a id="trunkSourceJavaScriptCorejitSlowPathCallh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/jit/SlowPathCall.h (181342 => 181343)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/jit/SlowPathCall.h        2015-03-10 20:11:37 UTC (rev 181342)
+++ trunk/Source/JavaScriptCore/jit/SlowPathCall.h        2015-03-10 20:18:24 UTC (rev 181343)
</span><span class="lines">@@ -45,7 +45,7 @@
</span><span class="cx">     JIT::Call call()
</span><span class="cx">     {
</span><span class="cx"> #if ENABLE(OPCODE_SAMPLING)
</span><del>-        if (m_jit-&gt;m_bytecodeOffset != (unsigned)-1)
</del><ins>+        if (m_jit-&gt;m_bytecodeOffset != std::numeric_limits&lt;unsigned&gt;::max())
</ins><span class="cx">             m_jit-&gt;sampleInstruction(m_jit-&gt;m_codeBlock-&gt;instructions().begin() + m_jit-&gt;m_bytecodeOffset, true);
</span><span class="cx"> #endif
</span><span class="cx">         m_jit-&gt;updateTopCallFrame();
</span><span class="lines">@@ -73,7 +73,7 @@
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx"> #if ENABLE(OPCODE_SAMPLING)
</span><del>-        if (m_jit-&gt;m_bytecodeOffset != (unsigned)-1)
</del><ins>+        if (m_jit-&gt;m_bytecodeOffset != std::numeric_limits&lt;unsigned&gt;::max())
</ins><span class="cx">             m_jit-&gt;sampleInstruction(m_jit-&gt;m_codeBlock-&gt;instructions().begin() + m_jit-&gt;m_bytecodeOffset, false);
</span><span class="cx"> #endif
</span><span class="cx">         
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreyarrYarrh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/yarr/Yarr.h (181342 => 181343)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/yarr/Yarr.h        2015-03-10 20:11:37 UTC (rev 181342)
+++ trunk/Source/JavaScriptCore/yarr/Yarr.h        2015-03-10 20:18:24 UTC (rev 181343)
</span><span class="lines">@@ -43,7 +43,7 @@
</span><span class="cx"> #define YarrStackSpaceForBackTrackInfoParentheses 2
</span><span class="cx"> 
</span><span class="cx"> static const unsigned quantifyInfinite = UINT_MAX;
</span><del>-static const unsigned offsetNoMatch = (unsigned)-1;
</del><ins>+static const unsigned offsetNoMatch = std::numeric_limits&lt;unsigned&gt;::max();
</ins><span class="cx"> 
</span><span class="cx"> // The below limit restricts the number of &quot;recursive&quot; match calls in order to
</span><span class="cx"> // avoid spending exponential time on complex regular expressions.
</span></span></pre>
</div>
</div>

</body>
</html>