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

Unified Diff: tests/standalone/io/code_collection_test.dart

Issue 1948353004: - Harden code_collection_test against GCs happening at unexpected (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/standalone/io/code_collection_test.dart
diff --git a/tests/standalone/io/code_collection_test.dart b/tests/standalone/io/code_collection_test.dart
index 43df6f733285063a51b048a3e3853684f25470eb..046c3c39a8db727097d3dffb3aaf245bec770e23 100644
--- a/tests/standalone/io/code_collection_test.dart
+++ b/tests/standalone/io/code_collection_test.dart
@@ -11,6 +11,7 @@ import "dart:io";
int foo(int x) {
x = x + 1;
+ print("foo=$x");
return x;
}
@@ -25,18 +26,18 @@ List<int> bar() {
doTest() {
var i = 0;
var ret = foo(1); // Initial call to compile.
- print("foo=$ret");
// Time passes, GC runs, foo's code is dropped.
var ms = const Duration(milliseconds: 100);
var t = new Timer.periodic(ms, (timer) {
i++;
+ // Calling bar will trigger GC without foo being on the stack. This way
+ // the method can be collected.
bar();
if (i > 1) {
timer.cancel();
// foo is called again to make sure we can still run it even after
// its code has been detached.
var ret = foo(2);
- print("foo=$ret");
}
});
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698