[SCM] WebKit Debian packaging branch, webkit-1.1, updated. upstream/1.1.15.1-1414-gc69ee75
eric at webkit.org
eric at webkit.org
Thu Oct 29 20:33:57 UTC 2009
The following commit has been merged in the webkit-1.1 branch:
commit b656e906ad7d3261e8cdc01842c8498503e9eb6f
Author: eric at webkit.org <eric at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Thu Sep 24 22:00:44 2009 +0000
2009-09-24 Yong Li <yong.li at torchmobile.com>
Reviewed by Adam Barth.
Replace platform-dependent code with WTF::currentTime()
https://bugs.webkit.org/show_bug.cgi?id=29148
* jsc.cpp:
(StopWatch::start):
(StopWatch::stop):
(StopWatch::getElapsedMS):
* runtime/TimeoutChecker.cpp:
(JSC::getCPUTime):
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@48736 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/JavaScriptCore/ChangeLog b/JavaScriptCore/ChangeLog
index f2f3532..8ab5d37 100644
--- a/JavaScriptCore/ChangeLog
+++ b/JavaScriptCore/ChangeLog
@@ -1,3 +1,17 @@
+2009-09-24 Yong Li <yong.li at torchmobile.com>
+
+ Reviewed by Adam Barth.
+
+ Replace platform-dependent code with WTF::currentTime()
+ https://bugs.webkit.org/show_bug.cgi?id=29148
+
+ * jsc.cpp:
+ (StopWatch::start):
+ (StopWatch::stop):
+ (StopWatch::getElapsedMS):
+ * runtime/TimeoutChecker.cpp:
+ (JSC::getCPUTime):
+
2009-09-24 Mark Rowe <mrowe at apple.com>
Reviewed by Sam Weinig.
diff --git a/JavaScriptCore/jsc.cpp b/JavaScriptCore/jsc.cpp
index 92b1e58..ee4e393 100644
--- a/JavaScriptCore/jsc.cpp
+++ b/JavaScriptCore/jsc.cpp
@@ -24,6 +24,7 @@
#include "BytecodeGenerator.h"
#include "Completion.h"
+#include "CurrentTime.h"
#include "InitializeThreading.h"
#include "JSArray.h"
#include "JSFunction.h"
@@ -118,53 +119,23 @@ public:
long getElapsedMS(); // call stop() first
private:
-#if PLATFORM(QT)
- uint m_startTime;
- uint m_stopTime;
-#elif PLATFORM(WIN_OS)
- DWORD m_startTime;
- DWORD m_stopTime;
-#else
- // Windows does not have timeval, disabling this class for now (bug 7399)
- timeval m_startTime;
- timeval m_stopTime;
-#endif
+ double m_startTime;
+ double m_stopTime;
};
void StopWatch::start()
{
-#if PLATFORM(QT)
- QDateTime t = QDateTime::currentDateTime();
- m_startTime = t.toTime_t() * 1000 + t.time().msec();
-#elif PLATFORM(WIN_OS)
- m_startTime = timeGetTime();
-#else
- gettimeofday(&m_startTime, 0);
-#endif
+ m_startTime = currentTime();
}
void StopWatch::stop()
{
-#if PLATFORM(QT)
- QDateTime t = QDateTime::currentDateTime();
- m_stopTime = t.toTime_t() * 1000 + t.time().msec();
-#elif PLATFORM(WIN_OS)
- m_stopTime = timeGetTime();
-#else
- gettimeofday(&m_stopTime, 0);
-#endif
+ m_stopTime = currentTime();
}
long StopWatch::getElapsedMS()
{
-#if PLATFORM(WIN_OS) || PLATFORM(QT)
- return m_stopTime - m_startTime;
-#else
- timeval elapsedTime;
- timersub(&m_stopTime, &m_startTime, &elapsedTime);
-
- return elapsedTime.tv_sec * 1000 + lroundf(elapsedTime.tv_usec / 1000.0f);
-#endif
+ return static_cast<long>((m_stopTime - m_startTime) * 1000);
}
class GlobalObject : public JSGlobalObject {
diff --git a/JavaScriptCore/runtime/TimeoutChecker.cpp b/JavaScriptCore/runtime/TimeoutChecker.cpp
index 30ba6e9..2a056c9 100644
--- a/JavaScriptCore/runtime/TimeoutChecker.cpp
+++ b/JavaScriptCore/runtime/TimeoutChecker.cpp
@@ -35,18 +35,10 @@
#if PLATFORM(DARWIN)
#include <mach/mach.h>
-#endif
-
-#if HAVE(SYS_TIME_H)
-#include <sys/time.h>
-#endif
-
-#if PLATFORM(WIN_OS)
+#elif PLATFORM(WIN_OS)
#include <windows.h>
-#endif
-
-#if PLATFORM(QT)
-#include <QDateTime>
+#else
+#include "CurrentTime.h"
#endif
using namespace std;
@@ -75,14 +67,6 @@ static inline unsigned getCPUTime()
time += info.system_time.seconds * 1000 + info.system_time.microseconds / 1000;
return time;
-#elif HAVE(SYS_TIME_H)
- // FIXME: This should probably use getrusage with the RUSAGE_THREAD flag.
- struct timeval tv;
- gettimeofday(&tv, 0);
- return tv.tv_sec * 1000 + tv.tv_usec / 1000;
-#elif PLATFORM(QT)
- QDateTime t = QDateTime::currentDateTime();
- return t.toTime_t() * 1000 + t.time().msec();
#elif PLATFORM(WIN_OS)
union {
FILETIME fileTime;
@@ -97,7 +81,8 @@ static inline unsigned getCPUTime()
return userTime.fileTimeAsLong / 10000 + kernelTime.fileTimeAsLong / 10000;
#else
-#error Platform does not have getCurrentTime function
+ // FIXME: We should return the time the current thread has spent executing.
+ return currentTime() * 1000;
#endif
}
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list