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

Side by Side Diff: pkg/compiler/lib/src/cps_ir/cps_ir_nodes_sexpr.dart

Issue 1153603006: dart2js cps: Type casts and related changes to type propagation. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Another typo in SExpression unstrngifier 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 dart2js.ir_nodes_sexpr; 5 library dart2js.ir_nodes_sexpr;
6 6
7 import '../constants/values.dart'; 7 import '../constants/values.dart';
8 import '../util/util.dart'; 8 import '../util/util.dart';
9 import 'cps_ir_nodes.dart'; 9 import 'cps_ir_nodes.dart';
10 10
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after
195 return '$indentation(Rethrow)'; 195 return '$indentation(Rethrow)';
196 } 196 }
197 197
198 String visitBranch(Branch node) { 198 String visitBranch(Branch node) {
199 String condition = visit(node.condition); 199 String condition = visit(node.condition);
200 String trueCont = access(node.trueContinuation); 200 String trueCont = access(node.trueContinuation);
201 String falseCont = access(node.falseContinuation); 201 String falseCont = access(node.falseContinuation);
202 return '$indentation(Branch $condition $trueCont $falseCont)'; 202 return '$indentation(Branch $condition $trueCont $falseCont)';
203 } 203 }
204 204
205 String visitUnreachable(Unreachable node) {
206 return '$indentation(Unreachable)';
207 }
208
205 String visitConstant(Constant node) { 209 String visitConstant(Constant node) {
206 String value = node.value.accept(new ConstantStringifier(), null); 210 String value = node.value.accept(new ConstantStringifier(), null);
207 return '(Constant $value)'; 211 return '(Constant $value)';
208 } 212 }
209 213
210 String visitCreateFunction(CreateFunction node) { 214 String visitCreateFunction(CreateFunction node) {
211 String function = 215 String function =
212 indentBlock(() => indentBlock(() => visit(node.definition))); 216 indentBlock(() => indentBlock(() => visit(node.definition)));
213 return '(CreateFunction\n$function)'; 217 return '(CreateFunction\n$function)';
214 } 218 }
215 219
216 String visitContinuation(Continuation node) { 220 String visitContinuation(Continuation node) {
217 // Continuations are visited directly in visitLetCont. 221 // Continuations are visited directly in visitLetCont.
218 return '(Unexpected Continuation)'; 222 return '(Unexpected Continuation)';
219 } 223 }
220 224
221 String visitGetMutableVariable(GetMutableVariable node) { 225 String visitGetMutableVariable(GetMutableVariable node) {
222 return '(GetMutableVariable ${access(node.variable)})'; 226 return '(GetMutableVariable ${access(node.variable)})';
223 } 227 }
224 228
225 String visitSetMutableVariable(SetMutableVariable node) { 229 String visitSetMutableVariable(SetMutableVariable node) {
226 String value = access(node.value); 230 String value = access(node.value);
227 String body = indentBlock(() => visit(node.body)); 231 String body = indentBlock(() => visit(node.body));
228 return '$indentation(SetMutableVariable ${access(node.variable)} ' 232 return '$indentation(SetMutableVariable ${access(node.variable)} '
229 '$value\n$body)'; 233 '$value\n$body)';
230 } 234 }
231 235
232 String visitTypeOperator(TypeOperator node) { 236 String visitTypeCast(TypeCast node) {
233 String value = access(node.value); 237 String value = access(node.value);
234 String cont = access(node.continuation); 238 String cont = access(node.continuation);
235 String operator = node.isTypeTest ? 'is' : 'as';
236 String typeArguments = node.typeArguments.map(access).join(' '); 239 String typeArguments = node.typeArguments.map(access).join(' ');
237 return '$indentation(TypeOperator $operator $value ${node.type} ' 240 return '$indentation(TypeCast $value ${node.type} ($typeArguments) $cont)';
238 '($typeArguments) $cont)'; 241 }
242
243 String visitTypeTest(TypeTest node) {
244 String value = access(node.value);
245 String typeArguments = node.typeArguments.map(access).join(' ');
246 return '(TypeTest $value ${node.type} ($typeArguments))';
239 } 247 }
240 248
241 String visitLiteralList(LiteralList node) { 249 String visitLiteralList(LiteralList node) {
242 String values = node.values.map(access).join(' '); 250 String values = node.values.map(access).join(' ');
243 return '(LiteralList ($values))'; 251 return '(LiteralList ($values))';
244 } 252 }
245 253
246 String visitLiteralMap(LiteralMap node) { 254 String visitLiteralMap(LiteralMap node) {
247 String keys = node.entries.map((e) => access(e.key)).join(' '); 255 String keys = node.entries.map((e) => access(e.key)).join(' ');
248 String values = node.entries.map((e) => access(e.value)).join(' '); 256 String values = node.entries.map((e) => access(e.value)).join(' ');
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after
437 void setReturnContinuation(Continuation node) { 445 void setReturnContinuation(Continuation node) {
438 assert(!_names.containsKey(node) || _names[node] == 'return'); 446 assert(!_names.containsKey(node) || _names[node] == 'return');
439 _names[node] = 'return'; 447 _names[node] = 'return';
440 } 448 }
441 449
442 String getName(Node node) { 450 String getName(Node node) {
443 if (!_names.containsKey(node)) return 'MISSING_NAME'; 451 if (!_names.containsKey(node)) return 'MISSING_NAME';
444 return _names[node]; 452 return _names[node];
445 } 453 }
446 } 454 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/cps_ir/cps_ir_nodes.dart ('k') | pkg/compiler/lib/src/cps_ir/cps_ir_tracer.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698