Title: [228784] releases/WebKitGTK/webkit-2.20/Source/_javascript_Core
Revision
228784
Author
carlo...@webkit.org
Date
2018-02-20 03:14:32 -0800 (Tue, 20 Feb 2018)

Log Message

Merge r228533 - [JSC] Remove monotonicallyIncreasingTime and currentTime
https://bugs.webkit.org/show_bug.cgi?id=182793

Reviewed by Saam Barati.

We would like to drop monotonicallyIncreasingTime and currentTime from our tree by
replacing them with MonotonicTime and WallTime, which are well-typed alternatives,
compared to double.
This patch removes monotonicallyIncreasingTime and currentTime in JSC.

* b3/testb3.cpp:
(JSC::B3::testComplex):
* dfg/DFGPhase.h:
(JSC::DFG::runAndLog):
* dfg/DFGPlan.cpp:
(JSC::DFG::Plan::compileInThread):
(JSC::DFG::Plan::compileInThreadImpl):
* dfg/DFGPlan.h:
* dynbench.cpp:
(JSC::benchmarkImpl):
* heap/BlockDirectory.cpp:
(JSC::BlockDirectory::isPagedOut):
* heap/BlockDirectory.h:
* heap/FullGCActivityCallback.cpp:
(JSC::FullGCActivityCallback::doCollection):
* heap/Heap.cpp:
(JSC::Heap::isPagedOut):
(JSC::Heap::sweepSynchronously):
* heap/Heap.h:
* heap/MarkedSpace.cpp:
(JSC::MarkedSpace::isPagedOut):
* heap/MarkedSpace.h:
* inspector/agents/InspectorConsoleAgent.cpp:
(Inspector::InspectorConsoleAgent::startTiming):
(Inspector::InspectorConsoleAgent::stopTiming):
* inspector/agents/InspectorConsoleAgent.h:
* inspector/agents/InspectorRuntimeAgent.cpp:
(Inspector::InspectorRuntimeAgent::getRuntimeTypesForVariablesAtOffsets):
* jit/JIT.cpp:
(JSC::JIT::compileWithoutLinking):
(JSC::JIT::compileTimeStats):
* jit/JIT.h:
* jsc.cpp:
(StopWatch::start):
(StopWatch::stop):
(StopWatch::getElapsedMS):
(functionPreciseTime):
(runJSC):
* profiler/ProfilerDatabase.cpp:
(JSC::Profiler::Database::logEvent):
* profiler/ProfilerEvent.cpp:
(JSC::Profiler::Event::toJS const):
* profiler/ProfilerEvent.h:
(JSC::Profiler::Event::Event):
(JSC::Profiler::Event::time const):
* runtime/CodeCache.cpp:
(JSC::CodeCacheMap::pruneSlowCase):
* runtime/CodeCache.h:
(JSC::CodeCacheMap::CodeCacheMap):
(JSC::CodeCacheMap::prune):
* runtime/DateConstructor.cpp:
(JSC::callDate):
* runtime/TypeProfilerLog.cpp:
(JSC::TypeProfilerLog::processLogEntries):
* testRegExp.cpp:
(StopWatch::start):
(StopWatch::stop):
(StopWatch::getElapsedMS):

Modified Paths

Diff

Modified: releases/WebKitGTK/webkit-2.20/Source/_javascript_Core/ChangeLog (228783 => 228784)


--- releases/WebKitGTK/webkit-2.20/Source/_javascript_Core/ChangeLog	2018-02-20 11:14:20 UTC (rev 228783)
+++ releases/WebKitGTK/webkit-2.20/Source/_javascript_Core/ChangeLog	2018-02-20 11:14:32 UTC (rev 228784)
@@ -1,3 +1,74 @@
+2018-02-15  Yusuke Suzuki  <utatane....@gmail.com>
+
+        [JSC] Remove monotonicallyIncreasingTime and currentTime
+        https://bugs.webkit.org/show_bug.cgi?id=182793
+
+        Reviewed by Saam Barati.
+
+        We would like to drop monotonicallyIncreasingTime and currentTime from our tree by
+        replacing them with MonotonicTime and WallTime, which are well-typed alternatives,
+        compared to double.
+        This patch removes monotonicallyIncreasingTime and currentTime in JSC.
+
+        * b3/testb3.cpp:
+        (JSC::B3::testComplex):
+        * dfg/DFGPhase.h:
+        (JSC::DFG::runAndLog):
+        * dfg/DFGPlan.cpp:
+        (JSC::DFG::Plan::compileInThread):
+        (JSC::DFG::Plan::compileInThreadImpl):
+        * dfg/DFGPlan.h:
+        * dynbench.cpp:
+        (JSC::benchmarkImpl):
+        * heap/BlockDirectory.cpp:
+        (JSC::BlockDirectory::isPagedOut):
+        * heap/BlockDirectory.h:
+        * heap/FullGCActivityCallback.cpp:
+        (JSC::FullGCActivityCallback::doCollection):
+        * heap/Heap.cpp:
+        (JSC::Heap::isPagedOut):
+        (JSC::Heap::sweepSynchronously):
+        * heap/Heap.h:
+        * heap/MarkedSpace.cpp:
+        (JSC::MarkedSpace::isPagedOut):
+        * heap/MarkedSpace.h:
+        * inspector/agents/InspectorConsoleAgent.cpp:
+        (Inspector::InspectorConsoleAgent::startTiming):
+        (Inspector::InspectorConsoleAgent::stopTiming):
+        * inspector/agents/InspectorConsoleAgent.h:
+        * inspector/agents/InspectorRuntimeAgent.cpp:
+        (Inspector::InspectorRuntimeAgent::getRuntimeTypesForVariablesAtOffsets):
+        * jit/JIT.cpp:
+        (JSC::JIT::compileWithoutLinking):
+        (JSC::JIT::compileTimeStats):
+        * jit/JIT.h:
+        * jsc.cpp:
+        (StopWatch::start):
+        (StopWatch::stop):
+        (StopWatch::getElapsedMS):
+        (functionPreciseTime):
+        (runJSC):
+        * profiler/ProfilerDatabase.cpp:
+        (JSC::Profiler::Database::logEvent):
+        * profiler/ProfilerEvent.cpp:
+        (JSC::Profiler::Event::toJS const):
+        * profiler/ProfilerEvent.h:
+        (JSC::Profiler::Event::Event):
+        (JSC::Profiler::Event::time const):
+        * runtime/CodeCache.cpp:
+        (JSC::CodeCacheMap::pruneSlowCase):
+        * runtime/CodeCache.h:
+        (JSC::CodeCacheMap::CodeCacheMap):
+        (JSC::CodeCacheMap::prune):
+        * runtime/DateConstructor.cpp:
+        (JSC::callDate):
+        * runtime/TypeProfilerLog.cpp:
+        (JSC::TypeProfilerLog::processLogEntries):
+        * testRegExp.cpp:
+        (StopWatch::start):
+        (StopWatch::stop):
+        (StopWatch::getElapsedMS):
+
 2018-02-14  Keith Miller  <keith_mil...@apple.com>
 
         We should be able to jsDynamicCast from JSType when possible

