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

Unified Diff: pkg/compiler/lib/src/cps_ir/cps_ir_nodes.dart

Issue 1175973005: dart2js cps: Introduce some built-in operators in type propagation. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Status files 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 side-by-side diff with in-line comments
Download patch
Index: pkg/compiler/lib/src/cps_ir/cps_ir_nodes.dart
diff --git a/pkg/compiler/lib/src/cps_ir/cps_ir_nodes.dart b/pkg/compiler/lib/src/cps_ir/cps_ir_nodes.dart
index 164663372e22cb8250b1c25be82a45353fa5b459..33ddf42ae34e5a423820f10242101cb3cd582983 100644
--- a/pkg/compiler/lib/src/cps_ir/cps_ir_nodes.dart
+++ b/pkg/compiler/lib/src/cps_ir/cps_ir_nodes.dart
@@ -10,6 +10,9 @@ import '../elements/elements.dart';
import '../io/source_information.dart' show SourceInformation;
import '../universe/universe.dart' show Selector, SelectorKind;
+import 'builtin_operator.dart';
+export 'builtin_operator.dart';
+
abstract class Node {
/// A pointer to the parent node. Is null until set by optimization passes.
Node parent;
@@ -119,7 +122,7 @@ class Reference<T extends Definition<T>> {
/// During one-pass construction a LetPrim with an empty body is used to
/// represent the one-hole context `let val x = V in []`.
class LetPrim extends Expression implements InteriorNode {
- final Primitive primitive;
+ Primitive primitive;
Expression body;
LetPrim(this.primitive, [this.body = null]);
@@ -437,6 +440,19 @@ class ConcatenateStrings extends Expression {
accept(Visitor visitor) => visitor.visitConcatenateStrings(this);
}
+/// Apply a built-in operator.
+///
+/// It must be known that the arguments have the proper types.
+class ApplyBuiltinOperator extends Primitive {
+ BuiltinOperator operator;
+ List<Reference<Primitive>> arguments;
+
+ ApplyBuiltinOperator(this.operator, List<Primitive> arguments)
+ : this.arguments = _referenceList(arguments);
+
+ accept(Visitor visitor) => visitor.visitApplyBuiltinOperator(this);
+}
+
/// Throw a value.
///
/// Throw is an expression, i.e., it always occurs in tail position with
@@ -536,14 +552,6 @@ class InvokeContinuation extends Expression {
if (isRecursive) cont.isRecursive = true;
}
- /// Build a one-argument InvokeContinuation using existing reference objects.
- ///
- /// This is useful for converting call continuations to local continuations.
- InvokeContinuation.fromCall(this.continuation,
- Reference<Primitive> argument)
- : arguments = <Reference<Primitive>>[argument],
- isRecursive = false;
-
/// A continuation invocation whose target and arguments will be filled
/// in later.
///
@@ -952,6 +960,7 @@ abstract class Visitor<T> {
T visitTypeExpression(TypeExpression node);
T visitCreateInvocationMirror(CreateInvocationMirror node);
T visitTypeTest(TypeTest node);
+ T visitApplyBuiltinOperator(ApplyBuiltinOperator node);
// Conditions.
T visitIsTrue(IsTrue node);
@@ -1234,6 +1243,12 @@ class RecursiveVisitor implements Visitor {
node.arguments.forEach(processReference);
}
+ processApplyBuiltinOperator(ApplyBuiltinOperator node) {}
+ visitApplyBuiltinOperator(ApplyBuiltinOperator node) {
+ processApplyBuiltinOperator(node);
+ node.arguments.forEach(processReference);
+ }
+
processUnreachable(Unreachable node) {}
visitUnreachable(Unreachable node) {
processUnreachable(node);
« 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