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

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: Revert doc comment change 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 367 matching lines...) Expand 10 before | Expand all | Expand 10 after
378 if (node.target.name.isEmpty) { 378 if (node.target.name.isEmpty) {
379 callName = '${className}'; 379 callName = '${className}';
380 } else { 380 } else {
381 callName = '${className}.${node.target.name}'; 381 callName = '${className}.${node.target.name}';
382 } 382 }
383 String args = formatArguments(node); 383 String args = formatArguments(node);
384 String keyword = node.constant != null ? 'const' : 'new'; 384 String keyword = node.constant != null ? 'const' : 'new';
385 return "$keyword $callName($args)"; 385 return "$keyword $callName($args)";
386 } 386 }
387 387
388 String visitConcatenateStrings(ConcatenateStrings node) {
389 String args = node.arguments.map(visitExpression).join(', ');
390 return "concat [$args]";
391 }
392
393 String visitLiteralList(LiteralList node) { 388 String visitLiteralList(LiteralList node) {
394 String values = node.values.map(visitExpression).join(', '); 389 String values = node.values.map(visitExpression).join(', ');
395 return "list [$values]"; 390 return "list [$values]";
396 } 391 }
397 392
398 String visitLiteralMap(LiteralMap node) { 393 String visitLiteralMap(LiteralMap node) {
399 List<String> entries = new List<String>(); 394 List<String> entries = new List<String>();
400 node.entries.forEach((LiteralMapEntry entry) { 395 node.entries.forEach((LiteralMapEntry entry) {
401 String key = visitExpression(entry.key); 396 String key = visitExpression(entry.key);
402 String value = visitExpression(entry.value); 397 String value = visitExpression(entry.value);
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
550 String prefix = v.element == null ? 'v' : '${v.element.name}_'; 545 String prefix = v.element == null ? 'v' : '${v.element.name}_';
551 while (name == null || _usedNames.contains(name)) { 546 while (name == null || _usedNames.contains(name)) {
552 name = "$prefix${_counter++}"; 547 name = "$prefix${_counter++}";
553 } 548 }
554 _names[v] = name; 549 _names[v] = name;
555 _usedNames.add(name); 550 _usedNames.add(name);
556 } 551 }
557 return name; 552 return name;
558 } 553 }
559 } 554 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/tree_ir/tree_ir_nodes.dart ('k') | tests/compiler/dart2js/js_backend_cps_ir_basic_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698