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

Unified Diff: pkg/compiler/lib/src/js_backend/backend.dart

Issue 2967153002: Change MemberTypeInformation.member type to MemberEntity (Closed)
Patch Set: Created 3 years, 5 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 side-by-side diff with in-line comments
Download patch
Index: pkg/compiler/lib/src/js_backend/backend.dart
diff --git a/pkg/compiler/lib/src/js_backend/backend.dart b/pkg/compiler/lib/src/js_backend/backend.dart
index 49899993cd8158cc0e5a3575152a2710506d653c..1ce01eb07a0cdcb7d947f18383af279e93abd683 100644
--- a/pkg/compiler/lib/src/js_backend/backend.dart
+++ b/pkg/compiler/lib/src/js_backend/backend.dart
@@ -667,9 +667,14 @@ class JavaScriptBackend {
/// One category of elements that do not apply is runtime helpers that the
/// backend calls, but the optimizations don't see those calls.
bool canFieldBeUsedForGlobalOptimizations(
- FieldElement element, ClosedWorld closedWorld) {
- return !closedWorld.backendUsage.isFieldUsedByBackend(element) &&
- !mirrorsData.invokedReflectively(element);
+ FieldEntity element, ClosedWorld closedWorld) {
+ if (closedWorld.backendUsage.isFieldUsedByBackend(element)) {
+ return false;
+ }
+ if ((element.isTopLevel || element.isStatic) && !element.isAssignable) {
+ return true;
+ }
+ return !mirrorsData.isMemberAccessibleByReflection(element);
}
/// Returns true if global optimizations such as type inferencing can apply to
@@ -678,11 +683,9 @@ class JavaScriptBackend {
/// One category of elements that do not apply is runtime helpers that the
/// backend calls, but the optimizations don't see those calls.
bool canFunctionParametersBeUsedForGlobalOptimizations(
- FunctionElement element, ClosedWorld closedWorld) {
- if (element.isLocal) return true;
- MethodElement method = element;
- return !closedWorld.backendUsage.isFunctionUsedByBackend(method) &&
- !mirrorsData.invokedReflectively(method);
+ FunctionEntity function, ClosedWorld closedWorld) {
+ return !closedWorld.backendUsage.isFunctionUsedByBackend(function) &&
+ !mirrorsData.isMemberAccessibleByReflection(function);
}
bool operatorEqHandlesNullArgument(FunctionEntity operatorEqfunction) {
« no previous file with comments | « pkg/compiler/lib/src/inferrer/type_graph_nodes.dart ('k') | pkg/compiler/lib/src/js_backend/mirrors_data.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698