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

Unified Diff: pkg/compiler/lib/src/js_backend/constant_system_javascript.dart

Issue 2395243008: Revert "dart2js: Constant fold num.round()" (Closed)
Patch Set: Created 4 years, 2 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/js_backend/constant_system_javascript.dart
diff --git a/pkg/compiler/lib/src/js_backend/constant_system_javascript.dart b/pkg/compiler/lib/src/js_backend/constant_system_javascript.dart
index 4c4d3e45d4be88335345511d017d8a5901d59a09..7f86482fd595d79f5dd2fbe2706e5801d8b29bb7 100644
--- a/pkg/compiler/lib/src/js_backend/constant_system_javascript.dart
+++ b/pkg/compiler/lib/src/js_backend/constant_system_javascript.dart
@@ -165,37 +165,12 @@ class JavaScriptIdentityOperation implements BinaryOperation {
apply(left, right) => identical(left, right);
}
-class JavaScriptRoundOperation implements UnaryOperation {
- const JavaScriptRoundOperation();
- String get name => DART_CONSTANT_SYSTEM.round.name;
- ConstantValue fold(ConstantValue constant) {
- // Be careful to round() only values that do not throw on either the host or
- // target platform.
- if (constant.isInt) {
- IntConstantValue intConstant = constant;
- int value = intConstant.primitiveValue;
- if (value >= -double.MAX_FINITE && value <= double.MAX_FINITE) {
- return JAVA_SCRIPT_CONSTANT_SYSTEM
- .convertToJavaScriptConstant(constant);
- }
- }
- if (constant.isDouble) {
- DoubleConstantValue doubleConstant = constant;
- double value = doubleConstant.primitiveValue;
- if (!value.isNaN && value.isFinite) {
- return JAVA_SCRIPT_CONSTANT_SYSTEM
- .convertToJavaScriptConstant(new IntConstantValue(value.round()));
- }
- }
- return null;
- }
-}
-
/**
* Constant system following the semantics for Dart code that has been
* compiled to JavaScript.
*/
class JavaScriptConstantSystem extends ConstantSystem {
+ final int BITS31 = 0x8FFFFFFF;
final int BITS32 = 0xFFFFFFFF;
final add = const JavaScriptAddOperation();
@@ -228,7 +203,6 @@ class JavaScriptConstantSystem extends ConstantSystem {
final truncatingDivide = const JavaScriptBinaryArithmeticOperation(
const TruncatingDivideOperation());
final codeUnitAt = const CodeUnitAtRuntimeOperation();
- final round = const JavaScriptRoundOperation();
const JavaScriptConstantSystem();
« no previous file with comments | « pkg/compiler/lib/src/constants/constant_system.dart ('k') | pkg/compiler/lib/src/ssa/invoke_dynamic_specializers.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698