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

Side by Side Diff: lib/src/compiler/code_generator.dart

Issue 1919173004: Use static dispatch for dynamic on Object methods (Closed) Base URL: git@github.com:dart-lang/dev_compiler.git@master
Patch Set: Created 4 years, 7 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
« no previous file with comments | « no previous file | test/codegen/expect/language-all.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, 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 import 'dart:collection' show HashMap, HashSet; 5 import 'dart:collection' show HashMap, HashSet;
6 6
7 import 'package:analyzer/analyzer.dart' hide ConstantEvaluator; 7 import 'package:analyzer/analyzer.dart' hide ConstantEvaluator;
8 import 'package:analyzer/dart/ast/ast.dart' hide ConstantEvaluator; 8 import 'package:analyzer/dart/ast/ast.dart' hide ConstantEvaluator;
9 import 'package:analyzer/dart/ast/token.dart' show Token, TokenType; 9 import 'package:analyzer/dart/ast/token.dart' show Token, TokenType;
10 import 'package:analyzer/dart/element/element.dart'; 10 import 'package:analyzer/dart/element/element.dart';
(...skipping 3112 matching lines...) Expand 10 before | Expand all | Expand 10 after
3123 if (node is PropertyAccess) { 3123 if (node is PropertyAccess) {
3124 return AstBuilder.propertyAccess(newTarget, node.propertyName); 3124 return AstBuilder.propertyAccess(newTarget, node.propertyName);
3125 } else { 3125 } else {
3126 var invoke = node as MethodInvocation; 3126 var invoke = node as MethodInvocation;
3127 return AstBuilder.methodInvoke( 3127 return AstBuilder.methodInvoke(
3128 newTarget, invoke.methodName, invoke.argumentList.arguments); 3128 newTarget, invoke.methodName, invoke.argumentList.arguments);
3129 } 3129 }
3130 } 3130 }
3131 3131
3132 bool _requiresStaticDispatch(Expression target, String memberName) { 3132 bool _requiresStaticDispatch(Expression target, String memberName) {
3133 var type = getStaticType(target); 3133 var type = target.propagatedType ?? getStaticType(target);
Harry Terkelsen 2016/04/26 20:51:55 btw, this is the only use of propagatedType in ddc
Jennifer Messerly 2016/04/26 21:04:56 yeah we never to use it. It's the old Analyzer inf
3134 if (!isObjectProperty(memberName)) { 3134 if (!isObjectProperty(memberName)) {
3135 return false; 3135 return false;
3136 } 3136 }
3137 3137
3138 // If the target could be `null`, we need static dispatch. 3138 // If the target could be `null`, we need static dispatch.
3139 // If the target may be an extension type, we also use static dispatch 3139 // If the target may be an extension type, we also use static dispatch
3140 // as we don't symbolize object properties like hashCode. 3140 // as we don't symbolize object properties like hashCode.
3141 return isNullable(target) || 3141 return isNullable(target) ||
3142 (_extensionTypes.contains(type.element) && target is! SuperExpression); 3142 (_extensionTypes.contains(type.element) && target is! SuperExpression);
3143 } 3143 }
(...skipping 716 matching lines...) Expand 10 before | Expand all | Expand 10 after
3860 } 3860 }
3861 3861
3862 bool isLibraryPrefix(Expression node) => 3862 bool isLibraryPrefix(Expression node) =>
3863 node is SimpleIdentifier && node.staticElement is PrefixElement; 3863 node is SimpleIdentifier && node.staticElement is PrefixElement;
3864 3864
3865 LibraryElement _getLibrary(AnalysisContext c, String uri) => 3865 LibraryElement _getLibrary(AnalysisContext c, String uri) =>
3866 c.computeLibraryElement(c.sourceFactory.forUri(uri)); 3866 c.computeLibraryElement(c.sourceFactory.forUri(uri));
3867 3867
3868 bool _isDartRuntime(LibraryElement l) => 3868 bool _isDartRuntime(LibraryElement l) =>
3869 l.isInSdk && l.source.uri.toString() == 'dart:_runtime'; 3869 l.isInSdk && l.source.uri.toString() == 'dart:_runtime';
OLDNEW
« no previous file with comments | « no previous file | test/codegen/expect/language-all.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698