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

Unified Diff: test/cctest/cctest.h

Issue 22852024: Track JS allocations as they arrive with no affection on performance when tracking is switched off (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Fix tracking flag + encode allocation type instead of calling different methods Created 7 years, 3 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
Index: test/cctest/cctest.h
diff --git a/test/cctest/cctest.h b/test/cctest/cctest.h
index b9c5d00fdd15cf979fb682a98683710d3815a890..04bee6806d545d3e40342abffe1fd3df275f2bf9 100644
--- a/test/cctest/cctest.h
+++ b/test/cctest/cctest.h
@@ -78,7 +78,6 @@ typedef v8::internal::EnumSet<CcTestExtensionIds> CcTestExtensionFlags;
EXTENSION_LIST(DEFINE_EXTENSION_FLAG)
#undef DEFINE_EXTENSION_FLAG
-
yurys 2013/09/25 10:41:12 revert this
Alexandra Mikhaylova 2013/09/25 14:33:40 Done.
class CcTest {
public:
typedef void (TestFunction)();
@@ -344,4 +343,26 @@ static inline void SimulateFullSpace(v8::internal::PagedSpace* space) {
}
+// Helper class for new allocations tracking and checking.
+// To use checking of JS allocations tracking in a test,
+// just create an instance of this class.
+class HeapObjectsTracker {
+ public:
+ HeapObjectsTracker() {
+ heap_profiler_ = i::Isolate::Current()->heap_profiler();
+ CHECK_NE(NULL, heap_profiler_);
+ heap_profiler_->StartHeapAllocationsRecording();
+ }
+
+ virtual ~HeapObjectsTracker() {
yurys 2013/09/25 10:41:12 No need to make it virtual.
Alexandra Mikhaylova 2013/09/25 14:33:40 Done.
+ i::Isolate::Current()->heap()->CollectAllAvailableGarbage();
+ CHECK_EQ(0, heap_profiler_->FindUntrackedObjects());
+ heap_profiler_->StopHeapAllocationsRecording();
+ }
+
+ private:
+ i::HeapProfiler* heap_profiler_;
+};
+
+
#endif // ifndef CCTEST_H_

Powered by Google App Engine
This is Rietveld 408576698