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

Side by Side Diff: pkg/compiler/lib/src/js_backend/codegen/codegen.dart

Issue 1571433002: dart2js cps: Compute intercepted classes in optimize_interceptors. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Address comments Created 4 years, 11 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
OLDNEW
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, 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 library code_generator; 5 library code_generator;
6 6
7 import 'glue.dart'; 7 import 'glue.dart';
8 8
9 import '../../closure.dart' show 9 import '../../closure.dart' show
10 ClosureClassElement; 10 ClosureClassElement;
(...skipping 845 matching lines...) Expand 10 before | Expand all | Expand 10 after
856 visitExpressionList(node.arguments)); 856 visitExpressionList(node.arguments));
857 js.Expression argumentNames = new js.ArrayInitializer( 857 js.Expression argumentNames = new js.ArrayInitializer(
858 node.selector.namedArguments.map(js.string).toList(growable: false)); 858 node.selector.namedArguments.map(js.string).toList(growable: false));
859 return buildStaticHelperInvocation(glue.createInvocationMirrorMethod, 859 return buildStaticHelperInvocation(glue.createInvocationMirrorMethod,
860 <js.Expression>[name, internalName, kind, arguments, argumentNames]); 860 <js.Expression>[name, internalName, kind, arguments, argumentNames]);
861 } 861 }
862 862
863 @override 863 @override
864 js.Expression visitInterceptor(tree_ir.Interceptor node) { 864 js.Expression visitInterceptor(tree_ir.Interceptor node) {
865 registry.registerUseInterceptor(); 865 registry.registerUseInterceptor();
866 registry.registerSpecializedGetInterceptor(node.interceptedClasses); 866 // Default to all intercepted classes if they have not been computed.
867 js.Name helperName = glue.getInterceptorName(node.interceptedClasses); 867 // This is to ensure we can run codegen without prior optimization passes.
868 Set<ClassElement> interceptedClasses = node.interceptedClasses.isEmpty
869 ? glue.interceptedClasses
870 : node.interceptedClasses;
871 registry.registerSpecializedGetInterceptor(interceptedClasses);
872 js.Name helperName = glue.getInterceptorName(interceptedClasses);
868 js.Expression globalHolder = glue.getInterceptorLibrary(); 873 js.Expression globalHolder = glue.getInterceptorLibrary();
869 return js.js('#.#(#)', 874 return js.js('#.#(#)',
870 [globalHolder, helperName, visitExpression(node.input)]) 875 [globalHolder, helperName, visitExpression(node.input)])
871 .withSourceInformation(node.sourceInformation); 876 .withSourceInformation(node.sourceInformation);
872 } 877 }
873 878
874 @override 879 @override
875 js.Expression visitGetField(tree_ir.GetField node) { 880 js.Expression visitGetField(tree_ir.GetField node) {
876 registry.registerStaticUse(new StaticUse.fieldGet(node.field)); 881 registry.registerStaticUse(new StaticUse.fieldGet(node.field));
877 return new js.PropertyAccess( 882 return new js.PropertyAccess(
(...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after
1214 void registerDefaultParameterValues(ExecutableElement element) { 1219 void registerDefaultParameterValues(ExecutableElement element) {
1215 if (element is! FunctionElement) return; 1220 if (element is! FunctionElement) return;
1216 FunctionElement function = element; 1221 FunctionElement function = element;
1217 if (function.isStatic) return; // Defaults are inlined at call sites. 1222 if (function.isStatic) return; // Defaults are inlined at call sites.
1218 function.functionSignature.forEachOptionalParameter((param) { 1223 function.functionSignature.forEachOptionalParameter((param) {
1219 ConstantValue constant = glue.getDefaultParameterValue(param); 1224 ConstantValue constant = glue.getDefaultParameterValue(param);
1220 registry.registerCompileTimeConstant(constant); 1225 registry.registerCompileTimeConstant(constant);
1221 }); 1226 });
1222 } 1227 }
1223 } 1228 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/cps_ir/type_propagation.dart ('k') | pkg/compiler/lib/src/js_backend/codegen/task.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698