Revision: 16405
Author:   [email protected]
Date:     Wed Aug 28 14:32:08 2013 UTC
Log: Revert "Cross-compiling from Linux to Android requires -lrt for the host toolset.", "Fix Visual Studio debug build after r16398." and "Reland "Add Chromium-style TimeDelta, Time and TimeTicks classes, and a new ElapsedTimer class.""

This reverts commit r16398, r16399 and r16402 for breaking the Windows
WebKit tests. Will reland fix which doesn't use High Resolution Timer
for ElapsedTimer (we suspect QueryPerformanceCounter overhead is
responsible for test breakage).

[email protected]

Review URL: https://codereview.chromium.org/23710002
http://code.google.com/p/v8/source/detail?r=16405

Deleted:
 /branches/bleeding_edge/src/platform
 /branches/bleeding_edge/test/cctest/test-time.cc
Modified:
 /branches/bleeding_edge/src/api.cc
 /branches/bleeding_edge/src/compiler.cc
 /branches/bleeding_edge/src/compiler.h
 /branches/bleeding_edge/src/counters.cc
 /branches/bleeding_edge/src/counters.h
 /branches/bleeding_edge/src/cpu-profiler.cc
 /branches/bleeding_edge/src/cpu-profiler.h
 /branches/bleeding_edge/src/deoptimizer.cc
 /branches/bleeding_edge/src/hydrogen.cc
 /branches/bleeding_edge/src/hydrogen.h
 /branches/bleeding_edge/src/lithium-allocator.cc
 /branches/bleeding_edge/src/log.cc
 /branches/bleeding_edge/src/log.h
 /branches/bleeding_edge/src/optimizing-compiler-thread.cc
 /branches/bleeding_edge/src/optimizing-compiler-thread.h
 /branches/bleeding_edge/src/parser.cc
 /branches/bleeding_edge/src/platform-linux.cc
 /branches/bleeding_edge/src/platform-macos.cc
 /branches/bleeding_edge/src/platform-openbsd.cc
 /branches/bleeding_edge/src/platform-posix.cc
 /branches/bleeding_edge/src/platform-win32.cc
 /branches/bleeding_edge/src/platform.h
 /branches/bleeding_edge/src/profile-generator.cc
 /branches/bleeding_edge/src/profile-generator.h
 /branches/bleeding_edge/src/win32-headers.h
 /branches/bleeding_edge/src/win32-math.cc
 /branches/bleeding_edge/test/cctest/cctest.gyp
 /branches/bleeding_edge/test/cctest/test-cpu-profiler.cc
 /branches/bleeding_edge/tools/gyp/v8.gyp

=======================================
--- /branches/bleeding_edge/test/cctest/test-time.cc Wed Aug 28 13:03:06 2013 UTC
+++ /dev/null
@@ -1,116 +0,0 @@
-// Copyright 2013 the V8 project authors. All rights reserved.
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-//     * Redistributions of source code must retain the above copyright
-//       notice, this list of conditions and the following disclaimer.
-//     * Redistributions in binary form must reproduce the above
-//       copyright notice, this list of conditions and the following
-//       disclaimer in the documentation and/or other materials provided
-//       with the distribution.
-//     * Neither the name of Google Inc. nor the names of its
-//       contributors may be used to endorse or promote products derived
-//       from this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-#include <cstdlib>
-
-#include "v8.h"
-
-#include "cctest.h"
-#if V8_OS_WIN
-#include "win32-headers.h"
-#endif
-
-using namespace v8::internal;
-
-
-TEST(TimeDeltaFromAndIn) {
-  CHECK(TimeDelta::FromDays(2) == TimeDelta::FromHours(48));
-  CHECK(TimeDelta::FromHours(3) == TimeDelta::FromMinutes(180));
-  CHECK(TimeDelta::FromMinutes(2) == TimeDelta::FromSeconds(120));
-  CHECK(TimeDelta::FromSeconds(2) == TimeDelta::FromMilliseconds(2000));
- CHECK(TimeDelta::FromMilliseconds(2) == TimeDelta::FromMicroseconds(2000));
-  CHECK_EQ(static_cast<int>(13), TimeDelta::FromDays(13).InDays());
-  CHECK_EQ(static_cast<int>(13), TimeDelta::FromHours(13).InHours());
-  CHECK_EQ(static_cast<int>(13), TimeDelta::FromMinutes(13).InMinutes());
- CHECK_EQ(static_cast<int64_t>(13), TimeDelta::FromSeconds(13).InSeconds());
-  CHECK_EQ(13.0, TimeDelta::FromSeconds(13).InSecondsF());
-  CHECK_EQ(static_cast<int64_t>(13),
-           TimeDelta::FromMilliseconds(13).InMilliseconds());
-  CHECK_EQ(13.0, TimeDelta::FromMilliseconds(13).InMillisecondsF());
-  CHECK_EQ(static_cast<int64_t>(13),
-           TimeDelta::FromMicroseconds(13).InMicroseconds());
-}
-
-
-TEST(TimeJsTime) {
-  Time t = Time::FromJsTime(700000.3);
-  CHECK_EQ(700000.3, t.ToJsTime());
-}
-
-
-#if V8_OS_POSIX
-TEST(TimeFromTimeVal) {
-  Time null;
-  CHECK(null.IsNull());
-  CHECK(null == Time::FromTimeval(null.ToTimeval()));
-  Time now = Time::Now();
-  CHECK(now == Time::FromTimeval(now.ToTimeval()));
-  Time now_sys = Time::NowFromSystemTime();
-  CHECK(now_sys == Time::FromTimeval(now_sys.ToTimeval()));
-  Time unix_epoch = Time::UnixEpoch();
-  CHECK(unix_epoch == Time::FromTimeval(unix_epoch.ToTimeval()));
-  Time max = Time::Max();
-  CHECK(max.IsMax());
-  CHECK(max == Time::FromTimeval(max.ToTimeval()));
-}
-#endif
-
-
-#if V8_OS_WIN
-TEST(TimeFromFiletime) {
-  Time null;
-  CHECK(null.IsNull());
-  CHECK(null == Time::FromFiletime(null.ToFiletime()));
-  Time now = Time::Now();
-  CHECK(now == Time::FromFiletime(now.ToFiletime()));
-  Time now_sys = Time::NowFromSystemTime();
-  CHECK(now_sys == Time::FromFiletime(now_sys.ToFiletime()));
-  Time unix_epoch = Time::UnixEpoch();
-  CHECK(unix_epoch == Time::FromFiletime(unix_epoch.ToFiletime()));
-  Time max = Time::Max();
-  CHECK(max.IsMax());
-  CHECK(max == Time::FromFiletime(max.ToFiletime()));
-}
-#endif
-
-
-TEST(TimeTicksIsMonotonic) {
-  TimeTicks previous_normal_ticks;
-  TimeTicks previous_highres_ticks;
-  ElapsedTimer timer;
-  timer.Start();
-  while (!timer.HasExpired(TimeDelta::FromMilliseconds(100))) {
-    TimeTicks normal_ticks = TimeTicks::Now();
-    TimeTicks highres_ticks = TimeTicks::HighResNow();
-    CHECK_GE(normal_ticks, previous_normal_ticks);
-    CHECK_GE((normal_ticks - previous_normal_ticks).InMicroseconds(), 0);
-    CHECK_GE(highres_ticks, previous_highres_ticks);
-    CHECK_GE((highres_ticks - previous_highres_ticks).InMicroseconds(), 0);
-    previous_normal_ticks = normal_ticks;
-    previous_highres_ticks = highres_ticks;
-  }
-}
=======================================
--- /branches/bleeding_edge/src/api.cc  Wed Aug 28 13:03:06 2013 UTC
+++ /branches/bleeding_edge/src/api.cc  Wed Aug 28 14:32:08 2013 UTC
@@ -7310,13 +7310,13 @@

 int64_t CpuProfile::GetStartTime() const {
const i::CpuProfile* profile = reinterpret_cast<const i::CpuProfile*>(this);
-  return (profile->start_time() - i::Time::UnixEpoch()).InMicroseconds();
+  return profile->start_time_us();
 }


 int64_t CpuProfile::GetEndTime() const {
const i::CpuProfile* profile = reinterpret_cast<const i::CpuProfile*>(this);
-  return (profile->end_time() - i::Time::UnixEpoch()).InMicroseconds();
+  return profile->end_time_us();
 }


