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

Side by Side Diff: tests/compiler/dart2js/backend_dart/sexpr_unstringifier.dart

Issue 864293004: Add a shrinking reduction for dead continuation parameters. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Incorporated review comments. Created 5 years, 11 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
« no previous file with comments | « tests/compiler/dart2js/backend_dart/opt_shrinking_test.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 // SExpressionUnstringifier implements the inverse operation to 5 // SExpressionUnstringifier implements the inverse operation to
6 // [SExpressionStringifier]. 6 // [SExpressionStringifier].
7 7
8 library sexpr_unstringifier; 8 library sexpr_unstringifier;
9 9
10 import 'package:compiler/src/constants/expressions.dart' 10 import 'package:compiler/src/constants/expressions.dart'
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 /// Constructs a minimal in-memory representation of the IR represented 112 /// Constructs a minimal in-memory representation of the IR represented
113 /// by the given string. Many fields are currently simply set to null. 113 /// by the given string. Many fields are currently simply set to null.
114 class SExpressionUnstringifier { 114 class SExpressionUnstringifier {
115 115
116 // Expressions 116 // Expressions
117 static const String BRANCH = "Branch"; 117 static const String BRANCH = "Branch";
118 static const String CONCATENATE_STRINGS = "ConcatenateStrings"; 118 static const String CONCATENATE_STRINGS = "ConcatenateStrings";
119 static const String DECLARE_FUNCTION = "DeclareFunction"; 119 static const String DECLARE_FUNCTION = "DeclareFunction";
120 static const String INVOKE_CONSTRUCTOR = "InvokeConstructor"; 120 static const String INVOKE_CONSTRUCTOR = "InvokeConstructor";
121 static const String INVOKE_CONTINUATION = "InvokeContinuation"; 121 static const String INVOKE_CONTINUATION = "InvokeContinuation";
122 static const String INVOKE_CONTINUATION_RECURSIVE = "InvokeContinuation*";
123 static const String INVOKE_STATIC = "InvokeStatic"; 122 static const String INVOKE_STATIC = "InvokeStatic";
124 static const String INVOKE_METHOD_DIRECTLY = "InvokeMethodDirectly"; 123 static const String INVOKE_METHOD_DIRECTLY = "InvokeMethodDirectly";
125 static const String INVOKE_METHOD = "InvokeMethod"; 124 static const String INVOKE_METHOD = "InvokeMethod";
126 static const String LET_PRIM = "LetPrim"; 125 static const String LET_PRIM = "LetPrim";
127 static const String LET_CONT = "LetCont"; 126 static const String LET_CONT = "LetCont";
128 static const String SET_CLOSURE_VARIABLE = "SetClosureVariable"; 127 static const String SET_CLOSURE_VARIABLE = "SetClosureVariable";
129 static const String TYPE_OPERATOR = "TypeOperator"; 128 static const String TYPE_OPERATOR = "TypeOperator";
130 129
131 // Primitives 130 // Primitives
132 static const String CONSTANT = "Constant"; 131 static const String CONSTANT = "Constant";
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
213 switch (tokens.next) { 212 switch (tokens.next) {
214 case BRANCH: 213 case BRANCH:
215 return parseBranch(); 214 return parseBranch();
216 case CONCATENATE_STRINGS: 215 case CONCATENATE_STRINGS:
217 return parseConcatenateStrings(); 216 return parseConcatenateStrings();
218 case DECLARE_FUNCTION: 217 case DECLARE_FUNCTION:
219 return parseDeclareFunction(); 218 return parseDeclareFunction();
220 case INVOKE_CONSTRUCTOR: 219 case INVOKE_CONSTRUCTOR:
221 return parseInvokeConstructor(); 220 return parseInvokeConstructor();
222 case INVOKE_CONTINUATION: 221 case INVOKE_CONTINUATION:
223 return parseInvokeContinuation(false); 222 return parseInvokeContinuation();
224 case INVOKE_CONTINUATION_RECURSIVE:
225 return parseInvokeContinuation(true);
226 case INVOKE_METHOD: 223 case INVOKE_METHOD:
227 return parseInvokeMethod(); 224 return parseInvokeMethod();
228 case INVOKE_STATIC: 225 case INVOKE_STATIC:
229 return parseInvokeStatic(); 226 return parseInvokeStatic();
230 case INVOKE_METHOD_DIRECTLY: 227 case INVOKE_METHOD_DIRECTLY:
231 return parseInvokeMethodDirectly(); 228 return parseInvokeMethodDirectly();
232 case LET_PRIM: 229 case LET_PRIM:
233 return parseLetPrim(); 230 return parseLetPrim();
234 case LET_CONT: 231 case LET_CONT:
235 return parseLetCont(); 232 return parseLetCont();
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
380 List<Primitive> args = parsePrimitiveList(); 377 List<Primitive> args = parsePrimitiveList();
381 378
382 Continuation cont = name2variable[tokens.read()]; 379 Continuation cont = name2variable[tokens.read()];
383 assert(cont != null); 380 assert(cont != null);
384 381
385 tokens.consumeEnd(); 382 tokens.consumeEnd();
386 Selector selector = dummySelector(constructorName, args.length); 383 Selector selector = dummySelector(constructorName, args.length);
387 return new InvokeConstructor(type, element, selector, cont, args); 384 return new InvokeConstructor(type, element, selector, cont, args);
388 } 385 }
389 386
390 /// (InvokeContinuation name (args)) 387 /// (InvokeContinuation rec? name (args))
391 InvokeContinuation parseInvokeContinuation(bool recursive) { 388 InvokeContinuation parseInvokeContinuation() {
392 tokens.consumeStart(recursive 389 tokens.consumeStart(INVOKE_CONTINUATION);
393 ? INVOKE_CONTINUATION_RECURSIVE : INVOKE_CONTINUATION); 390 String name = tokens.read();
394 391 bool isRecursive = name == "rec";
395 Continuation cont = name2variable[tokens.read()]; 392 if (isRecursive) name = tokens.read();
393
394 Continuation cont = name2variable[name];
396 assert(cont != null); 395 assert(cont != null);
397 396
398 List<Primitive> args = parsePrimitiveList(); 397 List<Primitive> args = parsePrimitiveList();
399 398
400 tokens.consumeEnd(); 399 tokens.consumeEnd();
401 return new InvokeContinuation(cont, args, recursive: recursive); 400 return new InvokeContinuation(cont, args, recursive: isRecursive);
402 } 401 }
403 402
404 /// (InvokeMethod receiver method (args) cont) 403 /// (InvokeMethod receiver method (args) cont)
405 InvokeMethod parseInvokeMethod() { 404 InvokeMethod parseInvokeMethod() {
406 tokens.consumeStart(INVOKE_METHOD); 405 tokens.consumeStart(INVOKE_METHOD);
407 406
408 Definition receiver = name2variable[tokens.read()]; 407 Definition receiver = name2variable[tokens.read()];
409 assert(receiver != null); 408 assert(receiver != null);
410 409
411 String methodName = tokens.read(); 410 String methodName = tokens.read();
(...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after
694 return new ReifyTypeVar(type); 693 return new ReifyTypeVar(type);
695 } 694 }
696 695
697 /// (This) 696 /// (This)
698 This parseThis() { 697 This parseThis() {
699 tokens.consumeStart(THIS); 698 tokens.consumeStart(THIS);
700 tokens.consumeEnd(); 699 tokens.consumeEnd();
701 return new This(); 700 return new This();
702 } 701 }
703 } 702 }
OLDNEW
« no previous file with comments | « tests/compiler/dart2js/backend_dart/opt_shrinking_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698