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

Side by Side Diff: pkg/compiler/lib/src/tree_ir/tree_ir_builder.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_builder; 5 library tree_ir_builder;
6 6
7 import '../dart2jslib.dart' as dart2js; 7 import '../dart2jslib.dart' as dart2js;
8 import '../dart_types.dart'; 8 import '../dart_types.dart';
9 import '../elements/elements.dart'; 9 import '../elements/elements.dart';
10 import '../cps_ir/cps_ir_nodes.dart' as cps_ir; 10 import '../cps_ir/cps_ir_nodes.dart' as cps_ir;
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 return variables[primitive.registerIndex]; 115 return variables[primitive.registerIndex];
116 } 116 }
117 117
118 /// Obtains a reference to the tree Variable corresponding to the IR primitive 118 /// Obtains a reference to the tree Variable corresponding to the IR primitive
119 /// referred to by [reference]. 119 /// referred to by [reference].
120 /// This increments the reference count for the given variable, so the 120 /// This increments the reference count for the given variable, so the
121 /// returned expression must be used in the tree. 121 /// returned expression must be used in the tree.
122 Expression getVariableReference(cps_ir.Reference reference) { 122 Expression getVariableReference(cps_ir.Reference reference) {
123 Variable variable = getVariable(reference.definition); 123 Variable variable = getVariable(reference.definition);
124 if (variable == null) { 124 if (variable == null) {
125 // Note: this may fail because you forgot to implement a visit-function
126 // in the RegisterAllocator.
125 internalError( 127 internalError(
126 CURRENT_ELEMENT_SPANNABLE, 128 CURRENT_ELEMENT_SPANNABLE,
127 "Reference to ${reference.definition} has no register"); 129 "Reference to ${reference.definition} has no register");
128 } 130 }
129 ++variable.readCount; 131 ++variable.readCount;
130 return variable; 132 return variable;
131 } 133 }
132 134
133 ExecutableDefinition build(cps_ir.ExecutableDefinition node) { 135 ExecutableDefinition build(cps_ir.ExecutableDefinition node) {
134 if (node is cps_ir.FieldDefinition) { 136 if (node is cps_ir.FieldDefinition) {
(...skipping 480 matching lines...) Expand 10 before | Expand all | Expand 10 after
615 Expression visitContinuation(cps_ir.Continuation node) { 617 Expression visitContinuation(cps_ir.Continuation node) {
616 // Until continuations with multiple uses are supported, they are not 618 // Until continuations with multiple uses are supported, they are not
617 // visited. 619 // visited.
618 internalError(CURRENT_ELEMENT_SPANNABLE, 'Unexpected IR node: $node.'); 620 internalError(CURRENT_ELEMENT_SPANNABLE, 'Unexpected IR node: $node.');
619 return null; 621 return null;
620 } 622 }
621 623
622 Expression visitIsTrue(cps_ir.IsTrue node) { 624 Expression visitIsTrue(cps_ir.IsTrue node) {
623 return getVariableReference(node.value); 625 return getVariableReference(node.value);
624 } 626 }
627
628 Expression visitReifyRuntimeType(cps_ir.ReifyRuntimeType node) {
629 return new ReifyRuntimeType(getVariableReference(node.value));
630 }
631
632 Expression visitReadTypeVariable(cps_ir.ReadTypeVariable node) {
633 return new ReadTypeVariable(node.variable, node.context,
634 getVariableReference(node.target));
635 }
625 } 636 }
626
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698