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

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

Issue 10180001: Introduce typed selectors to do better tree shaking based on calls on 'this'. Getters and setters w… (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 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 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 class SsaCodeGeneratorTask extends CompilerTask { 5 class SsaCodeGeneratorTask extends CompilerTask {
6 SsaCodeGeneratorTask(Compiler compiler) : super(compiler); 6 SsaCodeGeneratorTask(Compiler compiler) : super(compiler);
7 String get name() => 'SSA code generator'; 7 String get name() => 'SSA code generator';
8 8
9 9
10 String generateMethod(WorkItem work, HGraph graph) { 10 String generateMethod(WorkItem work, HGraph graph) {
(...skipping 1009 matching lines...) Expand 10 before | Expand all | Expand 10 after
1020 node.name.printOn(buffer); 1020 node.name.printOn(buffer);
1021 visitArguments(node.inputs); 1021 visitArguments(node.inputs);
1022 } else { 1022 } else {
1023 buffer.add(compiler.namer.instanceMethodInvocationName( 1023 buffer.add(compiler.namer.instanceMethodInvocationName(
1024 currentLibrary, node.name, node.selector)); 1024 currentLibrary, node.name, node.selector));
1025 visitArguments(node.inputs); 1025 visitArguments(node.inputs);
1026 if (node.element !== null) { 1026 if (node.element !== null) {
1027 // If we know we're calling a specific method, register that 1027 // If we know we're calling a specific method, register that
1028 // method only. 1028 // method only.
1029 compiler.registerDynamicInvocationOf(node.element); 1029 compiler.registerDynamicInvocationOf(node.element);
1030 } else if (node.inputs[0] is HThis) {
1031 // TODO(ngeoffray): We should propagate an union type in
1032 // earlier phases instead of just checking if the receiver is 'this'.
1033 ClassElement cls = work.element.enclosingElement;
1034 Element method = cls.lookupMember(node.name);
1035 if (method !== null) {
1036 // Make sure the method (whether in this class or in a
1037 // superclass) is compiled.
1038 // TODO(ngeoffray): Note that we could not emit this method
1039 // if it is always being overridden and its holder is not
1040 // instantiated.
1041 compiler.registerDynamicInvocationOf(method);
1042 }
1043 Type type = cls.computeType(compiler);
1044 compiler.registerDynamicInvocation(
1045 node.name, new TypedInvocation(type, node.selector));
1030 } else { 1046 } else {
1031 compiler.registerDynamicInvocation(node.name, node.selector); 1047 compiler.registerDynamicInvocation(node.name, node.selector);
1032 } 1048 }
1033 } 1049 }
1034 endExpression(JSPrecedence.CALL_PRECEDENCE); 1050 endExpression(JSPrecedence.CALL_PRECEDENCE);
1035 } 1051 }
1036 1052
1037 visitInvokeDynamicSetter(HInvokeDynamicSetter node) { 1053 visitInvokeDynamicSetter(HInvokeDynamicSetter node) {
1038 beginExpression(JSPrecedence.CALL_PRECEDENCE); 1054 beginExpression(JSPrecedence.CALL_PRECEDENCE);
1039 use(node.receiver, JSPrecedence.MEMBER_PRECEDENCE); 1055 use(node.receiver, JSPrecedence.MEMBER_PRECEDENCE);
(...skipping 912 matching lines...) Expand 10 before | Expand all | Expand 10 after
1952 startBailoutSwitch(); 1968 startBailoutSwitch();
1953 } 1969 }
1954 } 1970 }
1955 1971
1956 void endElse(HIf node) { 1972 void endElse(HIf node) {
1957 if (node.elseBlock.hasGuards()) { 1973 if (node.elseBlock.hasGuards()) {
1958 endBailoutSwitch(); 1974 endBailoutSwitch();
1959 } 1975 }
1960 } 1976 }
1961 } 1977 }
OLDNEW
« no previous file with comments | « lib/compiler/implementation/ssa/builder.dart ('k') | lib/compiler/implementation/ssa/optimize.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698