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

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

Issue 980853002: dart2dart: Bugfix in copy propagator. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Rebase 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_nodes; 5 library tree_ir_nodes;
6 6
7 import '../constants/expressions.dart'; 7 import '../constants/expressions.dart';
8 import '../constants/values.dart' as values; 8 import '../constants/values.dart' as values;
9 import '../dart_types.dart' show DartType, GenericType, TypeVariableType; 9 import '../dart_types.dart' show DartType, GenericType, TypeVariableType;
10 import '../elements/elements.dart'; 10 import '../elements/elements.dart';
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 /// Number of places where this variable occurs in a [VariableUse]. 109 /// Number of places where this variable occurs in a [VariableUse].
110 int readCount = 0; 110 int readCount = 0;
111 111
112 /// Number of places where this variable occurs as: 112 /// Number of places where this variable occurs as:
113 /// - left-hand of an [Assign] 113 /// - left-hand of an [Assign]
114 /// - left-hand of a [FunctionDeclaration] 114 /// - left-hand of a [FunctionDeclaration]
115 /// - parameter in a [FunctionDefinition] 115 /// - parameter in a [FunctionDefinition]
116 /// - catch parameter in a [Try] 116 /// - catch parameter in a [Try]
117 int writeCount = 0; 117 int writeCount = 0;
118 118
119 /// True if a nested function reads or writes this variable.
120 ///
121 /// Always false in JS-mode because closure conversion eliminated nested
122 /// functions.
123 bool isCaptured = false;
124
119 Variable(this.host, this.element) { 125 Variable(this.host, this.element) {
120 assert(host != null); 126 assert(host != null);
121 } 127 }
122 } 128 }
123 129
124 /// Read the value of a variable. 130 /// Read the value of a variable.
125 class VariableUse extends Expression { 131 class VariableUse extends Expression {
126 Variable variable; 132 Variable variable;
127 133
128 /// Creates a use of [variable] and updates its `readCount`. 134 /// Creates a use of [variable] and updates its `readCount`.
(...skipping 382 matching lines...) Expand 10 before | Expand all | Expand 10 after
511 517
512 /** 518 /**
513 * An assignments of an [Expression] to a [Variable]. 519 * An assignments of an [Expression] to a [Variable].
514 * 520 *
515 * In contrast to the CPS-based IR, non-primitive expressions can be assigned 521 * In contrast to the CPS-based IR, non-primitive expressions can be assigned
516 * to variables. 522 * to variables.
517 */ 523 */
518 class Assign extends Statement { 524 class Assign extends Statement {
519 Statement next; 525 Statement next;
520 Variable variable; 526 Variable variable;
521 Expression definition; 527 Expression value;
522 528
523 /// If true, this assignes to a fresh variable scoped to the [next] 529 /// If true, this assignes to a fresh variable scoped to the [next]
524 /// statement. 530 /// statement.
525 /// 531 ///
526 /// Variable declarations themselves are hoisted to function level. 532 /// Variable declarations themselves are hoisted to function level.
527 bool isDeclaration; 533 bool isDeclaration;
528 534
529 /// Creates an assignment to [variable] and updates its `writeCount`. 535 /// Creates an assignment to [variable] and updates its `writeCount`.
530 Assign(this.variable, this.definition, this.next, 536 Assign(this.variable, this.value, this.next,
531 { this.isDeclaration: false }) { 537 { this.isDeclaration: false }) {
532 variable.writeCount++; 538 variable.writeCount++;
533 } 539 }
534 540
535 bool get hasExactlyOneUse => variable.readCount == 1; 541 bool get hasExactlyOneUse => variable.readCount == 1;
536 542
537 accept(StatementVisitor visitor) => visitor.visitAssign(this); 543 accept(StatementVisitor visitor) => visitor.visitAssign(this);
538 accept1(StatementVisitor1 visitor, arg) => visitor.visitAssign(this, arg); 544 accept1(StatementVisitor1 visitor, arg) => visitor.visitAssign(this, arg);
539 } 545 }
540 546
(...skipping 414 matching lines...) Expand 10 before | Expand all | Expand 10 after
955 visitFunctionExpression(FunctionExpression node) { 961 visitFunctionExpression(FunctionExpression node) {
956 visitFunctionDefinition(node.definition); 962 visitFunctionDefinition(node.definition);
957 } 963 }
958 964
959 visitLabeledStatement(LabeledStatement node) { 965 visitLabeledStatement(LabeledStatement node) {
960 visitStatement(node.body); 966 visitStatement(node.body);
961 visitStatement(node.next); 967 visitStatement(node.next);
962 } 968 }
963 969
964 visitAssign(Assign node) { 970 visitAssign(Assign node) {
965 visitExpression(node.definition); 971 visitExpression(node.value);
966 visitVariable(node.variable); 972 visitVariable(node.variable);
967 visitStatement(node.next); 973 visitStatement(node.next);
968 } 974 }
969 975
970 visitReturn(Return node) { 976 visitReturn(Return node) {
971 visitExpression(node.value); 977 visitExpression(node.value);
972 } 978 }
973 979
974 visitBreak(Break node) {} 980 visitBreak(Break node) {}
975 981
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
1032 } 1038 }
1033 1039
1034 visitReifyRuntimeType(ReifyRuntimeType node) { 1040 visitReifyRuntimeType(ReifyRuntimeType node) {
1035 visitExpression(node.value); 1041 visitExpression(node.value);
1036 } 1042 }
1037 1043
1038 visitReadTypeVariable(ReadTypeVariable node) { 1044 visitReadTypeVariable(ReadTypeVariable node) {
1039 visitExpression(node.target); 1045 visitExpression(node.target);
1040 } 1046 }
1041 } 1047 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/tree_ir/tree_ir_builder.dart ('k') | pkg/compiler/lib/src/tree_ir/tree_ir_tracer.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698