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

Side by Side Diff: pkg/compiler/lib/src/tree_ir/tree_ir_tracer.dart

Issue 1195573003: dart2js cps: Refactor and optimize string concatenations. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Remove renegade linebreak Created 5 years, 6 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 tree_ir_tracer; 5 library tree_ir_tracer;
6 6
7 import 'dart:async' show EventSink; 7 import 'dart:async' show EventSink;
8 import '../tracer.dart'; 8 import '../tracer.dart';
9 import 'tree_ir_nodes.dart'; 9 import 'tree_ir_nodes.dart';
10 10
(...skipping 358 matching lines...) Expand 10 before | Expand all | Expand 10 after
369 if (node.target.name.isEmpty) { 369 if (node.target.name.isEmpty) {
370 callName = '${className}'; 370 callName = '${className}';
371 } else { 371 } else {
372 callName = '${className}.${node.target.name}'; 372 callName = '${className}.${node.target.name}';
373 } 373 }
374 String args = formatArguments(node); 374 String args = formatArguments(node);
375 String keyword = node.constant != null ? 'const' : 'new'; 375 String keyword = node.constant != null ? 'const' : 'new';
376 return "$keyword $callName($args)"; 376 return "$keyword $callName($args)";
377 } 377 }
378 378
379 String visitConcatenateStrings(ConcatenateStrings node) {
380 String args = node.arguments.map(visitExpression).join(', ');
381 return "concat [$args]";
382 }
383
384 String visitLiteralList(LiteralList node) { 379 String visitLiteralList(LiteralList node) {
385 String values = node.values.map(visitExpression).join(', '); 380 String values = node.values.map(visitExpression).join(', ');
386 return "list [$values]"; 381 return "list [$values]";
387 } 382 }
388 383
389 String visitLiteralMap(LiteralMap node) { 384 String visitLiteralMap(LiteralMap node) {
390 List<String> entries = new List<String>(); 385 List<String> entries = new List<String>();
391 node.entries.forEach((LiteralMapEntry entry) { 386 node.entries.forEach((LiteralMapEntry entry) {
392 String key = visitExpression(entry.key); 387 String key = visitExpression(entry.key);
393 String value = visitExpression(entry.value); 388 String value = visitExpression(entry.value);
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
535 String prefix = v.element == null ? 'v' : '${v.element.name}_'; 530 String prefix = v.element == null ? 'v' : '${v.element.name}_';
536 while (name == null || _usedNames.contains(name)) { 531 while (name == null || _usedNames.contains(name)) {
537 name = "$prefix${_counter++}"; 532 name = "$prefix${_counter++}";
538 } 533 }
539 _names[v] = name; 534 _names[v] = name;
540 _usedNames.add(name); 535 _usedNames.add(name);
541 } 536 }
542 return name; 537 return name;
543 } 538 }
544 } 539 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698