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

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

Issue 1408383006: Rename UniverseSelector to DynamicUse and move it to use.dart (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;
11 import '../../common.dart'; 11 import '../../common.dart';
12 import '../../common/codegen.dart' show 12 import '../../common/codegen.dart' show
13 CodegenRegistry; 13 CodegenRegistry;
14 import '../../constants/values.dart'; 14 import '../../constants/values.dart';
15 import '../../dart_types.dart'; 15 import '../../dart_types.dart';
16 import '../../elements/elements.dart'; 16 import '../../elements/elements.dart';
17 import '../../io/source_information.dart' show 17 import '../../io/source_information.dart' show
18 SourceInformation; 18 SourceInformation;
19 import '../../js/js.dart' as js; 19 import '../../js/js.dart' as js;
20 import '../../tree_ir/tree_ir_nodes.dart' as tree_ir; 20 import '../../tree_ir/tree_ir_nodes.dart' as tree_ir;
21 import '../../tree_ir/tree_ir_nodes.dart' show 21 import '../../tree_ir/tree_ir_nodes.dart' show
22 BuiltinMethod, 22 BuiltinMethod,
23 BuiltinOperator; 23 BuiltinOperator;
24 import '../../types/types.dart' show 24 import '../../types/types.dart' show
25 TypeMask; 25 TypeMask;
26 import '../../universe/call_structure.dart' show 26 import '../../universe/call_structure.dart' show
27 CallStructure; 27 CallStructure;
28 import '../../universe/selector.dart' show 28 import '../../universe/selector.dart' show
29 Selector; 29 Selector;
30 import '../../universe/universe.dart' show
31 UniverseSelector;
32 import '../../universe/use.dart' show 30 import '../../universe/use.dart' show
31 DynamicUse,
33 StaticUse; 32 StaticUse;
34 import '../../util/maplet.dart'; 33 import '../../util/maplet.dart';
35 34
36 class CodegenBailout { 35 class CodegenBailout {
37 final tree_ir.Node node; 36 final tree_ir.Node node;
38 final String reason; 37 final String reason;
39 CodegenBailout(this.node, this.reason); 38 CodegenBailout(this.node, this.reason);
40 String get message { 39 String get message {
41 return 'bailout${node != null ? " on $node" : ""}: $reason'; 40 return 'bailout${node != null ? " on $node" : ""}: $reason';
42 } 41 }
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after
266 return buildStaticInvoke( 265 return buildStaticInvoke(
267 target, 266 target,
268 arguments, 267 arguments,
269 sourceInformation: node.sourceInformation); 268 sourceInformation: node.sourceInformation);
270 } 269 }
271 270
272 void registerMethodInvoke(tree_ir.InvokeMethod node) { 271 void registerMethodInvoke(tree_ir.InvokeMethod node) {
273 Selector selector = node.selector; 272 Selector selector = node.selector;
274 TypeMask mask = node.mask; 273 TypeMask mask = node.mask;
275 if (selector.isGetter) { 274 if (selector.isGetter) {
276 registry.registerDynamicUse(new UniverseSelector(selector, mask)); 275 registry.registerDynamicUse(new DynamicUse(selector, mask));
277 } else if (selector.isSetter) { 276 } else if (selector.isSetter) {
278 registry.registerDynamicUse(new UniverseSelector(selector, mask)); 277 registry.registerDynamicUse(new DynamicUse(selector, mask));
279 } else { 278 } else {
280 assert(invariant(CURRENT_ELEMENT_SPANNABLE, 279 assert(invariant(CURRENT_ELEMENT_SPANNABLE,
281 selector.isCall || selector.isOperator || 280 selector.isCall || selector.isOperator ||
282 selector.isIndex || selector.isIndexSet, 281 selector.isIndex || selector.isIndexSet,
283 message: 'unexpected kind ${selector.kind}')); 282 message: 'unexpected kind ${selector.kind}'));
284 // TODO(sigurdm): We should find a better place to register the call. 283 // TODO(sigurdm): We should find a better place to register the call.
285 Selector call = new Selector.callClosureFrom(selector); 284 Selector call = new Selector.callClosureFrom(selector);
286 registry.registerDynamicUse(new UniverseSelector(call, null)); 285 registry.registerDynamicUse(new DynamicUse(call, null));
287 registry.registerDynamicUse(new UniverseSelector(selector, mask)); 286 registry.registerDynamicUse(new DynamicUse(selector, mask));
288 } 287 }
289 } 288 }
290 289
291 @override 290 @override
292 js.Expression visitInvokeMethod(tree_ir.InvokeMethod node) { 291 js.Expression visitInvokeMethod(tree_ir.InvokeMethod node) {
293 registerMethodInvoke(node); 292 registerMethodInvoke(node);
294 return js.propertyCall(visitExpression(node.receiver), 293 return js.propertyCall(visitExpression(node.receiver),
295 glue.invocationName(node.selector), 294 glue.invocationName(node.selector),
296 visitExpressionList(node.arguments)) 295 visitExpressionList(node.arguments))
297 .withSourceInformation(node.sourceInformation); 296 .withSourceInformation(node.sourceInformation);
(...skipping 782 matching lines...) Expand 10 before | Expand all | Expand 10 after
1080 void registerDefaultParameterValues(ExecutableElement element) { 1079 void registerDefaultParameterValues(ExecutableElement element) {
1081 if (element is! FunctionElement) return; 1080 if (element is! FunctionElement) return;
1082 FunctionElement function = element; 1081 FunctionElement function = element;
1083 if (function.isStatic) return; // Defaults are inlined at call sites. 1082 if (function.isStatic) return; // Defaults are inlined at call sites.
1084 function.functionSignature.forEachOptionalParameter((param) { 1083 function.functionSignature.forEachOptionalParameter((param) {
1085 ConstantValue constant = glue.getDefaultParameterValue(param); 1084 ConstantValue constant = glue.getDefaultParameterValue(param);
1086 registry.registerCompileTimeConstant(constant); 1085 registry.registerCompileTimeConstant(constant);
1087 }); 1086 });
1088 } 1087 }
1089 } 1088 }
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