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

Unified Diff: dart/tests/compiler/dart2js/memory_compiler.dart

Issue 233233002: Copy types object when using a cached compiler. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Found issue during test, added comment. Created 6 years, 8 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
Index: dart/tests/compiler/dart2js/memory_compiler.dart
diff --git a/dart/tests/compiler/dart2js/memory_compiler.dart b/dart/tests/compiler/dart2js/memory_compiler.dart
index 392f51b6bf3a36251bc7e48f634c42bc6fd82ef4..a279cadfaa6b54c45bd28126aacb564e6ec1c217 100644
--- a/dart/tests/compiler/dart2js/memory_compiler.dart
+++ b/dart/tests/compiler/dart2js/memory_compiler.dart
@@ -165,7 +165,7 @@ Compiler compilerFor(Map<String,String> memorySourceFiles,
{});
if (cachedCompiler != null) {
compiler.coreLibrary = cachedCompiler.libraries['dart:core'];
- compiler.types = cachedCompiler.types;
+ compiler.types = cachedCompiler.types.copy(compiler);
cachedCompiler.libraries.forEach((String uri, library) {
if (library.isPlatformLibrary) {
compiler.libraries[uri] = library;
@@ -193,6 +193,27 @@ Compiler compilerFor(Map<String,String> memorySourceFiles,
treeElements;
}
});
+
+ // One potential problem that can occur when reusing elements is that there
+ // is a stale reference to an old compiler object. By nulling out the old
+ // compiler's fields, such stale references are easier to identify.
+ cachedCompiler.scanner = null;
+ cachedCompiler.dietParser = null;
+ cachedCompiler.parser = null;
+ cachedCompiler.patchParser = null;
+ cachedCompiler.libraryLoader = null;
+ cachedCompiler.validator = null;
+ cachedCompiler.resolver = null;
+ cachedCompiler.closureToClassMapper = null;
+ cachedCompiler.checker = null;
+ cachedCompiler.irBuilder = null;
+ cachedCompiler.typesTask = null;
+ cachedCompiler.backend = null;
+ cachedCompiler.enqueuer = null;
+ cachedCompiler.deferredLoadTask = null;
+ cachedCompiler.mirrorUsageAnalyzerTask = null;
+ cachedCompiler.dumpInfoTask = null;
+ cachedCompiler.buildId = null;
}
return compiler;
}
« no previous file with comments | « dart/sdk/lib/_internal/compiler/implementation/use_unused_api.dart ('k') | dart/tests/compiler/dart2js/message_kind_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698