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

Unified Diff: pkg/compiler/lib/src/constant_system_dart.dart

Issue 2561533002: dart2js: Constant folding and specialization for remainder (Closed)
Patch Set: improve range analysis of remainder Created 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | pkg/compiler/lib/src/constants/constant_system.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/compiler/lib/src/constant_system_dart.dart
diff --git a/pkg/compiler/lib/src/constant_system_dart.dart b/pkg/compiler/lib/src/constant_system_dart.dart
index acace584b0b5ae8637064158d58a0b6f604ccad8..a9ec017ef9c6af48ea71f30f4ddd7cf87d6d3891 100644
--- a/pkg/compiler/lib/src/constant_system_dart.dart
+++ b/pkg/compiler/lib/src/constant_system_dart.dart
@@ -203,6 +203,14 @@ class ModuloOperation extends ArithmeticNumOperation {
apply(left, right) => left % right;
}
+class RemainderOperation extends ArithmeticNumOperation {
+ final String name = 'remainder';
+ const RemainderOperation();
+ // Not a defined constant operation.
+ num foldNums(num left, num right) => null;
+ apply(left, right) => left.remainder(right);
+}
+
class TruncatingDivideOperation extends ArithmeticNumOperation {
final String name = '~/';
const TruncatingDivideOperation();
@@ -406,6 +414,7 @@ class DartConstantSystem extends ConstantSystem {
final multiply = const MultiplyOperation();
final negate = const NegateOperation();
final not = const NotOperation();
+ final remainder = const RemainderOperation();
final shiftLeft = const ShiftLeftOperation();
final shiftRight = const ShiftRightOperation();
final subtract = const SubtractOperation();
« no previous file with comments | « no previous file | pkg/compiler/lib/src/constants/constant_system.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698