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

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

Issue 1243063002: dart2js cps: Remove NonTailThrow. (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 515 matching lines...) Expand 10 before | Expand all | Expand 10 after
526 526
527 /// Rethrow 527 /// Rethrow
528 /// 528 ///
529 /// Rethrow can only occur inside a continuation bound by [LetHandler]. It 529 /// Rethrow can only occur inside a continuation bound by [LetHandler]. It
530 /// implicitly throws the exception parameter of the enclosing handler with 530 /// implicitly throws the exception parameter of the enclosing handler with
531 /// the same stack trace as the enclosing handler. 531 /// the same stack trace as the enclosing handler.
532 class Rethrow extends TailExpression { 532 class Rethrow extends TailExpression {
533 accept(Visitor visitor) => visitor.visitRethrow(this); 533 accept(Visitor visitor) => visitor.visitRethrow(this);
534 } 534 }
535 535
536 /// A throw occurring in non-tail position.
537 ///
538 /// The CPS translation of an expression produces a primitive as the value
539 /// of the expression. For convenience in the implementation of the
540 /// translation, a [NonTailThrow] is used as that value. A cleanup pass
541 /// removes these and replaces them with [Throw] expressions.
542 class NonTailThrow extends Primitive {
543 final Reference<Primitive> value;
544
545 NonTailThrow(Primitive value) : value = new Reference<Primitive>(value);
546
547 accept(Visitor visitor) => visitor.visitNonTailThrow(this);
548
549 bool get isSafeForElimination => false;
550 bool get isSafeForReordering => false;
551 }
552
553 /// An expression that is known to be unreachable. 536 /// An expression that is known to be unreachable.
554 /// 537 ///
555 /// This can be placed as the body of a call continuation, when the caller is 538 /// This can be placed as the body of a call continuation, when the caller is
556 /// known never to invoke it, e.g. because the calling expression always throws. 539 /// known never to invoke it, e.g. because the calling expression always throws.
557 class Unreachable extends TailExpression { 540 class Unreachable extends TailExpression {
558 accept(Visitor visitor) => visitor.visitUnreachable(this); 541 accept(Visitor visitor) => visitor.visitUnreachable(this);
559 } 542 }
560 543
561 /// Gets the value from a [MutableVariable]. 544 /// Gets the value from a [MutableVariable].
562 /// 545 ///
(...skipping 567 matching lines...) Expand 10 before | Expand all | Expand 10 after
1130 1113
1131 // Definitions. 1114 // Definitions.
1132 T visitLiteralList(LiteralList node); 1115 T visitLiteralList(LiteralList node);
1133 T visitLiteralMap(LiteralMap node); 1116 T visitLiteralMap(LiteralMap node);
1134 T visitConstant(Constant node); 1117 T visitConstant(Constant node);
1135 T visitCreateFunction(CreateFunction node); 1118 T visitCreateFunction(CreateFunction node);
1136 T visitGetMutable(GetMutable node); 1119 T visitGetMutable(GetMutable node);
1137 T visitParameter(Parameter node); 1120 T visitParameter(Parameter node);
1138 T visitContinuation(Continuation node); 1121 T visitContinuation(Continuation node);
1139 T visitMutableVariable(MutableVariable node); 1122 T visitMutableVariable(MutableVariable node);
1140 T visitNonTailThrow(NonTailThrow node);
1141 T visitGetStatic(GetStatic node); 1123 T visitGetStatic(GetStatic node);
1142 T visitInterceptor(Interceptor node); 1124 T visitInterceptor(Interceptor node);
1143 T visitCreateInstance(CreateInstance node); 1125 T visitCreateInstance(CreateInstance node);
1144 T visitGetField(GetField node); 1126 T visitGetField(GetField node);
1145 T visitCreateBox(CreateBox node); 1127 T visitCreateBox(CreateBox node);
1146 T visitReifyRuntimeType(ReifyRuntimeType node); 1128 T visitReifyRuntimeType(ReifyRuntimeType node);
1147 T visitReadTypeVariable(ReadTypeVariable node); 1129 T visitReadTypeVariable(ReadTypeVariable node);
1148 T visitTypeExpression(TypeExpression node); 1130 T visitTypeExpression(TypeExpression node);
1149 T visitCreateInvocationMirror(CreateInvocationMirror node); 1131 T visitCreateInvocationMirror(CreateInvocationMirror node);
1150 T visitTypeTest(TypeTest node); 1132 T visitTypeTest(TypeTest node);
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after
1401 processReadTypeVariable(node); 1383 processReadTypeVariable(node);
1402 processReference(node.target); 1384 processReference(node.target);
1403 } 1385 }
1404 1386
1405 processTypeExpression(TypeExpression node) {} 1387 processTypeExpression(TypeExpression node) {}
1406 visitTypeExpression(TypeExpression node) { 1388 visitTypeExpression(TypeExpression node) {
1407 processTypeExpression(node); 1389 processTypeExpression(node);
1408 node.arguments.forEach(processReference); 1390 node.arguments.forEach(processReference);
1409 } 1391 }
1410 1392
1411 processNonTailThrow(NonTailThrow node) {}
1412 visitNonTailThrow(NonTailThrow node) {
1413 processNonTailThrow(node);
1414 processReference(node.value);
1415 }
1416
1417 processCreateInvocationMirror(CreateInvocationMirror node) {} 1393 processCreateInvocationMirror(CreateInvocationMirror node) {}
1418 visitCreateInvocationMirror(CreateInvocationMirror node) { 1394 visitCreateInvocationMirror(CreateInvocationMirror node) {
1419 processCreateInvocationMirror(node); 1395 processCreateInvocationMirror(node);
1420 node.arguments.forEach(processReference); 1396 node.arguments.forEach(processReference);
1421 } 1397 }
1422 1398
1423 processApplyBuiltinOperator(ApplyBuiltinOperator node) {} 1399 processApplyBuiltinOperator(ApplyBuiltinOperator node) {}
1424 visitApplyBuiltinOperator(ApplyBuiltinOperator node) { 1400 visitApplyBuiltinOperator(ApplyBuiltinOperator node) {
1425 processApplyBuiltinOperator(node); 1401 processApplyBuiltinOperator(node);
1426 node.arguments.forEach(processReference); 1402 node.arguments.forEach(processReference);
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
1467 const RemovalVisitor(); 1443 const RemovalVisitor();
1468 1444
1469 processReference(Reference reference) { 1445 processReference(Reference reference) {
1470 reference.unlink(); 1446 reference.unlink();
1471 } 1447 }
1472 1448
1473 static void remove(Node node) { 1449 static void remove(Node node) {
1474 (const RemovalVisitor()).visit(node); 1450 (const RemovalVisitor()).visit(node);
1475 } 1451 }
1476 } 1452 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/cps_ir/cps_ir_builder_task.dart ('k') | pkg/compiler/lib/src/cps_ir/cps_ir_nodes_sexpr.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698