Modified: releases/WebKitGTK/webkit-2.20/Source/_javascript_Core/b3/testb3.cpp (228783 => 228784)


--- releases/WebKitGTK/webkit-2.20/Source/_javascript_Core/b3/testb3.cpp	2018-02-20 11:14:20 UTC (rev 228783)
+++ releases/WebKitGTK/webkit-2.20/Source/_javascript_Core/b3/testb3.cpp	2018-02-20 11:14:32 UTC (rev 228784)
@@ -7963,7 +7963,7 @@
 
 void testComplex(unsigned numVars, unsigned numConstructs)
 {
-    double before = monotonicallyIncreasingTimeMS();
+    MonotonicTime before = MonotonicTime::now();
     
     Procedure proc;
     BasicBlock* current = proc.addBlock();
@@ -8092,8 +8092,8 @@
 
     compileProc(proc);
 
-    double after = monotonicallyIncreasingTimeMS();
-    dataLog(toCString("    That took ", after - before, " ms.\n"));
+    MonotonicTime after = MonotonicTime::now();
+    dataLog(toCString("    That took ", (after - before).milliseconds(), " ms.\n"));
 }
 
 void testSimplePatchpoint()

Modified: releases/WebKitGTK/webkit-2.20/Source/_javascript_Core/dfg/DFGPhase.h (228783 => 228784)


