<!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>[56081] trunk/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/56081">56081</a></dd>
<dt>Author</dt> <dd>darin@apple.com</dd>
<dt>Date</dt> <dd>2010-03-16 13:46:02 -0700 (Tue, 16 Mar 2010)</dd>
</dl>

<h3>Log Message</h3>
<pre>Added arrayLength function and used it instead of hand-written code.

Reviewed by Sam Weinig.

* JavaScriptCore.xcodeproj/project.pbxproj:
Removed PtrAndFlags.h. The file was removed long ago.

* interpreter/Interpreter.cpp:
(JSC::Interpreter::privateExecute): Use arrayLength.

* runtime/Collector.h:
(JSC::CollectorBitmap::count): Remove WTF:: prefix from use
of bitCount. In WTF we inject things into the global namespace
and this is no exception.

* runtime/DatePrototype.cpp:
(JSC::formatLocaleDate): Use arrayLength.

* runtime/JSFunction.h:
(JSC::JSFunction::nativeFunction): Remove WTF:: prefix as above.
(JSC::JSFunction::scopeChain): Ditto.
(JSC::JSFunction::setScopeChain): Ditto.
(JSC::JSFunction::setNativeFunction): Ditto.

* runtime/JSGlobalObject.cpp:
(JSC::JSGlobalObject::reset): Use arrayLength.

* runtime/JSImmediate.h:
(JSC::reinterpretDoubleToIntptr): Remove WTF:: prefix as above.
(JSC::reinterpretIntptrToDouble): Ditto.

* runtime/JSONObject.cpp:
(JSC::Stringifier::appendQuotedString): Use arrayLength.
(JSC::Stringifier::toJSON): Ditto.
(JSC::Stringifier::appendStringifiedValue): Ditto.
* runtime/SmallStrings.cpp:
(JSC::SmallStrings::SmallStrings): Ditto.

* runtime/UString.cpp:
(JSC::UString::from): Use arrayLength.

