Bug 1190077 - Move RDTSC and prmjtime.* to vm/Time.*. r=nbp
authorDavid Rajchenbach-Teller <dteller@mozilla.com>
Tue, 07 Jul 2015 18:47:40 +0200
changeset 287819 ee6b5e4532d33401445748e7927f73b50005cf79
parent 287818 d4a8f6b67ce0ebbafce7df91b67b0be6549ab99a
child 287820 318d42434ec3a937c4bd89253edfa76e9986d8e6
push id5067
push userraliiev@mozilla.com
push dateMon, 21 Sep 2015 14:04:52 +0000
treeherdermozilla-beta@14221ffe5b2f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersnbp
bugs1190077
milestone42.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1190077 - Move RDTSC and prmjtime.* to vm/Time.*. r=nbp CLOSED TREE
js/src/asmjs/AsmJSModule.cpp
js/src/asmjs/AsmJSValidate.cpp
js/src/builtin/AtomicsObject.cpp
js/src/gc/Nursery.cpp
js/src/gc/Statistics.cpp
js/src/jscompartment.h
js/src/jsdate.cpp
js/src/jsfriendapi.cpp
js/src/jsgc.cpp
js/src/jsmath.cpp
js/src/moz.build
js/src/prmjtime.cpp
js/src/prmjtime.h
js/src/shell/js.cpp
js/src/vm/HelperThreads.cpp
js/src/vm/SavedStacks.cpp
js/src/vm/Time.cpp
js/src/vm/Time.h
js/src/vm/TraceLogging.cpp
js/src/vm/TypeInference.cpp
--- a/js/src/asmjs/AsmJSModule.cpp
+++ b/js/src/asmjs/AsmJSModule.cpp
@@ -28,25 +28,27 @@
 #include "mozilla/TaggedAnonymousMemory.h"
 
 #include "jslibmath.h"
 #include "jsmath.h"
 #include "jsprf.h"
 #ifdef XP_WIN
 # include "jswin.h"
 #endif
-#include "prmjtime.h"
+
 
 #include "builtin/AtomicsObject.h"
 #include "frontend/Parser.h"
 #include "jit/IonCode.h"
 #include "js/Class.h"
 #include "js/Conversions.h"
 #include "js/MemoryMetrics.h"
 
+#include "vm/Time.h"
+
 #include "jsobjinlines.h"
 
 #include "frontend/ParseNode-inl.h"
 #include "jit/MacroAssembler-inl.h"
 #include "vm/ArrayBufferObject-inl.h"
 #include "vm/Stack-inl.h"
 
 using namespace js;
--- a/js/src/asmjs/AsmJSValidate.cpp
+++ b/js/src/asmjs/AsmJSValidate.cpp
@@ -23,33 +23,34 @@
 
 #ifdef MOZ_VTUNE
 # include "vtune/VTuneWrapper.h"
 #endif
 
 #include "jsmath.h"
 #include "jsprf.h"
 #include "jsutil.h"
-#include "prmjtime.h"
+
 
 #include "asmjs/AsmJSLink.h"
 #include "asmjs/AsmJSModule.h"
 #include "asmjs/AsmJSSignalHandlers.h"
 #include "builtin/SIMD.h"
 #include "frontend/Parser.h"
 #include "jit/AtomicOperations.h"
 #include "jit/CodeGenerator.h"
 #include "jit/CompileWrappers.h"
 #include "jit/MIR.h"
 #include "jit/MIRGraph.h"
 #ifdef JS_ION_PERF
 # include "jit/PerfSpewer.h"
 #endif
 #include "vm/HelperThreads.h"
 #include "vm/Interpreter.h"
+#include "vm/Time.h"
 
 #include "jsobjinlines.h"
 
 #include "frontend/ParseNode-inl.h"
 #include "frontend/Parser-inl.h"
 #include "jit/AtomicOperations-inl.h"
 #include "jit/MacroAssembler-inl.h"
 
--- a/js/src/builtin/AtomicsObject.cpp
+++ b/js/src/builtin/AtomicsObject.cpp
@@ -48,23 +48,22 @@
 #include "builtin/AtomicsObject.h"
 
 #include "mozilla/Atomics.h"
 #include "mozilla/FloatingPoint.h"
 
 #include "jsapi.h"
 #include "jsfriendapi.h"
 
