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

Unified Diff: sdk/lib/_internal/compiler/implementation/ssa/codegen.dart

Issue 218993003: Emit read-modify-write of fields as assignment op. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: add test Created 6 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 | sdk/lib/_internal/compiler/implementation/ssa/codegen_helpers.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/_internal/compiler/implementation/ssa/codegen.dart
diff --git a/sdk/lib/_internal/compiler/implementation/ssa/codegen.dart b/sdk/lib/_internal/compiler/implementation/ssa/codegen.dart
index 4e32168d36cbeea4cfe59b840b677339ccef9823..f26b0a2e249b146d840226ad1cb0550e60743698 100644
--- a/sdk/lib/_internal/compiler/implementation/ssa/codegen.dart
+++ b/sdk/lib/_internal/compiler/implementation/ssa/codegen.dart
@@ -1687,6 +1687,22 @@ class SsaCodeGenerator implements HVisitor, HBlockInformationVisitor {
node);
}
+ visitReadModifyWrite(HReadModifyWrite node) {
+ Element element = node.element;
+ world.registerFieldSetter(element);
+ String name = backend.namer.instanceFieldPropertyName(element);
+ use(node.receiver);
+ js.Expression fieldReference = new js.PropertyAccess.field(pop(), name);
+ if (node.isPreOp) {
+ push(new js.Prefix(node.jsOp, fieldReference), node);
+ } else if (node.isPostOp) {
+ push(new js.Postfix(node.jsOp, fieldReference), node);
+ } else {
+ use(node.value);
+ push(new js.Assignment.compound(fieldReference, node.jsOp, pop()), node);
+ }
+ }
+
visitLocalGet(HLocalGet node) {
use(node.receiver);
}
« no previous file with comments | « no previous file | sdk/lib/_internal/compiler/implementation/ssa/codegen_helpers.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698