Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(196)

Unified Diff: src/utils-inl.h

Issue 1640563004: Reland of "[heap] Parallel newspace evacuation, semispace copy, and compaction \o/" (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Convert bogus DCHECK into proper branch Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/objects-inl.h ('k') | test/cctest/heap/test-heap.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/utils-inl.h
diff --git a/src/utils-inl.h b/src/utils-inl.h
new file mode 100644
index 0000000000000000000000000000000000000000..617d7fc151f5668769e346c129b9cd664a9b2a85
--- /dev/null
+++ b/src/utils-inl.h
@@ -0,0 +1,37 @@
+// Copyright 2016 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef V8_UTILS_INL_H_
+#define V8_UTILS_INL_H_
+
+#include "src/utils.h"
+
+#include "include/v8-platform.h"
+#include "src/base/platform/time.h"
+#include "src/v8.h"
+
+namespace v8 {
+namespace internal {
+
+class TimedScope {
+ public:
+ explicit TimedScope(double* result)
+ : start_(TimestampMs()), result_(result) {}
+
+ ~TimedScope() { *result_ = TimestampMs() - start_; }
+
+ private:
+ static inline double TimestampMs() {
+ return V8::GetCurrentPlatform()->MonotonicallyIncreasingTime() *
+ static_cast<double>(base::Time::kMillisecondsPerSecond);
+ }
+
+ double start_;
+ double* result_;
+};
+
+} // namespace internal
+} // namespace v8
+
+#endif // V8_UTILS_INL_H_
« no previous file with comments | « src/objects-inl.h ('k') | test/cctest/heap/test-heap.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698