=======================================
--- /branches/bleeding_edge/src/compiler.cc     Wed Aug 28 13:03:06 2013 UTC
+++ /branches/bleeding_edge/src/compiler.cc     Wed Aug 28 14:32:08 2013 UTC
@@ -260,9 +260,10 @@
   Handle<JSFunction> function = info()->closure();
   int opt_count = function->shared()->opt_count();
   function->shared()->set_opt_count(opt_count + 1);
-  double ms_creategraph = time_taken_to_create_graph_.InMillisecondsF();
-  double ms_optimize = time_taken_to_optimize_.InMillisecondsF();
-  double ms_codegen = time_taken_to_codegen_.InMillisecondsF();
+  double ms_creategraph =
+      static_cast<double>(time_taken_to_create_graph_) / 1000;
+  double ms_optimize = static_cast<double>(time_taken_to_optimize_) / 1000;
+  double ms_codegen = static_cast<double>(time_taken_to_codegen_) / 1000;
   if (FLAG_trace_opt) {
     PrintF("[optimizing ");
     function->ShortPrint();
@@ -372,9 +373,9 @@
   // performance of the hydrogen-based compiler.
bool should_recompile = !info()->shared_info()->has_deoptimization_support();
   if (should_recompile || FLAG_hydrogen_stats) {
-    ElapsedTimer timer;
+    int64_t start_ticks = 0;
     if (FLAG_hydrogen_stats) {
-      timer.Start();
+      start_ticks = OS::Ticks();
     }
     CompilationInfoWithZone unoptimized(info()->shared_info());
     // Note that we use the same AST that we will use for generating the
@@ -393,7 +394,8 @@
           Logger::LAZY_COMPILE_TAG, &unoptimized, shared);
     }
     if (FLAG_hydrogen_stats) {
-      isolate()->GetHStatistics()->IncrementFullCodeGen(timer.Elapsed());
+      int64_t ticks = OS::Ticks() - start_ticks;
+      isolate()->GetHStatistics()->IncrementFullCodeGen(ticks);
     }
   }

@@ -1242,7 +1244,7 @@
     : name_(name), info_(info), zone_(info->isolate()) {
   if (FLAG_hydrogen_stats) {
     info_zone_start_allocation_size_ = info->zone()->allocation_size();
-    timer_.Start();
+    start_ticks_ = OS::Ticks();
   }
 }

@@ -1251,7 +1253,8 @@
   if (FLAG_hydrogen_stats) {
     unsigned size = zone()->allocation_size();
size += info_->zone()->allocation_size() - info_zone_start_allocation_size_;
-    isolate()->GetHStatistics()->SaveTiming(name_, timer_.Elapsed(), size);
+    int64_t ticks = OS::Ticks() - start_ticks_;
+    isolate()->GetHStatistics()->SaveTiming(name_, ticks, size);
   }
 }

=======================================
--- /branches/bleeding_edge/src/compiler.h      Wed Aug 28 13:03:06 2013 UTC
+++ /branches/bleeding_edge/src/compiler.h      Wed Aug 28 14:32:08 2013 UTC
@@ -501,6 +501,9 @@
         graph_builder_(NULL),
         graph_(NULL),
         chunk_(NULL),
+        time_taken_to_create_graph_(0),
+        time_taken_to_optimize_(0),
+        time_taken_to_codegen_(0),
         last_status_(FAILED) { }

   enum Status {
@@ -526,9 +529,9 @@
   HOptimizedGraphBuilder* graph_builder_;
   HGraph* graph_;
   LChunk* chunk_;
-  TimeDelta time_taken_to_create_graph_;
-  TimeDelta time_taken_to_optimize_;
-  TimeDelta time_taken_to_codegen_;
+  int64_t time_taken_to_create_graph_;
+  int64_t time_taken_to_optimize_;
+  int64_t time_taken_to_codegen_;
   Status last_status_;

   MUST_USE_RESULT Status SetLastStatus(Status status) {
@@ -538,20 +541,18 @@
   void RecordOptimizationStats();

   struct Timer {
-    Timer(OptimizingCompiler* compiler, TimeDelta* location)
+    Timer(OptimizingCompiler* compiler, int64_t* location)
         : compiler_(compiler),
-          location_(location) {
-      ASSERT(location_ != NULL);
-      timer_.Start();
-    }
+          start_(OS::Ticks()),
+          location_(location) { }

     ~Timer() {
-      *location_ += timer_.Elapsed();
+      *location_ += (OS::Ticks() - start_);
     }

     OptimizingCompiler* compiler_;
-    ElapsedTimer timer_;
-    TimeDelta* location_;
+    int64_t start_;
+    int64_t* location_;
   };
 };

@@ -643,7 +644,7 @@
   CompilationInfo* info_;
   Zone zone_;
   unsigned info_zone_start_allocation_size_;
-  ElapsedTimer timer_;
+  int64_t start_ticks_;

   DISALLOW_COPY_AND_ASSIGN(CompilationPhase);
 };
