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

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

Issue 10933124: Do 2 GCs on LowMemoryNotification instead of 7. Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 8 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
« no previous file with comments | « src/mark-compact.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/cctest/test-heap.cc
===================================================================
--- test/cctest/test-heap.cc (revision 12520)
+++ test/cctest/test-heap.cc (working copy)
@@ -1941,6 +1941,57 @@
}
+// Tests the FlushEagerly class from heap.h
+TEST(ReleaseUnoptimizedCode) {
+ i::FLAG_trace_gc = true;
+ // The optimizer can allocate stuff, messing up the test.
+ i::FLAG_crankshaft = false;
+ if (i::FLAG_always_opt) return;
+ InitializeVM();
+ v8::HandleScope scope;
+
+ PagedSpace* code_space = HEAP->code_space();
+ CompileRun("var a = [];"
+ "var sum = 0;"
+ "for (var j = 0; j < 1e4; j++) {"
+ " var fn = new Function("
+ " 'var k; var o = {}; for (k in o) { } return ' + j + ';');"
+ " sum += fn();"
+ "}");
+ HEAP->CollectAllGarbage(Heap::kNoGCFlags, "triggered for preparation");
+ printf("%d\n", code_space->CountTotalPages());
+ CHECK_GE(5, code_space->CountTotalPages());
+ HEAP->CollectAllAvailableGarbage("triggered really hard");
+ printf("%d\n", code_space->CountTotalPages());
+ CHECK_LE(2, code_space->CountTotalPages());
+}
+
+
+// Tests the FlushEagerly class from heap.h
+TEST(ReleaseRegexpCode) {
+ i::FLAG_trace_gc = true;
+ // The optimizer can allocate stuff, messing up the test.
+ i::FLAG_crankshaft = false;
+ if (i::FLAG_always_opt) return;
+ InitializeVM();
+ v8::HandleScope scope;
+
+ PagedSpace* code_space = HEAP->code_space();
+ CompileRun("var a = [];"
+ "for (var j = 0; j < 2e4; j++) {"
+ " var re = RegExp(j + '?');"
+ " a.push(re);"
+ " re.test('foo');"
+ "}");
+ HEAP->CollectAllGarbage(Heap::kNoGCFlags, "triggered for preparation");
+ printf("%d\n", code_space->CountTotalPages());
+ CHECK_GT(15, code_space->CountTotalPages());
+ HEAP->CollectAllAvailableGarbage("triggered really hard");
+ printf("%d\n", code_space->CountTotalPages());
+ CHECK_LE(2, code_space->CountTotalPages());
+}
+
+
TEST(Regress2237) {
InitializeVM();
v8::HandleScope scope;
« no previous file with comments | « src/mark-compact.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698