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

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

Issue 740273003: Incremental compiler: support optional arguments. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Add TODO for a follow-up CL. Created 6 years, 1 month 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/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 642859c90849f567e60efefc587ea9bc81479547..b50f490e30180ebed4d14f04d35bd5f14e7031bd 100644
--- a/dart/pkg/dart2js_incremental/lib/library_updater.dart
+++ b/dart/pkg/dart2js_incremental/lib/library_updater.dart
@@ -72,6 +72,9 @@ import 'package:compiler/src/elements/modelx.dart' show
FieldElementX,
LibraryElementX;
+import 'package:compiler/src/universe/universe.dart' show
+ Selector;
+
import 'diff.dart' show
Difference,
computeDifference;
@@ -568,13 +571,48 @@ class LibraryUpdater extends JsFeatures {
}
compiler.processQueue(compiler.enqueuer.codegen, null);
+ for (Element e in compiler.enqueuer.codegen.generatedCode.keys) {
+ if (e.isFunction && e.functionSignature.hasOptionalParameters) {
+ for (Selector selector in compiler.enqueuer.codegen.newlySeenSelectors) {
Johnni Winther 2014/12/05 09:48:23 Long line.
ahe 2014/12/09 16:28:23 Done.
+ // TODO(ahe): Group selectors by name at this point for improved
+ // performance.
+ if (e.name == selector.name &&
+ selector.appliesUnnamed(e, compiler.world)) {
Johnni Winther 2014/12/05 09:48:23 Isn't this the same as `applies`?
ahe 2014/12/09 16:28:23 Not exactly, but I had misunderstood the assertion
+ // TODO(ahe): Don't use
+ // compiler.enqueuer.codegen.newlyEnqueuedElements directly like
+ // this, make a copy.
+ compiler.enqueuer.codegen.newlyEnqueuedElements.add(e);
+ }
+ if (selector.name == namer.closureInvocationSelectorName) {
+ selector = new Selector.call(
+ e.name, e.library,
+ selector.argumentCount, selector.namedArguments);
+ if (selector.appliesUnnamed(e, compiler.world)) {
+ // TODO(ahe): Also make a copy here.
+ compiler.enqueuer.codegen.newlyEnqueuedElements.add(e);
+ }
+ }
+ }
+ }
+ }
+
List<jsAst.Statement> updates = <jsAst.Statement>[];
- Set newClasses = new Set.from(
+ // TODO(ahe): allInstantiatedClasses seem to include interfaces that aren't
+ // needed.
+ Set<ClassElementX> newClasses = new Set.from(
compiler.codegenWorld.allInstantiatedClasses.where(
emitter.computeClassFilter()));
newClasses.removeAll(_existingClasses);
+ // TODO(ahe): When more than one updated is computed, we need to make sure
+ // that existing classes aren't overwritten. No test except the one test
+ // that tests more than one update is affected by this problem, and only
+ // because main is closurized because we always enable tear-off. Is that
+ // really necessary? Also, add a test which tests directly that what
+ // happens when tear-off is introduced in second update.
+ emitter.neededClasses.addAll(newClasses);
+
List<jsAst.Statement> inherits = <jsAst.Statement>[];
for (ClassElementX cls in newClasses) {
@@ -617,9 +655,20 @@ class LibraryUpdater extends JsFeatures {
for (Element element in compiler.enqueuer.codegen.newlyEnqueuedElements) {
if (!element.isField) {
updates.add(computeMemberUpdateJs(element));
+ } else {
+ if (backend.constants.lazyStatics.contains(element)) {
+ throw new StateError("$element requires lazy initializer.");
+ }
}
}
+ updates.add(js.statement(r'''
+if (self.$dart_unsafe_eval.pendingStubs) {
+ self.$dart_unsafe_eval.pendingStubs.map(function(e) { return e(); });
+ self.$dart_unsafe_eval.pendingStubs = void 0;
+}
+'''));
+
if (updates.length == 1) {
return prettyPrintJs(updates.single);
} else {
« no previous file with comments | « dart/pkg/dart2js_incremental/lib/caching_compiler.dart ('k') | dart/sdk/lib/_internal/compiler/js_lib/js_helper.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698