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

Side by Side Diff: sdk/lib/_internal/compiler/implementation/ssa/codegen.dart

Issue 23567019: Change how we generate bound closures to handler boud closures due to super getters: we need to pas… (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 3 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 part of ssa; 5 part of ssa;
6 6
7 class SsaCodeGeneratorTask extends CompilerTask { 7 class SsaCodeGeneratorTask extends CompilerTask {
8 8
9 final JavaScriptBackend backend; 9 final JavaScriptBackend backend;
10 10
(...skipping 1621 matching lines...) Expand 10 before | Expand all | Expand 10 after
1632 || (element.isFactoryConstructor() && cls == compiler.listClass)) { 1632 || (element.isFactoryConstructor() && cls == compiler.listClass)) {
1633 world.registerInstantiatedClass(cls, work.resolutionTree); 1633 world.registerInstantiatedClass(cls, work.resolutionTree);
1634 } 1634 }
1635 push(new js.VariableUse(backend.namer.isolateAccess(node.element))); 1635 push(new js.VariableUse(backend.namer.isolateAccess(node.element)));
1636 push(new js.Call(pop(), visitArguments(node.inputs, start: 0)), node); 1636 push(new js.Call(pop(), visitArguments(node.inputs, start: 0)), node);
1637 } 1637 }
1638 1638
1639 visitInvokeSuper(HInvokeSuper node) { 1639 visitInvokeSuper(HInvokeSuper node) {
1640 Element superMethod = node.element; 1640 Element superMethod = node.element;
1641 world.registerStaticUse(superMethod); 1641 world.registerStaticUse(superMethod);
1642 Element superClass = superMethod.getEnclosingClass(); 1642 ClassElement superClass = superMethod.getEnclosingClass();
1643 if (superMethod.kind == ElementKind.FIELD) { 1643 if (superMethod.kind == ElementKind.FIELD) {
1644 String fieldName = node.caller.isShadowedByField(superMethod) 1644 String fieldName = node.caller.isShadowedByField(superMethod)
1645 ? backend.namer.shadowedFieldName(superMethod) 1645 ? backend.namer.shadowedFieldName(superMethod)
1646 : backend.namer.instanceFieldName(superMethod); 1646 : backend.namer.instanceFieldName(superMethod);
1647 use(node.inputs[0]); 1647 use(node.inputs[0]);
1648 js.PropertyAccess access = 1648 js.PropertyAccess access =
1649 new js.PropertyAccess.field(pop(), fieldName); 1649 new js.PropertyAccess.field(pop(), fieldName);
1650 if (node.isSetter) { 1650 if (node.isSetter) {
1651 use(node.value); 1651 use(node.value);
1652 push(new js.Assignment(access, pop()), node); 1652 push(new js.Assignment(access, pop()), node);
1653 } else { 1653 } else {
1654 push(access, node); 1654 push(access, node);
1655 } 1655 }
1656 } else { 1656 } else {
1657 String methodName = backend.namer.getName(superMethod); 1657 Selector selector = node.selector;
1658 String methodName;
1659 if (selector.isGetter()) {
1660 // If the selector we need to register a typed getter to the
1661 // [world]. The emitter needs to know if it needs to emit a
1662 // bound closure for a method.
1663 TypeMask receiverType = new TypeMask.nonNullExact(superClass.rawType);
1664 selector = new TypedSelector(receiverType, selector);
1665 world.registerDynamicGetter(selector);
1666 methodName = backend.namer.invocationName(selector);
1667 } else {
1668 methodName = backend.namer.getName(superMethod);
1669 }
1658 String className = backend.namer.isolateAccess(superClass); 1670 String className = backend.namer.isolateAccess(superClass);
1659 js.VariableUse classReference = new js.VariableUse(className); 1671 js.VariableUse classReference = new js.VariableUse(className);
1660 js.PropertyAccess prototype = 1672 js.PropertyAccess prototype =
1661 new js.PropertyAccess.field(classReference, "prototype"); 1673 new js.PropertyAccess.field(classReference, "prototype");
1662 js.PropertyAccess method = 1674 js.PropertyAccess method =
1663 new js.PropertyAccess.field(prototype, methodName); 1675 new js.PropertyAccess.field(prototype, methodName);
1664 push(jsPropertyCall( 1676 push(jsPropertyCall(
1665 method, "call", visitArguments(node.inputs, start: 0)), node); 1677 method, "call", visitArguments(node.inputs, start: 0)), node);
1666 } 1678 }
1667 } 1679 }
(...skipping 1323 matching lines...) Expand 10 before | Expand all | Expand 10 after
2991 if (leftType.canBeNull() && rightType.canBeNull()) { 3003 if (leftType.canBeNull() && rightType.canBeNull()) {
2992 if (left.isConstantNull() || right.isConstantNull() || 3004 if (left.isConstantNull() || right.isConstantNull() ||
2993 (leftType.isPrimitive(compiler) && leftType == rightType)) { 3005 (leftType.isPrimitive(compiler) && leftType == rightType)) {
2994 return '=='; 3006 return '==';
2995 } 3007 }
2996 return null; 3008 return null;
2997 } else { 3009 } else {
2998 return '==='; 3010 return '===';
2999 } 3011 }
3000 } 3012 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698