Version 2.12.0-163.0.dev
Merge commit '7ebbc89e78ab8ac58f51826bbd9a13b6491beb9f' into 'dev'
diff --git a/benchmarks/BigIntParsePrint/dart/BigIntParsePrint.dart b/benchmarks/BigIntParsePrint/dart/BigIntParsePrint.dart
index 5cade7b..0c9fe04 100644
--- a/benchmarks/BigIntParsePrint/dart/BigIntParsePrint.dart
+++ b/benchmarks/BigIntParsePrint/dart/BigIntParsePrint.dart
@@ -4,8 +4,6 @@
// ignore_for_file: avoid_function_literals_in_foreach_calls
-import 'dart:math' show pow;
-
import 'package:benchmark_harness/benchmark_harness.dart';
import 'package:fixnum/fixnum.dart';
@@ -33,29 +31,38 @@
// integers.
const requiredDigits = 11106;
-class ParseBigIntBenchmark extends BenchmarkBase {
- final int bits;
- final BigInt seed;
- final List<String> strings = [];
-
- ParseBigIntBenchmark(String name, this.bits)
- : seed = (BigInt.one << bits) - BigInt.one,
+class Benchmark extends BenchmarkBase {
+ final List<String> strings;
+ Benchmark(String name, int bits)
+ : strings = generateStrings(bits),
super(name);
- @override
- void setup() {
+ static List<String> generateStrings(int bits) {
+ List<String> strings = [];
+ BigInt seed = (BigInt.one << bits) - BigInt.one;
var b = seed;
+ var restartDelta = BigInt.zero;
var totalLength = 0;
while (totalLength < requiredDigits) {
if (b.bitLength < bits) {
- b = seed;
+ restartDelta += seed >> 20;
+ restartDelta += BigInt.one;
+ // Restart from a slighly reduced seed to generate different numbers.
+ b = seed - restartDelta;
}
final string = b.toString();
strings.add(string);
totalLength += string.length;
- b = b - (b >> 8);
+ var delta = b >> 8;
+ if (delta == BigInt.zero) delta = BigInt.one;
+ b = b - delta;
}
+ return strings;
}
+}
+
+class ParseBigIntBenchmark extends Benchmark {
+ ParseBigIntBenchmark(String name, int bits) : super(name, bits);
@override
void run() {
@@ -68,31 +75,8 @@
}
}
-int int64UnsignedBitLength(Int64 i) => i.isNegative ? 64 : i.bitLength;
-
-class ParseInt64Benchmark extends BenchmarkBase {
- final int bits;
- final Int64 seed;
- final List<String> strings = [];
-
- ParseInt64Benchmark(String name, this.bits)
- : seed = (Int64.ONE << bits) - Int64.ONE,
- super(name);
-
- @override
- void setup() {
- var b = seed;
- var totalLength = 0;
- while (totalLength < requiredDigits) {
- if (int64UnsignedBitLength(b) < bits) {
- b = seed;
- }
- final string = b.toStringUnsigned();
- strings.add(string);
- totalLength += string.length;
- b = b - b.shiftRightUnsigned(8);
- }
- }
+class ParseInt64Benchmark extends Benchmark {
+ ParseInt64Benchmark(String name, int bits) : super(name, bits);
@override
void run() {
@@ -105,29 +89,8 @@
}
}
-class ParseIntBenchmark extends BenchmarkBase {
- final int bits;
- final int seed;
- final List<String> strings = [];
-
- ParseIntBenchmark(String name, this.bits)
- : seed = (pow(2, bits) as int) - 1,
- super(name);
-
- @override
- void setup() {
- var b = seed;
- var totalLength = 0;
- while (totalLength < requiredDigits) {
- if (b.bitLength < bits) {
- b = seed;
- }
- final string = b.toString();
- strings.add(string);
- totalLength += string.length;
- b = b - b ~/ 256;
- }
- }
+class ParseIntBenchmark extends Benchmark {
+ ParseIntBenchmark(String name, int bits) : super(name, bits);
@override
void run() {
@@ -140,33 +103,8 @@
}
}
-class ParseJsBigIntBenchmark extends BenchmarkBase {
- final int bits;
- final Object seed;
- final List<String> strings = [];
-
- ParseJsBigIntBenchmark(String name, this.bits)
- : seed = nativeBigInt.subtract(
- nativeBigInt.shiftLeft(
- nativeBigInt.one, nativeBigInt.fromInt(bits)),
- nativeBigInt.one),
- super(name);
-
- @override
- void setup() {
- var b = seed;
- var totalLength = 0;
- while (totalLength < requiredDigits) {
- if (nativeBigInt.bitLength(b) < bits) {
- b = seed;
- }
- final string = nativeBigInt.toStringMethod(b);
- strings.add(string);
- totalLength += string.length;
- b = nativeBigInt.subtract(
- b, nativeBigInt.shiftRight(b, nativeBigInt.eight));
- }
- }
+class ParseJsBigIntBenchmark extends Benchmark {
+ ParseJsBigIntBenchmark(String name, int bits) : super(name, bits);
@override
void run() {
@@ -179,27 +117,16 @@
}
}
-class FormatBigIntBenchmark extends BenchmarkBase {
- final int bits;
- final BigInt seed;
+class FormatBigIntBenchmark extends Benchmark {
final List<BigInt> values = [];
- FormatBigIntBenchmark(String name, this.bits)
- : seed = (BigInt.one << bits) - BigInt.one,
- super(name);
+ FormatBigIntBenchmark(String name, int bits) : super(name, bits);
@override
void setup() {
- var b = seed;
- var totalLength = 0;
- while (totalLength < requiredDigits) {
- if (b.bitLength < bits) {
- b = seed;
- }
- final string = b.toString();
+ for (String s in strings) {
+ BigInt b = BigInt.parse(s);
values.add(b - BigInt.one); // We add 'one' back later.
- totalLength += string.length;
- b = b - (b >> 8);
}
}
@@ -218,28 +145,16 @@
}
}
-class FormatIntBenchmark extends BenchmarkBase {
- final int bits;
- final int seed;
+class FormatIntBenchmark extends Benchmark {
final List<int> values = [];
- FormatIntBenchmark(String name, this.bits)
- : seed = (pow(2, bits) as int) - 1,
- super(name);
+ FormatIntBenchmark(String name, int bits) : super(name, bits);
@override
void setup() {
- var b = seed;
- var totalLength = 0;
- int kk = b ~/ 100000;
- while (totalLength < requiredDigits) {
- if (b.bitLength < bits) {
- b = seed - ++kk;
- }
- final string = b.toString();
- values.add(b - 4096); // We add 'one' back later.
- totalLength += string.length;
- b = b - (b ~/ 256);
+ for (String s in strings) {
+ int b = int.parse(s);
+ values.add(b - 4096); // We add this back later.
}
}
@@ -247,7 +162,9 @@
void run() {
for (final b0 in values) {
// Instances might cache `toString()`, so use arithmetic to create a new
- // instance to try to protect against measuring a cached string.
+ // instance to try to protect against measuring a cached string. We use
+ // 4096 to avoid the arithmetic being a no-op due to rounding on web
+ // integers (i.e. doubles).
final b = b0 + 4096;
final s = b.toString();
sink1 = s;
@@ -257,27 +174,16 @@
}
}
-class FormatInt64Benchmark extends BenchmarkBase {
- final int bits;
- final Int64 seed;
+class FormatInt64Benchmark extends Benchmark {
final List<Int64> values = [];
- FormatInt64Benchmark(String name, this.bits)
- : seed = (Int64.ONE << bits) - Int64.ONE,
- super(name);
+ FormatInt64Benchmark(String name, int bits) : super(name, bits);
@override
void setup() {
- var b = seed;
- var totalLength = 0;
- while (totalLength < requiredDigits) {
- if (int64UnsignedBitLength(b) < bits) {
- b = seed;
- }
- final string = b.toStringUnsigned();
- values.add(b - Int64.ONE);
- totalLength += string.length;
- b = b - b.shiftRightUnsigned(8);
+ for (String s in strings) {
+ final b = Int64.parseInt(s);
+ values.add(b - Int64.ONE); // We add this back later.
}
}
@@ -296,32 +202,17 @@
}
}
-class FormatJsBigIntBenchmark extends BenchmarkBase {
- final int bits;
- final Object seed;
+class FormatJsBigIntBenchmark extends Benchmark {
final List<Object> values = [];
- FormatJsBigIntBenchmark(String name, this.bits)
- : seed = nativeBigInt.subtract(
- nativeBigInt.shiftLeft(
- nativeBigInt.one, nativeBigInt.fromInt(bits)),
- nativeBigInt.one),
- super(name);
+ FormatJsBigIntBenchmark(String name, int bits) : super(name, bits);
@override
void setup() {
final one = nativeBigInt.one;
- var b = seed;
- var totalLength = 0;
- while (totalLength < requiredDigits) {
- if (nativeBigInt.bitLength(b) < bits) {
- b = seed;
- }
- final string = nativeBigInt.toStringMethod(b);
- values.add(nativeBigInt.subtract(b, one)); // We add 'one' back later.
- totalLength += string.length;
- b = nativeBigInt.subtract(
- b, nativeBigInt.shiftRight(b, nativeBigInt.eight));
+ for (String s in strings) {
+ final b = nativeBigInt.parse(s);
+ values.add(nativeBigInt.subtract(b, one)); // We add this back later.
}
}
@@ -371,6 +262,9 @@
final benchmarks = [
() => ParseIntBenchmark('Int.parse.0009.bits', 9),
() => ParseIntBenchmark('Int.parse.0032.bits', 32),
+ // Use '63' bits to avoid 64-bit arithmetic overflowing to negative. Keep
+ // the name as '64' to help comparisons. The effect of an incorrect number
+ // is reduced since benchmark results are normalized to a 'per digit' score
() => ParseIntBenchmark('Int.parse.0064.bits', 63),
() => ParseInt64Benchmark('Int64.parse.0009.bits', 9),
() => ParseInt64Benchmark('Int64.parse.0032.bits', 32),
@@ -389,7 +283,7 @@
selectParseNativeBigIntBenchmark('JsBigInt.parse.4096.bits', 4096),
() => FormatIntBenchmark('Int.toString.0009.bits', 9),
() => FormatIntBenchmark('Int.toString.0032.bits', 32),
- () => FormatIntBenchmark('Int.toString.0064.bits', 63),
+ () => FormatIntBenchmark('Int.toString.0064.bits', 63), // '63': See above.
() => FormatInt64Benchmark('Int64.toString.0009.bits', 9),
() => FormatInt64Benchmark('Int64.toString.0032.bits', 32),
() => FormatInt64Benchmark('Int64.toString.0064.bits', 64),
diff --git a/benchmarks/BigIntParsePrint/dart2/BigIntParsePrint.dart b/benchmarks/BigIntParsePrint/dart2/BigIntParsePrint.dart
index 26a796f..5656eac 100644
--- a/benchmarks/BigIntParsePrint/dart2/BigIntParsePrint.dart
+++ b/benchmarks/BigIntParsePrint/dart2/BigIntParsePrint.dart
@@ -33,29 +33,38 @@
// integers.
const requiredDigits = 11106;
-class ParseBigIntBenchmark extends BenchmarkBase {
- final int bits;
- final BigInt seed;
- final List<String> strings = [];
-
- ParseBigIntBenchmark(String name, this.bits)
- : seed = (BigInt.one << bits) - BigInt.one,
+class Benchmark extends BenchmarkBase {
+ final List<String> strings;
+ Benchmark(String name, int bits)
+ : strings = generateStrings(bits),
super(name);
- @override
- void setup() {
+ static List<String> generateStrings(int bits) {
+ List<String> strings = [];
+ BigInt seed = (BigInt.one << bits) - BigInt.one;
var b = seed;
+ var restartDelta = BigInt.zero;
var totalLength = 0;
while (totalLength < requiredDigits) {
if (b.bitLength < bits) {
- b = seed;
+ restartDelta += seed >> 20;
+ restartDelta += BigInt.one;
+ // Restart from a slighly reduced seed to generate different numbers.
+ b = seed - restartDelta;
}
final string = b.toString();
strings.add(string);
totalLength += string.length;
- b = b - (b >> 8);
+ var delta = b >> 8;
+ if (delta == BigInt.zero) delta = BigInt.one;
+ b = b - delta;
}
+ return strings;
}
+}
+
+class ParseBigIntBenchmark extends Benchmark {
+ ParseBigIntBenchmark(String name, int bits) : super(name, bits);
@override
void run() {
@@ -68,31 +77,8 @@
}
}
-int int64UnsignedBitLength(Int64 i) => i.isNegative ? 64 : i.bitLength;
-
-class ParseInt64Benchmark extends BenchmarkBase {
- final int bits;
- final Int64 seed;
- final List<String> strings = [];
-
- ParseInt64Benchmark(String name, this.bits)
- : seed = (Int64.ONE << bits) - Int64.ONE,
- super(name);
-
- @override
- void setup() {
- var b = seed;
- var totalLength = 0;
- while (totalLength < requiredDigits) {
- if (int64UnsignedBitLength(b) < bits) {
- b = seed;
- }
- final string = b.toStringUnsigned();
- strings.add(string);
- totalLength += string.length;
- b = b - b.shiftRightUnsigned(8);
- }
- }
+class ParseInt64Benchmark extends Benchmark {
+ ParseInt64Benchmark(String name, int bits) : super(name, bits);
@override
void run() {
@@ -105,33 +91,22 @@
}
}
-class ParseJsBigIntBenchmark extends BenchmarkBase {
- final int bits;
- final Object seed;
- final List<String> strings = [];
-
- ParseJsBigIntBenchmark(String name, this.bits)
- : seed = nativeBigInt.subtract(
- nativeBigInt.shiftLeft(
- nativeBigInt.one, nativeBigInt.fromInt(bits)),
- nativeBigInt.one),
- super(name);
+class ParseIntBenchmark extends Benchmark {
+ ParseIntBenchmark(String name, int bits) : super(name, bits);
@override
- void setup() {
- var b = seed;
- var totalLength = 0;
- while (totalLength < requiredDigits) {
- if (nativeBigInt.bitLength(b) < bits) {
- b = seed;
- }
- final string = nativeBigInt.toStringMethod(b);
- strings.add(string);
- totalLength += string.length;
- b = nativeBigInt.subtract(
- b, nativeBigInt.shiftRight(b, nativeBigInt.eight));
+ void run() {
+ for (final s in strings) {
+ final b = int.parse(s);
+ sink1 = s;
+ sink2 = b;
}
+ check(sink2.isEven);
}
+}
+
+class ParseJsBigIntBenchmark extends Benchmark {
+ ParseJsBigIntBenchmark(String name, int bits) : super(name, bits);
@override
void run() {
@@ -144,27 +119,16 @@
}
}
-class FormatBigIntBenchmark extends BenchmarkBase {
- final int bits;
- final BigInt seed;
+class FormatBigIntBenchmark extends Benchmark {
final List<BigInt> values = [];
- FormatBigIntBenchmark(String name, this.bits)
- : seed = (BigInt.one << bits) - BigInt.one,
- super(name);
+ FormatBigIntBenchmark(String name, int bits) : super(name, bits);
@override
void setup() {
- var b = seed;
- var totalLength = 0;
- while (totalLength < requiredDigits) {
- if (b.bitLength < bits) {
- b = seed;
- }
- final string = b.toString();
+ for (String s in strings) {
+ BigInt b = BigInt.parse(s);
values.add(b - BigInt.one); // We add 'one' back later.
- totalLength += string.length;
- b = b - (b >> 8);
}
}
@@ -183,27 +147,45 @@
}
}
-class FormatInt64Benchmark extends BenchmarkBase {
- final int bits;
- final Int64 seed;
- final List<Int64> values = [];
+class FormatIntBenchmark extends Benchmark {
+ final List<int> values = [];
- FormatInt64Benchmark(String name, this.bits)
- : seed = (Int64.ONE << bits) - Int64.ONE,
- super(name);
+ FormatIntBenchmark(String name, int bits) : super(name, bits);
@override
void setup() {
- var b = seed;
- var totalLength = 0;
- while (totalLength < requiredDigits) {
- if (int64UnsignedBitLength(b) < bits) {
- b = seed;
- }
- final string = b.toStringUnsigned();
- values.add(b - Int64.ONE);
- totalLength += string.length;
- b = b - b.shiftRightUnsigned(8);
+ for (String s in strings) {
+ int b = int.parse(s);
+ values.add(b - 4096); // We add this back later.
+ }
+ }
+
+ @override
+ void run() {
+ for (final b0 in values) {
+ // Instances might cache `toString()`, so use arithmetic to create a new
+ // instance to try to protect against measuring a cached string. We use
+ // 4096 to avoid the arithmetic being a no-op due to rounding on web
+ // integers (i.e. doubles).
+ final b = b0 + 4096;
+ final s = b.toString();
+ sink1 = s;
+ sink2 = b;
+ }
+ check(sink2.isEven);
+ }
+}
+
+class FormatInt64Benchmark extends Benchmark {
+ final List<Int64> values = [];
+
+ FormatInt64Benchmark(String name, int bits) : super(name, bits);
+
+ @override
+ void setup() {
+ for (String s in strings) {
+ final b = Int64.parseInt(s);
+ values.add(b - Int64.ONE); // We add this back later.
}
}
@@ -222,32 +204,17 @@
}
}
-class FormatJsBigIntBenchmark extends BenchmarkBase {
- final int bits;
- final Object seed;
+class FormatJsBigIntBenchmark extends Benchmark {
final List<Object> values = [];
- FormatJsBigIntBenchmark(String name, this.bits)
- : seed = nativeBigInt.subtract(
- nativeBigInt.shiftLeft(
- nativeBigInt.one, nativeBigInt.fromInt(bits)),
- nativeBigInt.one),
- super(name);
+ FormatJsBigIntBenchmark(String name, int bits) : super(name, bits);
@override
void setup() {
final one = nativeBigInt.one;
- var b = seed;
- var totalLength = 0;
- while (totalLength < requiredDigits) {
- if (nativeBigInt.bitLength(b) < bits) {
- b = seed;
- }
- final string = nativeBigInt.toStringMethod(b);
- values.add(nativeBigInt.subtract(b, one)); // We add 'one' back later.
- totalLength += string.length;
- b = nativeBigInt.subtract(
- b, nativeBigInt.shiftRight(b, nativeBigInt.eight));
+ for (String s in strings) {
+ final b = nativeBigInt.parse(s);
+ values.add(nativeBigInt.subtract(b, one)); // We add this back later.
}
}
@@ -295,6 +262,12 @@
void main() {
final benchmarks = [
+ () => ParseIntBenchmark('Int.parse.0009.bits', 9),
+ () => ParseIntBenchmark('Int.parse.0032.bits', 32),
+ // Use '63' bits to avoid 64-bit arithmetic overflowing to negative. Keep
+ // the name as '64' to help comparisons. The effect of an incorrect number
+ // is reduced since benchmark results are normalized to a 'per digit' score
+ () => ParseIntBenchmark('Int.parse.0064.bits', 63),
() => ParseInt64Benchmark('Int64.parse.0009.bits', 9),
() => ParseInt64Benchmark('Int64.parse.0032.bits', 32),
() => ParseInt64Benchmark('Int64.parse.0064.bits', 64),
@@ -310,6 +283,9 @@
selectParseNativeBigIntBenchmark('JsBigInt.parse.0256.bits', 256),
selectParseNativeBigIntBenchmark('JsBigInt.parse.1024.bits', 1024),
selectParseNativeBigIntBenchmark('JsBigInt.parse.4096.bits', 4096),
+ () => FormatIntBenchmark('Int.toString.0009.bits', 9),
+ () => FormatIntBenchmark('Int.toString.0032.bits', 32),
+ () => FormatIntBenchmark('Int.toString.0064.bits', 63), // '63': See above.
() => FormatInt64Benchmark('Int64.toString.0009.bits', 9),
() => FormatInt64Benchmark('Int64.toString.0032.bits', 32),
() => FormatInt64Benchmark('Int64.toString.0064.bits', 64),
diff --git a/pkg/dev_compiler/tool/dart2js_nnbd_sdk_error_golden.txt b/pkg/dev_compiler/tool/dart2js_nnbd_sdk_error_golden.txt
index 22d60a1..91c4e1e 100644
--- a/pkg/dev_compiler/tool/dart2js_nnbd_sdk_error_golden.txt
+++ b/pkg/dev_compiler/tool/dart2js_nnbd_sdk_error_golden.txt
@@ -3,8 +3,6 @@
ERROR|COMPILE_TIME_ERROR|INCONSISTENT_INHERITANCE|lib/_internal/js_runtime/lib/interceptors.dart|1718|7|5|Superinterfaces don't have a valid override for '>>': JSNumber.>> (num Function(num)), int.>> (int Function(int)).
ERROR|COMPILE_TIME_ERROR|INCONSISTENT_INHERITANCE|lib/_internal/js_runtime/lib/interceptors.dart|1718|7|5|Superinterfaces don't have a valid override for '\|': JSNumber.\| (num Function(num)), int.\| (int Function(int)).
ERROR|COMPILE_TIME_ERROR|INCONSISTENT_INHERITANCE|lib/_internal/js_runtime/lib/interceptors.dart|1718|7|5|Superinterfaces don't have a valid override for '^': JSNumber.^ (num Function(num)), int.^ (int Function(int)).
-ERROR|COMPILE_TIME_ERROR|RETURN_OF_INVALID_TYPE|lib/_internal/js_runtime/lib/interceptors.dart|1573|14|45|A value of type 'double' can't be returned from method '%' because it has a return type of 'JSNumber'.
-ERROR|COMPILE_TIME_ERROR|RETURN_OF_INVALID_TYPE|lib/_internal/js_runtime/lib/interceptors.dart|1575|14|45|A value of type 'double' can't be returned from method '%' because it has a return type of 'JSNumber'.
ERROR|COMPILE_TIME_ERROR|UNDEFINED_OPERATOR|lib/_internal/js_runtime/lib/interceptors.dart|1735|28|1|The operator '&' isn't defined for the type 'JSInt'.
ERROR|COMPILE_TIME_ERROR|UNDEFINED_OPERATOR|lib/_internal/js_runtime/lib/interceptors.dart|1737|27|1|The operator '&' isn't defined for the type 'JSInt'.
ERROR|COMPILE_TIME_ERROR|UNDEFINED_OPERATOR|lib/_internal/js_runtime/lib/interceptors.dart|1740|17|1|The operator '&' isn't defined for the type 'JSInt'.
diff --git a/pkg/dev_compiler/tool/dartdevc_nnbd_sdk_error_golden.txt b/pkg/dev_compiler/tool/dartdevc_nnbd_sdk_error_golden.txt
index 5237a17..dd6530e 100644
--- a/pkg/dev_compiler/tool/dartdevc_nnbd_sdk_error_golden.txt
+++ b/pkg/dev_compiler/tool/dartdevc_nnbd_sdk_error_golden.txt
@@ -2,9 +2,6 @@
ERROR|COMPILE_TIME_ERROR|CONST_CONSTRUCTOR_THROWS_EXCEPTION|lib/core/core.dart|7888|5|97|Const constructors can't throw exceptions.
ERROR|COMPILE_TIME_ERROR|CONST_CONSTRUCTOR_THROWS_EXCEPTION|lib/core/core.dart|893|5|95|Const constructors can't throw exceptions.
ERROR|COMPILE_TIME_ERROR|CONST_CONSTRUCTOR_THROWS_EXCEPTION|lib/core/core.dart|926|5|94|Const constructors can't throw exceptions.
-ERROR|COMPILE_TIME_ERROR|INVALID_ASSIGNMENT|lib/_internal/js_dev_runtime/private/interceptors.dart|1358|18|27|A value of type 'double' can't be assigned to a variable of type 'int'.
-ERROR|COMPILE_TIME_ERROR|RETURN_OF_INVALID_TYPE|lib/_internal/js_dev_runtime/private/interceptors.dart|1225|14|38|A value of type 'double' can't be returned from method '%' because it has a return type of 'JSNumber'.
-ERROR|COMPILE_TIME_ERROR|RETURN_OF_INVALID_TYPE|lib/_internal/js_dev_runtime/private/interceptors.dart|1227|14|38|A value of type 'double' can't be returned from method '%' because it has a return type of 'JSNumber'.
ERROR|SYNTACTIC_ERROR|CONST_FACTORY|lib/core/core.dart|3677|3|5|Only redirecting factory constructors can be declared to be 'const'.
ERROR|SYNTACTIC_ERROR|CONST_FACTORY|lib/core/core.dart|7886|3|5|Only redirecting factory constructors can be declared to be 'const'.
ERROR|SYNTACTIC_ERROR|CONST_FACTORY|lib/core/core.dart|891|3|5|Only redirecting factory constructors can be declared to be 'const'.
diff --git a/sdk/lib/_internal/js_dev_runtime/private/js_number.dart b/sdk/lib/_internal/js_dev_runtime/private/js_number.dart
index 5d6f6ac..60b9246 100644
--- a/sdk/lib/_internal/js_dev_runtime/private/js_number.dart
+++ b/sdk/lib/_internal/js_dev_runtime/private/js_number.dart
@@ -285,9 +285,9 @@
if (result == 0) return (0 as JSNumber); // Make sure we don't return -0.0.
if (result > 0) return result;
if (JS<JSNumber>('!', '#', other) < 0) {
- return result - JS<JSNumber>('!', '#', other);
+ return JS<JSNumber>('!', '# - #', result, other);
} else {
- return result + JS<JSNumber>('!', '#', other);
+ return JS<JSNumber>('!', '# + #', result, other);
}
}
@@ -418,7 +418,7 @@
@notNull
int get bitLength {
- int nonneg = this < 0 ? -this - 1 : this;
+ int nonneg = JS<int>('!', '#', this < 0 ? -this - 1 : this);
int wordBits = 32;
while (nonneg >= 0x100000000) {
nonneg = nonneg ~/ 0x100000000;
diff --git a/sdk/lib/_internal/js_runtime/lib/js_number.dart b/sdk/lib/_internal/js_runtime/lib/js_number.dart
index 489da64..f32f0fa 100644
--- a/sdk/lib/_internal/js_runtime/lib/js_number.dart
+++ b/sdk/lib/_internal/js_runtime/lib/js_number.dart
@@ -310,9 +310,9 @@
if (result == 0) return JS('num', '0'); // Make sure we don't return -0.0.
if (result > 0) return result;
if (JS('num', '#', other) < 0) {
- return result - JS<JSNumber>('JSNumber', '#', other);
+ return JS<JSNumber>('JSNumber', '# - #', result, other);
} else {
- return result + JS<JSNumber>('JSNumber', '#', other);
+ return JS<JSNumber>('JSNumber', '# + #', result, other);
}
}
@@ -486,7 +486,7 @@
}
int get bitLength {
- int nonneg = (this < 0 ? -this - 1 : this) as int;
+ int nonneg = JS<int>('int', '#', this < 0 ? -this - 1 : this);
int wordBits = 32;
while (nonneg >= 0x100000000) {
nonneg = nonneg ~/ 0x100000000;
diff --git a/tools/VERSION b/tools/VERSION
index 7291e4f..f8fc983 100644
--- a/tools/VERSION
+++ b/tools/VERSION
@@ -27,5 +27,5 @@
MAJOR 2
MINOR 12
PATCH 0
-PRERELEASE 162
+PRERELEASE 163
PRERELEASE_PATCH 0
\ No newline at end of file