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

Side by Side Diff: pkg/compiler/lib/src/cps_ir/cps_ir_tracer.dart

Issue 1223813006: dart2js cps: Direct access on JS arrays. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Update unit tests and remove unused functions Created 5 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, 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 dart2js.ir_tracer; 5 library dart2js.ir_tracer;
6 6
7 import 'dart:async' show EventSink; 7 import 'dart:async' show EventSink;
8 import 'cps_ir_nodes.dart' as cps_ir hide Function; 8 import 'cps_ir_nodes.dart' as cps_ir hide Function;
9 import '../tracer.dart'; 9 import '../tracer.dart';
10 10
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
185 String dummy = names.name(node); 185 String dummy = names.name(node);
186 printStmt(dummy, "Rethrow"); 186 printStmt(dummy, "Rethrow");
187 } 187 }
188 188
189 visitUnreachable(cps_ir.Unreachable node) { 189 visitUnreachable(cps_ir.Unreachable node) {
190 String dummy = names.name(node); 190 String dummy = names.name(node);
191 printStmt(dummy, 'Unreachable'); 191 printStmt(dummy, 'Unreachable');
192 } 192 }
193 193
194 visitLiteralList(cps_ir.LiteralList node) { 194 visitLiteralList(cps_ir.LiteralList node) {
195 String dummy = names.name(node);
196 String values = node.values.map(formatReference).join(', '); 195 String values = node.values.map(formatReference).join(', ');
197 printStmt(dummy, "LiteralList ($values)"); 196 return "LiteralList ($values)";
198 } 197 }
199 198
200 visitLiteralMap(cps_ir.LiteralMap node) { 199 visitLiteralMap(cps_ir.LiteralMap node) {
201 String dummy = names.name(node);
202 List<String> entries = new List<String>(); 200 List<String> entries = new List<String>();
203 for (cps_ir.LiteralMapEntry entry in node.entries) { 201 for (cps_ir.LiteralMapEntry entry in node.entries) {
204 String key = formatReference(entry.key); 202 String key = formatReference(entry.key);
205 String value = formatReference(entry.value); 203 String value = formatReference(entry.value);
206 entries.add("$key: $value"); 204 entries.add("$key: $value");
207 } 205 }
208 printStmt(dummy, "LiteralMap (${entries.join(', ')})"); 206 return "LiteralMap (${entries.join(', ')})";
209 } 207 }
210 208
211 visitTypeCast(cps_ir.TypeCast node) { 209 visitTypeCast(cps_ir.TypeCast node) {
212 String dummy = names.name(node); 210 String dummy = names.name(node);
213 String value = formatReference(node.value); 211 String value = formatReference(node.value);
214 String args = node.typeArguments.map(formatReference).join(', '); 212 String args = node.typeArguments.map(formatReference).join(', ');
215 String kont = formatReference(node.continuation); 213 String kont = formatReference(node.continuation);
216 printStmt(dummy, "TypeCast ($value ${node.type} ($args)) $kont"); 214 printStmt(dummy, "TypeCast ($value ${node.type} ($args)) $kont");
217 } 215 }
218 216
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
367 365
368 @override 366 @override
369 visitForeignCode(cps_ir.ForeignCode node) { 367 visitForeignCode(cps_ir.ForeignCode node) {
370 String id = names.name(node); 368 String id = names.name(node);
371 String arguments = node.arguments.map(formatReference).join(', '); 369 String arguments = node.arguments.map(formatReference).join(', ');
372 String continuation = node.continuation == null ? '' 370 String continuation = node.continuation == null ? ''
373 : ' ${formatReference(node.continuation)}'; 371 : ' ${formatReference(node.continuation)}';
374 printStmt(id, "ForeignCode ${node.type} ${node.codeTemplate.source} " 372 printStmt(id, "ForeignCode ${node.type} ${node.codeTemplate.source} "
375 "$arguments $continuation"); 373 "$arguments $continuation");
376 } 374 }
375
376 visitGetLength(cps_ir.GetLength node) {
377 String object = formatReference(node.object);
378 return 'GetLength $object';
379 }
380
381 visitGetIndex(cps_ir.GetIndex node) {
382 String object = formatReference(node.object);
383 String index = formatReference(node.index);
384 return 'GetIndex $object $index';
385 }
386
387 visitSetIndex(cps_ir.SetIndex node) {
388 String object = formatReference(node.object);
389 String index = formatReference(node.index);
390 String value = formatReference(node.value);
391 return 'SetIndex $object $index $value';
392 }
377 } 393 }
378 394
379 /** 395 /**
380 * Invents (and remembers) names for Continuations, Parameters, etc. 396 * Invents (and remembers) names for Continuations, Parameters, etc.
381 * The names must match the conventions used by IR Hydra, e.g. 397 * The names must match the conventions used by IR Hydra, e.g.
382 * Continuations and Functions must have names of form B### since they 398 * Continuations and Functions must have names of form B### since they
383 * are visualized as basic blocks. 399 * are visualized as basic blocks.
384 */ 400 */
385 class Names { 401 class Names {
386 final Map<Object, String> names = {}; 402 final Map<Object, String> names = {};
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after
626 } 642 }
627 643
628 visitTypeTest(cps_ir.TypeTest node) { 644 visitTypeTest(cps_ir.TypeTest node) {
629 unexpectedNode(node); 645 unexpectedNode(node);
630 } 646 }
631 647
632 visitApplyBuiltinOperator(cps_ir.ApplyBuiltinOperator node) { 648 visitApplyBuiltinOperator(cps_ir.ApplyBuiltinOperator node) {
633 unexpectedNode(node); 649 unexpectedNode(node);
634 } 650 }
635 651
652 visitGetLength(cps_ir.GetLength node) {
653 unexpectedNode(node);
654 }
655
656 visitGetIndex(cps_ir.GetIndex node) {
657 unexpectedNode(node);
658 }
659
660 visitSetIndex(cps_ir.SetIndex node) {
661 unexpectedNode(node);
662 }
663
636 @override 664 @override
637 visitForeignCode(cps_ir.ForeignCode node) { 665 visitForeignCode(cps_ir.ForeignCode node) {
638 if (node.continuation != null) { 666 if (node.continuation != null) {
639 addEdgeToContinuation(node.continuation); 667 addEdgeToContinuation(node.continuation);
640 } 668 }
641 } 669 }
642 } 670 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/cps_ir/cps_ir_nodes_sexpr.dart ('k') | pkg/compiler/lib/src/cps_ir/shrinking_reductions.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698