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

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

Issue 1421463005: Move codegen registration to transformImpact method. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Updated cf. comments. 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 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 820 matching lines...) Expand 10 before | Expand all | Expand 10 after
831 } 831 }
832 } 832 }
833 833
834 @override 834 @override
835 js.Expression visitTypeExpression(tree_ir.TypeExpression node) { 835 js.Expression visitTypeExpression(tree_ir.TypeExpression node) {
836 List<js.Expression> arguments = visitExpressionList(node.arguments); 836 List<js.Expression> arguments = visitExpressionList(node.arguments);
837 return glue.generateTypeRepresentation(node.dartType, arguments, registry); 837 return glue.generateTypeRepresentation(node.dartType, arguments, registry);
838 } 838 }
839 839
840 js.Node handleForeignCode(tree_ir.ForeignCode node) { 840 js.Node handleForeignCode(tree_ir.ForeignCode node) {
841 registry.registerStaticUse(node.dependency); 841 if (node.dependency != null) {
842 // Dependency is only used if [node] calls a Dart function. Currently only
843 // through foreign function `RAW_DART_FUNCTION_REF`.
844 registry.registerStaticUse(node.dependency);
845 }
842 // TODO(sra): Should this be in CodegenRegistry? 846 // TODO(sra): Should this be in CodegenRegistry?
843 glue.registerNativeBehavior(node.nativeBehavior, node); 847 glue.registerNativeBehavior(node.nativeBehavior, node);
844 return node.codeTemplate.instantiate(visitExpressionList(node.arguments)); 848 return node.codeTemplate.instantiate(visitExpressionList(node.arguments));
845 } 849 }
846 850
847 @override 851 @override
848 js.Expression visitForeignExpression(tree_ir.ForeignExpression node) { 852 js.Expression visitForeignExpression(tree_ir.ForeignExpression node) {
849 return handleForeignCode(node); 853 return handleForeignCode(node);
850 } 854 }
851 855
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after
1041 void registerDefaultParameterValues(ExecutableElement element) { 1045 void registerDefaultParameterValues(ExecutableElement element) {
1042 if (element is! FunctionElement) return; 1046 if (element is! FunctionElement) return;
1043 FunctionElement function = element; 1047 FunctionElement function = element;
1044 if (function.isStatic) return; // Defaults are inlined at call sites. 1048 if (function.isStatic) return; // Defaults are inlined at call sites.
1045 function.functionSignature.forEachOptionalParameter((param) { 1049 function.functionSignature.forEachOptionalParameter((param) {
1046 ConstantValue constant = glue.getDefaultParameterValue(param); 1050 ConstantValue constant = glue.getDefaultParameterValue(param);
1047 registry.registerCompileTimeConstant(constant); 1051 registry.registerCompileTimeConstant(constant);
1048 }); 1052 });
1049 } 1053 }
1050 } 1054 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/js_backend/backend.dart ('k') | pkg/compiler/lib/src/js_backend/js_backend.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698