--- releases/WebKitGTK/webkit-2.20/Source/_javascript_Core/dfg/DFGPhase.h	2018-02-20 11:14:20 UTC (rev 228783)
+++ releases/WebKitGTK/webkit-2.20/Source/_javascript_Core/dfg/DFGPhase.h	2018-02-20 11:14:32 UTC (rev 228784)
@@ -76,16 +76,16 @@
 template<typename PhaseType>
 bool runAndLog(PhaseType& phase)
 {
-    double before = 0;
+    MonotonicTime before { };
 
     if (UNLIKELY(Options::reportDFGPhaseTimes()))
-        before = monotonicallyIncreasingTimeMS();
+        before = MonotonicTime::now();
 
     bool result = phase.run();
 
     if (UNLIKELY(Options::reportDFGPhaseTimes())) {
-        double after = monotonicallyIncreasingTimeMS();
-        dataLogF("Phase %s took %.4f ms\n", phase.name(), after - before);
+        MonotonicTime after = MonotonicTime::now();
+        dataLogF("Phase %s took %.4f ms\n", phase.name(), (after - before).milliseconds());
     }
     if (result && logCompilationChanges(phase.graph().m_plan.mode))
         dataLogF("Phase %s changed the IR.\n", phase.name());

Modified: releases/WebKitGTK/webkit-2.20/Source/_javascript_Core/dfg/DFGPlan.cpp (228783 => 228784)


--- releases/WebKitGTK/webkit-2.20/Source/_javascript_Core/dfg/DFGPlan.cpp	2018-02-20 11:14:20 UTC (rev 228783)
+++ releases/WebKitGTK/webkit-2.20/Source/_javascript_Core/dfg/DFGPlan.cpp	2018-02-20 11:14:32 UTC (rev 228784)
@@ -92,10 +92,10 @@
 
 namespace JSC {
 
-extern double totalDFGCompileTime;
-extern double totalFTLCompileTime;
-extern double totalFTLDFGCompileTime;
-extern double totalFTLB3CompileTime;
+extern Seconds totalDFGCompileTime;
+extern Seconds totalFTLCompileTime;
+extern Seconds totalFTLDFGCompileTime;
+extern Seconds totalFTLB3CompileTime;
 
 }
 
@@ -173,10 +173,10 @@
 {
     this->threadData = threadData;
     
-    double before = 0;
+    MonotonicTime before { };
     CString codeBlockName;
     if (UNLIKELY(computeCompileTimes()))
-        before = monotonicallyIncreasingTimeMS();
+        before = MonotonicTime::now();
     if (UNLIKELY(reportCompileTimes()))
         codeBlockName = toCString(*codeBlock);
     
@@ -190,9 +190,9 @@
     RELEASE_ASSERT(path == CancelPath || finalizer);
     RELEASE_ASSERT((path == CancelPath) == (stage == Cancelled));
     
-    double after = 0;
+    MonotonicTime after { };
     if (UNLIKELY(computeCompileTimes())) {
-        after = monotonicallyIncreasingTimeMS();
+        after = MonotonicTime::now();
     
         if (Options::reportTotalCompileTimes()) {
             if (isFTL(mode)) {
@@ -223,14 +223,14 @@
     }
     if (codeBlock) { // codeBlock will be null if the compilation was cancelled.
         if (path == FTLPath)
-            CODEBLOCK_LOG_EVENT(codeBlock, "ftlCompile", ("took ", after - before, " ms (DFG: ", m_timeBeforeFTL - before, ", B3: ", after - m_timeBeforeFTL, ") with ", pathName));
+            CODEBLOCK_LOG_EVENT(codeBlock, "ftlCompile", ("took ", (after - before).milliseconds(), " ms (DFG: ", (m_timeBeforeFTL - before).milliseconds(), ", B3: ", (after - m_timeBeforeFTL).milliseconds(), ") with ", pathName));
         else
-            CODEBLOCK_LOG_EVENT(codeBlock, "dfgCompile", ("took ", after - before, " ms with ", pathName));
+            CODEBLOCK_LOG_EVENT(codeBlock, "dfgCompile", ("took ", (after - before).milliseconds(), " ms with ", pathName));
     }
     if (UNLIKELY(reportCompileTimes())) {
-        dataLog("Optimized ", codeBlockName, " using ", mode, " with ", pathName, " into ", finalizer ? finalizer->codeSize() : 0, " bytes in ", after - before, " ms");
+        dataLog("Optimized ", codeBlockName, " using ", mode, " with ", pathName, " into ", finalizer ? finalizer->codeSize() : 0, " bytes in ", (after - before).milliseconds(), " ms");
         if (path == FTLPath)
-            dataLog(" (DFG: ", m_timeBeforeFTL - before, ", B3: ", after - m_timeBeforeFTL, ")");
+            dataLog(" (DFG: ", (m_timeBeforeFTL - before).milliseconds(), ", B3: ", (after - m_timeBeforeFTL).milliseconds(), ")");
         dataLog(".\n");
     }
 }
@@ -491,7 +491,7 @@
         FTL::lowerDFGToB3(state);
         
         if (UNLIKELY(computeCompileTimes()))
-            m_timeBeforeFTL = monotonicallyIncreasingTimeMS();
+            m_timeBeforeFTL = MonotonicTime::now();
         
         if (Options::b3AlwaysFailsBeforeCompile()) {
             FTL::fail(state);

Modified: releases/WebKitGTK/webkit-2.20/Source/_javascript_Core/dfg/DFGPlan.h (228783 => 228784)


--- releases/WebKitGTK/webkit-2.20/Source/_javascript_Core/dfg/DFGPlan.h	2018-02-20 11:14:20 UTC (rev 228783)
+++ releases/WebKitGTK/webkit-2.20/Source/_javascript_Core/dfg/DFGPlan.h	2018-02-20 11:14:32 UTC (rev 228784)
@@ -125,7 +125,7 @@
     bool isStillValid();
     void reallyAdd(CommonData*);
 
-    double m_timeBeforeFTL;
+    MonotonicTime m_timeBeforeFTL;
 };
 
 #endif // ENABLE(DFG_JIT)

Modified: releases/WebKitGTK/webkit-2.20/Source/_javascript_Core/dynbench.cpp (228783 => 228784)


--- releases/WebKitGTK/webkit-2.20/Source/_javascript_Core/dynbench.cpp	2018-02-20 11:14:20 UTC (rev 228783)
+++ releases/WebKitGTK/webkit-2.20/Source/_javascript_Core/dynbench.cpp	2018-02-20 11:14:32 UTC (rev 228784)
@@ -60,10 +60,10 @@
     if (requestedIterationCount)
         iterationCount = requestedIterationCount;
     
-    double before = monotonicallyIncreasingTimeMS();
+    MonotonicTime before = MonotonicTime::now();
     callback(iterationCount);
-    double after = monotonicallyIncreasingTimeMS();
-    dataLog(name, ": ", after - before, " ms.\n");
+    MonotonicTime after = MonotonicTime::now();
+    dataLog(name, ": ", (after - before).milliseconds(), " ms.\n");
 }
 
 } // anonymous namespace

Modified: releases/WebKitGTK/webkit-2.20/Source/_javascript_Core/heap/BlockDirectory.cpp (228783 => 228784)


--- releases/WebKitGTK/webkit-2.20/Source/_javascript_Core/heap/BlockDirectory.cpp	2018-02-20 11:14:20 UTC (rev 228783)
+++ releases/WebKitGTK/webkit-2.20/Source/_javascript_Core/heap/BlockDirectory.cpp	2018-02-20 11:14:32 UTC (rev 228784)
@@ -56,7 +56,7 @@
     m_subspace = subspace;
 }
 
