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

Side by Side Diff: sdk/lib/_internal/compiler/implementation/ssa/tracer.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, 8 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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 tracer; 5 library tracer;
6 6
7 import 'dart:async' show EventSink; 7 import 'dart:async' show EventSink;
8 8
9 import 'ssa.dart'; 9 import 'ssa.dart';
10 import '../js_backend/js_backend.dart'; 10 import '../js_backend/js_backend.dart';
(...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after
268 String fieldName = node.element.name; 268 String fieldName = node.element.name;
269 return 'field get ${temporaryId(node.receiver)}.$fieldName'; 269 return 'field get ${temporaryId(node.receiver)}.$fieldName';
270 } 270 }
271 271
272 String visitFieldSet(HFieldSet node) { 272 String visitFieldSet(HFieldSet node) {
273 String valueId = temporaryId(node.value); 273 String valueId = temporaryId(node.value);
274 String fieldName = node.element.name; 274 String fieldName = node.element.name;
275 return 'field set ${temporaryId(node.receiver)}.$fieldName to $valueId'; 275 return 'field set ${temporaryId(node.receiver)}.$fieldName to $valueId';
276 } 276 }
277 277
278 String visitReadModifyWrite(HReadModifyWrite node) {
279 String fieldName = node.element.name;
280 String receiverId = temporaryId(node.receiver);
281 String op = node.jsOp;
282 if (node.isAssignOp) {
283 String valueId = temporaryId(node.value);
284 return 'field-update $receiverId.$fieldName $op= $valueId';
285 } else if (node.isPreOp) {
286 return 'field-update $op$receiverId.$fieldName';
287 } else {
288 return 'field-update $receiverId.$fieldName$op';
289 }
290 }
291
278 String visitLocalGet(HLocalGet node) { 292 String visitLocalGet(HLocalGet node) {
279 String localName = node.element.name; 293 String localName = node.element.name;
280 return 'local get ${temporaryId(node.local)}.$localName'; 294 return 'local get ${temporaryId(node.local)}.$localName';
281 } 295 }
282 296
283 String visitLocalSet(HLocalSet node) { 297 String visitLocalSet(HLocalSet node) {
284 String valueId = temporaryId(node.value); 298 String valueId = temporaryId(node.value);
285 String localName = node.element.name; 299 String localName = node.element.name;
286 return 'local set ${temporaryId(node.local)}.$localName to $valueId'; 300 return 'local set ${temporaryId(node.local)}.$localName to $valueId';
287 } 301 }
(...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after
549 } 563 }
550 564
551 String visitInterfaceType(HInterfaceType node) { 565 String visitInterfaceType(HInterfaceType node) {
552 return "InterfaceType: ${node.dartType}"; 566 return "InterfaceType: ${node.dartType}";
553 } 567 }
554 568
555 String visitDynamicType(HDynamicType node) { 569 String visitDynamicType(HDynamicType node) {
556 return "DynamicType"; 570 return "DynamicType";
557 } 571 }
558 } 572 }
OLDNEW
« no previous file with comments | « sdk/lib/_internal/compiler/implementation/ssa/nodes.dart ('k') | tests/compiler/dart2js/field_update_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698