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

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

Issue 1220123004: dart2js cps: Ensure definitions are specialized before their uses. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Rebase Created 5 years, 5 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) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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 library dart2js.ir_nodes; 4 library dart2js.ir_nodes;
5 5
6 import '../constants/values.dart' as values show ConstantValue; 6 import '../constants/values.dart' as values show ConstantValue;
7 import '../dart_types.dart' show DartType, InterfaceType, TypeVariableType; 7 import '../dart_types.dart' show DartType, InterfaceType, TypeVariableType;
8 import '../elements/elements.dart'; 8 import '../elements/elements.dart';
9 import '../io/source_information.dart' show SourceInformation; 9 import '../io/source_information.dart' show SourceInformation;
10 import '../types/types.dart' show TypeMask; 10 import '../types/types.dart' show TypeMask;
(...skipping 550 matching lines...) Expand 10 before | Expand all | Expand 10 after
561 561
562 /// Invoke a continuation in tail position. 562 /// Invoke a continuation in tail position.
563 class InvokeContinuation extends Expression { 563 class InvokeContinuation extends Expression {
564 Reference<Continuation> continuation; 564 Reference<Continuation> continuation;
565 List<Reference<Primitive>> arguments; 565 List<Reference<Primitive>> arguments;
566 566
567 // An invocation of a continuation is recursive if it occurs in the body of 567 // An invocation of a continuation is recursive if it occurs in the body of
568 // the continuation itself. 568 // the continuation itself.
569 bool isRecursive; 569 bool isRecursive;
570 570
571 /// True if this invocation escapes from the body of a [LetHandler]
572 /// (i.e. a try block). Notably, such an invocation cannot be inlined.
573 bool isEscapingTry;
574
571 InvokeContinuation(Continuation cont, List<Primitive> args, 575 InvokeContinuation(Continuation cont, List<Primitive> args,
572 {this.isRecursive: false}) 576 {this.isRecursive: false,
577 this.isEscapingTry: false})
573 : continuation = new Reference<Continuation>(cont), 578 : continuation = new Reference<Continuation>(cont),
574 arguments = _referenceList(args) { 579 arguments = _referenceList(args) {
575 assert(cont.parameters == null || cont.parameters.length == args.length); 580 assert(cont.parameters == null || cont.parameters.length == args.length);
576 if (isRecursive) cont.isRecursive = true; 581 if (isRecursive) cont.isRecursive = true;
577 } 582 }
578 583
579 /// A continuation invocation whose target and arguments will be filled 584 /// A continuation invocation whose target and arguments will be filled
580 /// in later. 585 /// in later.
581 /// 586 ///
582 /// Used as a placeholder for a jump whose target is not yet created 587 /// Used as a placeholder for a jump whose target is not yet created
583 /// (e.g., in the translation of break and continue). 588 /// (e.g., in the translation of break and continue).
584 InvokeContinuation.uninitialized({this.isRecursive: false}) 589 InvokeContinuation.uninitialized({this.isRecursive: false,
590 this.isEscapingTry: false})
585 : continuation = null, 591 : continuation = null,
586 arguments = null; 592 arguments = null;
587 593
588 accept(Visitor visitor) => visitor.visitInvokeContinuation(this); 594 accept(Visitor visitor) => visitor.visitInvokeContinuation(this);
589 } 595 }
590 596
591 /// The base class of things which can be tested and branched on. 597 /// The base class of things which can be tested and branched on.
592 abstract class Condition extends Node { 598 abstract class Condition extends Node {
593 } 599 }
594 600
(...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after
890 // gives constant-time access to the continuation from the parent. 896 // gives constant-time access to the continuation from the parent.
891 int parent_index; 897 int parent_index;
892 898
893 // A continuation is recursive if it has any recursive invocations. 899 // A continuation is recursive if it has any recursive invocations.
894 bool isRecursive; 900 bool isRecursive;
895 901
896 bool get isReturnContinuation => body == null; 902 bool get isReturnContinuation => body == null;
897 903
898 Continuation(this.parameters, {this.isRecursive: false}); 904 Continuation(this.parameters, {this.isRecursive: false});
899 905
900 Continuation.retrn() : parameters = <Parameter>[new Parameter(null)]; 906 Continuation.retrn()
907 : parameters = <Parameter>[new Parameter(null)],
908 isRecursive = false;
901 909
902 accept(Visitor visitor) => visitor.visitContinuation(this); 910 accept(Visitor visitor) => visitor.visitContinuation(this);
903 } 911 }
904 912
905 /// Identifies a mutable variable. 913 /// Identifies a mutable variable.
906 class MutableVariable extends Definition { 914 class MutableVariable extends Definition {
907 Entity hint; 915 Entity hint;
908 916
909 MutableVariable(this.hint); 917 MutableVariable(this.hint);
910 918
(...skipping 430 matching lines...) Expand 10 before | Expand all | Expand 10 after
1341 const RemovalVisitor(); 1349 const RemovalVisitor();
1342 1350
1343 processReference(Reference reference) { 1351 processReference(Reference reference) {
1344 reference.unlink(); 1352 reference.unlink();
1345 } 1353 }
1346 1354
1347 static void remove(Node node) { 1355 static void remove(Node node) {
1348 (const RemovalVisitor()).visit(node); 1356 (const RemovalVisitor()).visit(node);
1349 } 1357 }
1350 } 1358 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/cps_ir/cps_ir_builder.dart ('k') | pkg/compiler/lib/src/cps_ir/type_propagation.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698