Revision f230a1cf deps/v8/src/counters.h

View differences:

deps/v8/src/counters.h
259 259
    return Enabled() && timer_.IsStarted();
260 260
  }
261 261

  
262
  // TODO(bmeurer): Remove this when HistogramTimerScope is fixed.
263
#ifdef DEBUG
264
  ElapsedTimer* timer() { return &timer_; }
265
#endif
266

  
262 267
 private:
263 268
  ElapsedTimer timer_;
264 269
};
265 270

  
266 271
// Helper class for scoping a HistogramTimer.
272
// TODO(bmeurer): The ifdeffery is an ugly hack around the fact that the
273
// Parser is currently reentrant (when it throws an error, we call back
274
// into JavaScript and all bets are off), but ElapsedTimer is not
275
// reentry-safe. Fix this properly and remove |allow_nesting|.
267 276
class HistogramTimerScope BASE_EMBEDDED {
268 277
 public:
269
  explicit HistogramTimerScope(HistogramTimer* timer) :
270
  timer_(timer) {
278
  explicit HistogramTimerScope(HistogramTimer* timer,
279
                               bool allow_nesting = false)
280
#ifdef DEBUG
281
      : timer_(timer),
282
        skipped_timer_start_(false) {
283
    if (timer_->timer()->IsStarted() && allow_nesting) {
284
      skipped_timer_start_ = true;
285
    } else {
286
      timer_->Start();
287
    }
288
#else
289
      : timer_(timer) {
271 290
    timer_->Start();
291
#endif
272 292
  }
273 293
  ~HistogramTimerScope() {
294
#ifdef DEBUG
295
    if (!skipped_timer_start_) {
296
      timer_->Stop();
297
    }
298
#else
274 299
    timer_->Stop();
300
#endif
275 301
  }
276 302
 private:
277 303
  HistogramTimer* timer_;
304
#ifdef DEBUG
305
  bool skipped_timer_start_;
306
#endif
278 307
};
279 308

  
280 309

  

Also available in: Unified diff