-#include "prmjtime.h"
-
 #include "asmjs/AsmJSModule.h"
 #include "jit/AtomicOperations.h"
 #include "js/Class.h"
 #include "vm/GlobalObject.h"
 #include "vm/SharedTypedArrayObject.h"
+#include "vm/Time.h"
 #include "vm/TypedArrayObject.h"
 
 #include "jsobjinlines.h"
 #include "jit/AtomicOperations-inl.h"
 
 using namespace js;
 
 const Class AtomicsObject::class_ = {
--- a/js/src/gc/Nursery.cpp
+++ b/js/src/gc/Nursery.cpp
@@ -8,26 +8,26 @@
 #include "gc/Nursery-inl.h"
 
 #include "mozilla/IntegerPrintfMacros.h"
 #include "mozilla/Move.h"
 
 #include "jscompartment.h"
 #include "jsgc.h"
 #include "jsutil.h"
-#include "prmjtime.h"
 
 #include "gc/GCInternals.h"
 #include "gc/Memory.h"
 #include "jit/JitFrames.h"
 #include "vm/ArrayObject.h"
 #include "vm/Debugger.h"
 #if defined(DEBUG)
 #include "vm/ScopeObject.h"
 #endif
+#include "vm/Time.h"
 #include "vm/TypedArrayObject.h"
 #include "vm/TypeInference.h"
 
 #include "jsobjinlines.h"
 
 #include "vm/NativeObject-inl.h"
 
 using namespace js;
--- a/js/src/gc/Statistics.cpp
+++ b/js/src/gc/Statistics.cpp
@@ -12,22 +12,22 @@
 #include "mozilla/UniquePtr.h"
 
 #include <ctype.h>
 #include <stdarg.h>
 #include <stdio.h>
 
 #include "jsprf.h"
 #include "jsutil.h"
-#include "prmjtime.h"
 
 #include "gc/Memory.h"
 #include "vm/Debugger.h"
 #include "vm/HelperThreads.h"
 #include "vm/Runtime.h"
+#include "vm/Time.h"
 
 using namespace js;
 using namespace js::gc;
 using namespace js::gcstats;
 
 using mozilla::MakeRange;
 using mozilla::PodArrayZero;
 using mozilla::PodZero;
--- a/js/src/jscompartment.h
+++ b/js/src/jscompartment.h
@@ -5,23 +5,23 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #ifndef jscompartment_h
 #define jscompartment_h
 
 #include "mozilla/MemoryReporting.h"
 #include "mozilla/Variant.h"
 
-#include "prmjtime.h"
 #include "builtin/RegExp.h"
 #include "gc/Barrier.h"
 #include "gc/Zone.h"
 #include "vm/GlobalObject.h"
 #include "vm/PIC.h"
 #include "vm/SavedStacks.h"
+#include "vm/Time.h"
 
 namespace js {
 
 namespace jit {
 class JitCompartment;
 } // namespace jit
 
 namespace gc {
--- a/js/src/jsdate.cpp
+++ b/js/src/jsdate.cpp
@@ -28,25 +28,25 @@
 #include "jscntxt.h"
 #include "jsnum.h"
 #include "jsobj.h"
 #include "jsprf.h"
 #include "jsstr.h"
 #include "jstypes.h"
 #include "jsutil.h"
 #include "jswrapper.h"
-#include "prmjtime.h"
 
 #include "js/Conversions.h"
 #include "js/Date.h"
 #include "vm/DateTime.h"
 #include "vm/GlobalObject.h"
 #include "vm/Interpreter.h"
 #include "vm/String.h"
 #include "vm/StringBuffer.h"
+#include "vm/Time.h"
 
 #include "jsobjinlines.h"
 
 using namespace js;
 
 using mozilla::ArrayLength;
 using mozilla::IsFinite;
 using mozilla::IsNaN;
--- a/js/src/jsfriendapi.cpp
+++ b/js/src/jsfriendapi.cpp
@@ -13,22 +13,22 @@
 #include "jscntxt.h"
 #include "jscompartment.h"
 #include "jsgc.h"
 #include "jsobj.h"
 #include "jsprf.h"
 #include "jswatchpoint.h"
 #include "jsweakmap.h"
 #include "jswrapper.h"
-#include "prmjtime.h"
 
 #include "builtin/TestingFunctions.h"
 #include "js/Proxy.h"
 #include "proxy/DeadObjectProxy.h"
 #include "vm/ArgumentsObject.h"
+#include "vm/Time.h"
 #include "vm/WeakMapObject.h"
 #include "vm/WrapperObject.h"
 
 #include "jsobjinlines.h"
 #include "jsscriptinlines.h"
 
 #include "vm/NativeObject-inl.h"
 #include "vm/ScopeObject-inl.h"
--- a/js/src/jsgc.cpp
+++ b/js/src/jsgc.cpp
@@ -205,33 +205,33 @@
 #include "jsscript.h"
 #include "jstypes.h"
 #include "jsutil.h"
 #include "jswatchpoint.h"
 #include "jsweakmap.h"
 #ifdef XP_WIN
 # include "jswin.h"
 #endif
-#include "prmjtime.h"
 
 #include "gc/FindSCCs.h"
 #include "gc/GCInternals.h"
 #include "gc/GCTrace.h"
 #include "gc/Marking.h"
 #include "gc/Memory.h"
 #include "jit/BaselineJIT.h"
 #include "jit/IonCode.h"
 #include "jit/JitcodeMap.h"
 #include "js/SliceBudget.h"
 #include "proxy/DeadObjectProxy.h"
 #include "vm/Debugger.h"
 #include "vm/ProxyObject.h"
 #include "vm/Shape.h"
 #include "vm/String.h"
 #include "vm/Symbol.h"
+#include "vm/Time.h"
 #include "vm/TraceLogging.h"
 #include "vm/WrapperObject.h"
 
 #include "jsobjinlines.h"
 #include "jsscriptinlines.h"
 
 #include "vm/Stack-inl.h"
 #include "vm/String-inl.h"
--- a/js/src/jsmath.cpp
+++ b/js/src/jsmath.cpp
@@ -28,20 +28,21 @@
 #endif
 
 #include "jsapi.h"
 #include "jsatom.h"
 #include "jscntxt.h"
 #include "jscompartment.h"
 #include "jslibmath.h"
 #include "jstypes.h"
-#include "prmjtime.h"
 
 #include "js/Class.h"
 
+#include "vm/Time.h"
+
 #include "jsobjinlines.h"
 
 #if defined(ANDROID) || defined(XP_MACOSX) || defined(__DragonFly__) || \
     defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__)
 # include <stdlib.h>
 # define HAVE_ARC4RANDOM
 #endif
 
--- a/js/src/moz.build
+++ b/js/src/moz.build
@@ -262,17 +262,16 @@ UNIFIED_SOURCES += [
     'jsopcode.cpp',
     'jsprf.cpp',
     'jspropertytree.cpp',
     'jsscript.cpp',
     'jsstr.cpp',
     'jswatchpoint.cpp',
     'jsweakmap.cpp',
     'perf/jsperf.cpp',
-    'prmjtime.cpp',
     'proxy/BaseProxyHandler.cpp',
     'proxy/CrossCompartmentWrapper.cpp',
     'proxy/DeadObjectProxy.cpp',
     'proxy/DirectProxyHandler.cpp',
     'proxy/OpaqueCrossCompartmentWrapper.cpp',
     'proxy/Proxy.cpp',
     'proxy/ScriptedDirectProxyHandler.cpp',
     'proxy/ScriptedIndirectProxyHandler.cpp',
@@ -313,16 +312,17 @@ UNIFIED_SOURCES += [
     'vm/SharedArrayObject.cpp',
     'vm/SharedTypedArrayObject.cpp',
     'vm/SPSProfiler.cpp',
     'vm/Stack.cpp',
     'vm/String.cpp',
     'vm/StringBuffer.cpp',
     'vm/StructuredClone.cpp',
     'vm/Symbol.cpp',
+    'vm/Time.cpp',
     'vm/TypedArrayObject.cpp',
     'vm/TypeInference.cpp',
     'vm/UbiNode.cpp',
     'vm/UnboxedObject.cpp',
     'vm/Unicode.cpp',
     'vm/Value.cpp',
     'vm/WeakMapPtr.cpp',
     'vm/Xdr.cpp'
--- a/js/src/shell/js.cpp
+++ b/js/src/shell/js.cpp
@@ -50,17 +50,16 @@
 #include "jsprf.h"
 #include "jsscript.h"
 #include "jstypes.h"
 #include "jsutil.h"
 #ifdef XP_WIN
 # include "jswin.h"
 #endif
 #include "jswrapper.h"
-#include "prmjtime.h"
 
 #include "builtin/TestingFunctions.h"
 #include "frontend/Parser.h"
 #include "gc/GCInternals.h"
 #include "jit/arm/Simulator-arm.h"
 #include "jit/Ion.h"
 #include "jit/JitcodeMap.h"
 #include "jit/OptimizationTracking.h"
@@ -72,16 +71,17 @@
 #include "shell/jsoptparse.h"
 #include "shell/OSObject.h"
 #include "vm/ArgumentsObject.h"
 #include "vm/Debugger.h"
 #include "vm/HelperThreads.h"
 #include "vm/Monitor.h"
 #include "vm/Shape.h"
 #include "vm/SharedArrayObject.h"
+#include "vm/Time.h"
 #include "vm/TypedArrayObject.h"
 #include "vm/WrapperObject.h"
 
 #include "jscompartmentinlines.h"
 #include "jsobjinlines.h"
 
 #include "vm/Interpreter-inl.h"
 #include "vm/Stack-inl.h"
--- a/js/src/vm/HelperThreads.cpp
+++ b/js/src/vm/HelperThreads.cpp
@@ -5,22 +5,22 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "vm/HelperThreads.h"
 
 #include "mozilla/DebugOnly.h"
 
 #include "jsnativestack.h"
 #include "jsnum.h" // For FIX_FPU()
-#include "prmjtime.h"
 
 #include "frontend/BytecodeCompiler.h"
 #include "gc/GCInternals.h"
 #include "jit/IonBuilder.h"
 #include "vm/Debugger.h"
+#include "vm/Time.h"
 #include "vm/TraceLogging.h"
 
 #include "jscntxtinlines.h"
 #include "jscompartmentinlines.h"
 #include "jsobjinlines.h"
 #include "jsscriptinlines.h"
 
 using namespace js;
--- a/js/src/vm/SavedStacks.cpp
+++ b/js/src/vm/SavedStacks.cpp
@@ -15,23 +15,23 @@
 
 #include "jsapi.h"
 #include "jscompartment.h"
 #include "jsfriendapi.h"
 #include "jshashutil.h"
 #include "jsmath.h"
 #include "jsnum.h"
 #include "jsscript.h"
-#include "prmjtime.h"
 
 #include "gc/Marking.h"
 #include "gc/Rooting.h"
 #include "js/Vector.h"
 #include "vm/Debugger.h"
 #include "vm/StringBuffer.h"
+#include "vm/Time.h"
 #include "vm/WrapperObject.h"
 
 #include "jscntxtinlines.h"
 
 #include "vm/NativeObject-inl.h"
 #include "vm/Stack-inl.h"
 
 using mozilla::AddToHash;
rename from js/src/prmjtime.cpp
rename to js/src/vm/Time.cpp
--- a/js/src/prmjtime.cpp
+++ b/js/src/vm/Time.cpp
@@ -1,17 +1,17 @@
 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
  * vim: set ts=8 sts=4 et sw=4 tw=99:
  * This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 /* PR time code. */
 
-#include "prmjtime.h"
+#include "vm/Time.h"
 
 #include "mozilla/DebugOnly.h"
 #include "mozilla/MathAlgorithms.h"
 
 #ifdef SOLARIS
 #define _REENTRANT 1
 #endif
 #include <string.h>
rename from js/src/prmjtime.h
rename to js/src/vm/Time.h
--- a/js/src/prmjtime.h
+++ b/js/src/vm/Time.h
@@ -1,16 +1,16 @@
 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
  * vim: set ts=8 sts=4 et sw=4 tw=99:
  * This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
-#ifndef prmjtime_h
-#define prmjtime_h
+#ifndef vm_Time_h
+#define vm_Time_h
 
 #include <stddef.h>
 #include <stdint.h>
 
 /*
  * Broken down form of 64 bit time value.
  */
 struct PRMJTime {
@@ -51,9 +51,113 @@ PRMJ_NowShutdown();
 inline void
 PRMJ_NowShutdown() {}
 #endif
 
 /* Format a time value into a buffer. Same semantics as strftime() */
 extern size_t
 PRMJ_FormatTime(char* buf, int buflen, const char* fmt, PRMJTime* tm);
 
-#endif /* prmjtime_h */
+
+/**
+ * Requesting the number of cycles from the CPU.
+ *
+ * `rdtsc`, or Read TimeStamp Cycle, is an instruction provided by
+ * x86-compatible CPUs that lets processes request the number of
+ * cycles spent by the CPU executing instructions since the CPU was
+ * started. It may be used for performance monitoring, but you should
+ * be aware of the following limitations.
+ *
+ *
+ * 1. The value is *not* monotonic.
+ *
+ * The value is reset to 0 whenever a CPU is turned off (e.g. computer
+ * in full hibernation, single CPU going turned off). Moreover, on
+ * multi-core/multi-CPU architectures, the cycles of each core/CPU are
+ * generally not synchronized.  Therefore, is a process or thread is
+ * rescheduled to another core/CPU, the result of `rdtsc` may decrease
+ * arbitrarily.
+ *
+ * The only way to prevent this is to pin your thread to a particular
+ * CPU, which is generally not a good idea.
+ *
+ *
+ *
+ * 2. The value increases independently.
+ *
+ * The value may increase whenever the CPU executes an instruction,
+ * regardless of the process that has issued this
+ * instruction. Moreover, if a process or thread is rescheduled to
+ * another core/CPU, the result of `rdtsc` may increase arbitrarily.
+ *
+ * The only way to prevent this is to ensure that your thread is the
+ * sole owner of the CPU. See [1] for an example. This is also
+ * generally not a good idea.
+ *
+ *
+ *
+ * 3. The value does not measure time.
+ *
+ * On older architectures (pre-Pentium 4), there was no constant mapping
+ * between rdtsc and CPU time.
+ *
+ *
+ * 4. Instructions may be reordered.
+ *
+ * The CPU can reorder instructions. Also, rdtsc does not necessarily
+ * wait until all previous instructions have finished executing before
+ * reading the counter. Similarly, subsequent instructions may begin
+ * execution before the read operation is performed. If you use rdtsc
+ * for micro-benchmarking, you may end up measuring something else
+ * than what you expect. See [1] for a study of countermeasures.
+ *
+ *
+ * ** Performance
+ *
+ * According to unchecked sources on the web, the overhead of rdtsc is
+ * expected to be 150-200 cycles on old architectures, 6-50 on newer
+ * architectures. Agner's instruction tables [2] seem to confirm the latter
+ * results.
+ *
+ *
+ * [1]
+ * http://www.intel.com/content/dam/www/public/us/en/documents/white-papers/ia-32-ia-64-benchmark-code-execution-paper.pdf
+ * [2] http://www.agner.org/optimize/instruction_tables.pdf
+ */
+
+#define MOZ_HAVE_RDTSC 1
+
+#if defined(_WIN32)
+
+#include <intrin.h>
+static __inline uint64_t
+ReadTimestampCounter(void)
+{
+    return __rdtsc();
+}
+
+#elif defined(__i386__)
+
+static __inline__ uint64_t
+ReadTimestampCounter(void)
+{
+    uint64_t x;
+    __asm__ volatile (".byte 0x0f, 0x31" : "=A" (x));
+    return x;
+}
+
+#elif defined(__x86_64__)
+
+static __inline__ uint64_t
+ReadTimestampCounter(void)
+{
+    unsigned hi, lo;
+    __asm__ __volatile__ ("rdtsc" : "=a"(lo), "=d"(hi));
+    return ( (uint64_t)lo)|( ((uint64_t)hi)<<32 );
+}
+
+#else
+
+#undef MOZ_HAVE_RDTSC
+
+#endif
+
+#endif /* vm_Time_h */
--- a/js/src/vm/TraceLogging.cpp
+++ b/js/src/vm/TraceLogging.cpp
@@ -12,51 +12,35 @@
 
 #include "jsapi.h"
 #include "jsprf.h"
 #include "jsscript.h"
 
 #include "jit/BaselineJIT.h"
 #include "jit/CompileWrappers.h"
 #include "vm/Runtime.h"
+#include "vm/Time.h"
 #include "vm/TraceLoggingGraph.h"
 
 #include "jit/JitFrames-inl.h"
 
 using namespace js;
 using namespace js::jit;
 
 using mozilla::DebugOnly;
 using mozilla::NativeEndian;
 
 TraceLoggerThreadState* traceLoggerState = nullptr;
 
-#if defined(_WIN32)
-#include <intrin.h>
-static __inline uint64_t
-rdtsc(void)
-{
-    return __rdtsc();
+#if defined(MOZ_HAVE_RDTSC)
+
+uint64_t inline rdtsc() {
+    return ReadTimestampCounter();
 }
-#elif defined(__i386__)
-static __inline__ uint64_t
-rdtsc(void)
-{
-    uint64_t x;
-    __asm__ volatile (".byte 0x0f, 0x31" : "=A" (x));
-    return x;
-}
-#elif defined(__x86_64__)
-static __inline__ uint64_t
-rdtsc(void)
-{
-    unsigned hi, lo;
-    __asm__ __volatile__ ("rdtsc" : "=a"(lo), "=d"(hi));
-    return ( (uint64_t)lo)|( ((uint64_t)hi)<<32 );
-}
+
 #elif defined(__powerpc__)
 static __inline__ uint64_t
 rdtsc(void)
 {
     uint64_t result=0;
     uint32_t upper, lower,tmp;
     __asm__ volatile(
             "0:                  \n"
@@ -67,36 +51,42 @@ rdtsc(void)
             "\tbne     0b         \n"
             : "=r"(upper),"=r"(lower),"=r"(tmp)
             );
     result = upper;
     result = result<<32;
     result = result|lower;
 
     return result;
+
 }
 #elif defined(__arm__)
+
 #include <sys/time.h>
+
 static __inline__ uint64_t
 rdtsc(void)
 {
     struct timeval tv;
     gettimeofday(&tv, NULL);
     uint64_t ret = tv.tv_sec;
     ret *= 1000000;
     ret += tv.tv_usec;
     return ret;
 }
+
 #else
+
 static __inline__ uint64_t
 rdtsc(void)
 {
     return 0;
 }
-#endif
+
+#endif // defined(MOZ_HAVE_RDTSC)
 
 class AutoTraceLoggerThreadStateLock
 {
   TraceLoggerThreadState* logging;
 
   public:
     explicit AutoTraceLoggerThreadStateLock(TraceLoggerThreadState* logging MOZ_GUARD_OBJECT_NOTIFIER_PARAM)
       : logging(logging)
--- a/js/src/vm/TypeInference.cpp
+++ b/js/src/vm/TypeInference.cpp
@@ -14,29 +14,29 @@
 #include "jsapi.h"
 #include "jscntxt.h"
 #include "jsgc.h"
 #include "jshashutil.h"
 #include "jsobj.h"
 #include "jsprf.h"
 #include "jsscript.h"
 #include "jsstr.h"
-#include "prmjtime.h"
 
 #include "gc/Marking.h"
 #include "jit/BaselineJIT.h"
 #include "jit/CompileInfo.h"
 #include "jit/Ion.h"
 #include "jit/IonAnalysis.h"
 #include "jit/JitCompartment.h"
 #include "jit/OptimizationTracking.h"
 #include "js/MemoryMetrics.h"
 #include "vm/HelperThreads.h"
 #include "vm/Opcodes.h"
 #include "vm/Shape.h"
+#include "vm/Time.h"
 #include "vm/UnboxedObject.h"
 
 #include "jsatominlines.h"
 #include "jsscriptinlines.h"
 
 #include "vm/NativeObject-inl.h"
 
 using namespace js;