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

Unified Diff: pkg/compiler/lib/src/js_emitter/program_builder/program_builder.dart

Issue 2820573005: dart2js: --fast-startup: share defaultValues property for closures with no default values (Closed)
Patch Set: Created 3 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: pkg/compiler/lib/src/js_emitter/program_builder/program_builder.dart
diff --git a/pkg/compiler/lib/src/js_emitter/program_builder/program_builder.dart b/pkg/compiler/lib/src/js_emitter/program_builder/program_builder.dart
index a0ce8a667ba03e5720d586fbf10a706dc5b5ab2b..0a5716193d4974495d1835147727be0d0fabf096 100644
--- a/pkg/compiler/lib/src/js_emitter/program_builder/program_builder.dart
+++ b/pkg/compiler/lib/src/js_emitter/program_builder/program_builder.dart
@@ -502,6 +502,7 @@ class ProgramBuilder {
// if it does not we can suppress it completely.
onlyForRti = true;
}
+ bool isClosureBaseClass = element == _compiler.commonElements.closureClass;
List<Method> methods = [];
List<StubMethod> callStubs = <StubMethod>[];
@@ -551,9 +552,8 @@ class ProgramBuilder {
});
}
- if (element == _compiler.commonElements.closureClass) {
- // We add a special getter here to allow for tearing off a closure from
- // itself.
+ if (isClosureBaseClass) {
+ // We add a special getter to allow for tearing off a closure from itself.
js.Name name = namer.getterForMember(Names.call);
js.Fun function = js.js('function() { return this; }');
callStubs.add(_buildStubMethod(name, function));
@@ -617,6 +617,7 @@ class ProgramBuilder {
if (element.isMixinApplication && !onlyForRti) {
assert(!backend.nativeData.isNativeClass(element));
assert(methods.isEmpty);
+ assert(!isClosureBaseClass);
result = new MixinApplication(
element,
@@ -647,7 +648,8 @@ class ProgramBuilder {
isDirectlyInstantiated: isInstantiated,
hasRtiField: hasRtiField,
onlyForRti: onlyForRti,
- isNative: backend.nativeData.isNativeClass(element));
+ isNative: backend.nativeData.isNativeClass(element),
+ isClosureBaseClass: isClosureBaseClass);
}
_classes[element] = result;
return result;
« no previous file with comments | « pkg/compiler/lib/src/js_emitter/model.dart ('k') | pkg/compiler/lib/src/js_emitter/startup_emitter/fragment_emitter.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698