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

Unified Diff: pkg/compiler/lib/src/cps_ir/type_propagation.dart

Issue 1776473006: dart2js cps: Do field calls directly instead going through the adapter. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 9 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/compiler/lib/src/cps_ir/type_propagation.dart
diff --git a/pkg/compiler/lib/src/cps_ir/type_propagation.dart b/pkg/compiler/lib/src/cps_ir/type_propagation.dart
index ce8d5b1aaf8772930095e5fa6585003a4b0e3497..f665897410b5e694f008f1bbb584d07a01a66e6e 100644
--- a/pkg/compiler/lib/src/cps_ir/type_propagation.dart
+++ b/pkg/compiler/lib/src/cps_ir/type_propagation.dart
@@ -1445,8 +1445,7 @@ class TransformingVisitor extends DeepRecursiveVisitor {
/// invocation with a direct access to a field.
///
/// Returns `true` if the node was replaced.
- Primitive specializeFieldAccess(InvokeMethod node) {
- if (!node.selector.isGetter && !node.selector.isSetter) return null;
+ specializeFieldAccess(InvokeMethod node) {
AbstractConstantValue receiver = getValue(node.receiver);
Element target =
typeSystem.locateSingleElement(receiver.type, node.selector);
@@ -1458,12 +1457,24 @@ class TransformingVisitor extends DeepRecursiveVisitor {
}
if (node.selector.isGetter) {
return new GetField(node.receiver, target);
- } else {
+ } else if (node.selector.isSetter) {
if (target.isFinal) return null;
assert(node.hasNoUses);
return new SetField(node.receiver,
target,
node.argument(0));
+ } else if (node.selector.isCall) {
+ CpsFragment cps = new CpsFragment(node.sourceInformation);
+ Primitive fieldValue = cps.letPrim(new GetField(node.receiver, target));
+ Primitive result = cps.invokeMethod(
+ fieldValue,
+ new Selector.callClosureFrom(node.selector),
+ typeSystem.getFieldType(target),
+ node.arguments.toList());
+ node.replaceUsesWith(result);
+ return cps;
+ } else {
+ return null;
}
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698