| Index: src/log.cc
 | 
| diff --git a/src/log.cc b/src/log.cc
 | 
| index 9a3c54d0432b72ec54887615fc0f679a6c561623..88527ca6b304d67b6fdd7d317988877da06568d0 100644
 | 
| --- a/src/log.cc
 | 
| +++ b/src/log.cc
 | 
| @@ -44,37 +44,6 @@
 | 
|  namespace v8 {
 | 
|  namespace internal {
 | 
|  
 | 
| -//
 | 
| -// Sliding state window.  Updates counters to keep track of the last
 | 
| -// window of kBufferSize states.  This is useful to track where we
 | 
| -// spent our time.
 | 
| -//
 | 
| -class SlidingStateWindow {
 | 
| - public:
 | 
| -  explicit SlidingStateWindow(Isolate* isolate);
 | 
| -  ~SlidingStateWindow();
 | 
| -  void AddState(StateTag state);
 | 
| -
 | 
| - private:
 | 
| -  static const int kBufferSize = 256;
 | 
| -  Counters* counters_;
 | 
| -  int current_index_;
 | 
| -  bool is_full_;
 | 
| -  byte buffer_[kBufferSize];
 | 
| -
 | 
| -
 | 
| -  void IncrementStateCounter(StateTag state) {
 | 
| -    counters_->state_counters(state)->Increment();
 | 
| -  }
 | 
| -
 | 
| -
 | 
| -  void DecrementStateCounter(StateTag state) {
 | 
| -    counters_->state_counters(state)->Decrement();
 | 
| -  }
 | 
| -};
 | 
| -
 | 
| -
 | 
| -//
 | 
|  // The Profiler samples pc and sp values for the main thread.
 | 
|  // Each sample is appended to a circular buffer.
 | 
|  // An independent thread removes data and writes it to the log.
 | 
| @@ -189,24 +158,12 @@ class Ticker: public Sampler {
 | 
|   public:
 | 
|    Ticker(Isolate* isolate, int interval):
 | 
|        Sampler(isolate, interval),
 | 
| -      window_(NULL),
 | 
|        profiler_(NULL) {}
 | 
|  
 | 
|    ~Ticker() { if (IsActive()) Stop(); }
 | 
|  
 | 
|    virtual void Tick(TickSample* sample) {
 | 
|      if (profiler_) profiler_->Insert(sample);
 | 
| -    if (window_) window_->AddState(sample->state);
 | 
| -  }
 | 
| -
 | 
| -  void SetWindow(SlidingStateWindow* window) {
 | 
| -    window_ = window;
 | 
| -    if (!IsActive()) Start();
 | 
| -  }
 | 
| -
 | 
| -  void ClearWindow() {
 | 
| -    window_ = NULL;
 | 
| -    if (!profiler_ && IsActive() && !RuntimeProfiler::IsEnabled()) Stop();
 | 
|    }
 | 
|  
 | 
|    void SetProfiler(Profiler* profiler) {
 | 
| @@ -219,7 +176,7 @@ class Ticker: public Sampler {
 | 
|    void ClearProfiler() {
 | 
|      DecreaseProfilingDepth();
 | 
|      profiler_ = NULL;
 | 
| -    if (!window_ && IsActive() && !RuntimeProfiler::IsEnabled()) Stop();
 | 
| +    if (IsActive()) Stop();
 | 
|    }
 | 
|  
 | 
|   protected:
 | 
| @@ -228,42 +185,11 @@ class Ticker: public Sampler {
 | 
|    }
 | 
|  
 | 
|   private:
 | 
| -  SlidingStateWindow* window_;
 | 
|    Profiler* profiler_;
 | 
|  };
 | 
|  
 | 
|  
 | 
|  //
 | 
| -// SlidingStateWindow implementation.
 | 
| -//
 | 
| -SlidingStateWindow::SlidingStateWindow(Isolate* isolate)
 | 
| -    : counters_(isolate->counters()), current_index_(0), is_full_(false) {
 | 
| -  for (int i = 0; i < kBufferSize; i++) {
 | 
| -    buffer_[i] = static_cast<byte>(OTHER);
 | 
| -  }
 | 
| -  isolate->logger()->ticker_->SetWindow(this);
 | 
| -}
 | 
| -
 | 
| -
 | 
| -SlidingStateWindow::~SlidingStateWindow() {
 | 
| -  LOGGER->ticker_->ClearWindow();
 | 
| -}
 | 
| -
 | 
| -
 | 
| -void SlidingStateWindow::AddState(StateTag state) {
 | 
| -  if (is_full_) {
 | 
| -    DecrementStateCounter(static_cast<StateTag>(buffer_[current_index_]));
 | 
| -  } else if (current_index_ == kBufferSize - 1) {
 | 
| -    is_full_ = true;
 | 
| -  }
 | 
| -  buffer_[current_index_] = static_cast<byte>(state);
 | 
| -  IncrementStateCounter(state);
 | 
| -  ASSERT(IsPowerOf2(kBufferSize));
 | 
| -  current_index_ = (current_index_ + 1) & (kBufferSize - 1);
 | 
| -}
 | 
| -
 | 
| -
 | 
| -//
 | 
|  // Profiler implementation.
 | 
|  //
 | 
|  Profiler::Profiler(Isolate* isolate)
 | 
| @@ -518,7 +444,6 @@ class Logger::NameBuffer {
 | 
|  Logger::Logger()
 | 
|    : ticker_(NULL),
 | 
|      profiler_(NULL),
 | 
| -    sliding_state_window_(NULL),
 | 
|      log_events_(NULL),
 | 
|      logging_nesting_(0),
 | 
|      cpu_profiler_nesting_(0),
 | 
| @@ -1412,9 +1337,7 @@ void Logger::PauseProfiler() {
 | 
|      if (--cpu_profiler_nesting_ == 0) {
 | 
|        profiler_->pause();
 | 
|        if (FLAG_prof_lazy) {
 | 
| -        if (!FLAG_sliding_state_window && !RuntimeProfiler::IsEnabled()) {
 | 
| -          ticker_->Stop();
 | 
| -        }
 | 
| +        ticker_->Stop();
 | 
|          FLAG_log_code = false;
 | 
|          LOG(ISOLATE, UncheckedStringEvent("profiler", "pause"));
 | 
|        }
 | 
| @@ -1435,9 +1358,7 @@ void Logger::ResumeProfiler() {
 | 
|          FLAG_log_code = true;
 | 
|          LogCompiledFunctions();
 | 
|          LogAccessorCallbacks();
 | 
| -        if (!FLAG_sliding_state_window && !ticker_->IsActive()) {
 | 
| -          ticker_->Start();
 | 
| -        }
 | 
| +        if (!ticker_->IsActive()) ticker_->Start();
 | 
|        }
 | 
|        profiler_->resume();
 | 
|      }
 | 
| @@ -1781,10 +1702,6 @@ bool Logger::SetUp() {
 | 
|    Isolate* isolate = Isolate::Current();
 | 
|    ticker_ = new Ticker(isolate, kSamplingIntervalMs);
 | 
|  
 | 
| -  if (FLAG_sliding_state_window && sliding_state_window_ == NULL) {
 | 
| -    sliding_state_window_ = new SlidingStateWindow(isolate);
 | 
| -  }
 | 
| -
 | 
|    bool start_logging = FLAG_log || FLAG_log_runtime || FLAG_log_api
 | 
|      || FLAG_log_code || FLAG_log_gc || FLAG_log_handles || FLAG_log_suspect
 | 
|      || FLAG_log_regexp || FLAG_log_state_changes || FLAG_ll_prof
 | 
| @@ -1851,9 +1768,6 @@ FILE* Logger::TearDown() {
 | 
|      profiler_ = NULL;
 | 
|    }
 | 
|  
 | 
| -  delete sliding_state_window_;
 | 
| -  sliding_state_window_ = NULL;
 | 
| -
 | 
|    delete ticker_;
 | 
|    ticker_ = NULL;
 | 
|  
 | 
| @@ -1861,22 +1775,6 @@ FILE* Logger::TearDown() {
 | 
|  }
 | 
|  
 | 
|  
 | 
| -void Logger::EnableSlidingStateWindow() {
 | 
| -  // If the ticker is NULL, Logger::SetUp has not been called yet.  In
 | 
| -  // that case, we set the sliding_state_window flag so that the
 | 
| -  // sliding window computation will be started when Logger::SetUp is
 | 
| -  // called.
 | 
| -  if (ticker_ == NULL) {
 | 
| -    FLAG_sliding_state_window = true;
 | 
| -    return;
 | 
| -  }
 | 
| -  // Otherwise, if the sliding state window computation has not been
 | 
| -  // started we do it now.
 | 
| -  if (sliding_state_window_ == NULL) {
 | 
| -    sliding_state_window_ = new SlidingStateWindow(Isolate::Current());
 | 
| -  }
 | 
| -}
 | 
| -
 | 
|  // Protects the state below.
 | 
|  static Mutex* active_samplers_mutex = NULL;
 | 
|  
 | 
| 
 |