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

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

Issue 1125383007: Postpone counters triggered during GC, and use a HandleScope when calling back. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Codereview feedback Created 5 years, 7 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/isolate.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
diff --git a/test/cctest/test-heap.cc b/test/cctest/test-heap.cc
index cb08fb4c04ee7841593c525589c918e7d5c8df25..d8c89aec1b4b242a9702c3a018681bdb9b2569bc 100644
--- a/test/cctest/test-heap.cc
+++ b/test/cctest/test-heap.cc
@@ -3203,6 +3203,31 @@ TEST(ReleaseOverReservedPages) {
CHECK_EQ(1, old_space->CountTotalPages());
}
+static int forced_gc_counter = 0;
+
+void MockUseCounterCallback(v8::Isolate* isolate,
+ v8::Isolate::UseCounterFeature feature) {
+ isolate->GetCallingContext();
+ if (feature == v8::Isolate::kForcedGC) {
+ forced_gc_counter++;
+ }
+}
+
+
+TEST(CountForcedGC) {
+ i::FLAG_expose_gc = true;
+ CcTest::InitializeVM();
+ Isolate* isolate = CcTest::i_isolate();
+ v8::HandleScope scope(CcTest::isolate());
+
+ isolate->SetUseCounterCallback(MockUseCounterCallback);
+
+ forced_gc_counter = 0;
+ const char* source = "gc();";
+ CompileRun(source);
+ CHECK_GT(forced_gc_counter, 0);
+}
+
TEST(Regress2237) {
i::FLAG_stress_compaction = false;
« no previous file with comments | « src/isolate.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698