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

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

Issue 968843003: Implement type argument access and reification of runtime types. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 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 unified diff | Download patch | Annotate | Revision Log
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 import 'optimization/optimization.dart'; 10 import 'optimization/optimization.dart';
(...skipping 446 matching lines...) Expand 10 before | Expand all | Expand 10 after
457 String visitCreateBox(CreateBox node) { 457 String visitCreateBox(CreateBox node) {
458 return 'CreateBox'; 458 return 'CreateBox';
459 } 459 }
460 460
461 String visitCreateInstance(CreateInstance node) { 461 String visitCreateInstance(CreateInstance node) {
462 String className = node.classElement.name; 462 String className = node.classElement.name;
463 String arguments = node.arguments.map(visitExpression).join(', '); 463 String arguments = node.arguments.map(visitExpression).join(', ');
464 return 'CreateInstance $className($arguments)'; 464 return 'CreateInstance $className($arguments)';
465 } 465 }
466 466
467
468 @override
469 String visitReadTypeVariable(ReadTypeVariable node) {
470 return 'read ${node.variable.element} ${visitExpression(node.target)}';
471 }
472
473 @override
474 String visitReifyRuntimeType(ReifyRuntimeType node) {
475 return 'reify ${node.value}';
476 }
467 } 477 }
468 478
469 /** 479 /**
470 * Invents (and remembers) names for Variables that do not have an associated 480 * Invents (and remembers) names for Variables that do not have an associated
471 * identifier. 481 * identifier.
472 * 482 *
473 * In case a variable is named v0, v1, etc, it may be assigned a different 483 * In case a variable is named v0, v1, etc, it may be assigned a different
474 * name to avoid clashing with a previously synthesized variable name. 484 * name to avoid clashing with a previously synthesized variable name.
475 */ 485 */
476 class Names { 486 class Names {
477 final Map<Variable, String> _names = {}; 487 final Map<Variable, String> _names = {};
478 final Set<String> _usedNames = new Set(); 488 final Set<String> _usedNames = new Set();
479 int _counter = 0; 489 int _counter = 0;
480 490
481 String varName(Variable v) { 491 String varName(Variable v) {
482 String name = _names[v]; 492 String name = _names[v];
483 if (name == null) { 493 if (name == null) {
484 String prefix = v.element == null ? 'v' : '${v.element.name}_'; 494 String prefix = v.element == null ? 'v' : '${v.element.name}_';
485 while (name == null || _usedNames.contains(name)) { 495 while (name == null || _usedNames.contains(name)) {
486 name = "$prefix${_counter++}"; 496 name = "$prefix${_counter++}";
487 } 497 }
488 _names[v] = name; 498 _names[v] = name;
489 _usedNames.add(name); 499 _usedNames.add(name);
490 } 500 }
491 return name; 501 return name;
492 } 502 }
493 } 503 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698