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

Unified Diff: dart/pkg/dart2js_incremental/lib/library_updater.dart

Issue 796463003: Incremental compilation: correctly track emitted constants. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Constant output list may be null. Created 6 years 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 | dart/tests/try/web/incremental_compilation_update_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: dart/pkg/dart2js_incremental/lib/library_updater.dart
diff --git a/dart/pkg/dart2js_incremental/lib/library_updater.dart b/dart/pkg/dart2js_incremental/lib/library_updater.dart
index 9bb2c30930755325fab9ec75dc1d42c9b25bff6d..b7d41e0090fd5a160c335473171e34bc9382cb1a 100644
--- a/dart/pkg/dart2js_incremental/lib/library_updater.dart
+++ b/dart/pkg/dart2js_incremental/lib/library_updater.dart
@@ -144,15 +144,35 @@ class LibraryUpdater extends JsFeatures {
this.logTime,
this.logVerbose)
: this.compiler = compiler,
- _emittedClasses = new Set.from(
- compiler == null
- ? [] : compiler.backend.emitter.neededClasses),
- _directlyInstantiatedClasses = new Set.from(
- compiler == null
- ? [] : compiler.codegenWorld.directlyInstantiatedClasses),
- _compiledConstants = new Set<ConstantValue>.identity()..addAll(
- compiler == null
- ? [] : compiler.backend.constants.compiledConstants);
+ _emittedClasses = _getEmittedClasses(compiler),
+ _directlyInstantiatedClasses =
+ _getDirectlyInstantiatedClasses(compiler),
+ _compiledConstants = _getEmittedConstants(compiler);
+
+ /// Returns the classes emitted by [compiler].
+ static Set<ClassElementX> _getEmittedClasses(Compiler compiler) {
+ if (compiler == null) return null;
+ return new Set.from(compiler.backend.emitter.neededClasses);
+ }
+
+ /// Returns the directly instantantiated classes seen by [compiler].
+ static Set<ClassElementX> _getDirectlyInstantiatedClasses(Compiler compiler) {
+ if (compiler == null) return null;
+ return new Set.from(compiler.codegenWorld.directlyInstantiatedClasses);
+ }
+
+ /// Returns the constants emitted by [compiler].
+ static Set<ConstantValue> _getEmittedConstants(Compiler compiler) {
+ if (compiler != null) {
+ List<ConstantValue> constants =
+ compiler.backend.emitter.outputConstantLists[
+ compiler.deferredLoadTask.mainOutputUnit];
+ if (constants != null) {
+ return new Set<ConstantValue>.identity()..addAll(constants);
+ }
+ }
+ return null;
+ }
/// When [true], updates must be applied (using [applyUpdates]) before the
/// [compiler]'s state correctly reflects the updated program.
@@ -688,9 +708,10 @@ class LibraryUpdater extends JsFeatures {
emitter.outputConstantLists[compiler.deferredLoadTask.mainOutputUnit];
if (constants != null) {
for (ConstantValue constant in constants) {
- if (newConstants.contains(constant)) {
- jsAst.Statement constantInitializer = emitter.oldEmitter
- .buildConstantInitializer(constant).toStatement();
+ if (!_compiledConstants.contains(constant)) {
+ jsAst.Statement constantInitializer =
+ emitter.oldEmitter.buildConstantInitializer(constant)
+ .toStatement();
updates.add(constantInitializer);
}
}
« no previous file with comments | « no previous file | dart/tests/try/web/incremental_compilation_update_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698