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

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

Issue 10693127: Make sure to use the type-restricted selector when registering (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 5 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 class SsaCodeGeneratorTask extends CompilerTask { 5 class SsaCodeGeneratorTask extends CompilerTask {
6 final JavaScriptBackend backend; 6 final JavaScriptBackend backend;
7 SsaCodeGeneratorTask(JavaScriptBackend backend) 7 SsaCodeGeneratorTask(JavaScriptBackend backend)
8 : this.backend = backend, 8 : this.backend = backend,
9 super(backend.compiler); 9 super(backend.compiler);
10 String get name() => 'SSA code generator'; 10 String get name() => 'SSA code generator';
(...skipping 1711 matching lines...) Expand 10 before | Expand all | Expand 10 after
1722 visitArguments(node.inputs); 1722 visitArguments(node.inputs);
1723 bool inLoop = node.block.enclosingLoopHeader !== null; 1723 bool inLoop = node.block.enclosingLoopHeader !== null;
1724 if (node.element !== null) { 1724 if (node.element !== null) {
1725 // If we know we're calling a specific method, register that 1725 // If we know we're calling a specific method, register that
1726 // method only. 1726 // method only.
1727 if (inLoop) { 1727 if (inLoop) {
1728 backend.builder.functionsCalledInLoop.add(node.element); 1728 backend.builder.functionsCalledInLoop.add(node.element);
1729 } 1729 }
1730 world.registerDynamicInvocationOf(node.element); 1730 world.registerDynamicInvocationOf(node.element);
1731 } else { 1731 } else {
1732 if (inLoop) { 1732 Selector selector = getOptimizedSelectorFor(node, node.selector);
1733 backend.builder.selectorsCalledInLoop[node.name] = node.selector; 1733 world.registerDynamicInvocation(node.name, selector);
1734 } 1734 if (inLoop) backend.builder.selectorsCalledInLoop[node.name] = selector;
1735 world.registerDynamicInvocation(
1736 node.name,
1737 getOptimizedSelectorFor(node, node.selector));
1738 } 1735 }
1739 } 1736 }
1740 endExpression(JSPrecedence.CALL_PRECEDENCE); 1737 endExpression(JSPrecedence.CALL_PRECEDENCE);
1741 } 1738 }
1742 1739
1743 Selector getOptimizedSelectorFor(HInvoke node, Selector defaultSelector) { 1740 Selector getOptimizedSelectorFor(HInvoke node, Selector defaultSelector) {
1744 Type receiverType = node.inputs[0].propagatedType.computeType(compiler); 1741 Type receiverType = node.inputs[0].propagatedType.computeType(compiler);
1745 if (receiverType !== null) { 1742 if (receiverType !== null) {
1746 return new TypedSelector(receiverType, defaultSelector); 1743 return new TypedSelector(receiverType, defaultSelector);
1747 } else { 1744 } else {
(...skipping 1366 matching lines...) Expand 10 before | Expand all | Expand 10 after
3114 if (leftType.canBeNull() && rightType.canBeNull()) { 3111 if (leftType.canBeNull() && rightType.canBeNull()) {
3115 if (left.isConstantNull() || right.isConstantNull() || 3112 if (left.isConstantNull() || right.isConstantNull() ||
3116 (leftType.isPrimitive() && leftType == rightType)) { 3113 (leftType.isPrimitive() && leftType == rightType)) {
3117 return '=='; 3114 return '==';
3118 } 3115 }
3119 return null; 3116 return null;
3120 } else { 3117 } else {
3121 return '==='; 3118 return '===';
3122 } 3119 }
3123 } 3120 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698