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

Unified Diff: test/cctest/test-heap.cc

Issue 1268333004: Introduce object visitor to estimate the size of a native context. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: fix compare Created 5 years, 4 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 | « test/cctest/test-api.cc ('k') | tools/gyp/v8.gyp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/cctest/test-heap.cc
diff --git a/test/cctest/test-heap.cc b/test/cctest/test-heap.cc
index e476bcca84665990347988a1780298a134086fe5..dfabb92b9894ebf986f43d0b8239b68c81bbd60f 100644
--- a/test/cctest/test-heap.cc
+++ b/test/cctest/test-heap.cc
@@ -31,6 +31,7 @@
#include "src/v8.h"
#include "src/compilation-cache.h"
+#include "src/context-measure.h"
#include "src/deoptimizer.h"
#include "src/execution.h"
#include "src/factory.h"
@@ -6268,3 +6269,30 @@ TEST(SlotsBufferObjectSlotsRemoval) {
FixedArrayBase::kLengthOffset));
delete buffer;
}
+
+
+TEST(ContextMeasure) {
+ CcTest::InitializeVM();
+ v8::HandleScope scope(CcTest::isolate());
+ Isolate* isolate = CcTest::i_isolate();
+ LocalContext context;
+
+ int size_upper_limit = 0;
+ int count_upper_limit = 0;
+ HeapIterator it(CcTest::heap());
+ for (HeapObject* obj = it.next(); obj != NULL; obj = it.next()) {
+ size_upper_limit += obj->Size();
+ count_upper_limit++;
+ }
+
+ ContextMeasure measure(*isolate->native_context());
+
+ PrintF("Context size : %d bytes\n", measure.Size());
+ PrintF("Context object count: %d\n", measure.Count());
+
+ CHECK_LE(1000, measure.Count());
+ CHECK_LE(50000, measure.Size());
+
+ CHECK_LE(measure.Count(), count_upper_limit);
+ CHECK_LE(measure.Size(), size_upper_limit);
+}
« no previous file with comments | « test/cctest/test-api.cc ('k') | tools/gyp/v8.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698