=======================================
--- /branches/bleeding_edge/src/counters.cc     Wed Aug 28 13:03:06 2013 UTC
+++ /branches/bleeding_edge/src/counters.cc     Wed Aug 28 14:32:08 2013 UTC
@@ -60,7 +60,8 @@
 // Start the timer.
 void HistogramTimer::Start() {
   if (Enabled()) {
-    timer_.Start();
+    stop_time_ = 0;
+    start_time_ = OS::Ticks();
   }
   if (FLAG_log_internal_timer_events) {
     LOG(isolate(), TimerEvent(Logger::START, name()));
@@ -71,9 +72,10 @@
 // Stop the timer and record the results.
 void HistogramTimer::Stop() {
   if (Enabled()) {
+    stop_time_ = OS::Ticks();
     // Compute the delta between start and stop, in milliseconds.
-    AddSample(static_cast<int>(timer_.Elapsed().InMilliseconds()));
-    timer_.Stop();
+    int milliseconds = static_cast<int>(stop_time_ - start_time_) / 1000;
+    AddSample(milliseconds);
   }
   if (FLAG_log_internal_timer_events) {
     LOG(isolate(), TimerEvent(Logger::END, name()));
=======================================
--- /branches/bleeding_edge/src/counters.h      Wed Aug 28 13:03:06 2013 UTC
+++ /branches/bleeding_edge/src/counters.h      Wed Aug 28 14:32:08 2013 UTC
@@ -245,7 +245,9 @@
                  int max,
                  int num_buckets,
                  Isolate* isolate)
-      : Histogram(name, min, max, num_buckets, isolate) {}
+      : Histogram(name, min, max, num_buckets, isolate),
+        start_time_(0),
+        stop_time_(0) { }

   // Start the timer.
   void Start();
@@ -255,11 +257,12 @@

   // Returns true if the timer is running.
   bool Running() {
-    return Enabled() && timer_.IsStarted();
+    return Enabled() && (start_time_ != 0) && (stop_time_ == 0);
   }

  private:
-  ElapsedTimer timer_;
+  int64_t start_time_;
+  int64_t stop_time_;
 };

 // Helper class for scoping a HistogramTimer.
=======================================
--- /branches/bleeding_edge/src/cpu-profiler.cc Wed Aug 28 13:03:06 2013 UTC
+++ /branches/bleeding_edge/src/cpu-profiler.cc Wed Aug 28 14:32:08 2013 UTC
@@ -46,12 +46,12 @@
 ProfilerEventsProcessor::ProfilerEventsProcessor(
     ProfileGenerator* generator,
     Sampler* sampler,
-    TimeDelta period)
+    int period_in_useconds)
     : Thread(Thread::Options("v8:ProfEvntProc", kProfilerStackSize)),
       generator_(generator),
       sampler_(sampler),
       running_(true),
-      period_(period),
+      period_in_useconds_(period_in_useconds),
       last_code_event_id_(0), last_processed_code_event_id_(0) {
 }

@@ -124,10 +124,9 @@


 void ProfilerEventsProcessor::ProcessEventsAndDoSample() {
-  ElapsedTimer timer;
-  timer.Start();
+  int64_t stop_time = OS::Ticks() + period_in_useconds_;
   // Keep processing existing events until we need to do next sample.
-  while (!timer.HasExpired(period_)) {
+  while (OS::Ticks() < stop_time) {
     if (ProcessTicks()) {
       // All ticks of the current dequeue_order are processed,
       // proceed to the next code event.
@@ -435,8 +434,7 @@
     generator_ = new ProfileGenerator(profiles_);
     Sampler* sampler = logger->sampler();
     processor_ = new ProfilerEventsProcessor(
-        generator_, sampler,
-        TimeDelta::FromMicroseconds(FLAG_cpu_profiler_sampling_interval));
+        generator_, sampler, FLAG_cpu_profiler_sampling_interval);
     is_profiling_ = true;
     // Enumerate stuff we already have in the heap.
     ASSERT(isolate_->heap()->HasBeenSetUp());
=======================================
--- /branches/bleeding_edge/src/cpu-profiler.h  Wed Aug 28 13:03:06 2013 UTC
+++ /branches/bleeding_edge/src/cpu-profiler.h  Wed Aug 28 14:32:08 2013 UTC
@@ -138,7 +138,7 @@
  public:
   ProfilerEventsProcessor(ProfileGenerator* generator,
                           Sampler* sampler,
-                          TimeDelta period);
+                          int period_in_useconds);
   virtual ~ProfilerEventsProcessor() {}

   // Thread control.
@@ -169,7 +169,7 @@
   Sampler* sampler_;
   bool running_;
   // Sampling period in microseconds.
-  const TimeDelta period_;
+  const int period_in_useconds_;
   UnboundQueue<CodeEventsContainer> events_buffer_;
   static const size_t kTickSampleBufferSize = 1 * MB;
   static const size_t kTickSampleQueueLength =
=======================================
--- /branches/bleeding_edge/src/deoptimizer.cc  Wed Aug 28 13:03:06 2013 UTC
+++ /branches/bleeding_edge/src/deoptimizer.cc  Wed Aug 28 14:32:08 2013 UTC
@@ -784,13 +784,12 @@
   }

   // Print some helpful diagnostic information.
+  int64_t start = OS::Ticks();
   if (FLAG_log_timer_events &&
       compiled_code_->kind() == Code::OPTIMIZED_FUNCTION) {
     LOG(isolate(), CodeDeoptEvent(compiled_code_));
   }
-  ElapsedTimer timer;
   if (trace_) {
-    timer.Start();
     PrintF("[deoptimizing (DEOPT %s): begin 0x%08" V8PRIxPTR " ",
            MessageFor(bailout_type_),
            reinterpret_cast<intptr_t>(function_));
@@ -871,7 +870,7 @@

   // Print some helpful diagnostic information.
   if (trace_) {
-    double ms = timer.Elapsed().InMillisecondsF();
+    double ms = static_cast<double>(OS::Ticks() - start) / 1000;
     int index = output_count_ - 1;  // Index of the topmost frame.
     JSFunction* function = output_[index]->GetFunction();
     PrintF("[deoptimizing (%s): end 0x%08" V8PRIxPTR " ",
=======================================
--- /branches/bleeding_edge/src/hydrogen.cc     Wed Aug 28 14:16:57 2013 UTC
+++ /branches/bleeding_edge/src/hydrogen.cc     Wed Aug 28 14:32:08 2013 UTC
@@ -9815,15 +9815,15 @@

 void HStatistics::Print() {
   PrintF("Timing results:\n");
-  TimeDelta sum;
-  for (int i = 0; i < times_.length(); ++i) {
-    sum += times_[i];
+  int64_t sum = 0;
+  for (int i = 0; i < timing_.length(); ++i) {
+    sum += timing_[i];
   }

   for (int i = 0; i < names_.length(); ++i) {
     PrintF("%32s", names_[i]);
-    double ms = times_[i].InMillisecondsF();
-    double percent = times_[i].PercentOf(sum);
+    double ms = static_cast<double>(timing_[i]) / 1000;
+    double percent = static_cast<double>(timing_[i]) * 100 / sum;
     PrintF(" %8.3f ms / %4.1f %% ", ms, percent);

     unsigned size = sizes_[i];
@@ -9833,29 +9833,29 @@

   PrintF("----------------------------------------"
          "---------------------------------------\n");
-  TimeDelta total = create_graph_ + optimize_graph_ + generate_code_;
+  int64_t total = create_graph_ + optimize_graph_ + generate_code_;
   PrintF("%32s %8.3f ms / %4.1f %% \n",
          "Create graph",
-         create_graph_.InMillisecondsF(),
-         create_graph_.PercentOf(total));
+         static_cast<double>(create_graph_) / 1000,
+         static_cast<double>(create_graph_) * 100 / total);
   PrintF("%32s %8.3f ms / %4.1f %% \n",
          "Optimize graph",
-         optimize_graph_.InMillisecondsF(),
-         optimize_graph_.PercentOf(total));
+         static_cast<double>(optimize_graph_) / 1000,
+         static_cast<double>(optimize_graph_) * 100 / total);
   PrintF("%32s %8.3f ms / %4.1f %% \n",
          "Generate and install code",
-         generate_code_.InMillisecondsF(),
-         generate_code_.PercentOf(total));
+         static_cast<double>(generate_code_) / 1000,
+         static_cast<double>(generate_code_) * 100 / total);
   PrintF("----------------------------------------"
          "---------------------------------------\n");
   PrintF("%32s %8.3f ms (%.1f times slower than full code gen)\n",
          "Total",
-         total.InMillisecondsF(),
-         total.TimesOf(full_code_gen_));
+         static_cast<double>(total) / 1000,
+         static_cast<double>(total) / full_code_gen_);

   double source_size_in_kb = static_cast<double>(source_size_) / 1024;
   double normalized_time =  source_size_in_kb > 0
-      ? total.InMillisecondsF() / source_size_in_kb
+      ? (static_cast<double>(total) / 1000) / source_size_in_kb
       : 0;
   double normalized_size_in_kb = source_size_in_kb > 0
       ? total_size_ / 1024 / source_size_in_kb
@@ -9866,17 +9866,17 @@
 }


-void HStatistics::SaveTiming(const char* name, TimeDelta time, unsigned size) { +void HStatistics::SaveTiming(const char* name, int64_t ticks, unsigned size) {
   total_size_ += size;
   for (int i = 0; i < names_.length(); ++i) {
     if (strcmp(names_[i], name) == 0) {
-      times_[i] += time;
+      timing_[i] += ticks;
       sizes_[i] += size;
       return;
     }
   }
   names_.Add(name);
-  times_.Add(time);
+  timing_.Add(ticks);
   sizes_.Add(size);
 }

=======================================
--- /branches/bleeding_edge/src/hydrogen.h      Wed Aug 28 13:03:06 2013 UTC
+++ /branches/bleeding_edge/src/hydrogen.h      Wed Aug 28 14:32:08 2013 UTC
@@ -2165,37 +2165,41 @@
 class HStatistics V8_FINAL: public Malloced {
  public:
   HStatistics()
-      : times_(5),
+      : timing_(5),
         names_(5),
         sizes_(5),
+        create_graph_(0),
+        optimize_graph_(0),
+        generate_code_(0),
         total_size_(0),
+        full_code_gen_(0),
         source_size_(0) { }

   void Initialize(CompilationInfo* info);
   void Print();
-  void SaveTiming(const char* name, TimeDelta time, unsigned size);
+  void SaveTiming(const char* name, int64_t ticks, unsigned size);

-  void IncrementFullCodeGen(TimeDelta full_code_gen) {
+  void IncrementFullCodeGen(int64_t full_code_gen) {
     full_code_gen_ += full_code_gen;
   }

-  void IncrementSubtotals(TimeDelta create_graph,
-                          TimeDelta optimize_graph,
-                          TimeDelta generate_code) {
+  void IncrementSubtotals(int64_t create_graph,
+                          int64_t optimize_graph,
+                          int64_t generate_code) {
     create_graph_ += create_graph;
     optimize_graph_ += optimize_graph;
     generate_code_ += generate_code;
   }

  private:
-  List<TimeDelta> times_;
+  List<int64_t> timing_;
   List<const char*> names_;
   List<unsigned> sizes_;
-  TimeDelta create_graph_;
-  TimeDelta optimize_graph_;
-  TimeDelta generate_code_;
+  int64_t create_graph_;
+  int64_t optimize_graph_;
+  int64_t generate_code_;
   unsigned total_size_;
-  TimeDelta full_code_gen_;
+  int64_t full_code_gen_;
   double source_size_;
 };

=======================================
--- /branches/bleeding_edge/src/lithium-allocator.cc Wed Aug 28 13:03:06 2013 UTC +++ /branches/bleeding_edge/src/lithium-allocator.cc Wed Aug 28 14:32:08 2013 UTC
@@ -2189,7 +2189,7 @@
   if (FLAG_hydrogen_stats) {
     unsigned size = allocator_->zone()->allocation_size() -
                     allocator_zone_start_allocation_size_;
-    isolate()->GetHStatistics()->SaveTiming(name(), TimeDelta(), size);
+    isolate()->GetHStatistics()->SaveTiming(name(), 0, size);
   }

   if (ShouldProduceTraceOutput()) {
=======================================
--- /branches/bleeding_edge/src/log.cc  Wed Aug 28 13:03:06 2013 UTC
+++ /branches/bleeding_edge/src/log.cc  Wed Aug 28 14:32:08 2013 UTC
@@ -716,7 +716,8 @@
     ll_logger_(NULL),
     jit_logger_(NULL),
     listeners_(5),
-    is_initialized_(false) {
+    is_initialized_(false),
+    epoch_(0) {
 }


@@ -867,7 +868,7 @@
   if (!log_->IsEnabled()) return;
   ASSERT(FLAG_log_internal_timer_events);
   Log::MessageBuilder msg(log_);
-  int since_epoch = static_cast<int>(timer_.Elapsed().InMicroseconds());
+  int since_epoch = static_cast<int>(OS::Ticks() - epoch_);
   msg.Append("code-deopt,%ld,%d\n", since_epoch, code->CodeSize());
   msg.WriteToLogFile();
 }
@@ -877,7 +878,7 @@
   if (!log_->IsEnabled()) return;
   ASSERT(FLAG_log_internal_timer_events);
   Log::MessageBuilder msg(log_);
-  int since_epoch = static_cast<int>(timer_.Elapsed().InMicroseconds());
+  int since_epoch = static_cast<int>(OS::Ticks() - epoch_);
   const char* format = (se == START) ? "timer-event-start,\"%s\",%ld\n"
                                      : "timer-event-end,\"%s\",%ld\n";
   msg.Append(format, name, since_epoch);
@@ -1500,7 +1501,7 @@
   Log::MessageBuilder msg(log_);
   msg.Append("%s,", kLogEventsNames[TICK_EVENT]);
   msg.AppendAddress(sample->pc);
-  msg.Append(",%ld", static_cast<int>(timer_.Elapsed().InMicroseconds()));
+  msg.Append(",%ld", static_cast<int>(OS::Ticks() - epoch_));
   if (sample->has_external_callback) {
     msg.Append(",1,");
     msg.AppendAddress(sample->external_callback);
@@ -1895,7 +1896,7 @@
     }
   }

-  if (FLAG_log_internal_timer_events || FLAG_prof) timer_.Start();
+  if (FLAG_log_internal_timer_events || FLAG_prof) epoch_ = OS::Ticks();

   return true;
 }
=======================================
--- /branches/bleeding_edge/src/log.h   Wed Aug 28 13:03:06 2013 UTC
+++ /branches/bleeding_edge/src/log.h   Wed Aug 28 14:32:08 2013 UTC
@@ -31,7 +31,6 @@
 #include "allocation.h"
 #include "objects.h"
 #include "platform.h"
-#include "platform/elapsed-timer.h"

 namespace v8 {
 namespace internal {
@@ -451,7 +450,7 @@
   // 'true' between SetUp() and TearDown().
   bool is_initialized_;

-  ElapsedTimer timer_;
+  int64_t epoch_;

   friend class CpuProfiler;
 };
=======================================
--- /branches/bleeding_edge/src/optimizing-compiler-thread.cc Wed Aug 28 13:03:06 2013 UTC +++ /branches/bleeding_edge/src/optimizing-compiler-thread.cc Wed Aug 28 14:32:08 2013 UTC
@@ -48,8 +48,8 @@
   DisallowHandleAllocation no_handles;
   DisallowHandleDereference no_deref;

-  ElapsedTimer total_timer;
-  if (FLAG_trace_concurrent_recompilation) total_timer.Start();
+  int64_t epoch = 0;
+  if (FLAG_trace_concurrent_recompilation) epoch = OS::Ticks();

   while (true) {
     input_queue_semaphore_->Wait();
@@ -65,7 +65,7 @@
         break;
       case STOP:
         if (FLAG_trace_concurrent_recompilation) {
-          time_spent_total_ = total_timer.Elapsed();
+          time_spent_total_ = OS::Ticks() - epoch;
         }
         stop_semaphore_->Signal();
         return;
@@ -81,13 +81,13 @@
         continue;
     }

-    ElapsedTimer compiling_timer;
-    if (FLAG_trace_concurrent_recompilation) compiling_timer.Start();
+    int64_t compiling_start = 0;
+    if (FLAG_trace_concurrent_recompilation) compiling_start = OS::Ticks();

     CompileNext();

     if (FLAG_trace_concurrent_recompilation) {
-      time_spent_compiling_ += compiling_timer.Elapsed();
+      time_spent_compiling_ += OS::Ticks() - compiling_start;
     }
   }
 }
@@ -175,7 +175,9 @@
   }

   if (FLAG_trace_concurrent_recompilation) {
-    double percentage = time_spent_compiling_.PercentOf(time_spent_total_);
+    double compile_time = static_cast<double>(time_spent_compiling_);
+    double total_time = static_cast<double>(time_spent_total_);
+    double percentage = (compile_time * 100) / total_time;
     PrintF("  ** Compiler thread did %.2f%% useful work\n", percentage);
   }

=======================================
--- /branches/bleeding_edge/src/optimizing-compiler-thread.h Wed Aug 28 13:03:06 2013 UTC +++ /branches/bleeding_edge/src/optimizing-compiler-thread.h Wed Aug 28 14:32:08 2013 UTC
@@ -31,7 +31,6 @@
 #include "atomicops.h"
 #include "flags.h"
 #include "platform.h"
-#include "platform/time.h"
 #include "unbound-queue-inl.h"

 namespace v8 {
@@ -52,7 +51,9 @@
       isolate_(isolate),
       stop_semaphore_(OS::CreateSemaphore(0)),
       input_queue_semaphore_(OS::CreateSemaphore(0)),
-      install_mutex_(OS::CreateMutex()) {
+      install_mutex_(OS::CreateMutex()),
+      time_spent_compiling_(0),
+      time_spent_total_(0) {
     NoBarrier_Store(&stop_thread_, static_cast<AtomicWord>(CONTINUE));
     NoBarrier_Store(&queue_length_, static_cast<AtomicWord>(0));
   }
@@ -111,8 +112,8 @@
   Mutex* install_mutex_;
   volatile AtomicWord stop_thread_;
   volatile Atomic32 queue_length_;
-  TimeDelta time_spent_compiling_;
-  TimeDelta time_spent_total_;
+  int64_t time_spent_compiling_;
+  int64_t time_spent_total_;
 };

 } }  // namespace v8::internal
=======================================
--- /branches/bleeding_edge/src/parser.cc       Wed Aug 28 13:03:06 2013 UTC
+++ /branches/bleeding_edge/src/parser.cc       Wed Aug 28 14:32:08 2013 UTC
@@ -569,13 +569,10 @@


 FunctionLiteral* Parser::ParseProgram() {
-  HistogramTimerScope timer_scope(isolate()->counters()->parse());
+  HistogramTimerScope timer(isolate()->counters()->parse());
   Handle<String> source(String::cast(script_->source()));
   isolate()->counters()->total_parse_size()->Increment(source->length());
-  ElapsedTimer timer;
-  if (FLAG_trace_parse) {
-    timer.Start();
-  }
+  int64_t start = FLAG_trace_parse ? OS::Ticks() : 0;
   fni_ = new(zone()) FuncNameInferrer(isolate(), zone());

   // Initialize parser state.
@@ -596,7 +593,7 @@
   }

   if (FLAG_trace_parse && result != NULL) {
-    double ms = timer.Elapsed().InMillisecondsF();
+    double ms = static_cast<double>(OS::Ticks() - start) / 1000;
     if (info()->is_eval()) {
       PrintF("[parsing eval");
     } else if (info()->script()->name()->IsString()) {
@@ -700,13 +697,10 @@


 FunctionLiteral* Parser::ParseLazy() {
-  HistogramTimerScope timer_scope(isolate()->counters()->parse_lazy());
+  HistogramTimerScope timer(isolate()->counters()->parse_lazy());
   Handle<String> source(String::cast(script_->source()));
   isolate()->counters()->total_parse_size()->Increment(source->length());
-  ElapsedTimer timer;
-  if (FLAG_trace_parse) {
-    timer.Start();
-  }
+  int64_t start = FLAG_trace_parse ? OS::Ticks() : 0;
   Handle<SharedFunctionInfo> shared_info = info()->shared_info();

   // Initialize parser state.
@@ -726,7 +720,7 @@
   }

   if (FLAG_trace_parse && result != NULL) {
-    double ms = timer.Elapsed().InMillisecondsF();
+    double ms = static_cast<double>(OS::Ticks() - start) / 1000;
     SmartArrayPointer<char> name_chars = result->debug_name()->ToCString();
     PrintF("[parsing function: %s - took %0.3f ms]\n", *name_chars, ms);
   }
=======================================
--- /branches/bleeding_edge/src/platform-linux.cc Wed Aug 28 13:03:06 2013 UTC +++ /branches/bleeding_edge/src/platform-linux.cc Wed Aug 28 14:32:08 2013 UTC
@@ -569,7 +569,7 @@

 void OS::SetUp() {
   // Seed the random number generator. We preserve microsecond resolution.
- uint64_t seed = static_cast<uint64_t>(TimeCurrentMillis()) ^ (getpid() << 16);
+  uint64_t seed = Ticks() ^ (getpid() << 16);
   srandom(static_cast<unsigned int>(seed));
   limit_mutex = CreateMutex();
 }
=======================================
--- /branches/bleeding_edge/src/platform-macos.cc Wed Aug 28 13:03:06 2013 UTC +++ /branches/bleeding_edge/src/platform-macos.cc Wed Aug 28 14:32:08 2013 UTC
@@ -441,7 +441,7 @@

 void OS::SetUp() {
   // Seed the random number generator. We preserve microsecond resolution.
- uint64_t seed = static_cast<uint64_t>(TimeCurrentMillis()) ^ (getpid() << 16);
+  uint64_t seed = Ticks() ^ (getpid() << 16);
   srandom(static_cast<unsigned int>(seed));
   limit_mutex = CreateMutex();
 }
=======================================
--- /branches/bleeding_edge/src/platform-openbsd.cc Wed Aug 28 13:03:06 2013 UTC +++ /branches/bleeding_edge/src/platform-openbsd.cc Wed Aug 28 14:32:08 2013 UTC
@@ -500,7 +500,7 @@

 void OS::SetUp() {
   // Seed the random number generator. We preserve microsecond resolution.
- uint64_t seed = static_cast<uint64_t>(TimeCurrentMillis()) ^ (getpid() << 16);
+  uint64_t seed = Ticks() ^ (getpid() << 16);
   srandom(static_cast<unsigned int>(seed));
   limit_mutex = CreateMutex();
 }
=======================================
--- /branches/bleeding_edge/src/platform-posix.cc Wed Aug 28 13:03:06 2013 UTC +++ /branches/bleeding_edge/src/platform-posix.cc Wed Aug 28 14:32:08 2013 UTC
@@ -313,7 +313,19 @@


 double OS::TimeCurrentMillis() {
-  return Time::Now().ToJsTime();
+  struct timeval tv;
+  if (gettimeofday(&tv, NULL) < 0) return 0.0;
+  return (static_cast<double>(tv.tv_sec) * 1000) +
+         (static_cast<double>(tv.tv_usec) / 1000);
+}
+
+
+int64_t OS::Ticks() {
+  // gettimeofday has microsecond resolution.
+  struct timeval tv;
+  if (gettimeofday(&tv, NULL) < 0)
+    return 0;
+  return (static_cast<int64_t>(tv.tv_sec) * 1000000) + tv.tv_usec;
 }


=======================================
--- /branches/bleeding_edge/src/platform-win32.cc Wed Aug 28 13:03:06 2013 UTC +++ /branches/bleeding_edge/src/platform-win32.cc Wed Aug 28 14:32:08 2013 UTC
@@ -38,6 +38,7 @@
 #endif  // MINGW_HAS_SECURE_API
 #endif  // __MINGW32__

+#define V8_WIN32_HEADERS_FULL
 #include "win32-headers.h"

 #include "v8.h"
@@ -245,15 +246,19 @@
// timestamps are represented as a doubles in milliseconds since 00:00:00 UTC,
 // January 1, 1970.

-class Win32Time {
+class Time {
  public:
   // Constructors.
-  explicit Win32Time(double jstime);
-  Win32Time(int year, int mon, int day, int hour, int min, int sec);
+  Time();
+  explicit Time(double jstime);
+  Time(int year, int mon, int day, int hour, int min, int sec);

   // Convert timestamp to JavaScript representation.
   double ToJSTime();

+  // Set timestamp to current time.
+  void SetToCurrentTime();
+
   // Returns the local timezone offset in milliseconds east of UTC. This is
   // the number of milliseconds you must add to UTC to get local time, i.e.
   // LocalOffset(CET) = 3600000 and LocalOffset(PST) = -28800000. This
@@ -295,6 +300,10 @@
   // Return whether or not daylight savings time is in effect at this time.
   bool InDST();

+  // Return the difference (in milliseconds) between this timestamp and
+  // another timestamp.
+  int64_t Diff(Time* other);
+
   // Accessor for FILETIME representation.
   FILETIME& ft() { return time_.ft_; }

@@ -316,20 +325,26 @@


 // Static variables.
-bool Win32Time::tz_initialized_ = false;
-TIME_ZONE_INFORMATION Win32Time::tzinfo_;
-char Win32Time::std_tz_name_[kTzNameSize];
-char Win32Time::dst_tz_name_[kTzNameSize];
+bool Time::tz_initialized_ = false;
+TIME_ZONE_INFORMATION Time::tzinfo_;
+char Time::std_tz_name_[kTzNameSize];
+char Time::dst_tz_name_[kTzNameSize];
+
+
+// Initialize timestamp to start of epoc.
+Time::Time() {
+  t() = 0;
+}


 // Initialize timestamp from a JavaScript timestamp.
-Win32Time::Win32Time(double jstime) {
+Time::Time(double jstime) {
   t() = static_cast<int64_t>(jstime) * kTimeScaler + kTimeEpoc;
 }


 // Initialize timestamp from date/time components.
-Win32Time::Win32Time(int year, int mon, int day, int hour, int min, int sec) {
+Time::Time(int year, int mon, int day, int hour, int min, int sec) {
   SYSTEMTIME st;
   st.wYear = year;
   st.wMonth = mon;
@@ -343,14 +358,14 @@


 // Convert timestamp to JavaScript timestamp.
-double Win32Time::ToJSTime() {
+double Time::ToJSTime() {
   return static_cast<double>((t() - kTimeEpoc) / kTimeScaler);
 }


 // Guess the name of the timezone from the bias.
 // The guess is very biased towards the northern hemisphere.
-const char* Win32Time::GuessTimezoneNameFromBias(int bias) {
+const char* Time::GuessTimezoneNameFromBias(int bias) {
   static const int kHour = 60;
   switch (-bias) {
     case -9*kHour: return "Alaska";
@@ -375,7 +390,7 @@
// Initialize timezone information. The timezone information is obtained from
 // windows. If we cannot get the timezone information we fall back to CET.
 // Please notice that this code is not thread-safe.
-void Win32Time::TzSet() {
+void Time::TzSet() {
   // Just return if timezone information has already been initialized.
   if (tz_initialized_) return;

@@ -422,18 +437,80 @@
   // Timezone information initialized.
   tz_initialized_ = true;
 }
+
+
+// Return the difference in milliseconds between this and another timestamp.
+int64_t Time::Diff(Time* other) {
+  return (t() - other->t()) / kTimeScaler;
+}
+

+// Set timestamp to current time.
+void Time::SetToCurrentTime() {
+  // The default GetSystemTimeAsFileTime has a ~15.5ms resolution.
+  // Because we're fast, we like fast timers which have at least a
+  // 1ms resolution.
+  //
+  // timeGetTime() provides 1ms granularity when combined with
+  // timeBeginPeriod().  If the host application for v8 wants fast
+  // timers, it can use timeBeginPeriod to increase the resolution.
+  //
+  // Using timeGetTime() has a drawback because it is a 32bit value
+  // and hence rolls-over every ~49days.
+  //
+  // To use the clock, we use GetSystemTimeAsFileTime as our base;
+  // and then use timeGetTime to extrapolate current time from the
+  // start time.  To deal with rollovers, we resync the clock
+  // any time when more than kMaxClockElapsedTime has passed or
+  // whenever timeGetTime creates a rollover.
+
+  static bool initialized = false;
+  static TimeStamp init_time;
+  static DWORD init_ticks;
+  static const int64_t kHundredNanosecondsPerSecond = 10000000;
+  static const int64_t kMaxClockElapsedTime =
+      60*kHundredNanosecondsPerSecond;  // 1 minute
+
+  // If we are uninitialized, we need to resync the clock.
+  bool needs_resync = !initialized;
+
+  // Get the current time.
+  TimeStamp time_now;
+  GetSystemTimeAsFileTime(&time_now.ft_);
+  DWORD ticks_now = timeGetTime();
+
+  // Check if we need to resync due to clock rollover.
+  needs_resync |= ticks_now < init_ticks;
+
+  // Check if we need to resync due to elapsed time.
+  needs_resync |= (time_now.t_ - init_time.t_) > kMaxClockElapsedTime;
+
+  // Check if we need to resync due to backwards time change.
+  needs_resync |= time_now.t_ < init_time.t_;
+
+  // Resync the clock if necessary.
+  if (needs_resync) {
+    GetSystemTimeAsFileTime(&init_time.ft_);
+    init_ticks = ticks_now = timeGetTime();
+    initialized = true;
+  }
+
+  // Finally, compute the actual time.  Why is this so hard.
+  DWORD elapsed = ticks_now - init_ticks;
+  this->time_.t_ = init_time.t_ + (static_cast<int64_t>(elapsed) * 10000);
+}
+

 // Return the local timezone offset in milliseconds east of UTC. This
 // takes into account whether daylight saving is in effect at the time.
 // Only times in the 32-bit Unix range may be passed to this function.
 // Also, adding the time-zone offset to the input must not overflow.
 // The function EquivalentTime() in date.js guarantees this.
-int64_t Win32Time::LocalOffset() {
+int64_t Time::LocalOffset() {
   // Initialize timezone information, if needed.
   TzSet();

-  Win32Time rounded_to_second(*this);
+  Time rounded_to_second(*this);
   rounded_to_second.t() = rounded_to_second.t() / 1000 / kTimeScaler *
       1000 * kTimeScaler;
   // Convert to local time using POSIX localtime function.
@@ -464,7 +541,7 @@


 // Return whether or not daylight savings time is in effect at this time.
-bool Win32Time::InDST() {
+bool Time::InDST() {
   // Initialize timezone information, if needed.
   TzSet();

@@ -488,14 +565,14 @@


 // Return the daylight savings time offset for this time.
-int64_t Win32Time::DaylightSavingsOffset() {
+int64_t Time::DaylightSavingsOffset() {
   return InDST() ? 60 * kMsPerMinute : 0;
 }


 // Returns a string identifying the current timezone for the
 // timestamp taking into account daylight saving.
-char* Win32Time::LocalTimezone() {
+char* Time::LocalTimezone() {
   // Return the standard or DST time zone name based on whether daylight
   // saving is in effect at the given time.
   return InDST() ? dst_tz_name_ : std_tz_name_;
@@ -537,14 +614,22 @@
 // Returns current time as the number of milliseconds since
 // 00:00:00 UTC, January 1, 1970.
 double OS::TimeCurrentMillis() {
-  return Time::Now().ToJsTime();
+  Time t;
+  t.SetToCurrentTime();
+  return t.ToJSTime();
+}
+
+
+// Returns the tickcounter based on timeGetTime.
+int64_t OS::Ticks() {
+  return timeGetTime() * 1000;  // Convert to microseconds.
 }


 // Returns a string identifying the current timezone taking into
 // account daylight saving.
 const char* OS::LocalTimezone(double time) {
-  return Win32Time(time).LocalTimezone();
+  return Time(time).LocalTimezone();
 }


@@ -552,7 +637,7 @@
 // taking daylight savings time into account.
 double OS::LocalTimeOffset() {
   // Use current time, rounded to the millisecond.
-  Win32Time t(TimeCurrentMillis());
+  Time t(TimeCurrentMillis());
// Time::LocalOffset inlcudes any daylight savings offset, so subtract it.
   return static_cast<double>(t.LocalOffset() - t.DaylightSavingsOffset());
 }
@@ -561,7 +646,7 @@
 // Returns the daylight savings offset in milliseconds for the given
 // time.
 double OS::DaylightSavingsOffset(double time) {
-  int64_t offset = Win32Time(time).DaylightSavingsOffset();
+  int64_t offset = Time(time).DaylightSavingsOffset();
   return static_cast<double>(offset);
 }

=======================================
--- /branches/bleeding_edge/src/platform.h      Wed Aug 28 13:03:06 2013 UTC
+++ /branches/bleeding_edge/src/platform.h      Wed Aug 28 14:32:08 2013 UTC
@@ -192,6 +192,10 @@
   // micro-second resolution.
   static int GetUserTime(uint32_t* secs,  uint32_t* usecs);

+  // Get a tick counter normalized to one tick per microsecond.
+  // Used for calculating time intervals.
+  static int64_t Ticks();
+
   // Returns current time as the number of milliseconds since
   // 00:00:00 UTC, January 1, 1970.
   static double TimeCurrentMillis();
=======================================
--- /branches/bleeding_edge/src/profile-generator.cc Wed Aug 28 13:03:06 2013 UTC +++ /branches/bleeding_edge/src/profile-generator.cc Wed Aug 28 14:32:08 2013 UTC
@@ -334,8 +334,8 @@
     : title_(title),
       uid_(uid),
       record_samples_(record_samples),
-      start_time_(Time::NowFromSystemTime()) {
-  timer_.Start();
+      start_time_us_(OS::Ticks()),
+      end_time_us_(0) {
 }


@@ -346,7 +346,7 @@


 void CpuProfile::CalculateTotalTicksAndSamplingRate() {
-  end_time_ = start_time_ + timer_.Elapsed();
+  end_time_us_ = OS::Ticks();
 }


=======================================
--- /branches/bleeding_edge/src/profile-generator.h Wed Aug 28 13:03:06 2013 UTC +++ /branches/bleeding_edge/src/profile-generator.h Wed Aug 28 14:32:08 2013 UTC
@@ -202,8 +202,8 @@
   int samples_count() const { return samples_.length(); }
   ProfileNode* sample(int index) const { return samples_.at(index); }

-  Time start_time() const { return start_time_; }
-  Time end_time() const { return end_time_; }
+  int64_t start_time_us() const { return start_time_us_; }
+  int64_t end_time_us() const { return end_time_us_; }

   void UpdateTicksScale();

@@ -213,9 +213,8 @@
   const char* title_;
   unsigned uid_;
   bool record_samples_;
-  Time start_time_;
-  Time end_time_;
-  ElapsedTimer timer_;
+  int64_t start_time_us_;
+  int64_t end_time_us_;
   List<ProfileNode*> samples_;
   ProfileTree top_down_;

=======================================
--- /branches/bleeding_edge/src/win32-headers.h Wed Aug 28 13:03:06 2013 UTC
+++ /branches/bleeding_edge/src/win32-headers.h Wed Aug 28 14:32:08 2013 UTC
@@ -25,9 +25,6 @@
 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

-#ifndef V8_WIN32_HEADERS_H_
-#define V8_WIN32_HEADERS_H_
-
 #ifndef WIN32_LEAN_AND_MEAN
 // WIN32_LEAN_AND_MEAN implies NOCRYPT and NOGDI.
 #define WIN32_LEAN_AND_MEAN
@@ -58,6 +55,7 @@

 #include <windows.h>

+#ifdef V8_WIN32_HEADERS_FULL
 #include <signal.h>  // For raise().
 #include <time.h>  // For LocalOffset() implementation.
 #include <mmsystem.h>  // For timeGetTime().
@@ -83,6 +81,7 @@
 #endif  // __MINGW32__
 #include <process.h>  // For _beginthreadex().
 #include <stdlib.h>
+#endif  // V8_WIN32_HEADERS_FULL

 #undef VOID
 #undef DELETE
@@ -98,5 +97,3 @@
 #undef CreateMutex
 #undef CreateSemaphore
 #undef Yield
-
-#endif  // V8_WIN32_HEADERS_H_
=======================================
--- /branches/bleeding_edge/src/win32-math.cc   Wed Aug 28 13:03:06 2013 UTC
+++ /branches/bleeding_edge/src/win32-math.cc   Wed Aug 28 14:32:08 2013 UTC
@@ -31,6 +31,8 @@
 // (http://www.opengroup.org/onlinepubs/000095399/)
 #ifdef _MSC_VER

+#undef V8_WIN32_LEAN_AND_MEAN
+#define V8_WIN32_HEADERS_FULL
 #include "win32-headers.h"
 #include <limits.h>        // Required for INT_MAX etc.
#include <float.h> // Required for DBL_MAX and on Win32 for finite()
=======================================
--- /branches/bleeding_edge/test/cctest/cctest.gyp Wed Aug 28 13:03:06 2013 UTC +++ /branches/bleeding_edge/test/cctest/cctest.gyp Wed Aug 28 14:32:08 2013 UTC
@@ -100,7 +100,6 @@
         'test-strtod.cc',
         'test-thread-termination.cc',
         'test-threads.cc',
-        'test-time.cc',
         'test-types.cc',
         'test-unbound-queue.cc',
         'test-utils.cc',
=======================================
--- /branches/bleeding_edge/test/cctest/test-cpu-profiler.cc Wed Aug 28 13:03:06 2013 UTC +++ /branches/bleeding_edge/test/cctest/test-cpu-profiler.cc Wed Aug 28 14:32:08 2013 UTC
@@ -44,15 +44,14 @@
 using i::ProfilerEventsProcessor;
 using i::ScopedVector;
 using i::SmartPointer;
-using i::TimeDelta;
 using i::Vector;


 TEST(StartStop) {
   CpuProfilesCollection profiles;
   ProfileGenerator generator(&profiles);
- SmartPointer<ProfilerEventsProcessor> processor(new ProfilerEventsProcessor(
-          &generator, NULL, TimeDelta::FromMicroseconds(100)));
+  SmartPointer<ProfilerEventsProcessor> processor(
+      new ProfilerEventsProcessor(&generator, NULL, 100));
   processor->Start();
   processor->StopSynchronously();
 }
@@ -143,8 +142,8 @@
   CpuProfilesCollection* profiles = new CpuProfilesCollection;
   profiles->StartProfiling("", 1, false);
   ProfileGenerator generator(profiles);
- SmartPointer<ProfilerEventsProcessor> processor(new ProfilerEventsProcessor(
-          &generator, NULL, TimeDelta::FromMicroseconds(100)));
+  SmartPointer<ProfilerEventsProcessor> processor(
+      new ProfilerEventsProcessor(&generator, NULL, 100));
   processor->Start();
   CpuProfiler profiler(isolate, profiles, &generator, *processor);

@@ -205,8 +204,8 @@
   CpuProfilesCollection* profiles = new CpuProfilesCollection;
   profiles->StartProfiling("", 1, false);
   ProfileGenerator generator(profiles);
- SmartPointer<ProfilerEventsProcessor> processor(new ProfilerEventsProcessor(
-          &generator, NULL, TimeDelta::FromMicroseconds(100)));
+  SmartPointer<ProfilerEventsProcessor> processor(
+      new ProfilerEventsProcessor(&generator, NULL, 100));
   processor->Start();
   CpuProfiler profiler(isolate, profiles, &generator, *processor);

@@ -274,8 +273,8 @@
   CpuProfilesCollection* profiles = new CpuProfilesCollection;
   profiles->StartProfiling("", 1, false);
   ProfileGenerator generator(profiles);
- SmartPointer<ProfilerEventsProcessor> processor(new ProfilerEventsProcessor(
-          &generator, NULL, TimeDelta::FromMicroseconds(100)));
+  SmartPointer<ProfilerEventsProcessor> processor(
+      new ProfilerEventsProcessor(&generator, NULL, 100));
   processor->Start();
   CpuProfiler profiler(isolate, profiles, &generator, *processor);

@@ -420,10 +419,13 @@
   v8::HandleScope scope(env->GetIsolate());
   v8::CpuProfiler* cpu_profiler = env->GetIsolate()->GetCpuProfiler();

+  int64_t time_before_profiling = i::OS::Ticks();
   v8::Local<v8::String> profile_name = v8::String::New("test");
   cpu_profiler->StartCpuProfiling(profile_name);
const v8::CpuProfile* profile = cpu_profiler->StopCpuProfiling(profile_name);
+  CHECK(time_before_profiling <= profile->GetStartTime());
   CHECK(profile->GetStartTime() <= profile->GetEndTime());
+  CHECK(profile->GetEndTime() <= i::OS::Ticks());
 }


=======================================
--- /branches/bleeding_edge/tools/gyp/v8.gyp    Wed Aug 28 14:11:07 2013 UTC
+++ /branches/bleeding_edge/tools/gyp/v8.gyp    Wed Aug 28 14:32:08 2013 UTC
@@ -436,9 +436,6 @@
         '../../src/optimizing-compiler-thread.cc',
         '../../src/parser.cc',
         '../../src/parser.h',
-        '../../src/platform/elapsed-timer.h',
-        '../../src/platform/time.cc',
-        '../../src/platform/time.h',
         '../../src/platform-posix.h',
         '../../src/platform.h',
         '../../src/preparse-data-format.h',
@@ -691,9 +688,6 @@
                   ]
                 }],
               ],
-              'libraries': [
-                '-lrt'
-              ]
             },
             'sources': [  ### gcmole(os:linux) ###
               '../../src/platform-linux.cc',
@@ -706,7 +700,7 @@
               'CAN_USE_VFP_INSTRUCTIONS',
             ],
             'sources': [
-              '../../src/platform-posix.cc'
+              '../../src/platform-posix.cc',
             ],
             'conditions': [
               ['host_os=="mac"', {
@@ -722,15 +716,6 @@
                   }],
                 ],
               }, {
-                'link_settings': {
-                  'target_conditions': [
-                    ['_toolset=="host"', {
-                      'libraries': [
-                        '-lrt'
-                      ]
-                    }]
-                  ]
-                },
                 'sources': [
                   '../../src/platform-linux.cc'
                 ]
@@ -778,7 +763,7 @@
             ]},
             'sources': [
               '../../src/platform-solaris.cc',
-              '../../src/platform-posix.cc'
+              '../../src/platform-posix.cc',
             ],
           }
         ],
@@ -801,13 +786,13 @@
                 ['build_env=="Cygwin"', {
                   'sources': [
                     '../../src/platform-cygwin.cc',
-                    '../../src/platform-posix.cc'
+                    '../../src/platform-posix.cc',
                   ],
                 }, {
                   'sources': [
                     '../../src/platform-win32.cc',
+                    '../../src/win32-math.h',
                     '../../src/win32-math.cc',
-                    '../../src/win32-math.h'
                   ],
                 }],
               ],
@@ -817,8 +802,8 @@
             }, {
               'sources': [
                 '../../src/platform-win32.cc',
+                '../../src/win32-math.h',
                 '../../src/win32-math.cc',
-                '../../src/win32-math.h'
               ],
               'msvs_disabled_warnings': [4351, 4355, 4800],
               'link_settings':  {

--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
--- You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to