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

Unified Diff: pkg/compiler/lib/src/ssa/codegen.dart

Issue 1418573011: dart2js: Change how super tear-offs are registered. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Fix Created 5 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
« no previous file with comments | « pkg/compiler/lib/src/js_backend/codegen/glue.dart ('k') | pkg/compiler/lib/src/tree_ir/tree_ir_nodes.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/compiler/lib/src/ssa/codegen.dart
diff --git a/pkg/compiler/lib/src/ssa/codegen.dart b/pkg/compiler/lib/src/ssa/codegen.dart
index dc07333725eb847e480edbdd5e479cc09a7150b1..69ee9c85266ab2d6ee554561096735444866e087 100644
--- a/pkg/compiler/lib/src/ssa/codegen.dart
+++ b/pkg/compiler/lib/src/ssa/codegen.dart
@@ -1763,26 +1763,16 @@ class SsaCodeGenerator implements HVisitor, HBlockInformationVisitor {
Selector selector = node.selector;
if (!backend.maybeRegisterAliasedSuperMember(superElement, selector)) {
js.Name methodName;
- if (selector.isGetter) {
- // If the selector we need to register a typed getter to the
- // [world]. The emitter needs to know if it needs to emit a
- // bound closure for a method.
-
- // If [superMethod] is mixed in, [superClass] might not be live.
- // We use the superclass of the access instead.
- TypeMask receiverType =
- new TypeMask.nonNullExact(node.caller.superclass, compiler.world);
- // TODO(floitsch): we know the target. We shouldn't register a
- // dynamic getter.
- registry.registerDynamicUse(
- new DynamicUse(selector, receiverType));
- if (superElement.isFunction) {
- registry.registerStaticUse(
- new StaticUse.superTearOff(superElement));
- }
+ if (selector.isGetter && !superElement.isGetter) {
+ // If this is a tear-off, register the fact that a tear-off closure
+ // will be created, and that this tear-off must bypass ordinary
+ // dispatch to ensure the super method is invoked.
+ FunctionElement helper = backend.helpers.closureFromTearOff;
+ registry.registerStaticUse(new StaticUse.staticInvoke(helper,
+ new CallStructure.unnamed(helper.parameters.length)));
+ registry.registerStaticUse(new StaticUse.superTearOff(node.element));
methodName = backend.namer.invocationName(selector);
} else {
- assert(invariant(node, compiler.hasIncrementalSupport));
methodName = backend.namer.instanceMethodName(superElement);
}
registry.registerStaticUse(
« no previous file with comments | « pkg/compiler/lib/src/js_backend/codegen/glue.dart ('k') | pkg/compiler/lib/src/tree_ir/tree_ir_nodes.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698