* wtf/StdLibExtras.h:
(WTF::bitwise_cast): Marked this inline!
(WTF::arrayLength): Added function template (actually written by Sam).
Added using declarations for public things in WTF namespace defined
in this file.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkJavaScriptCoreChangeLog">trunk/JavaScriptCore/ChangeLog</a></li>
<li><a href="#trunkJavaScriptCoreJavaScriptCorexcodeprojprojectpbxproj">trunk/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj</a></li>
<li><a href="#trunkJavaScriptCoreinterpreterInterpretercpp">trunk/JavaScriptCore/interpreter/Interpreter.cpp</a></li>
<li><a href="#trunkJavaScriptCoreruntimeCollectorh">trunk/JavaScriptCore/runtime/Collector.h</a></li>
<li><a href="#trunkJavaScriptCoreruntimeDatePrototypecpp">trunk/JavaScriptCore/runtime/DatePrototype.cpp</a></li>
<li><a href="#trunkJavaScriptCoreruntimeJSFunctionh">trunk/JavaScriptCore/runtime/JSFunction.h</a></li>
<li><a href="#trunkJavaScriptCoreruntimeJSGlobalObjectcpp">trunk/JavaScriptCore/runtime/JSGlobalObject.cpp</a></li>
<li><a href="#trunkJavaScriptCoreruntimeJSImmediateh">trunk/JavaScriptCore/runtime/JSImmediate.h</a></li>
<li><a href="#trunkJavaScriptCoreruntimeJSONObjectcpp">trunk/JavaScriptCore/runtime/JSONObject.cpp</a></li>
<li><a href="#trunkJavaScriptCoreruntimeSmallStringscpp">trunk/JavaScriptCore/runtime/SmallStrings.cpp</a></li>
<li><a href="#trunkJavaScriptCoreruntimeUStringcpp">trunk/JavaScriptCore/runtime/UString.cpp</a></li>
<li><a href="#trunkJavaScriptCorewtfStdLibExtrash">trunk/JavaScriptCore/wtf/StdLibExtras.h</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkJavaScriptCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/JavaScriptCore/ChangeLog (56080 => 56081)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/JavaScriptCore/ChangeLog        2010-03-16 20:44:25 UTC (rev 56080)
+++ trunk/JavaScriptCore/ChangeLog        2010-03-16 20:46:02 UTC (rev 56081)
</span><span class="lines">@@ -1,3 +1,52 @@
</span><ins>+2010-03-16  Darin Adler  &lt;darin@apple.com&gt;
+
+        Reviewed by Sam Weinig.
+
+        Added arrayLength function and used it instead of hand-written code.
+
+        * JavaScriptCore.xcodeproj/project.pbxproj:
+        Removed PtrAndFlags.h. The file was removed long ago.
+
+        * interpreter/Interpreter.cpp:
+        (JSC::Interpreter::privateExecute): Use arrayLength.
+
+        * runtime/Collector.h:
+        (JSC::CollectorBitmap::count): Remove WTF:: prefix from use
+        of bitCount. In WTF we inject things into the global namespace
+        and this is no exception.
+
+        * runtime/DatePrototype.cpp:
+        (JSC::formatLocaleDate): Use arrayLength.
+
+        * runtime/JSFunction.h:
+        (JSC::JSFunction::nativeFunction): Remove WTF:: prefix as above.
+        (JSC::JSFunction::scopeChain): Ditto.
+        (JSC::JSFunction::setScopeChain): Ditto.
+        (JSC::JSFunction::setNativeFunction): Ditto.
+
+        * runtime/JSGlobalObject.cpp:
+        (JSC::JSGlobalObject::reset): Use arrayLength.
+
+        * runtime/JSImmediate.h:
+        (JSC::reinterpretDoubleToIntptr): Remove WTF:: prefix as above.
+        (JSC::reinterpretIntptrToDouble): Ditto.
+
+        * runtime/JSONObject.cpp:
+        (JSC::Stringifier::appendQuotedString): Use arrayLength.
+        (JSC::Stringifier::toJSON): Ditto.
+        (JSC::Stringifier::appendStringifiedValue): Ditto.
+        * runtime/SmallStrings.cpp:
+        (JSC::SmallStrings::SmallStrings): Ditto.
+
+        * runtime/UString.cpp:
+        (JSC::UString::from): Use arrayLength.
+
+        * wtf/StdLibExtras.h:
+        (WTF::bitwise_cast): Marked this inline!
+        (WTF::arrayLength): Added function template (actually written by Sam).
+        Added using declarations for public things in WTF namespace defined
+        in this file.
+
</ins><span class="cx"> 2010-03-16  Zoltan Horvath  &lt;zoltan@webkit.org&gt;
</span><span class="cx"> 
</span><span class="cx">         Reviewed by Darin Adler.
</span></span></pre></div>
<a id="trunkJavaScriptCoreJavaScriptCorexcodeprojprojectpbxproj"></a>
<div class="modfile"><h4>Modified: trunk/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj (56080 => 56081)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj        2010-03-16 20:44:25 UTC (rev 56080)
+++ trunk/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj        2010-03-16 20:46:02 UTC (rev 56081)
</span><span class="lines">@@ -551,7 +551,6 @@
</span><span class="cx">                 088FA5B90EF76D4300578E6F /* RandomNumber.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RandomNumber.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 088FA5BA0EF76D4300578E6F /* RandomNumber.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RandomNumber.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 08E279E80EF83B10007DB523 /* RandomNumberSeed.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RandomNumberSeed.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><del>-                0B1F921B0F17502D0036468E /* PtrAndFlags.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PtrAndFlags.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</del><span class="cx">                 0B330C260F38C62300692DE3 /* TypeTraits.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TypeTraits.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 0B4D7E620F319AC800AD7E58 /* TypeTraits.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TypeTraits.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 0BDFFAD10FC616EC00D69EF4 /* OwnFastMallocPtr.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OwnFastMallocPtr.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="lines">@@ -1333,7 +1332,6 @@
</span><span class="cx">                                 6580F795094070560082C219 /* PassRefPtr.h */,
</span><span class="cx">                                 65D6D87E09B5A32E0002E4D7 /* Platform.h */,
</span><span class="cx">                                 A7D649A91015224E009B2E1B /* PossiblyNull.h */,
</span><del>-                                0B1F921B0F17502D0036468E /* PtrAndFlags.h */,
</del><span class="cx">                                 088FA5B90EF76D4300578E6F /* RandomNumber.cpp */,
</span><span class="cx">                                 088FA5BA0EF76D4300578E6F /* RandomNumber.h */,
</span><span class="cx">                                 08E279E80EF83B10007DB523 /* RandomNumberSeed.h */,
</span></span></pre></div>
<a id="trunkJavaScriptCoreinterpreterInterpretercpp"></a>
<div class="modfile"><h4>Modified: trunk/JavaScriptCore/interpreter/Interpreter.cpp (56080 => 56081)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/JavaScriptCore/interpreter/Interpreter.cpp        2010-03-16 20:44:25 UTC (rev 56080)
+++ trunk/JavaScriptCore/interpreter/Interpreter.cpp        2010-03-16 20:46:02 UTC (rev 56081)
</span><span class="lines">@@ -1134,7 +1134,7 @@
</span><span class="cx">         #if HAVE(COMPUTED_GOTO)
</span><span class="cx">             #define LIST_OPCODE_LABEL(id, length) &amp;&amp;id,
</span><span class="cx">                 static Opcode labels[] = { FOR_EACH_OPCODE_ID(LIST_OPCODE_LABEL) };
</span><del>-                for (size_t i = 0; i &lt; sizeof(labels) / sizeof(Opcode); ++i)
</del><ins>+                for (size_t i = 0; i &lt; arrayLength(labels); ++i)
</ins><span class="cx">                     m_opcodeTable[i] = labels[i];
</span><span class="cx">             #undef LIST_OPCODE_LABEL
</span><span class="cx">         #endif // HAVE(COMPUTED_GOTO)
</span></span></pre></div>
<a id="trunkJavaScriptCoreruntimeCollectorh"></a>
<div class="modfile"><h4>Modified: trunk/JavaScriptCore/runtime/Collector.h (56080 => 56081)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/JavaScriptCore/runtime/Collector.h        2010-03-16 20:44:25 UTC (rev 56080)
+++ trunk/JavaScriptCore/runtime/Collector.h        2010-03-16 20:46:02 UTC (rev 56081)
</span><span class="lines">@@ -216,7 +216,7 @@
</span><span class="cx">                     ++result;
</span><span class="cx">             }
</span><span class="cx">             for (size_t i = startCell &gt;&gt; 5; i &lt; BITMAP_WORDS; ++i)
</span><del>-                result += WTF::bitCount(bits[i]);
</del><ins>+                result += bitCount(bits[i]);
</ins><span class="cx">             return result;
</span><span class="cx">         }
</span><span class="cx">         size_t isEmpty() // Much more efficient than testing count() == 0.
</span></span></pre></div>
<a id="trunkJavaScriptCoreruntimeDatePrototypecpp"></a>
<div class="modfile"><h4>Modified: trunk/JavaScriptCore/runtime/DatePrototype.cpp (56080 => 56081)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/JavaScriptCore/runtime/DatePrototype.cpp        2010-03-16 20:44:25 UTC (rev 56080)
+++ trunk/JavaScriptCore/runtime/DatePrototype.cpp        2010-03-16 20:46:02 UTC (rev 56081)
</span><span class="lines">@@ -180,7 +180,7 @@
</span><span class="cx">     // We truncate the string returned from CFDateFormatter if it's absurdly long (&gt; 200 characters).
</span><span class="cx">     // That's not great error handling, but it just won't happen so it doesn't matter.
</span><span class="cx">     UChar buffer[200];
</span><del>-    const size_t bufferLength = sizeof(buffer) / sizeof(buffer[0]);
</del><ins>+    const size_t bufferLength = arrayLength(buffer);
</ins><span class="cx">     size_t length = CFStringGetLength(string);
</span><span class="cx">     ASSERT(length &lt;= bufferLength);
</span><span class="cx">     if (length &gt; bufferLength)
</span></span></pre></div>
<a id="trunkJavaScriptCoreruntimeJSFunctionh"></a>
<div class="modfile"><h4>Modified: trunk/JavaScriptCore/runtime/JSFunction.h (56080 => 56081)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/JavaScriptCore/runtime/JSFunction.h        2010-03-16 20:44:25 UTC (rev 56080)
+++ trunk/JavaScriptCore/runtime/JSFunction.h        2010-03-16 20:46:02 UTC (rev 56081)
</span><span class="lines">@@ -66,7 +66,7 @@
</span><span class="cx"> 
</span><span class="cx">         NativeFunction nativeFunction()
</span><span class="cx">         {
</span><del>-            return *WTF::bitwise_cast&lt;NativeFunction*&gt;(m_data);
</del><ins>+            return *bitwise_cast&lt;NativeFunction*&gt;(m_data);
</ins><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         virtual ConstructType getConstructData(ConstructData&amp;);
</span><span class="lines">@@ -98,7 +98,7 @@
</span><span class="cx">         ScopeChain&amp; scopeChain()
</span><span class="cx">         {
</span><span class="cx">             ASSERT(!isHostFunctionNonInline());
</span><del>-            return *WTF::bitwise_cast&lt;ScopeChain*&gt;(m_data);
</del><ins>+            return *bitwise_cast&lt;ScopeChain*&gt;(m_data);
</ins><span class="cx">         }
</span><span class="cx">         void clearScopeChain()
</span><span class="cx">         {
</span><span class="lines">@@ -113,11 +113,11 @@
</span><span class="cx">         void setScopeChain(const ScopeChain&amp; sc)
</span><span class="cx">         {
</span><span class="cx">             ASSERT(!isHostFunctionNonInline());
</span><del>-            *WTF::bitwise_cast&lt;ScopeChain*&gt;(m_data) = sc;
</del><ins>+            *bitwise_cast&lt;ScopeChain*&gt;(m_data) = sc;
</ins><span class="cx">         }
</span><span class="cx">         void setNativeFunction(NativeFunction func)
</span><span class="cx">         {
</span><del>-            *WTF::bitwise_cast&lt;NativeFunction*&gt;(m_data) = func;
</del><ins>+            *bitwise_cast&lt;NativeFunction*&gt;(m_data) = func;
</ins><span class="cx">         }
</span><span class="cx">         unsigned char m_data[sizeof(void*)];
</span><span class="cx">     };
</span></span></pre></div>
<a id="trunkJavaScriptCoreruntimeJSGlobalObjectcpp"></a>
<div class="modfile"><h4>Modified: trunk/JavaScriptCore/runtime/JSGlobalObject.cpp (56080 => 56081)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/JavaScriptCore/runtime/JSGlobalObject.cpp        2010-03-16 20:44:25 UTC (rev 56080)
+++ trunk/JavaScriptCore/runtime/JSGlobalObject.cpp        2010-03-16 20:46:02 UTC (rev 56081)
</span><span class="lines">@@ -325,7 +325,7 @@
</span><span class="cx">         GlobalPropertyInfo(Identifier(exec, &quot;JSON&quot;), new (exec) JSONObject(JSONObject::createStructure(d()-&gt;objectPrototype)), DontEnum | DontDelete)
</span><span class="cx">     };
</span><span class="cx"> 
</span><del>-    addStaticGlobals(staticGlobals, sizeof(staticGlobals) / sizeof(GlobalPropertyInfo));
</del><ins>+    addStaticGlobals(staticGlobals, arrayLength(staticGlobals));
</ins><span class="cx"> 
</span><span class="cx">     // Set global functions.
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkJavaScriptCoreruntimeJSImmediateh"></a>
<div class="modfile"><h4>Modified: trunk/JavaScriptCore/runtime/JSImmediate.h (56080 => 56081)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/JavaScriptCore/runtime/JSImmediate.h        2010-03-16 20:44:25 UTC (rev 56080)
+++ trunk/JavaScriptCore/runtime/JSImmediate.h        2010-03-16 20:46:02 UTC (rev 56081)
</span><span class="lines">@@ -47,12 +47,12 @@
</span><span class="cx"> #if USE(JSVALUE64)
</span><span class="cx">     inline intptr_t reinterpretDoubleToIntptr(double value)
</span><span class="cx">     {
</span><del>-        return WTF::bitwise_cast&lt;intptr_t&gt;(value);
</del><ins>+        return bitwise_cast&lt;intptr_t&gt;(value);
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     inline double reinterpretIntptrToDouble(intptr_t value)
</span><span class="cx">     {
</span><del>-        return WTF::bitwise_cast&lt;double&gt;(value);
</del><ins>+        return bitwise_cast&lt;double&gt;(value);
</ins><span class="cx">     }
</span><span class="cx"> #endif
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkJavaScriptCoreruntimeJSONObjectcpp"></a>
<div class="modfile"><h4>Modified: trunk/JavaScriptCore/runtime/JSONObject.cpp (56080 => 56081)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/JavaScriptCore/runtime/JSONObject.cpp        2010-03-16 20:44:25 UTC (rev 56080)
+++ trunk/JavaScriptCore/runtime/JSONObject.cpp        2010-03-16 20:46:02 UTC (rev 56081)
</span><span class="lines">@@ -321,7 +321,7 @@
</span><span class="cx">                 static const char hexDigits[] = &quot;0123456789abcdef&quot;;
</span><span class="cx">                 UChar ch = data[i];
</span><span class="cx">                 UChar hex[] = { '\\', 'u', hexDigits[(ch &gt;&gt; 12) &amp; 0xF], hexDigits[(ch &gt;&gt; 8) &amp; 0xF], hexDigits[(ch &gt;&gt; 4) &amp; 0xF], hexDigits[ch &amp; 0xF] };
</span><del>-                builder.append(hex, sizeof(hex) / sizeof(UChar));
</del><ins>+                builder.append(hex, arrayLength(hex));
</ins><span class="cx">                 break;
</span><span class="cx">         }
</span><span class="cx">     }
</span><span class="lines">@@ -349,7 +349,7 @@
</span><span class="cx">         return value;
</span><span class="cx"> 
</span><span class="cx">     JSValue list[] = { propertyName.value(m_exec) };
</span><del>-    ArgList args(list, sizeof(list) / sizeof(JSValue));
</del><ins>+    ArgList args(list, arrayLength(list));
</ins><span class="cx">     return call(m_exec, object, callType, callData, value, args);
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -363,7 +363,7 @@
</span><span class="cx">     // Call the replacer function.
</span><span class="cx">     if (m_replacerCallType != CallTypeNone) {
</span><span class="cx">         JSValue list[] = { propertyName.value(m_exec), value };
</span><del>-        ArgList args(list, sizeof(list) / sizeof(JSValue));
</del><ins>+        ArgList args(list, arrayLength(list));
</ins><span class="cx">         value = call(m_exec, m_replacer, m_replacerCallType, m_replacerCallData, holder, args);
</span><span class="cx">         if (m_exec-&gt;hadException())
</span><span class="cx">             return StringifyFailed;
</span></span></pre></div>
<a id="trunkJavaScriptCoreruntimeSmallStringscpp"></a>
<div class="modfile"><h4>Modified: trunk/JavaScriptCore/runtime/SmallStrings.cpp (56080 => 56081)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/JavaScriptCore/runtime/SmallStrings.cpp        2010-03-16 20:44:25 UTC (rev 56080)
+++ trunk/JavaScriptCore/runtime/SmallStrings.cpp        2010-03-16 20:46:02 UTC (rev 56081)
</span><span class="lines">@@ -61,7 +61,7 @@
</span><span class="cx"> 
</span><span class="cx"> SmallStrings::SmallStrings()
</span><span class="cx"> {
</span><del>-    COMPILE_ASSERT(numCharactersToStore == sizeof(m_singleCharacterStrings) / sizeof(m_singleCharacterStrings[0]), IsNumCharactersConstInSyncWithClassUsage);
</del><ins>+    COMPILE_ASSERT(numCharactersToStore == arrayLength(m_singleCharacterStrings), IsNumCharactersConstInSyncWithClassUsage);
</ins><span class="cx">     clear();
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkJavaScriptCoreruntimeUStringcpp"></a>
<div class="modfile"><h4>Modified: trunk/JavaScriptCore/runtime/UString.cpp (56080 => 56081)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/JavaScriptCore/runtime/UString.cpp        2010-03-16 20:44:25 UTC (rev 56080)
+++ trunk/JavaScriptCore/runtime/UString.cpp        2010-03-16 20:46:02 UTC (rev 56081)
</span><span class="lines">@@ -178,7 +178,7 @@
</span><span class="cx"> UString UString::from(int i)
</span><span class="cx"> {
</span><span class="cx">     UChar buf[1 + sizeof(i) * 3];
</span><del>-    UChar* end = buf + sizeof(buf) / sizeof(UChar);
</del><ins>+    UChar* end = buf + arrayLength(buf);
</ins><span class="cx">     UChar* p = end;
</span><span class="cx"> 
</span><span class="cx">     if (i == 0)
</span><span class="lines">@@ -207,7 +207,7 @@
</span><span class="cx"> UString UString::from(long long i)
</span><span class="cx"> {
</span><span class="cx">     UChar buf[1 + sizeof(i) * 3];
</span><del>-    UChar* end = buf + sizeof(buf) / sizeof(UChar);
</del><ins>+    UChar* end = buf + arrayLength(buf);
</ins><span class="cx">     UChar* p = end;
</span><span class="cx"> 
</span><span class="cx">     if (i == 0)
</span><span class="lines">@@ -240,7 +240,7 @@
</span><span class="cx"> UString UString::from(unsigned int u)
</span><span class="cx"> {
</span><span class="cx">     UChar buf[sizeof(u) * 3];
</span><del>-    UChar* end = buf + sizeof(buf) / sizeof(UChar);
</del><ins>+    UChar* end = buf + arrayLength(buf);
</ins><span class="cx">     UChar* p = end;
</span><span class="cx"> 
</span><span class="cx">     if (u == 0)
</span><span class="lines">@@ -258,7 +258,7 @@
</span><span class="cx"> UString UString::from(long l)
</span><span class="cx"> {
</span><span class="cx">     UChar buf[1 + sizeof(l) * 3];
</span><del>-    UChar* end = buf + sizeof(buf) / sizeof(UChar);
</del><ins>+    UChar* end = buf + arrayLength(buf);
</ins><span class="cx">     UChar* p = end;
</span><span class="cx"> 
</span><span class="cx">     if (l == 0)
</span></span></pre></div>
<a id="trunkJavaScriptCorewtfStdLibExtrash"></a>
<div class="modfile"><h4>Modified: trunk/JavaScriptCore/wtf/StdLibExtras.h (56080 => 56081)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/JavaScriptCore/wtf/StdLibExtras.h        2010-03-16 20:44:25 UTC (rev 56080)
+++ trunk/JavaScriptCore/wtf/StdLibExtras.h        2010-03-16 20:46:02 UTC (rev 56081)
</span><span class="lines">@@ -1,5 +1,5 @@
</span><span class="cx"> /*
</span><del>- * Copyright (C) 2008 Apple Inc. All Rights Reserved.
</del><ins>+ * Copyright (C) 2008, 2010 Apple Inc. All Rights Reserved.
</ins><span class="cx">  *
</span><span class="cx">  * Redistribution and use in source and binary forms, with or without
</span><span class="cx">  * modification, are permitted provided that the following conditions
</span><span class="lines">@@ -26,6 +26,7 @@
</span><span class="cx"> #ifndef WTF_StdLibExtras_h
</span><span class="cx"> #define WTF_StdLibExtras_h
</span><span class="cx"> 
</span><ins>+#include &lt;stdlib.h&gt;
</ins><span class="cx"> #include &lt;wtf/Assertions.h&gt;
</span><span class="cx"> 
</span><span class="cx"> // Use these to declare and define a static local variable (static T;) so that
</span><span class="lines">@@ -53,11 +54,9 @@
</span><span class="cx"> 
</span><span class="cx"> namespace WTF {
</span><span class="cx"> 
</span><del>-    /*
-     * C++'s idea of a reinterpret_cast lacks sufficient cojones.
-     */
</del><ins>+    // C++'s idea of a reinterpret_cast lacks sufficient cojones.
</ins><span class="cx">     template&lt;typename TO, typename FROM&gt;
</span><del>-    TO bitwise_cast(FROM from)
</del><ins>+    inline TO bitwise_cast(FROM from)
</ins><span class="cx">     {
</span><span class="cx">         COMPILE_ASSERT(sizeof(TO) == sizeof(FROM), WTF_bitwise_cast_sizeof_casted_types_is_equal);
</span><span class="cx">         union {
</span><span class="lines">@@ -76,6 +75,17 @@
</span><span class="cx">         return (((bits + (bits &gt;&gt; 4)) &amp; 0xF0F0F0F) * 0x1010101) &gt;&gt; 24;
</span><span class="cx">     }
</span><span class="cx"> 
</span><ins>+    // Returns the length of an array. Use instead of macros such as ARRAYSIZE.
+    template&lt;class ElementType, size_t length&gt;
+    inline size_t arrayLength(ElementType (&amp;)[length])
+    {
+        return length;
+    }
+
</ins><span class="cx"> } // namespace WTF
</span><span class="cx"> 
</span><ins>+using WTF::arrayLength;
+using WTF::bitCount;
+using WTF::bitwise_cast;
+
</ins><span class="cx"> #endif
</span></span></pre>
</div>
</div>

</body>
</html>