-bool BlockDirectory::isPagedOut(double deadline)
+bool BlockDirectory::isPagedOut(MonotonicTime deadline)
 {
     unsigned itersSinceLastTimeCheck = 0;
     for (auto* block : m_blocks) {
@@ -64,7 +64,7 @@
             holdLock(block->block().lock());
         ++itersSinceLastTimeCheck;
         if (itersSinceLastTimeCheck >= Heap::s_timeCheckResolution) {
-            double currentTime = WTF::monotonicallyIncreasingTime();
+            MonotonicTime currentTime = MonotonicTime::now();
             if (currentTime > deadline)
                 return true;
             itersSinceLastTimeCheck = 0;

Modified: releases/WebKitGTK/webkit-2.20/Source/_javascript_Core/heap/BlockDirectory.h (228783 => 228784)


--- releases/WebKitGTK/webkit-2.20/Source/_javascript_Core/heap/BlockDirectory.h	2018-02-20 11:14:20 UTC (rev 228783)
+++ releases/WebKitGTK/webkit-2.20/Source/_javascript_Core/heap/BlockDirectory.h	2018-02-20 11:14:32 UTC (rev 228784)
@@ -33,6 +33,7 @@
 #include "MarkedBlock.h"
 #include <wtf/DataLog.h>
 #include <wtf/FastBitVector.h>
+#include <wtf/MonotonicTime.h>
 #include <wtf/SharedTask.h>
 #include <wtf/Vector.h>
 
@@ -112,7 +113,7 @@
     void addBlock(MarkedBlock::Handle*);
     void removeBlock(MarkedBlock::Handle*);
 
-    bool isPagedOut(double deadline);
+    bool isPagedOut(MonotonicTime deadline);
     
     Lock& bitvectorLock() { return m_bitvectorLock; }
 

Modified: releases/WebKitGTK/webkit-2.20/Source/_javascript_Core/heap/FullGCActivityCallback.cpp (228783 => 228784)


--- releases/WebKitGTK/webkit-2.20/Source/_javascript_Core/heap/FullGCActivityCallback.cpp	2018-02-20 11:14:20 UTC (rev 228783)
+++ releases/WebKitGTK/webkit-2.20/Source/_javascript_Core/heap/FullGCActivityCallback.cpp	2018-02-20 11:14:32 UTC (rev 228784)
@@ -31,7 +31,7 @@
 namespace JSC {
 
 #if !PLATFORM(IOS)
-const double pagingTimeOut = 0.1; // Time in seconds to allow opportunistic timer to iterate over all blocks to see if the Heap is paged out.
+const constexpr Seconds pagingTimeOut { 100_ms }; // Time in seconds to allow opportunistic timer to iterate over all blocks to see if the Heap is paged out.
 #endif
 
 FullGCActivityCallback::FullGCActivityCallback(Heap* heap)
@@ -45,10 +45,10 @@
     m_didGCRecently = false;
 
 #if !PLATFORM(IOS)
-    double startTime = WTF::monotonicallyIncreasingTime();
+    MonotonicTime startTime = MonotonicTime::now();
     if (heap.isPagedOut(startTime + pagingTimeOut)) {
         cancel();
-        heap.increaseLastFullGCLength(Seconds(pagingTimeOut));
+        heap.increaseLastFullGCLength(pagingTimeOut);
         return;
     }
 #endif

Modified: releases/WebKitGTK/webkit-2.20/Source/_javascript_Core/heap/Heap.cpp (228783 => 228784)


--- releases/WebKitGTK/webkit-2.20/Source/_javascript_Core/heap/Heap.cpp	2018-02-20 11:14:20 UTC (rev 228783)
+++ releases/WebKitGTK/webkit-2.20/Source/_javascript_Core/heap/Heap.cpp	2018-02-20 11:14:32 UTC (rev 228784)
@@ -196,7 +196,7 @@
         , m_name(name)
     {
         if (measurePhaseTiming())
-            m_before = monotonicallyIncreasingTimeMS();
+            m_before = MonotonicTime::now();
     }
     
     TimingScope(Heap& heap, const char* name)
@@ -217,16 +217,16 @@
     ~TimingScope()
     {
         if (measurePhaseTiming()) {
-            double after = monotonicallyIncreasingTimeMS();
-            double timing = after - m_before;
+            MonotonicTime after = MonotonicTime::now();
+            Seconds timing = after - m_before;
             SimpleStats& stats = timingStats(m_name, *m_scope);
-            stats.add(timing);
-            dataLog("[GC:", *m_scope, "] ", m_name, " took: ", timing, "ms (average ", stats.mean(), "ms).\n");
+            stats.add(timing.milliseconds());
+            dataLog("[GC:", *m_scope, "] ", m_name, " took: ", timing.milliseconds(), "ms (average ", stats.mean(), "ms).\n");
         }
     }
 private:
     std::optional<CollectionScope> m_scope;
-    double m_before;
+    MonotonicTime m_before;
     const char* m_name;
 };
 
@@ -362,7 +362,7 @@
         WeakBlock::destroy(*this, block);
 }
 
-bool Heap::isPagedOut(double deadline)
+bool Heap::isPagedOut(MonotonicTime deadline)
 {
     return m_objectSpace.isPagedOut(deadline);
 }
@@ -1004,16 +1004,16 @@
 
 void Heap::sweepSynchronously()
 {
-    double before = 0;
+    MonotonicTime before { };
     if (Options::logGC()) {
         dataLog("Full sweep: ", capacity() / 1024, "kb ");
-        before = currentTimeMS();
+        before = MonotonicTime::now();
     }
     m_objectSpace.sweep();
     m_objectSpace.shrink();
     if (Options::logGC()) {
-        double after = currentTimeMS();
-        dataLog("=> ", capacity() / 1024, "kb, ", after - before, "ms");
+        MonotonicTime after = MonotonicTime::now();
+        dataLog("=> ", capacity() / 1024, "kb, ", (after - before).milliseconds(), "ms");
     }
 }
 

Modified: releases/WebKitGTK/webkit-2.20/Source/_javascript_Core/heap/Heap.h (228783 => 228784)


--- releases/WebKitGTK/webkit-2.20/Source/_javascript_Core/heap/Heap.h	2018-02-20 11:14:20 UTC (rev 228783)
+++ releases/WebKitGTK/webkit-2.20/Source/_javascript_Core/heap/Heap.h	2018-02-20 11:14:32 UTC (rev 228784)
@@ -257,7 +257,7 @@
     void deleteAllUnlinkedCodeBlocks(DeleteAllCodeEffort);
 
     void didAllocate(size_t);
-    bool isPagedOut(double deadline);
+    bool isPagedOut(MonotonicTime deadline);
     
     const JITStubRoutineSet& jitStubRoutines() { return *m_jitStubRoutines; }
     

Modified: releases/WebKitGTK/webkit-2.20/Source/_javascript_Core/heap/MarkedSpace.cpp (228783 => 228784)


--- releases/WebKitGTK/webkit-2.20/Source/_javascript_Core/heap/MarkedSpace.cpp	2018-02-20 11:14:20 UTC (rev 228783)
+++ releases/WebKitGTK/webkit-2.20/Source/_javascript_Core/heap/MarkedSpace.cpp	2018-02-20 11:14:32 UTC (rev 228784)
@@ -347,7 +347,7 @@
     // Nothing to do for LargeAllocations.
 }
 
-bool MarkedSpace::isPagedOut(double deadline)
+bool MarkedSpace::isPagedOut(MonotonicTime deadline)
 {
     bool result = false;
     forEachDirectory(

Modified: releases/WebKitGTK/webkit-2.20/Source/_javascript_Core/heap/MarkedSpace.h (228783 => 228784)


--- releases/WebKitGTK/webkit-2.20/Source/_javascript_Core/heap/MarkedSpace.h	2018-02-20 11:14:20 UTC (rev 228783)
+++ releases/WebKitGTK/webkit-2.20/Source/_javascript_Core/heap/MarkedSpace.h	2018-02-20 11:14:32 UTC (rev 228784)
@@ -142,7 +142,7 @@
     size_t size();
     size_t capacity();
 
-    bool isPagedOut(double deadline);
+    bool isPagedOut(MonotonicTime deadline);
     
     HeapVersion markingVersion() const { return m_markingVersion; }
     HeapVersion newlyAllocatedVersion() const { return m_newlyAllocatedVersion; }

Modified: releases/WebKitGTK/webkit-2.20/Source/_javascript_Core/inspector/agents/InspectorConsoleAgent.cpp (228783 => 228784)


--- releases/WebKitGTK/webkit-2.20/Source/_javascript_Core/inspector/agents/InspectorConsoleAgent.cpp	2018-02-20 11:14:20 UTC (rev 228783)
+++ releases/WebKitGTK/webkit-2.20/Source/_javascript_Core/inspector/agents/InspectorConsoleAgent.cpp	2018-02-20 11:14:32 UTC (rev 228784)
@@ -138,7 +138,7 @@
     if (title.isNull())
         return;
 
-    auto result = m_times.add(title, monotonicallyIncreasingTime());
+    auto result = m_times.add(title, MonotonicTime::now());
 
     if (!result.isNewEntry) {
         // FIXME: Send an enum to the frontend for localization?
@@ -161,11 +161,11 @@
         return;
     }
 
-    double startTime = it->value;
+    MonotonicTime startTime = it->value;
     m_times.remove(it);
 
-    double elapsed = monotonicallyIncreasingTime() - startTime;
-    String message = title + String::format(": %.3fms", elapsed * 1000);
+    Seconds elapsed = MonotonicTime::now() - startTime;
+    String message = title + String::format(": %.3fms", elapsed.milliseconds());
     addMessageToConsole(std::make_unique<ConsoleMessage>(MessageSource::ConsoleAPI, MessageType::Timing, MessageLevel::Debug, message, WTFMove(callStack)));
 }
 

Modified: releases/WebKitGTK/webkit-2.20/Source/_javascript_Core/inspector/agents/InspectorConsoleAgent.h (228783 => 228784)


--- releases/WebKitGTK/webkit-2.20/Source/_javascript_Core/inspector/agents/InspectorConsoleAgent.h	2018-02-20 11:14:20 UTC (rev 228783)
+++ releases/WebKitGTK/webkit-2.20/Source/_javascript_Core/inspector/agents/InspectorConsoleAgent.h	2018-02-20 11:14:32 UTC (rev 228784)
@@ -30,6 +30,7 @@
 #include "InspectorFrontendDispatchers.h"
 #include <wtf/Forward.h>
 #include <wtf/HashMap.h>
+#include <wtf/MonotonicTime.h>
 #include <wtf/Noncopyable.h>
 #include <wtf/Vector.h>
 #include <wtf/text/StringHash.h>
@@ -86,7 +87,7 @@
     Vector<std::unique_ptr<ConsoleMessage>> m_consoleMessages;
     int m_expiredConsoleMessageCount { 0 };
     HashMap<String, unsigned> m_counts;
-    HashMap<String, double> m_times;
+    HashMap<String, MonotonicTime> m_times;
     bool m_enabled { false };
 };
 

Modified: releases/WebKitGTK/webkit-2.20/Source/_javascript_Core/inspector/agents/InspectorRuntimeAgent.cpp (228783 => 228784)


--- releases/WebKitGTK/webkit-2.20/Source/_javascript_Core/inspector/agents/InspectorRuntimeAgent.cpp	2018-02-20 11:14:20 UTC (rev 228783)
+++ releases/WebKitGTK/webkit-2.20/Source/_javascript_Core/inspector/agents/InspectorRuntimeAgent.cpp	2018-02-20 11:14:32 UTC (rev 228784)
@@ -286,7 +286,7 @@
         return;
     }
 
