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

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: Unbreak long line. 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 471 matching lines...) Expand 10 before | Expand all | Expand 10 after
482 String visitCreateBox(CreateBox node) { 482 String visitCreateBox(CreateBox node) {
483 return 'CreateBox'; 483 return 'CreateBox';
484 } 484 }
485 485
486 String visitCreateInstance(CreateInstance node) { 486 String visitCreateInstance(CreateInstance node) {
487 String className = node.classElement.name; 487 String className = node.classElement.name;
488 String arguments = node.arguments.map(visitExpression).join(', '); 488 String arguments = node.arguments.map(visitExpression).join(', ');
489 return 'CreateInstance $className($arguments)'; 489 return 'CreateInstance $className($arguments)';
490 } 490 }
491 491
492
493 @override
494 String visitReadTypeVariable(ReadTypeVariable node) {
495 return 'read ${node.variable.element} ${visitExpression(node.target)}';
496 }
497
498 @override
499 String visitReifyRuntimeType(ReifyRuntimeType node) {
500 return 'reify ${node.value}';
501 }
492 } 502 }
493 503
494 /** 504 /**
495 * Invents (and remembers) names for Variables that do not have an associated 505 * Invents (and remembers) names for Variables that do not have an associated
496 * identifier. 506 * identifier.
497 * 507 *
498 * In case a variable is named v0, v1, etc, it may be assigned a different 508 * In case a variable is named v0, v1, etc, it may be assigned a different
499 * name to avoid clashing with a previously synthesized variable name. 509 * name to avoid clashing with a previously synthesized variable name.
500 */ 510 */
501 class Names { 511 class Names {
502 final Map<Variable, String> _names = {}; 512 final Map<Variable, String> _names = {};
503 final Set<String> _usedNames = new Set(); 513 final Set<String> _usedNames = new Set();
504 int _counter = 0; 514 int _counter = 0;
505 515
506 String varName(Variable v) { 516 String varName(Variable v) {
507 String name = _names[v]; 517 String name = _names[v];
508 if (name == null) { 518 if (name == null) {
509 String prefix = v.element == null ? 'v' : '${v.element.name}_'; 519 String prefix = v.element == null ? 'v' : '${v.element.name}_';
510 while (name == null || _usedNames.contains(name)) { 520 while (name == null || _usedNames.contains(name)) {
511 name = "$prefix${_counter++}"; 521 name = "$prefix${_counter++}";
512 } 522 }
513 _names[v] = name; 523 _names[v] = name;
514 _usedNames.add(name); 524 _usedNames.add(name);
515 } 525 }
516 return name; 526 return name;
517 } 527 }
518 } 528 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/tree_ir/tree_ir_nodes.dart ('k') | tests/compiler/dart2js/js_backend_cps_ir_runtime_types_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698