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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2008 the V8 project authors. All rights reserved. 1 // Copyright 2008 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 #undef DEFINE_EXTENSION_ID 71 #undef DEFINE_EXTENSION_ID
72 72
73 typedef v8::internal::EnumSet<CcTestExtensionIds> CcTestExtensionFlags; 73 typedef v8::internal::EnumSet<CcTestExtensionIds> CcTestExtensionFlags;
74 #define DEFINE_EXTENSION_FLAG(Name, Ident) \ 74 #define DEFINE_EXTENSION_FLAG(Name, Ident) \
75 static const CcTestExtensionFlags Name(1 << Name##_ID); 75 static const CcTestExtensionFlags Name(1 << Name##_ID);
76 static const CcTestExtensionFlags NO_EXTENSIONS(0); 76 static const CcTestExtensionFlags NO_EXTENSIONS(0);
77 static const CcTestExtensionFlags ALL_EXTENSIONS((1 << kMaxExtensions) - 1); 77 static const CcTestExtensionFlags ALL_EXTENSIONS((1 << kMaxExtensions) - 1);
78 EXTENSION_LIST(DEFINE_EXTENSION_FLAG) 78 EXTENSION_LIST(DEFINE_EXTENSION_FLAG)
79 #undef DEFINE_EXTENSION_FLAG 79 #undef DEFINE_EXTENSION_FLAG
80 80
81
yurys 2013/09/25 10:41:12 revert this
Alexandra Mikhaylova 2013/09/25 14:33:40 Done.
82 class CcTest { 81 class CcTest {
83 public: 82 public:
84 typedef void (TestFunction)(); 83 typedef void (TestFunction)();
85 CcTest(TestFunction* callback, const char* file, const char* name, 84 CcTest(TestFunction* callback, const char* file, const char* name,
86 const char* dependency, bool enabled, bool initialize); 85 const char* dependency, bool enabled, bool initialize);
87 void Run(); 86 void Run();
88 static CcTest* last() { return last_; } 87 static CcTest* last() { return last_; }
89 CcTest* prev() { return prev_; } 88 CcTest* prev() { return prev_; }
90 const char* file() { return file_; } 89 const char* file() { return file_; }
91 const char* name() { return name_; } 90 const char* name() { return name_; }
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after
337 // Helper function that simulates a full old-space in the heap. 336 // Helper function that simulates a full old-space in the heap.
338 static inline void SimulateFullSpace(v8::internal::PagedSpace* space) { 337 static inline void SimulateFullSpace(v8::internal::PagedSpace* space) {
339 int old_linear_size = static_cast<int>(space->limit() - space->top()); 338 int old_linear_size = static_cast<int>(space->limit() - space->top());
340 space->Free(space->top(), old_linear_size); 339 space->Free(space->top(), old_linear_size);
341 space->SetTop(space->limit(), space->limit()); 340 space->SetTop(space->limit(), space->limit());
342 space->ResetFreeList(); 341 space->ResetFreeList();
343 space->ClearStats(); 342 space->ClearStats();
344 } 343 }
345 344
346 345
346 // Helper class for new allocations tracking and checking.
347 // To use checking of JS allocations tracking in a test,
348 // just create an instance of this class.
349 class HeapObjectsTracker {
350 public:
351 HeapObjectsTracker() {
352 heap_profiler_ = i::Isolate::Current()->heap_profiler();
353 CHECK_NE(NULL, heap_profiler_);
354 heap_profiler_->StartHeapAllocationsRecording();
355 }
356
357 virtual ~HeapObjectsTracker() {
yurys 2013/09/25 10:41:12 No need to make it virtual.
Alexandra Mikhaylova 2013/09/25 14:33:40 Done.
358 i::Isolate::Current()->heap()->CollectAllAvailableGarbage();
359 CHECK_EQ(0, heap_profiler_->FindUntrackedObjects());
360 heap_profiler_->StopHeapAllocationsRecording();
361 }
362
363 private:
364 i::HeapProfiler* heap_profiler_;
365 };
366
367
347 #endif // ifndef CCTEST_H_ 368 #endif // ifndef CCTEST_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698