-    double start = currentTimeMS();
+    MonotonicTime start = MonotonicTime::now();
     m_vm.typeProfilerLog()->processLogEntries(ASCIILiteral("User Query"));
 
     for (size_t i = 0; i < locations.length(); i++) {
@@ -331,9 +331,9 @@
         typeDescriptions->addItem(WTFMove(description));
     }
 
-    double end = currentTimeMS();
+    MonotonicTime end = MonotonicTime::now();
     if (verbose)
-        dataLogF("Inspector::getRuntimeTypesForVariablesAtOffsets took %lfms\n", end - start);
+        dataLogF("Inspector::getRuntimeTypesForVariablesAtOffsets took %lfms\n", (end - start).milliseconds());
 }
 
 void InspectorRuntimeAgent::willDestroyFrontendAndBackend(DisconnectReason reason)

Modified: releases/WebKitGTK/webkit-2.20/Source/_javascript_Core/jit/JIT.cpp (228783 => 228784)


--- releases/WebKitGTK/webkit-2.20/Source/_javascript_Core/jit/JIT.cpp	2018-02-20 11:14:20 UTC (rev 228783)
+++ releases/WebKitGTK/webkit-2.20/Source/_javascript_Core/jit/JIT.cpp	2018-02-20 11:14:32 UTC (rev 228784)
@@ -58,11 +58,11 @@
 
 namespace JSC {
 
-double totalBaselineCompileTime;
-double totalDFGCompileTime;
-double totalFTLCompileTime;
-double totalFTLDFGCompileTime;
-double totalFTLB3CompileTime;
+Seconds totalBaselineCompileTime;
+Seconds totalDFGCompileTime;
+Seconds totalFTLCompileTime;
+Seconds totalFTLDFGCompileTime;
+Seconds totalFTLB3CompileTime;
 
 void ctiPatchCallByReturnAddress(ReturnAddressPtr returnAddress, FunctionPtr newCalleeFunction)
 {
@@ -589,9 +589,9 @@
 
 void JIT::compileWithoutLinking(JITCompilationEffort effort)
 {
-    double before = 0;
+    MonotonicTime before { };
     if (UNLIKELY(computeCompileTimes()))
-        before = monotonicallyIncreasingTimeMS();
+        before = MonotonicTime::now();
     
     {
         ConcurrentJSLocker locker(m_codeBlock->m_lock);
@@ -745,9 +745,9 @@
 
     m_linkBuffer = std::unique_ptr<LinkBuffer>(new LinkBuffer(*this, m_codeBlock, effort));
 
-    double after = 0;
+    MonotonicTime after { };
     if (UNLIKELY(computeCompileTimes())) {
-        after = monotonicallyIncreasingTimeMS();
+        after = MonotonicTime::now();
 
         if (Options::reportTotalCompileTimes())
             totalBaselineCompileTime += after - before;
@@ -755,7 +755,7 @@
     if (UNLIKELY(reportCompileTimes())) {
         CString codeBlockName = toCString(*m_codeBlock);
         
-        dataLog("Optimized ", codeBlockName, " with Baseline JIT into ", m_linkBuffer->size(), " bytes in ", after - before, " ms.\n");
+        dataLog("Optimized ", codeBlockName, " with Baseline JIT into ", m_linkBuffer->size(), " bytes in ", (after - before).milliseconds(), " ms.\n");
     }
 }
 
@@ -964,9 +964,9 @@
     return reportCompileTimes() || Options::reportTotalCompileTimes();
 }
 
-HashMap<CString, double> JIT::compileTimeStats()
+HashMap<CString, Seconds> JIT::compileTimeStats()
 {
-    HashMap<CString, double> result;
+    HashMap<CString, Seconds> result;
     if (Options::reportTotalCompileTimes()) {
         result.add("Total Compile Time", totalBaselineCompileTime + totalDFGCompileTime + totalFTLCompileTime);
         result.add("Baseline Compile Time", totalBaselineCompileTime);

Modified: releases/WebKitGTK/webkit-2.20/Source/_javascript_Core/jit/JIT.h (228783 => 228784)


--- releases/WebKitGTK/webkit-2.20/Source/_javascript_Core/jit/JIT.h	2018-02-20 11:14:20 UTC (rev 228783)
+++ releases/WebKitGTK/webkit-2.20/Source/_javascript_Core/jit/JIT.h	2018-02-20 11:14:32 UTC (rev 228784)
@@ -249,7 +249,7 @@
         static unsigned frameRegisterCountFor(CodeBlock*);
         static int stackPointerOffsetFor(CodeBlock*);
 
-        JS_EXPORT_PRIVATE static HashMap<CString, double> compileTimeStats();
+        JS_EXPORT_PRIVATE static HashMap<CString, Seconds> compileTimeStats();
 
     private:
         void privateCompileMainPass();

Modified: releases/WebKitGTK/webkit-2.20/Source/_javascript_Core/jsc.cpp (228783 => 228784)


--- releases/WebKitGTK/webkit-2.20/Source/_javascript_Core/jsc.cpp	2018-02-20 11:14:20 UTC (rev 228783)
+++ releases/WebKitGTK/webkit-2.20/Source/_javascript_Core/jsc.cpp	2018-02-20 11:14:32 UTC (rev 228784)
@@ -80,10 +80,10 @@
 #include <thread>
 #include <type_traits>
 #include <wtf/CommaPrinter.h>
-#include <wtf/CurrentTime.h>
 #include <wtf/MainThread.h>
 #include <wtf/NeverDestroyed.h>
 #include <wtf/StringPrintStream.h>
+#include <wtf/WallTime.h>
 #include <wtf/text/StringBuilder.h>
 
 #if OS(WINDOWS)
@@ -409,23 +409,23 @@
     long getElapsedMS(); // call stop() first
 
 private:
-    double m_startTime;
-    double m_stopTime;
+    MonotonicTime m_startTime;
+    MonotonicTime m_stopTime;
 };
 
 void StopWatch::start()
 {
-    m_startTime = monotonicallyIncreasingTime();
+    m_startTime = MonotonicTime::now();
 }
 
 void StopWatch::stop()
 {
-    m_stopTime = monotonicallyIncreasingTime();
+    m_stopTime = MonotonicTime::now();
 }
 
 long StopWatch::getElapsedMS()
 {
-    return static_cast<long>((m_stopTime - m_startTime) * 1000);
+    return (m_stopTime - m_startTime).millisecondsAs<long>();
 }
 
 template<typename Vector>
@@ -1377,7 +1377,7 @@
 
 EncodedJSValue JSC_HOST_CALL functionPreciseTime(ExecState*)
 {
-    return JSValue::encode(jsNumber(currentTime()));
+    return JSValue::encode(jsNumber(WallTime::now().secondsSinceEpoch().value()));
 }
 
 EncodedJSValue JSC_HOST_CALL functionNeverInlineFunction(ExecState* exec)
@@ -2649,7 +2649,7 @@
             compileTimeKeys.append(entry.key);
         std::sort(compileTimeKeys.begin(), compileTimeKeys.end());
         for (CString key : compileTimeKeys)
-            printf("%40s: %.3lf ms\n", key.data(), compileTimeStats.get(key));
+            printf("%40s: %.3lf ms\n", key.data(), compileTimeStats.get(key).milliseconds());
     }
 #endif
 

Modified: releases/WebKitGTK/webkit-2.20/Source/_javascript_Core/profiler/ProfilerDatabase.cpp (228783 => 228784)


--- releases/WebKitGTK/webkit-2.20/Source/_javascript_Core/profiler/ProfilerDatabase.cpp	2018-02-20 11:14:20 UTC (rev 228783)
+++ releases/WebKitGTK/webkit-2.20/Source/_javascript_Core/profiler/ProfilerDatabase.cpp	2018-02-20 11:14:32 UTC (rev 228784)
@@ -181,7 +181,7 @@
     
     Bytecodes* bytecodes = ensureBytecodesFor(locker, codeBlock);
     Compilation* compilation = m_compilationMap.get(codeBlock);
-    m_events.append(Event(currentTime(), bytecodes, compilation, summary, detail));
+    m_events.append(Event(WallTime::now(), bytecodes, compilation, summary, detail));
 }
 
 void Database::addDatabaseToAtExit()

Modified: releases/WebKitGTK/webkit-2.20/Source/_javascript_Core/profiler/ProfilerEvent.cpp (228783 => 228784)


--- releases/WebKitGTK/webkit-2.20/Source/_javascript_Core/profiler/ProfilerEvent.cpp	2018-02-20 11:14:20 UTC (rev 228783)
+++ releases/WebKitGTK/webkit-2.20/Source/_javascript_Core/profiler/ProfilerEvent.cpp	2018-02-20 11:14:32 UTC (rev 228784)
@@ -49,7 +49,7 @@
     VM& vm = exec->vm();
     JSObject* result = constructEmptyObject(exec);
     
-    result->putDirect(vm, vm.propertyNames->time, jsNumber(m_time));
+    result->putDirect(vm, vm.propertyNames->time, jsNumber(m_time.secondsSinceEpoch().value()));
     result->putDirect(vm, vm.propertyNames->bytecodesID, jsNumber(m_bytecodes->id()));
     if (m_compilation)
         result->putDirect(vm, vm.propertyNames->compilationUID, m_compilation->uid().toJS(exec));

Modified: releases/WebKitGTK/webkit-2.20/Source/_javascript_Core/profiler/ProfilerEvent.h (228783 => 228784)


--- releases/WebKitGTK/webkit-2.20/Source/_javascript_Core/profiler/ProfilerEvent.h	2018-02-20 11:14:20 UTC (rev 228783)
+++ releases/WebKitGTK/webkit-2.20/Source/_javascript_Core/profiler/ProfilerEvent.h	2018-02-20 11:14:32 UTC (rev 228784)
@@ -27,6 +27,7 @@
 
 #include "JSCJSValue.h"
 #include <wtf/PrintStream.h>
+#include <wtf/WallTime.h>
 #include <wtf/text/CString.h>
 
 namespace JSC { namespace Profiler {
@@ -40,7 +41,7 @@
     {
     }
     
-    Event(double time, Bytecodes* bytecodes, Compilation* compilation, const char* summary, const CString& detail)
+    Event(WallTime time, Bytecodes* bytecodes, Compilation* compilation, const char* summary, const CString& detail)
         : m_time(time)
         , m_bytecodes(bytecodes)
         , m_compilation(compilation)
@@ -54,7 +55,7 @@
         return m_bytecodes;
     }
     
-    double time() const { return m_time; }
+    WallTime time() const { return m_time; }
     Bytecodes* bytecodes() const { return m_bytecodes; }
     Compilation* compilation() const { return m_compilation; }
     const char* summary() const { return m_summary; }
@@ -64,7 +65,7 @@
     JSValue toJS(ExecState*) const;
     
 private:
-    double m_time { 0 };
+    WallTime m_time { };
     Bytecodes* m_bytecodes { nullptr };
     Compilation* m_compilation { nullptr };
     const char* m_summary { nullptr };

Modified: releases/WebKitGTK/webkit-2.20/Source/_javascript_Core/runtime/CodeCache.cpp (228783 => 228784)


--- releases/WebKitGTK/webkit-2.20/Source/_javascript_Core/runtime/CodeCache.cpp	2018-02-20 11:14:20 UTC (rev 228783)
+++ releases/WebKitGTK/webkit-2.20/Source/_javascript_Core/runtime/CodeCache.cpp	2018-02-20 11:14:32 UTC (rev 228784)
@@ -30,13 +30,13 @@
 
 namespace JSC {
 
-const double CodeCacheMap::workingSetTime = 10.0;
+const Seconds CodeCacheMap::workingSetTime = 10_s;
 
 void CodeCacheMap::pruneSlowCase()
 {
     m_minCapacity = std::max(m_size - m_sizeAtLastPrune, static_cast<int64_t>(0));
     m_sizeAtLastPrune = m_size;
-    m_timeAtLastPrune = monotonicallyIncreasingTime();
+    m_timeAtLastPrune = MonotonicTime::now();
 
     if (m_capacity < m_minCapacity)
         m_capacity = m_minCapacity;

Modified: releases/WebKitGTK/webkit-2.20/Source/_javascript_Core/runtime/CodeCache.h (228783 => 228784)


--- releases/WebKitGTK/webkit-2.20/Source/_javascript_Core/runtime/CodeCache.h	2018-02-20 11:14:20 UTC (rev 228783)
+++ releases/WebKitGTK/webkit-2.20/Source/_javascript_Core/runtime/CodeCache.h	2018-02-20 11:14:32 UTC (rev 228784)
@@ -83,7 +83,7 @@
     CodeCacheMap()
         : m_size(0)
         , m_sizeAtLastPrune(0)
-        , m_timeAtLastPrune(monotonicallyIncreasingTime())
+        , m_timeAtLastPrune(MonotonicTime::now())
         , m_minCapacity(0)
         , m_capacity(0)
         , m_age(0)
@@ -149,7 +149,7 @@
 private:
     // This constant factor biases cache capacity toward allowing a minimum
     // working set to enter the cache before it starts evicting.
-    static const double workingSetTime;
+    static const Seconds workingSetTime;
     static const int64_t workingSetMaxBytes = 16000000;
     static const size_t workingSetMaxEntries = 2000;
 
@@ -171,7 +171,7 @@
         if (m_size <= m_capacity && canPruneQuickly())
             return;
 
-        if (monotonicallyIncreasingTime() - m_timeAtLastPrune < workingSetTime
+        if (MonotonicTime::now() - m_timeAtLastPrune < workingSetTime
             && m_size - m_sizeAtLastPrune < workingSetMaxBytes
             && canPruneQuickly())
                 return;
@@ -182,7 +182,7 @@
     MapType m_map;
     int64_t m_size;
     int64_t m_sizeAtLastPrune;
-    double m_timeAtLastPrune;
+    MonotonicTime m_timeAtLastPrune;
     int64_t m_minCapacity;
     int64_t m_capacity;
     int64_t m_age;

Modified: releases/WebKitGTK/webkit-2.20/Source/_javascript_Core/runtime/DateConstructor.cpp (228783 => 228784)


--- releases/WebKitGTK/webkit-2.20/Source/_javascript_Core/runtime/DateConstructor.cpp	2018-02-20 11:14:20 UTC (rev 228783)
+++ releases/WebKitGTK/webkit-2.20/Source/_javascript_Core/runtime/DateConstructor.cpp	2018-02-20 11:14:32 UTC (rev 228784)
@@ -161,7 +161,7 @@
 {
     VM& vm = exec->vm();
     GregorianDateTime ts;
-    msToGregorianDateTime(vm, currentTimeMS(), WTF::LocalTime, ts);
+    msToGregorianDateTime(vm, WallTime::now().secondsSinceEpoch().milliseconds(), WTF::LocalTime, ts);
     return JSValue::encode(jsNontrivialString(&vm, formatDateTime(ts, DateTimeFormatDateAndTime, false)));
 }
 

Modified: releases/WebKitGTK/webkit-2.20/Source/_javascript_Core/runtime/TypeProfilerLog.cpp (228783 => 228784)


--- releases/WebKitGTK/webkit-2.20/Source/_javascript_Core/runtime/TypeProfilerLog.cpp	2018-02-20 11:14:20 UTC (rev 228783)
+++ releases/WebKitGTK/webkit-2.20/Source/_javascript_Core/runtime/TypeProfilerLog.cpp	2018-02-20 11:14:32 UTC (rev 228784)
@@ -57,10 +57,10 @@
 
 void TypeProfilerLog::processLogEntries(const String& reason)
 {
-    double before = 0;
+    MonotonicTime before { };
     if (TypeProfilerLogInternal::verbose) {
         dataLog("Process caller:'", reason, "'");
-        before = currentTimeMS();
+        before = MonotonicTime::now();
     }
 
     HashMap<Structure*, RefPtr<StructureShape>> cachedMonoProtoShapes;
@@ -114,8 +114,8 @@
     m_currentLogEntryPtr = m_logStartPtr;
 
     if (TypeProfilerLogInternal::verbose) {
-        double after = currentTimeMS();
-        dataLogF(" Processing the log took: '%f' ms\n", after - before);
+        MonotonicTime after = MonotonicTime::now();
+        dataLogF(" Processing the log took: '%f' ms\n", (after - before).milliseconds());
     }
 }
 

Modified: releases/WebKitGTK/webkit-2.20/Source/_javascript_Core/testRegExp.cpp (228783 => 228784)


--- releases/WebKitGTK/webkit-2.20/Source/_javascript_Core/testRegExp.cpp	2018-02-20 11:14:20 UTC (rev 228783)
+++ releases/WebKitGTK/webkit-2.20/Source/_javascript_Core/testRegExp.cpp	2018-02-20 11:14:32 UTC (rev 228784)
@@ -70,23 +70,23 @@
     long getElapsedMS(); // call stop() first
 
 private:
-    double m_startTime;
-    double m_stopTime;
+    MonotonicTime m_startTime;
+    MonotonicTime m_stopTime;
 };
 
 void StopWatch::start()
 {
-    m_startTime = monotonicallyIncreasingTime();
+    m_startTime = MonotonicTime::now();
 }
 
 void StopWatch::stop()
 {
-    m_stopTime = monotonicallyIncreasingTime();
+    m_stopTime = MonotonicTime::now();
 }
 
 long StopWatch::getElapsedMS()
 {
-    return static_cast<long>((m_stopTime - m_startTime) * 1000);
+    return (m_stopTime - m_startTime).millisecondsAs<long>();
 }
 
 struct RegExpTest {
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to