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

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

Issue 1474713002: dart2js cps: Clean up and avoid processing unreachable code. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Merge Created 5 years 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 1057 matching lines...) Expand 10 before | Expand all | Expand 10 after
1068 js.Expression receiver = visitExpression(node.receiver); 1068 js.Expression receiver = visitExpression(node.receiver);
1069 List<js.Expression> args = visitExpressionList(node.arguments); 1069 List<js.Expression> args = visitExpressionList(node.arguments);
1070 return js.js('#.#(#)', [receiver, name, args]); 1070 return js.js('#.#(#)', [receiver, name, args]);
1071 } 1071 }
1072 1072
1073 @override 1073 @override
1074 js.Expression visitAwait(tree_ir.Await node) { 1074 js.Expression visitAwait(tree_ir.Await node) {
1075 return new js.Await(visitExpression(node.input)); 1075 return new js.Await(visitExpression(node.input));
1076 } 1076 }
1077 1077
1078 visitFunctionExpression(tree_ir.FunctionExpression node) {
1079 // FunctionExpressions are currently unused.
1080 // We might need them if we want to emit raw JS nested functions.
1081 throw 'FunctionExpressions should not be used';
1082 }
1083
1084 /// Ensures that parameter defaults will be emitted. 1078 /// Ensures that parameter defaults will be emitted.
1085 /// 1079 ///
1086 /// Ideally, this should be done when generating the relevant stub methods, 1080 /// Ideally, this should be done when generating the relevant stub methods,
1087 /// since those are the ones that actually reference the constants, but those 1081 /// since those are the ones that actually reference the constants, but those
1088 /// are created by the emitter when it is too late to register new constants. 1082 /// are created by the emitter when it is too late to register new constants.
1089 /// 1083 ///
1090 /// For non-static methods, we have no way of knowing if the defaults are 1084 /// For non-static methods, we have no way of knowing if the defaults are
1091 /// actually used, so we conservatively register them all. 1085 /// actually used, so we conservatively register them all.
1092 void registerDefaultParameterValues(ExecutableElement element) { 1086 void registerDefaultParameterValues(ExecutableElement element) {
1093 if (element is! FunctionElement) return; 1087 if (element is! FunctionElement) return;
1094 FunctionElement function = element; 1088 FunctionElement function = element;
1095 if (function.isStatic) return; // Defaults are inlined at call sites. 1089 if (function.isStatic) return; // Defaults are inlined at call sites.
1096 function.functionSignature.forEachOptionalParameter((param) { 1090 function.functionSignature.forEachOptionalParameter((param) {
1097 ConstantValue constant = glue.getDefaultParameterValue(param); 1091 ConstantValue constant = glue.getDefaultParameterValue(param);
1098 registry.registerCompileTimeConstant(constant); 1092 registry.registerCompileTimeConstant(constant);
1099 }); 1093 });
1100 } 1094 }
1101 } 1095 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/cps_ir/type_propagation.dart ('k') | pkg/compiler/lib/src/js_backend/codegen/unsugar.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698