<!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>[50608] 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/50608">50608</a></dd>
<dt>Author</dt> <dd>ggaren@apple.com</dd>
<dt>Date</dt> <dd>2009-11-06 15:33:17 -0800 (Fri, 06 Nov 2009)</dd>
</dl>

<h3>Log Message</h3>
<pre>Rolled back in <a href="http://trac.webkit.org/projects/webkit/changeset/50590">r50590</a> with Windows build hopefully fixed.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkJavaScriptCoreChangeLog">trunk/JavaScriptCore/ChangeLog</a></li>
<li><a href="#trunkJavaScriptCoreJavaScriptCoreexp">trunk/JavaScriptCore/JavaScriptCore.exp</a></li>
<li><a href="#trunkJavaScriptCoreJavaScriptCorevcprojJavaScriptCoreJavaScriptCorevcproj">trunk/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj</a></li>
<li><a href="#trunkJavaScriptCoreJavaScriptCorevcprojWTFWTFvcproj">trunk/JavaScriptCore/JavaScriptCore.vcproj/WTF/WTF.vcproj</a></li>
<li><a href="#trunkJavaScriptCoreJavaScriptCoreSourcesbkl">trunk/JavaScriptCore/JavaScriptCoreSources.bkl</a></li>
<li><a href="#trunkJavaScriptCoreinterpreterCachedCallh">trunk/JavaScriptCore/interpreter/CachedCall.h</a></li>
<li><a href="#trunkJavaScriptCoreinterpreterInterpretercpp">trunk/JavaScriptCore/interpreter/Interpreter.cpp</a></li>
<li><a href="#trunkJavaScriptCorepcrepcre_execcpp">trunk/JavaScriptCore/pcre/pcre_exec.cpp</a></li>
<li><a href="#trunkJavaScriptCoreprofilerProfileNodecpp">trunk/JavaScriptCore/profiler/ProfileNode.cpp</a></li>
<li><a href="#trunkJavaScriptCoreruntimeDateConstructorcpp">trunk/JavaScriptCore/runtime/DateConstructor.cpp</a></li>
<li><a href="#trunkJavaScriptCoreruntimeDateConversioncpp">trunk/JavaScriptCore/runtime/DateConversion.cpp</a></li>
<li><a href="#trunkJavaScriptCoreruntimeDateConversionh">trunk/JavaScriptCore/runtime/DateConversion.h</a></li>
<li><a href="#trunkJavaScriptCoreruntimeDateInstancecpp">trunk/JavaScriptCore/runtime/DateInstance.cpp</a></li>
<li><a href="#trunkJavaScriptCoreruntimeDateInstanceh">trunk/JavaScriptCore/runtime/DateInstance.h</a></li>
<li><a href="#trunkJavaScriptCoreruntimeDateInstanceCacheh">trunk/JavaScriptCore/runtime/DateInstanceCache.h</a></li>
<li><a href="#trunkJavaScriptCoreruntimeDatePrototypecpp">trunk/JavaScriptCore/runtime/DatePrototype.cpp</a></li>
<li><a href="#trunkJavaScriptCoreruntimeInitializeThreadingcpp">trunk/JavaScriptCore/runtime/InitializeThreading.cpp</a></li>
<li><a href="#trunkJavaScriptCoreruntimeJSGlobalDatacpp">trunk/JavaScriptCore/runtime/JSGlobalData.cpp</a></li>
<li><a href="#trunkJavaScriptCoreruntimeJSGlobalDatah">trunk/JavaScriptCore/runtime/JSGlobalData.h</a></li>
<li><a href="#trunkJavaScriptCoreruntimeJSGlobalObjecth">trunk/JavaScriptCore/runtime/JSGlobalObject.h</a></li>
<li><a href="#trunkJavaScriptCorewtfCurrentTimeh">trunk/JavaScriptCore/wtf/CurrentTime.h</a></li>
<li><a href="#trunkJavaScriptCorewtfDateMathcpp">trunk/JavaScriptCore/wtf/DateMath.cpp</a></li>
<li><a href="#trunkJavaScriptCorewtfDateMathh">trunk/JavaScriptCore/wtf/DateMath.h</a></li>
<li><a href="#trunkJavaScriptGlueChangeLog">trunk/JavaScriptGlue/ChangeLog</a></li>
<li><a href="#trunkWebCoreChangeLog">trunk/WebCore/ChangeLog</a></li>
<li><a href="#trunkWebCorebridgeqtqt_runtimecpp">trunk/WebCore/bridge/qt/qt_runtime.cpp</a></li>
<li><a href="#trunkWebCoreplatformnetworkHTTPParserscpp">trunk/WebCore/platform/network/HTTPParsers.cpp</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkJavaScriptGlueForwardingHeaderswtfCurrentTimeh">trunk/JavaScriptGlue/ForwardingHeaders/wtf/CurrentTime.h</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkJavaScriptCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/JavaScriptCore/ChangeLog (50607 => 50608)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/JavaScriptCore/ChangeLog        2009-11-06 23:00:44 UTC (rev 50607)
+++ trunk/JavaScriptCore/ChangeLog        2009-11-06 23:33:17 UTC (rev 50608)
</span><span class="lines">@@ -1,3 +1,80 @@
</span><ins>+2009-11-06  Geoffrey Garen  &lt;ggaren@apple.com&gt;
+
+        Reviewed by Oliver Hunt.
+        
+        https://bugs.webkit.org/show_bug.cgi?id=31197
+        Implemented a timezone cache not based on Mac OS X's notify_check API.
+        
+        If the VM calculates the local timezone offset from UTC, it caches the
+        result until the end of the current VM invocation. (We don't want to cache
+        forever, because the user's timezone may change over time.)
+        
+        This removes notify_* overhead on Mac, and, more significantly, removes
+        OS time and date call overhead on non-Mac platforms.
+
+        ~8% speedup on Date microbenchmark on Mac. SunSpider reports maybe a tiny
+        speedup on Mac. (Speedup on non-Mac platforms should be even more noticeable.)
+
+        * JavaScriptCore.exp:
+
+        * interpreter/CachedCall.h:
+        (JSC::CachedCall::CachedCall):
+        * interpreter/Interpreter.cpp:
+        (JSC::Interpreter::execute):
+        * runtime/JSGlobalObject.h:
+        (JSC::DynamicGlobalObjectScope::DynamicGlobalObjectScope): Made the 
+        DynamicGlobalObjectScope constructor responsible for checking whether a
+        dynamicGlobalObject has already been set. This eliminated some duplicate
+        client code, and allowed me to avoid adding even more duplicate client
+        code. Made DynamicGlobalObjectScope responsible for resetting the
+        local timezone cache upon first entry to the VM.
+
+        * runtime/DateConstructor.cpp:
+        (JSC::constructDate):
+        (JSC::callDate):
+        (JSC::dateParse):
+        (JSC::dateUTC):
+        * runtime/DateConversion.cpp:
+        (JSC::parseDate):
+        * runtime/DateConversion.h:
+        * runtime/DateInstance.cpp:
+        (JSC::DateInstance::gregorianDateTime):
+        * runtime/DateInstance.h:
+        * runtime/DateInstanceCache.h:
+        * runtime/DatePrototype.cpp:
+        (JSC::setNewValueFromTimeArgs):
+        (JSC::setNewValueFromDateArgs):
+        (JSC::dateProtoFuncSetYear):
+        * runtime/InitializeThreading.cpp:
+        (JSC::initializeThreadingOnce):
+        * runtime/JSGlobalData.cpp:
+        (JSC::JSGlobalData::JSGlobalData):
+        * runtime/JSGlobalData.h:
+        * wtf/DateMath.cpp:
+        (WTF::getCurrentUTCTime):
+        (WTF::getCurrentUTCTimeWithMicroseconds):
+        (WTF::getLocalTime):
+        (JSC::getUTCOffset): Use the new cache. Also, see below.
+        (JSC::gregorianDateTimeToMS):
+        (JSC::msToGregorianDateTime):
+        (JSC::initializeDates):
+        (JSC::parseDateFromNullTerminatedCharacters): Simplified the way this function
+        accounts for the local timezone offset, to accomodate our new caching API,
+        and a (possibly misguided) caller in WebCore. Also, see below.
+        * wtf/DateMath.h:
+        (JSC::GregorianDateTime::GregorianDateTime): Moved most of the code in
+        DateMath.* into the JSC namespace. The code needed to move so it could
+        naturally interact with ExecState and JSGlobalData to support caching.
+        Logically, it seemed right to move it, too, since this code is not really
+        as low-level as the WTF namespace might imply -- it implements a set of
+        date parsing and conversion quirks that are finely tuned to the JavaScript
+        language. Also removed the Mac OS X notify_* infrastructure.
+        
+        * wtf/CurrentTime.h:
+        (WTF::currentTimeMS):
+        (WTF::getLocalTime): Moved the rest of the DateMath code here, and renamed
+        it to make it consistent with WTF's currentTime function.
+
</ins><span class="cx"> 2009-11-06  Gabor Loki  &lt;loki@inf.u-szeged.hu&gt;
</span><span class="cx"> 
</span><span class="cx">         Unreviewed trivial buildfix after r50595.
</span></span></pre></div>
<a id="trunkJavaScriptCoreJavaScriptCoreexp"></a>
<div class="modfile"><h4>Modified: trunk/JavaScriptCore/JavaScriptCore.exp (50607 => 50608)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/JavaScriptCore/JavaScriptCore.exp        2009-11-06 23:00:44 UTC (rev 50607)
+++ trunk/JavaScriptCore/JavaScriptCore.exp        2009-11-06 23:33:17 UTC (rev 50608)
</span><span class="lines">@@ -178,6 +178,8 @@
</span><span class="cx"> __ZN3JSC24createStackOverflowErrorEPNS_9ExecStateE
</span><span class="cx"> __ZN3JSC25evaluateInGlobalCallFrameERKNS_7UStringERNS_7JSValueEPNS_14JSGlobalObjectE
</span><span class="cx"> __ZN3JSC35createInterruptedExecutionExceptionEPNS_12JSGlobalDataE
</span><ins>+__ZN3JSC37parseDateFromNullTerminatedCharactersEPKcPNS_9ExecStateE
+__ZN3JSC3NaNE
</ins><span class="cx"> __ZN3JSC4Heap11objectCountEv
</span><span class="cx"> __ZN3JSC4Heap14primaryHeapEndEv
</span><span class="cx"> __ZN3JSC4Heap15recordExtraCostEm
</span><span class="lines">@@ -330,7 +332,6 @@
</span><span class="cx"> __ZN3WTF27releaseFastMallocFreeMemoryEv
</span><span class="cx"> __ZN3WTF28setMainThreadCallbacksPausedEb
</span><span class="cx"> __ZN3WTF36lockAtomicallyInitializedStaticMutexEv
</span><del>-__ZN3WTF37parseDateFromNullTerminatedCharactersEPKc
</del><span class="cx"> __ZN3WTF38unlockAtomicallyInitializedStaticMutexEv
</span><span class="cx"> __ZN3WTF5Mutex4lockEv
</span><span class="cx"> __ZN3WTF5Mutex6unlockEv
</span></span></pre></div>
<a id="trunkJavaScriptCoreJavaScriptCorevcprojJavaScriptCoreJavaScriptCorevcproj"></a>
<div class="modfile"><h4>Modified: trunk/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj (50607 => 50608)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj        2009-11-06 23:00:44 UTC (rev 50607)
+++ trunk/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj        2009-11-06 23:33:17 UTC (rev 50608)
</span><span class="lines">@@ -668,6 +668,14 @@
</span><span class="cx">                                 RelativePath=&quot;..\..\runtime\DateInstanceCache.h&quot;
</span><span class="cx">                                 &gt;
</span><span class="cx">                         &lt;/File&gt;
</span><ins>+                        &lt;File
+                                RelativePath=&quot;..\..\wtf\DateMath.cpp&quot;
+                                &gt;
+                        &lt;/File&gt;
+                        &lt;File
+                                RelativePath=&quot;..\..\wtf\DateMath.h&quot;
+                                &gt;
+                        &lt;/File&gt;
</ins><span class="cx">                         &lt;File
</span><span class="cx">                                 RelativePath=&quot;..\..\runtime\DatePrototype.cpp&quot;
</span><span class="cx">                                 &gt;
</span></span></pre></div>
<a id="trunkJavaScriptCoreJavaScriptCorevcprojWTFWTFvcproj"></a>
<div class="modfile"><h4>Modified: trunk/JavaScriptCore/JavaScriptCore.vcproj/WTF/WTF.vcproj (50607 => 50608)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/JavaScriptCore/JavaScriptCore.vcproj/WTF/WTF.vcproj        2009-11-06 23:00:44 UTC (rev 50607)
+++ trunk/JavaScriptCore/JavaScriptCore.vcproj/WTF/WTF.vcproj        2009-11-06 23:33:17 UTC (rev 50608)
</span><span class="lines">@@ -285,14 +285,6 @@
</span><span class="cx">                         &gt;
</span><span class="cx">                 &lt;/File&gt;
</span><span class="cx">                 &lt;File
</span><del>-                        RelativePath=&quot;..\..\wtf\DateMath.cpp&quot;
-                        &gt;
-                &lt;/File&gt;
-                &lt;File
-                        RelativePath=&quot;..\..\wtf\DateMath.h&quot;
-                        &gt;
-                &lt;/File&gt;
-                &lt;File
</del><span class="cx">                         RelativePath=&quot;..\..\wtf\Deque.h&quot;
</span><span class="cx">                         &gt;
</span><span class="cx">                 &lt;/File&gt;
</span></span></pre></div>
<a id="trunkJavaScriptCoreJavaScriptCoreSourcesbkl"></a>
<div class="modfile"><h4>Modified: trunk/JavaScriptCore/JavaScriptCoreSources.bkl (50607 => 50608)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/JavaScriptCore/JavaScriptCoreSources.bkl        2009-11-06 23:00:44 UTC (rev 50607)
+++ trunk/JavaScriptCore/JavaScriptCoreSources.bkl        2009-11-06 23:33:17 UTC (rev 50608)
</span><span class="lines">@@ -89,6 +89,7 @@
</span><span class="cx">         runtime/DateConstructor.cpp
</span><span class="cx">         runtime/DateConversion.cpp
</span><span class="cx">         runtime/DateInstance.cpp
</span><ins>+        wtf/DateMath.cpp
</ins><span class="cx">         runtime/DatePrototype.cpp
</span><span class="cx">         runtime/Error.cpp
</span><span class="cx">         runtime/ErrorConstructor.cpp
</span><span class="lines">@@ -173,7 +174,6 @@
</span><span class="cx">         wtf/Assertions.cpp
</span><span class="cx">         wtf/ByteArray.cpp
</span><span class="cx">         wtf/CurrentTime.cpp
</span><del>-        wtf/DateMath.cpp
</del><span class="cx">         wtf/FastMalloc.cpp
</span><span class="cx">         wtf/HashTable.cpp
</span><span class="cx">         wtf/MainThread.cpp
</span></span></pre></div>
<a id="trunkJavaScriptCoreinterpreterCachedCallh"></a>
<div class="modfile"><h4>Modified: trunk/JavaScriptCore/interpreter/CachedCall.h (50607 => 50608)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/JavaScriptCore/interpreter/CachedCall.h        2009-11-06 23:00:44 UTC (rev 50607)
+++ trunk/JavaScriptCore/interpreter/CachedCall.h        2009-11-06 23:33:17 UTC (rev 50608)
</span><span class="lines">@@ -38,7 +38,7 @@
</span><span class="cx">             : m_valid(false)
</span><span class="cx">             , m_interpreter(callFrame-&gt;interpreter())
</span><span class="cx">             , m_exception(exception)
</span><del>-            , m_globalObjectScope(callFrame, callFrame-&gt;globalData().dynamicGlobalObject ? callFrame-&gt;globalData().dynamicGlobalObject : function-&gt;scope().globalObject())
</del><ins>+            , m_globalObjectScope(callFrame, function-&gt;scope().globalObject())
</ins><span class="cx">         {
</span><span class="cx">             ASSERT(!function-&gt;isHostFunction());
</span><span class="cx">             m_closure = m_interpreter-&gt;prepareForRepeatCall(function-&gt;jsExecutable(), callFrame, function, argCount, function-&gt;scope().node(), exception);
</span></span></pre></div>
<a id="trunkJavaScriptCoreinterpreterInterpretercpp"></a>
<div class="modfile"><h4>Modified: trunk/JavaScriptCore/interpreter/Interpreter.cpp (50607 => 50608)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/JavaScriptCore/interpreter/Interpreter.cpp        2009-11-06 23:00:44 UTC (rev 50607)
+++ trunk/JavaScriptCore/interpreter/Interpreter.cpp        2009-11-06 23:33:17 UTC (rev 50608)
</span><span class="lines">@@ -647,7 +647,7 @@
</span><span class="cx">         return jsNull();
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    DynamicGlobalObjectScope globalObjectScope(callFrame, callFrame-&gt;globalData().dynamicGlobalObject ? callFrame-&gt;globalData().dynamicGlobalObject : scopeChain-&gt;globalObject);
</del><ins>+    DynamicGlobalObjectScope globalObjectScope(callFrame, scopeChain-&gt;globalObject);
</ins><span class="cx"> 
</span><span class="cx">     CallFrame* newCallFrame = CallFrame::create(oldEnd);
</span><span class="cx">     size_t dst = 0;
</span><span class="lines">@@ -777,7 +777,7 @@
</span><span class="cx">         }
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    DynamicGlobalObjectScope globalObjectScope(callFrame, callFrame-&gt;globalData().dynamicGlobalObject ? callFrame-&gt;globalData().dynamicGlobalObject : scopeChain-&gt;globalObject);
</del><ins>+    DynamicGlobalObjectScope globalObjectScope(callFrame, scopeChain-&gt;globalObject);
</ins><span class="cx"> 
</span><span class="cx">     EvalCodeBlock* codeBlock = &amp;eval-&gt;bytecode(callFrame, scopeChain);
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkJavaScriptCorepcrepcre_execcpp"></a>
<div class="modfile"><h4>Modified: trunk/JavaScriptCore/pcre/pcre_exec.cpp (50607 => 50608)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/JavaScriptCore/pcre/pcre_exec.cpp        2009-11-06 23:00:44 UTC (rev 50607)
+++ trunk/JavaScriptCore/pcre/pcre_exec.cpp        2009-11-06 23:33:17 UTC (rev 50608)
</span><span class="lines">@@ -2164,14 +2164,14 @@
</span><span class="cx"> 
</span><span class="cx"> HistogramTimeLogger::HistogramTimeLogger(const JSRegExp* re)
</span><span class="cx">     : m_re(re)
</span><del>-    , m_startTime(getCurrentUTCTimeWithMicroseconds())
</del><ins>+    , m_startTime(currentTimeMS())
</ins><span class="cx"> {
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> HistogramTimeLogger::~HistogramTimeLogger()
</span><span class="cx"> {
</span><span class="cx">     static Histogram histogram;
</span><del>-    histogram.add(m_re, getCurrentUTCTimeWithMicroseconds() - m_startTime);
</del><ins>+    histogram.add(m_re, currentTimeMS() - m_startTime);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> #endif
</span></span></pre></div>
<a id="trunkJavaScriptCoreprofilerProfileNodecpp"></a>
<div class="modfile"><h4>Modified: trunk/JavaScriptCore/profiler/ProfileNode.cpp (50607 => 50608)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/JavaScriptCore/profiler/ProfileNode.cpp        2009-11-06 23:00:44 UTC (rev 50607)
+++ trunk/JavaScriptCore/profiler/ProfileNode.cpp        2009-11-06 23:33:17 UTC (rev 50608)
</span><span class="lines">@@ -37,6 +37,8 @@
</span><span class="cx"> #include &lt;windows.h&gt;
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><ins>+using namespace WTF;
+
</ins><span class="cx"> namespace JSC {
</span><span class="cx"> 
</span><span class="cx"> static double getCount()
</span><span class="lines">@@ -49,7 +51,7 @@
</span><span class="cx">     QueryPerformanceCounter(&amp;counter);
</span><span class="cx">     return static_cast&lt;double&gt;(counter.QuadPart) / frequency.QuadPart;
</span><span class="cx"> #else
</span><del>-    return WTF::getCurrentUTCTimeWithMicroseconds();
</del><ins>+    return currentTimeMS();
</ins><span class="cx"> #endif
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkJavaScriptCoreruntimeDateConstructorcpp"></a>
<div class="modfile"><h4>Modified: trunk/JavaScriptCore/runtime/DateConstructor.cpp (50607 => 50608)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/JavaScriptCore/runtime/DateConstructor.cpp        2009-11-06 23:00:44 UTC (rev 50607)
+++ trunk/JavaScriptCore/runtime/DateConstructor.cpp        2009-11-06 23:33:17 UTC (rev 50608)
</span><span class="lines">@@ -77,14 +77,14 @@
</span><span class="cx">     double value;
</span><span class="cx"> 
</span><span class="cx">     if (numArgs == 0) // new Date() ECMA 15.9.3.3
</span><del>-        value = getCurrentUTCTime();
</del><ins>+        value = jsCurrentTime();
</ins><span class="cx">     else if (numArgs == 1) {
</span><span class="cx">         if (args.at(0).inherits(&amp;DateInstance::info))
</span><span class="cx">             value = asDateInstance(args.at(0))-&gt;internalNumber();
</span><span class="cx">         else {
</span><span class="cx">             JSValue primitive = args.at(0).toPrimitive(exec);
</span><span class="cx">             if (primitive.isString())
</span><del>-                value = parseDate(primitive.getString());
</del><ins>+                value = parseDate(exec, primitive.getString());
</ins><span class="cx">             else
</span><span class="cx">                 value = primitive.toNumber(exec);
</span><span class="cx">         }
</span><span class="lines">@@ -108,7 +108,7 @@
</span><span class="cx">             t.second = args.at(5).toInt32(exec);
</span><span class="cx">             t.isDST = -1;
</span><span class="cx">             double ms = (numArgs &gt;= 7) ? args.at(6).toNumber(exec) : 0;
</span><del>-            value = gregorianDateTimeToMS(t, ms, false);
</del><ins>+            value = gregorianDateTimeToMS(exec, t, ms, false);
</ins><span class="cx">         }
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="lines">@@ -132,7 +132,7 @@
</span><span class="cx">     time_t localTime = time(0);
</span><span class="cx">     tm localTM;
</span><span class="cx">     getLocalTime(&amp;localTime, &amp;localTM);
</span><del>-    GregorianDateTime ts(localTM);
</del><ins>+    GregorianDateTime ts(exec, localTM);
</ins><span class="cx">     return jsNontrivialString(exec, formatDate(ts) + &quot; &quot; + formatTime(ts, false));
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -144,12 +144,12 @@
</span><span class="cx"> 
</span><span class="cx"> static JSValue JSC_HOST_CALL dateParse(ExecState* exec, JSObject*, JSValue, const ArgList&amp; args)
</span><span class="cx"> {
</span><del>-    return jsNumber(exec, parseDate(args.at(0).toString(exec)));
</del><ins>+    return jsNumber(exec, parseDate(exec, args.at(0).toString(exec)));
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> static JSValue JSC_HOST_CALL dateNow(ExecState* exec, JSObject*, JSValue, const ArgList&amp;)
</span><span class="cx"> {
</span><del>-    return jsNumber(exec, getCurrentUTCTime());
</del><ins>+    return jsNumber(exec, jsCurrentTime());
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> static JSValue JSC_HOST_CALL dateUTC(ExecState* exec, JSObject*, JSValue, const ArgList&amp; args) 
</span><span class="lines">@@ -173,7 +173,7 @@
</span><span class="cx">     t.minute = args.at(4).toInt32(exec);
</span><span class="cx">     t.second = args.at(5).toInt32(exec);
</span><span class="cx">     double ms = (n &gt;= 7) ? args.at(6).toNumber(exec) : 0;
</span><del>-    return jsNumber(exec, gregorianDateTimeToMS(t, ms, true));
</del><ins>+    return jsNumber(exec, gregorianDateTimeToMS(exec, t, ms, true));
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> } // namespace JSC
</span></span></pre></div>
<a id="trunkJavaScriptCoreruntimeDateConversioncpp"></a>
<div class="modfile"><h4>Modified: trunk/JavaScriptCore/runtime/DateConversion.cpp (50607 => 50608)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/JavaScriptCore/runtime/DateConversion.cpp        2009-11-06 23:00:44 UTC (rev 50607)
+++ trunk/JavaScriptCore/runtime/DateConversion.cpp        2009-11-06 23:33:17 UTC (rev 50608)
</span><span class="lines">@@ -51,9 +51,9 @@
</span><span class="cx"> 
</span><span class="cx"> namespace JSC {
</span><span class="cx"> 
</span><del>-double parseDate(const UString &amp;date)
</del><ins>+double parseDate(ExecState* exec, const UString &amp;date)
</ins><span class="cx"> {
</span><del>-    return parseDateFromNullTerminatedCharacters(date.UTF8String().c_str());
</del><ins>+    return parseDateFromNullTerminatedCharacters(date.UTF8String().c_str(), exec);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> UString formatDate(const GregorianDateTime &amp;t)
</span></span></pre></div>
<a id="trunkJavaScriptCoreruntimeDateConversionh"></a>
<div class="modfile"><h4>Modified: trunk/JavaScriptCore/runtime/DateConversion.h (50607 => 50608)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/JavaScriptCore/runtime/DateConversion.h        2009-11-06 23:00:44 UTC (rev 50607)
+++ trunk/JavaScriptCore/runtime/DateConversion.h        2009-11-06 23:33:17 UTC (rev 50608)
</span><span class="lines">@@ -42,18 +42,16 @@
</span><span class="cx"> #ifndef DateConversion_h
</span><span class="cx"> #define DateConversion_h
</span><span class="cx"> 
</span><del>-namespace WTF {
-    struct GregorianDateTime;
-}
-
</del><span class="cx"> namespace JSC {
</span><span class="cx"> 
</span><ins>+class ExecState;
</ins><span class="cx"> class UString;
</span><ins>+struct GregorianDateTime;
</ins><span class="cx"> 
</span><del>-double parseDate(const UString&amp;);
-UString formatDate(const WTF::GregorianDateTime&amp;);
-UString formatDateUTCVariant(const WTF::GregorianDateTime&amp;);
-UString formatTime(const WTF::GregorianDateTime&amp;, bool inputIsUTC);
</del><ins>+double parseDate(ExecState* exec, const UString&amp;);
+UString formatDate(const GregorianDateTime&amp;);
+UString formatDateUTCVariant(const GregorianDateTime&amp;);
+UString formatTime(const GregorianDateTime&amp;, bool inputIsUTC);
</ins><span class="cx"> 
</span><span class="cx"> } // namespace JSC
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkJavaScriptCoreruntimeDateInstancecpp"></a>
<div class="modfile"><h4>Modified: trunk/JavaScriptCore/runtime/DateInstance.cpp (50607 => 50608)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/JavaScriptCore/runtime/DateInstance.cpp        2009-11-06 23:00:44 UTC (rev 50607)
+++ trunk/JavaScriptCore/runtime/DateInstance.cpp        2009-11-06 23:33:17 UTC (rev 50608)
</span><span class="lines">@@ -57,14 +57,14 @@
</span><span class="cx"> 
</span><span class="cx">     if (outputIsUTC) {
</span><span class="cx">         if (m_data-&gt;m_gregorianDateTimeUTCCachedForMS != milli) {
</span><del>-            msToGregorianDateTime(internalNumber(), true, m_data-&gt;m_cachedGregorianDateTimeUTC);
</del><ins>+            msToGregorianDateTime(exec, internalNumber(), true, m_data-&gt;m_cachedGregorianDateTimeUTC);
</ins><span class="cx">             m_data-&gt;m_gregorianDateTimeUTCCachedForMS = milli;
</span><span class="cx">         }
</span><span class="cx">         return &amp;m_data-&gt;m_cachedGregorianDateTimeUTC;
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     if (m_data-&gt;m_gregorianDateTimeCachedForMS != milli) {
</span><del>-        msToGregorianDateTime(internalNumber(), false, m_data-&gt;m_cachedGregorianDateTime);
</del><ins>+        msToGregorianDateTime(exec, internalNumber(), false, m_data-&gt;m_cachedGregorianDateTime);
</ins><span class="cx">         m_data-&gt;m_gregorianDateTimeCachedForMS = milli;
</span><span class="cx">     }
</span><span class="cx">     return &amp;m_data-&gt;m_cachedGregorianDateTime;
</span></span></pre></div>
<a id="trunkJavaScriptCoreruntimeDateInstanceh"></a>
<div class="modfile"><h4>Modified: trunk/JavaScriptCore/runtime/DateInstance.h (50607 => 50608)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/JavaScriptCore/runtime/DateInstance.h        2009-11-06 23:00:44 UTC (rev 50607)
+++ trunk/JavaScriptCore/runtime/DateInstance.h        2009-11-06 23:33:17 UTC (rev 50608)
</span><span class="lines">@@ -38,7 +38,7 @@
</span><span class="cx"> 
</span><span class="cx">         static JS_EXPORTDATA const ClassInfo info;
</span><span class="cx"> 
</span><del>-        const WTF::GregorianDateTime* gregorianDateTime(ExecState*, bool outputIsUTC) const;
</del><ins>+        const GregorianDateTime* gregorianDateTime(ExecState*, bool outputIsUTC) const;
</ins><span class="cx"> 
</span><span class="cx">         static PassRefPtr&lt;Structure&gt; createStructure(JSValue prototype)
</span><span class="cx">         {
</span></span></pre></div>
<a id="trunkJavaScriptCoreruntimeDateInstanceCacheh"></a>
<div class="modfile"><h4>Modified: trunk/JavaScriptCore/runtime/DateInstanceCache.h (50607 => 50608)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/JavaScriptCore/runtime/DateInstanceCache.h        2009-11-06 23:00:44 UTC (rev 50607)
+++ trunk/JavaScriptCore/runtime/DateInstanceCache.h        2009-11-06 23:33:17 UTC (rev 50608)
</span><span class="lines">@@ -40,9 +40,9 @@
</span><span class="cx">         static PassRefPtr&lt;DateInstanceData&gt; create() { return adoptRef(new DateInstanceData); }
</span><span class="cx"> 
</span><span class="cx">         double m_gregorianDateTimeCachedForMS;
</span><del>-        WTF::GregorianDateTime m_cachedGregorianDateTime;
</del><ins>+        GregorianDateTime m_cachedGregorianDateTime;
</ins><span class="cx">         double m_gregorianDateTimeUTCCachedForMS;
</span><del>-        WTF::GregorianDateTime m_cachedGregorianDateTimeUTC;
</del><ins>+        GregorianDateTime m_cachedGregorianDateTimeUTC;
</ins><span class="cx"> 
</span><span class="cx">     private:
</span><span class="cx">         DateInstanceData()
</span></span></pre></div>
<a id="trunkJavaScriptCoreruntimeDatePrototypecpp"></a>
<div class="modfile"><h4>Modified: trunk/JavaScriptCore/runtime/DatePrototype.cpp (50607 => 50608)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/JavaScriptCore/runtime/DatePrototype.cpp        2009-11-06 23:00:44 UTC (rev 50607)
+++ trunk/JavaScriptCore/runtime/DatePrototype.cpp        2009-11-06 23:33:17 UTC (rev 50608)
</span><span class="lines">@@ -842,7 +842,7 @@
</span><span class="cx">         return result;
</span><span class="cx">     } 
</span><span class="cx">     
</span><del>-    JSValue result = jsNumber(exec, gregorianDateTimeToMS(gregorianDateTime, ms, inputIsUTC));
</del><ins>+    JSValue result = jsNumber(exec, gregorianDateTimeToMS(exec, gregorianDateTime, ms, inputIsUTC));
</ins><span class="cx">     thisDateObj-&gt;setInternalValue(result);
</span><span class="cx">     return result;
</span><span class="cx"> }
</span><span class="lines">@@ -864,7 +864,7 @@
</span><span class="cx"> 
</span><span class="cx">     GregorianDateTime gregorianDateTime; 
</span><span class="cx">     if (numArgsToUse == 3 &amp;&amp; isnan(milli)) 
</span><del>-        WTF::msToGregorianDateTime(0, true, gregorianDateTime); 
</del><ins>+        msToGregorianDateTime(exec, 0, true, gregorianDateTime); 
</ins><span class="cx">     else { 
</span><span class="cx">         ms = milli - floor(milli / msPerSecond) * msPerSecond; 
</span><span class="cx">         const GregorianDateTime* other = thisDateObj-&gt;gregorianDateTime(exec, inputIsUTC);
</span><span class="lines">@@ -879,7 +879,7 @@
</span><span class="cx">         return result;
</span><span class="cx">     } 
</span><span class="cx">            
</span><del>-    JSValue result = jsNumber(exec, gregorianDateTimeToMS(gregorianDateTime, ms, inputIsUTC));
</del><ins>+    JSValue result = jsNumber(exec, gregorianDateTimeToMS(exec, gregorianDateTime, ms, inputIsUTC));
</ins><span class="cx">     thisDateObj-&gt;setInternalValue(result);
</span><span class="cx">     return result;
</span><span class="cx"> }
</span><span class="lines">@@ -989,7 +989,7 @@
</span><span class="cx">     if (isnan(milli))
</span><span class="cx">         // Based on ECMA 262 B.2.5 (setYear)
</span><span class="cx">         // the time must be reset to +0 if it is NaN. 
</span><del>-        msToGregorianDateTime(0, true, gregorianDateTime);
</del><ins>+        msToGregorianDateTime(exec, 0, true, gregorianDateTime);
</ins><span class="cx">     else {   
</span><span class="cx">         double secs = floor(milli / msPerSecond);
</span><span class="cx">         ms = milli - secs * msPerSecond;
</span><span class="lines">@@ -1006,7 +1006,7 @@
</span><span class="cx">     }
</span><span class="cx">             
</span><span class="cx">     gregorianDateTime.year = (year &gt; 99 || year &lt; 0) ? year - 1900 : year;
</span><del>-    JSValue result = jsNumber(exec, gregorianDateTimeToMS(gregorianDateTime, ms, outputIsUTC));
</del><ins>+    JSValue result = jsNumber(exec, gregorianDateTimeToMS(exec, gregorianDateTime, ms, outputIsUTC));
</ins><span class="cx">     thisDateObj-&gt;setInternalValue(result);
</span><span class="cx">     return result;
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkJavaScriptCoreruntimeInitializeThreadingcpp"></a>
<div class="modfile"><h4>Modified: trunk/JavaScriptCore/runtime/InitializeThreading.cpp (50607 => 50608)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/JavaScriptCore/runtime/InitializeThreading.cpp        2009-11-06 23:00:44 UTC (rev 50607)
+++ trunk/JavaScriptCore/runtime/InitializeThreading.cpp        2009-11-06 23:33:17 UTC (rev 50608)
</span><span class="lines">@@ -51,7 +51,7 @@
</span><span class="cx">     initializeUString();
</span><span class="cx"> #if ENABLE(JSC_MULTIPLE_THREADS)
</span><span class="cx">     s_dtoaP5Mutex = new Mutex;
</span><del>-    WTF::initializeDates();
</del><ins>+    initializeDates();
</ins><span class="cx"> #endif
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkJavaScriptCoreruntimeJSGlobalDatacpp"></a>
<div class="modfile"><h4>Modified: trunk/JavaScriptCore/runtime/JSGlobalData.cpp (50607 => 50608)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/JavaScriptCore/runtime/JSGlobalData.cpp        2009-11-06 23:00:44 UTC (rev 50607)
+++ trunk/JavaScriptCore/runtime/JSGlobalData.cpp        2009-11-06 23:33:17 UTC (rev 50608)
</span><span class="lines">@@ -147,6 +147,7 @@
</span><span class="cx">     , functionCodeBlockBeingReparsed(0)
</span><span class="cx">     , firstStringifierToMark(0)
</span><span class="cx">     , markStack(vptrSet.jsArrayVPtr)
</span><ins>+    , cachedUTCOffset(NaN)
</ins><span class="cx"> #ifndef NDEBUG
</span><span class="cx">     , mainThreadOnly(false)
</span><span class="cx"> #endif
</span></span></pre></div>
<a id="trunkJavaScriptCoreruntimeJSGlobalDatah"></a>
<div class="modfile"><h4>Modified: trunk/JavaScriptCore/runtime/JSGlobalData.h (50607 => 50608)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/JavaScriptCore/runtime/JSGlobalData.h        2009-11-06 23:00:44 UTC (rev 50607)
+++ trunk/JavaScriptCore/runtime/JSGlobalData.h        2009-11-06 23:33:17 UTC (rev 50608)
</span><span class="lines">@@ -153,6 +153,8 @@
</span><span class="cx"> 
</span><span class="cx">         MarkStack markStack;
</span><span class="cx"> 
</span><ins>+        double cachedUTCOffset;
+
</ins><span class="cx"> #ifndef NDEBUG
</span><span class="cx">         bool mainThreadOnly;
</span><span class="cx"> #endif
</span></span></pre></div>
<a id="trunkJavaScriptCoreruntimeJSGlobalObjecth"></a>
<div class="modfile"><h4>Modified: trunk/JavaScriptCore/runtime/JSGlobalObject.h (50607 => 50608)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/JavaScriptCore/runtime/JSGlobalObject.h        2009-11-06 23:00:44 UTC (rev 50607)
+++ trunk/JavaScriptCore/runtime/JSGlobalObject.h        2009-11-06 23:33:17 UTC (rev 50608)
</span><span class="lines">@@ -442,7 +442,13 @@
</span><span class="cx">             : m_dynamicGlobalObjectSlot(callFrame-&gt;globalData().dynamicGlobalObject)
</span><span class="cx">             , m_savedDynamicGlobalObject(m_dynamicGlobalObjectSlot)
</span><span class="cx">         {
</span><del>-            m_dynamicGlobalObjectSlot = dynamicGlobalObject;
</del><ins>+            if (!m_dynamicGlobalObjectSlot) {
+                m_dynamicGlobalObjectSlot = dynamicGlobalObject;
+
+                // Reset the UTC cache between JS invocations to force the VM
+                // to observe time zone changes.
+                callFrame-&gt;globalData().cachedUTCOffset = NaN;
+            }
</ins><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         ~DynamicGlobalObjectScope()
</span></span></pre></div>
<a id="trunkJavaScriptCorewtfCurrentTimeh"></a>
<div class="modfile"><h4>Modified: trunk/JavaScriptCore/wtf/CurrentTime.h (50607 => 50608)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/JavaScriptCore/wtf/CurrentTime.h        2009-11-06 23:00:44 UTC (rev 50607)
+++ trunk/JavaScriptCore/wtf/CurrentTime.h        2009-11-06 23:33:17 UTC (rev 50608)
</span><span class="lines">@@ -34,11 +34,28 @@
</span><span class="cx"> 
</span><span class="cx"> namespace WTF {
</span><span class="cx"> 
</span><del>-    // Returns the current system (UTC) time in seconds, starting January 1, 1970.
-    // Precision varies depending on a platform but usually is as good or better 
</del><ins>+    // Returns the current UTC time in seconds, counted from January 1, 1970.
+    // Precision varies depending on platform but is usually as good or better 
</ins><span class="cx">     // than a millisecond.
</span><span class="cx">     double currentTime();
</span><span class="cx"> 
</span><ins>+    // Same thing, in milliseconds.
+    inline double currentTimeMS()
+    {
+        return currentTime() * 1000.0; 
+    }
+
+    inline void getLocalTime(const time_t* localTime, struct tm* localTM)
+    {
+    #if COMPILER(MSVC7) || COMPILER(MINGW) || PLATFORM(WINCE)
+        *localTM = *localtime(localTime);
+    #elif COMPILER(MSVC)
+        localtime_s(localTM, localTime);
+    #else
+        localtime_r(localTime, localTM);
+    #endif
+    }
+
</ins><span class="cx"> } // namespace WTF
</span><span class="cx"> 
</span><span class="cx"> using WTF::currentTime;
</span></span></pre></div>
<a id="trunkJavaScriptCorewtfDateMathcpp"></a>
<div class="modfile"><h4>Modified: trunk/JavaScriptCore/wtf/DateMath.cpp (50607 => 50608)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/JavaScriptCore/wtf/DateMath.cpp        2009-11-06 23:00:44 UTC (rev 50607)
+++ trunk/JavaScriptCore/wtf/DateMath.cpp        2009-11-06 23:33:17 UTC (rev 50608)
</span><span class="lines">@@ -50,6 +50,8 @@
</span><span class="cx"> #include &quot;MathExtras.h&quot;
</span><span class="cx"> #include &quot;StringExtras.h&quot;
</span><span class="cx"> 
</span><ins>+#include &quot;CallFrame.h&quot;
+
</ins><span class="cx"> #include &lt;algorithm&gt;
</span><span class="cx"> #include &lt;limits.h&gt;
</span><span class="cx"> #include &lt;limits&gt;
</span><span class="lines">@@ -61,10 +63,6 @@
</span><span class="cx"> #include &lt;errno.h&gt;
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><del>-#if PLATFORM(DARWIN)
-#include &lt;notify.h&gt;
-#endif
-
</del><span class="cx"> #if PLATFORM(WINCE)
</span><span class="cx"> extern &quot;C&quot; size_t strftime(char * const s, const size_t maxsize, const char * const format, const struct tm * const t);
</span><span class="cx"> extern &quot;C&quot; struct tm * localtime(const time_t *timer);
</span><span class="lines">@@ -80,8 +78,10 @@
</span><span class="cx"> 
</span><span class="cx"> #define NaN std::numeric_limits&lt;double&gt;::quiet_NaN()
</span><span class="cx"> 
</span><del>-namespace WTF {
</del><ins>+using namespace WTF;
</ins><span class="cx"> 
</span><ins>+namespace JSC {
+
</ins><span class="cx"> /* Constants */
</span><span class="cx"> 
</span><span class="cx"> static const double minutesPerDay = 24.0 * 60.0;
</span><span class="lines">@@ -293,28 +293,6 @@
</span><span class="cx">     return yearday + monthday + day - 1;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-double getCurrentUTCTime()
-{
-    return floor(getCurrentUTCTimeWithMicroseconds());
-}
-
-// Returns current time in milliseconds since 1 Jan 1970.
-double getCurrentUTCTimeWithMicroseconds()
-{
-    return currentTime() * 1000.0; 
-}
-
-void getLocalTime(const time_t* localTime, struct tm* localTM)
-{
-#if COMPILER(MSVC7) || COMPILER(MINGW) || PLATFORM(WINCE)
-    *localTM = *localtime(localTime);
-#elif COMPILER(MSVC)
-    localtime_s(localTM, localTime);
-#else
-    localtime_r(localTime, localTM);
-#endif
-}
-
</del><span class="cx"> // There is a hard limit at 2038 that we currently do not have a workaround
</span><span class="cx"> // for (rdar://problem/5052975).
</span><span class="cx"> static inline int maximumYearForDST()
</span><span class="lines">@@ -328,7 +306,7 @@
</span><span class="cx">     // greater than the max year minus 27 (2010), we want to use the max year
</span><span class="cx">     // minus 27 instead, to ensure there is a range of 28 years that all years
</span><span class="cx">     // can map to.
</span><del>-    return std::min(msToYear(getCurrentUTCTime()), maximumYearForDST() - 27) ;
</del><ins>+    return std::min(msToYear(jsCurrentTime()), maximumYearForDST() - 27) ;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> /*
</span><span class="lines">@@ -399,36 +377,17 @@
</span><span class="cx">     return static_cast&lt;int32_t&gt;(utcOffset * 1000);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-#if PLATFORM(DARWIN)
-static int32_t s_cachedUTCOffset; // In milliseconds. An assumption here is that access to an int32_t variable is atomic on platforms that take this code path.
-static bool s_haveCachedUTCOffset;
-static int s_notificationToken;
-#endif
-
</del><span class="cx"> /*
</span><span class="cx">  * Get the difference in milliseconds between this time zone and UTC (GMT)
</span><span class="cx">  * NOT including DST.
</span><span class="cx">  */
</span><del>-double getUTCOffset()
</del><ins>+double getUTCOffset(ExecState* exec)
</ins><span class="cx"> {
</span><del>-#if PLATFORM(DARWIN)
-    if (s_haveCachedUTCOffset) {
-        int notified;
-        uint32_t status = notify_check(s_notificationToken, &amp;notified);
-        if (status == NOTIFY_STATUS_OK &amp;&amp; !notified)
-            return s_cachedUTCOffset;
-    }
-#endif
-
-    int32_t utcOffset = calculateUTCOffset();
-
-#if PLATFORM(DARWIN)
-    // Theoretically, it is possible that several threads will be executing this code at once, in which case we will have a race condition,
-    // and a newer value may be overwritten. In practice, time zones don't change that often.
-    s_cachedUTCOffset = utcOffset;
-#endif
-
-    return utcOffset;
</del><ins>+    double utcOffset = exec-&gt;globalData().cachedUTCOffset;
+    if (!isnan(utcOffset))
+        return utcOffset;
+    exec-&gt;globalData().cachedUTCOffset = calculateUTCOffset();
+    return exec-&gt;globalData().cachedUTCOffset;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> /*
</span><span class="lines">@@ -486,14 +445,14 @@
</span><span class="cx">     return getDSTOffsetSimple(ms / msPerSecond, utcOffset);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-double gregorianDateTimeToMS(const GregorianDateTime&amp; t, double milliSeconds, bool inputIsUTC)
</del><ins>+double gregorianDateTimeToMS(ExecState* exec, const GregorianDateTime&amp; t, double milliSeconds, bool inputIsUTC)
</ins><span class="cx"> {
</span><span class="cx">     int day = dateToDayInYear(t.year + 1900, t.month, t.monthDay);
</span><span class="cx">     double ms = timeToMS(t.hour, t.minute, t.second, milliSeconds);
</span><span class="cx">     double result = (day * msPerDay) + ms;
</span><span class="cx"> 
</span><span class="cx">     if (!inputIsUTC) { // convert to UTC
</span><del>-        double utcOffset = getUTCOffset();
</del><ins>+        double utcOffset = getUTCOffset(exec);
</ins><span class="cx">         result -= utcOffset;
</span><span class="cx">         result -= getDSTOffset(result, utcOffset);
</span><span class="cx">     }
</span><span class="lines">@@ -502,12 +461,12 @@
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> // input is UTC
</span><del>-void msToGregorianDateTime(double ms, bool outputIsUTC, GregorianDateTime&amp; tm)
</del><ins>+void msToGregorianDateTime(ExecState* exec, double ms, bool outputIsUTC, GregorianDateTime&amp; tm)
</ins><span class="cx"> {
</span><span class="cx">     double dstOff = 0.0;
</span><span class="cx">     double utcOff = 0.0;
</span><span class="cx">     if (!outputIsUTC) {
</span><del>-        utcOff = getUTCOffset();
</del><ins>+        utcOff = getUTCOffset(exec);
</ins><span class="cx">         dstOff = getDSTOffset(ms, utcOff);
</span><span class="cx">         ms += dstOff + utcOff;
</span><span class="cx">     }
</span><span class="lines">@@ -534,14 +493,6 @@
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx">     equivalentYearForDST(2000); // Need to call once to initialize a static used in this function.
</span><del>-#if PLATFORM(DARWIN)
-    // Register for a notification whenever the time zone changes.
-    uint32_t status = notify_register_check(&quot;com.apple.system.timezone&quot;, &amp;s_notificationToken);
-    if (status == NOTIFY_STATUS_OK) {
-        s_cachedUTCOffset = calculateUTCOffset();
-        s_haveCachedUTCOffset = true;
-    }
-#endif
</del><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> static inline double ymdhmsToSeconds(long year, int mon, int day, int hour, int minute, int second)
</span><span class="lines">@@ -622,7 +573,8 @@
</span><span class="cx">     return true;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-double parseDateFromNullTerminatedCharacters(const char* dateString)
</del><ins>+// Odd case where 'exec' is allowed to be 0, to accomodate a caller in WebCore.
+double parseDateFromNullTerminatedCharacters(const char* dateString, ExecState* exec)
</ins><span class="cx"> {
</span><span class="cx">     // This parses a date in the form:
</span><span class="cx">     //     Tuesday, 09-Nov-99 23:12:40 GMT
</span><span class="lines">@@ -889,23 +841,22 @@
</span><span class="cx">         else
</span><span class="cx">             year += 1900;
</span><span class="cx">     }
</span><del>-
</del><ins>+    
+    double ms = ymdhmsToSeconds(year, month + 1, day, hour, minute, second) * msPerSecond;
</ins><span class="cx">     // fall back to local timezone
</span><span class="cx">     if (!haveTZ) {
</span><del>-        GregorianDateTime t;
-        t.monthDay = day;
-        t.month = month;
-        t.year = year - 1900;
-        t.isDST = -1;
-        t.second = second;
-        t.minute = minute;
-        t.hour = hour;
-
-        // Use our gregorianDateTimeToMS() rather than mktime() as the latter can't handle the full year range.
-        return gregorianDateTimeToMS(t, 0, false);
</del><ins>+        if (exec) {
+            double utcOffset = getUTCOffset(exec);
+            double dstOffset = getDSTOffset(ms, utcOffset);
+            offset = static_cast&lt;int&gt;((utcOffset + dstOffset) / msPerMinute);
+        } else {
+            double utcOffset = calculateUTCOffset();
+            double dstOffset = getDSTOffset(ms, utcOffset);
+            offset = static_cast&lt;int&gt;((utcOffset + dstOffset) / msPerMinute);
+        }
</ins><span class="cx">     }
</span><span class="cx"> 
</span><del>-    return (ymdhmsToSeconds(year, month + 1, day, hour, minute, second) - (offset * 60.0)) * msPerSecond;
</del><ins>+    return ms - (offset * msPerMinute);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> double timeClip(double t)
</span><span class="lines">@@ -918,4 +869,4 @@
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> 
</span><del>-} // namespace WTF
</del><ins>+} // namespace JSC
</ins></span></pre></div>
<a id="trunkJavaScriptCorewtfDateMathh"></a>
<div class="modfile"><h4>Modified: trunk/JavaScriptCore/wtf/DateMath.h (50607 => 50608)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/JavaScriptCore/wtf/DateMath.h        2009-11-06 23:00:44 UTC (rev 50607)
+++ trunk/JavaScriptCore/wtf/DateMath.h        2009-11-06 23:33:17 UTC (rev 50608)
</span><span class="lines">@@ -44,25 +44,31 @@
</span><span class="cx"> 
</span><span class="cx"> #include &lt;time.h&gt;
</span><span class="cx"> #include &lt;string.h&gt;
</span><ins>+#include &lt;wtf/CurrentTime.h&gt;
</ins><span class="cx"> #include &lt;wtf/Noncopyable.h&gt;
</span><ins>+#include &lt;wtf/UnusedParam.h&gt;
</ins><span class="cx"> 
</span><del>-namespace WTF {
</del><ins>+namespace JSC {
</ins><span class="cx"> 
</span><ins>+class ExecState;
</ins><span class="cx"> struct GregorianDateTime;
</span><span class="cx"> 
</span><span class="cx"> void initializeDates();
</span><del>-void msToGregorianDateTime(double, bool outputIsUTC, GregorianDateTime&amp;);
-double gregorianDateTimeToMS(const GregorianDateTime&amp;, double, bool inputIsUTC);
-double getUTCOffset();
</del><ins>+void msToGregorianDateTime(ExecState*, double, bool outputIsUTC, GregorianDateTime&amp;);
+double gregorianDateTimeToMS(ExecState*, const GregorianDateTime&amp;, double, bool inputIsUTC);
+double getUTCOffset(ExecState*);
</ins><span class="cx"> int equivalentYearForDST(int year);
</span><del>-double getCurrentUTCTime();
-double getCurrentUTCTimeWithMicroseconds();
-void getLocalTime(const time_t*, tm*);
</del><span class="cx"> 
</span><span class="cx"> // Not really math related, but this is currently the only shared place to put these.  
</span><del>-double parseDateFromNullTerminatedCharacters(const char*);
</del><ins>+double parseDateFromNullTerminatedCharacters(const char* dateString, ExecState* exec); // exec may be 0
</ins><span class="cx"> double timeClip(double);
</span><span class="cx"> 
</span><ins>+inline double jsCurrentTime()
+{
+    // JavaScript doesn't recognize fractions of a millisecond.
+    return floor(WTF::currentTimeMS());
+}
+
</ins><span class="cx"> const char * const weekdayName[7] = { &quot;Mon&quot;, &quot;Tue&quot;, &quot;Wed&quot;, &quot;Thu&quot;, &quot;Fri&quot;, &quot;Sat&quot;, &quot;Sun&quot; };
</span><span class="cx"> const char * const monthName[12] = { &quot;Jan&quot;, &quot;Feb&quot;, &quot;Mar&quot;, &quot;Apr&quot;, &quot;May&quot;, &quot;Jun&quot;, &quot;Jul&quot;, &quot;Aug&quot;, &quot;Sep&quot;, &quot;Oct&quot;, &quot;Nov&quot;, &quot;Dec&quot; };
</span><span class="cx"> 
</span><span class="lines">@@ -98,7 +104,7 @@
</span><span class="cx">         delete [] timeZone;
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    GregorianDateTime(const tm&amp; inTm)
</del><ins>+    GregorianDateTime(ExecState* exec, const tm&amp; inTm)
</ins><span class="cx">         : second(inTm.tm_sec)
</span><span class="cx">         , minute(inTm.tm_min)
</span><span class="cx">         , hour(inTm.tm_hour)
</span><span class="lines">@@ -109,10 +115,11 @@
</span><span class="cx">         , year(inTm.tm_year)
</span><span class="cx">         , isDST(inTm.tm_isdst)
</span><span class="cx">     {
</span><ins>+        UNUSED_PARAM(exec);
</ins><span class="cx"> #if HAVE(TM_GMTOFF)
</span><span class="cx">         utcOffset = static_cast&lt;int&gt;(inTm.tm_gmtoff);
</span><span class="cx"> #else
</span><del>-        utcOffset = static_cast&lt;int&gt;(getUTCOffset() / msPerSecond + (isDST ? secondsPerHour : 0));
</del><ins>+        utcOffset = static_cast&lt;int&gt;(getUTCOffset(exec) / msPerSecond + (isDST ? secondsPerHour : 0));
</ins><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx"> #if HAVE(TM_ZONE)
</span><span class="lines">@@ -187,6 +194,6 @@
</span><span class="cx">     return t.utcOffset;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-} // namespace WTF
</del><ins>+} // namespace JSC
</ins><span class="cx"> 
</span><span class="cx"> #endif // DateMath_h
</span></span></pre></div>
<a id="trunkJavaScriptGlueChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/JavaScriptGlue/ChangeLog (50607 => 50608)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/JavaScriptGlue/ChangeLog        2009-11-06 23:00:44 UTC (rev 50607)
+++ trunk/JavaScriptGlue/ChangeLog        2009-11-06 23:33:17 UTC (rev 50608)
</span><span class="lines">@@ -1,3 +1,12 @@
</span><ins>+2009-11-06  Geoffrey Garen  &lt;ggaren@apple.com&gt;
+
+        Reviewed by Oliver Hunt.
+
+        https://bugs.webkit.org/show_bug.cgi?id=31197
+        Implemented a timezone cache not based on Mac OS X's notify_check API.
+        
+        * ForwardingHeaders/wtf/CurrentTime.h: Added.
+
</ins><span class="cx"> 2009-10-27  Geoffrey Garen  &lt;ggaren@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Build fix: Updated for JavaScriptCore export changes.
</span></span></pre></div>
<a id="trunkJavaScriptGlueForwardingHeaderswtfCurrentTimeh"></a>
<div class="addfile"><h4>Added: trunk/JavaScriptGlue/ForwardingHeaders/wtf/CurrentTime.h (0 => 50608)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/JavaScriptGlue/ForwardingHeaders/wtf/CurrentTime.h                                (rev 0)
+++ trunk/JavaScriptGlue/ForwardingHeaders/wtf/CurrentTime.h        2009-11-06 23:33:17 UTC (rev 50608)
</span><span class="lines">@@ -0,0 +1 @@
</span><ins>+#include &lt;JavaScriptCore/CurrentTime.h&gt;
</ins></span></pre></div>
<a id="trunkWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/WebCore/ChangeLog (50607 => 50608)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebCore/ChangeLog        2009-11-06 23:00:44 UTC (rev 50607)
+++ trunk/WebCore/ChangeLog        2009-11-06 23:33:17 UTC (rev 50608)
</span><span class="lines">@@ -1,3 +1,19 @@
</span><ins>+2009-11-06  Geoffrey Garen  &lt;ggaren@apple.com&gt;
+
+        https://bugs.webkit.org/show_bug.cgi?id=31197
+        Implemented a timezone cache not based on Mac OS X's notify_check API.
+
+        Updated for JavaScriptCore internal API change.
+
+        * bridge/qt/qt_runtime.cpp:
+        (JSC::Bindings::convertValueToQVariant):
+        (JSC::Bindings::convertQVariantToValue): Updated for namespace change.
+
+        * platform/network/HTTPParsers.cpp:
+        (WebCore::parseDate): Pass 0 for ExecState, since we don't have one.
+        (This function probably shouldn't be using a JavaScript date parser
+        to begin with, but oh well.)
+
</ins><span class="cx"> 2009-11-06  Anantanarayanan G Iyengar  &lt;ananta@chromium.org&gt;
</span><span class="cx"> 
</span><span class="cx">         Reviewed by Adam Barth.
</span></span></pre></div>
<a id="trunkWebCorebridgeqtqt_runtimecpp"></a>
<div class="modfile"><h4>Modified: trunk/WebCore/bridge/qt/qt_runtime.cpp (50607 => 50608)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebCore/bridge/qt/qt_runtime.cpp        2009-11-06 23:00:44 UTC (rev 50607)
+++ trunk/WebCore/bridge/qt/qt_runtime.cpp        2009-11-06 23:33:17 UTC (rev 50608)
</span><span class="lines">@@ -457,8 +457,8 @@
</span><span class="cx">         case QMetaType::QTime:
</span><span class="cx">             if (type == Date) {
</span><span class="cx">                 DateInstance* date = static_cast&lt;DateInstance*&gt;(object);
</span><del>-                WTF::GregorianDateTime gdt;
-                WTF::msToGregorianDateTime(date-&gt;internalNumber(), true, gdt);
</del><ins>+                GregorianDateTime gdt;
+                msToGregorianDateTime(date-&gt;internalNumber(), true, gdt);
</ins><span class="cx">                 if (hint == QMetaType::QDateTime) {
</span><span class="cx">                     ret = QDateTime(QDate(gdt.year + 1900, gdt.month + 1, gdt.monthDay), QTime(gdt.hour, gdt.minute, gdt.second), Qt::UTC);
</span><span class="cx">                     dist = 0;
</span><span class="lines">@@ -471,7 +471,7 @@
</span><span class="cx">                 }
</span><span class="cx">             } else if (type == Number) {
</span><span class="cx">                 double b = value.toNumber(exec);
</span><del>-                WTF::GregorianDateTime gdt;
</del><ins>+                GregorianDateTime gdt;
</ins><span class="cx">                 msToGregorianDateTime(b, true, gdt);
</span><span class="cx">                 if (hint == QMetaType::QDateTime) {
</span><span class="cx">                     ret = QDateTime(QDate(gdt.year + 1900, gdt.month + 1, gdt.monthDay), QTime(gdt.hour, gdt.minute, gdt.second), Qt::UTC);
</span><span class="lines">@@ -824,7 +824,7 @@
</span><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         // Dates specified this way are in local time (we convert DateTimes above)
</span><del>-        WTF::GregorianDateTime dt;
</del><ins>+        GregorianDateTime dt;
</ins><span class="cx">         dt.year = date.year() - 1900;
</span><span class="cx">         dt.month = date.month() - 1;
</span><span class="cx">         dt.monthDay = date.day();
</span><span class="lines">@@ -832,7 +832,7 @@
</span><span class="cx">         dt.minute = time.minute();
</span><span class="cx">         dt.second = time.second();
</span><span class="cx">         dt.isDST = -1;
</span><del>-        double ms = WTF::gregorianDateTimeToMS(dt, time.msec(), /*inputIsUTC*/ false);
</del><ins>+        double ms = gregorianDateTimeToMS(dt, time.msec(), /*inputIsUTC*/ false);
</ins><span class="cx"> 
</span><span class="cx">         return new (exec) DateInstance(exec, trunc(ms));
</span><span class="cx">     }
</span></span></pre></div>
<a id="trunkWebCoreplatformnetworkHTTPParserscpp"></a>
<div class="modfile"><h4>Modified: trunk/WebCore/platform/network/HTTPParsers.cpp (50607 => 50608)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebCore/platform/network/HTTPParsers.cpp        2009-11-06 23:00:44 UTC (rev 50607)
+++ trunk/WebCore/platform/network/HTTPParsers.cpp        2009-11-06 23:33:17 UTC (rev 50608)
</span><span class="lines">@@ -35,6 +35,7 @@
</span><span class="cx"> #include &quot;PlatformString.h&quot;
</span><span class="cx"> #include &lt;wtf/DateMath.h&gt;
</span><span class="cx"> 
</span><ins>+using namespace JSC;
</ins><span class="cx"> using namespace WTF;
</span><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><span class="lines">@@ -116,7 +117,7 @@
</span><span class="cx"> 
</span><span class="cx"> double parseDate(const String&amp; value)
</span><span class="cx"> {
</span><del>-    return parseDateFromNullTerminatedCharacters(value.utf8().data());
</del><ins>+    return parseDateFromNullTerminatedCharacters(value.utf8().data(), 0);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> String filenameFromHTTPContentDisposition(const String&amp; value)
</span></span></pre>
</div>
</div>

</body>
</html>