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

Unified Diff: pkg/compiler/lib/src/cps_ir/builtin_operator.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
« no previous file with comments | « no previous file | pkg/compiler/lib/src/cps_ir/cps_ir_builder_task.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/compiler/lib/src/cps_ir/builtin_operator.dart
diff --git a/pkg/compiler/lib/src/cps_ir/builtin_operator.dart b/pkg/compiler/lib/src/cps_ir/builtin_operator.dart
new file mode 100644
index 0000000000000000000000000000000000000000..60c1ec98b2e9700a9d148cb6919f736a3a0a3a97
--- /dev/null
+++ b/pkg/compiler/lib/src/cps_ir/builtin_operator.dart
@@ -0,0 +1,59 @@
+// Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+library builtin_operator;
+// This is shared by the CPS and Tree IRs.
+// Both cps_ir_nodes and tree_ir_nodes import and re-export this file.
+
+/// An operator supported natively in the CPS and Tree IRs using the
+/// `ApplyBuiltinOperator` instructions.
+///
+/// These operators are pure in the sense that they cannot throw, diverge,
+/// have observable side-effects, return new objects, nor depend on any
+/// mutable state.
+///
+/// Most operators place restrictions on the values that may be given as
+/// argument; their behaviour is unspecified if those requirements are violated.
+///
+/// In all cases, the word "null" refers to the Dart null object, corresponding
+/// to both JS null and JS undefined.
+enum BuiltinOperator {
+ /// The numeric binary operators must take two numbers as argument.
+ /// The bitwise operators coerce the result to an unsigned integer, but
+ /// otherwise these all behave like the corresponding JS operator.
+ NumAdd,
+ NumSubtract,
+ NumMultiply,
+ NumAnd,
+ NumOr,
+ NumXor,
+ NumLt,
+ NumLe,
+ NumGt,
+ NumGe,
+
+ /// Returns true if the two arguments are the same value, and that value is
+ /// not NaN, or if one argument is +0 and the other is -0.
+ ///
+ /// At most one of the arguments may be null.
+ StrictEq,
+
+ /// Negated version of [StrictEq]. Introduced by [LogicalRewriter] in Tree IR.
+ StrictNeq,
+
+ /// Returns true if the two arguments are both null or are the same string,
+ /// boolean, or number, and that number is not NaN, or one argument is +0
+ /// and the other is -0.
+ ///
+ /// One of the following must hold:
+ /// - At least one argument is null.
+ /// - Arguments are both strings, or both booleans, or both numbers.
+ LooseEq,
+
+ /// Negated version of [LooseEq]. Introduced by [LogicalRewriter] in Tree IR.
+ LooseNeq,
+
+ /// Returns true if the argument is false, +0. -0, NaN, the empty string,
+ /// or null.
+ IsFalsy
+}
« no previous file with comments | « no previous file | pkg/compiler/lib/src/cps_ir/cps_ir_builder_task.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698