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

Unified Diff: test/dart_codegen/expect/math/math

Issue 961493003: don't run dart gen on JS patch code (Closed) Base URL: git@github.com:dart-lang/dev_compiler.git@master
Patch Set: Created 5 years, 10 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 | « test/dart_codegen/expect/core/uri.dart ('k') | test/dart_codegen/expect/math/random.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/dart_codegen/expect/math/math
diff --git a/test/dart_codegen/expect/math/math b/test/dart_codegen/expect/math/math
index c410873645cf35c503184a228b3535c84279a14f..88443a483f94e5ea1ab16e4a9b5c58a65af86a74 100644
--- a/test/dart_codegen/expect/math/math
+++ b/test/dart_codegen/expect/math/math
@@ -47,161 +47,14 @@ num max(num a, num b) {
if (b == 0 && a.isNegative) return b;
return a;
}
-double atan2(num a, num b) => ((__x13) => DDC$RT.cast(__x13, dynamic, double,
- "CastGeneral", """line 150, column 6 of dart:math: """, __x13 is double,
- true))(JS('double', r'Math.atan2(#, #)', checkNum(a), checkNum(b)));
-num pow(num x, num exponent) {
- checkNum(x);
- checkNum(exponent);
- return ((__x14) => DDC$RT.cast(__x14, dynamic, num, "CastGeneral",
- """line 192, column 10 of dart:math: """, __x14 is num,
- true))(JS('num', r'Math.pow(#, #)', x, exponent));
-}
-double sin(num x) => ((__x15) => DDC$RT.cast(__x15, dynamic, double,
- "CastGeneral", """line 201, column 6 of dart:math: """, __x15 is double,
- true))(JS('double', r'Math.sin(#)', checkNum(x)));
-double cos(num x) => ((__x16) => DDC$RT.cast(__x16, dynamic, double,
- "CastGeneral", """line 209, column 6 of dart:math: """, __x16 is double,
- true))(JS('double', r'Math.cos(#)', checkNum(x)));
-double tan(num x) => ((__x17) => DDC$RT.cast(__x17, dynamic, double,
- "CastGeneral", """line 219, column 6 of dart:math: """, __x17 is double,
- true))(JS('double', r'Math.tan(#)', checkNum(x)));
-double acos(num x) => ((__x18) => DDC$RT.cast(__x18, dynamic, double,
- "CastGeneral", """line 228, column 6 of dart:math: """, __x18 is double,
- true))(JS('double', r'Math.acos(#)', checkNum(x)));
-double asin(num x) => ((__x19) => DDC$RT.cast(__x19, dynamic, double,
- "CastGeneral", """line 236, column 6 of dart:math: """, __x19 is double,
- true))(JS('double', r'Math.asin(#)', checkNum(x)));
-double atan(num x) => ((__x20) => DDC$RT.cast(__x20, dynamic, double,
- "CastGeneral", """line 243, column 6 of dart:math: """, __x20 is double,
- true))(JS('double', r'Math.atan(#)', checkNum(x)));
-double sqrt(num x) => ((__x21) => DDC$RT.cast(__x21, dynamic, double,
- "CastGeneral", """line 251, column 6 of dart:math: """, __x21 is double,
- true))(JS('double', r'Math.sqrt(#)', checkNum(x)));
-double exp(num x) => ((__x22) => DDC$RT.cast(__x22, dynamic, double,
- "CastGeneral", """line 259, column 6 of dart:math: """, __x22 is double,
- true))(JS('double', r'Math.exp(#)', checkNum(x)));
-double log(num x) => ((__x23) => DDC$RT.cast(__x23, dynamic, double,
- "CastGeneral", """line 267, column 6 of dart:math: """, __x23 is double,
- true))(JS('double', r'Math.log(#)', checkNum(x)));
-const int _POW2_32 = 0x100000000;
-class _JSRandom implements Random {
- const _JSRandom();
- int nextInt(int max) {
- if (max <= 0 || max > _POW2_32) {
- throw new RangeError("max must be in range 0 < max ≤ 2^32, was $max");
- }
- return ((__x24) => DDC$RT.cast(__x24, dynamic, int, "CastGeneral",
- """line 278, column 12 of dart:math: """, __x24 is int,
- true))(JS("int", "(Math.random() * #) >>> 0", max));
- }
- double nextDouble() => ((__x25) => DDC$RT.cast(__x25, dynamic, double,
- "CastGeneral", """line 285, column 26 of dart:math: """, __x25 is double,
- true))(JS("double", "Math.random()"));
- bool nextBool() => ((__x26) => DDC$RT.cast(__x26, dynamic, bool,
- "CastGeneral", """line 290, column 22 of dart:math: """, __x26 is bool,
- true))(JS("bool", "Math.random() < 0.5"));
-}
-class _Random implements Random {
- static const double _POW2_53_D = 1.0 * (0x20000000000000);
- static const double _POW2_27_D = 1.0 * (1 << 27);
- static const int _MASK32 = 0xFFFFFFFF;
- int _lo = 0;
- int _hi = 0;
- _Random(int seed) {
- int empty_seed = 0;
- if (seed < 0) {
- empty_seed = -1;
- }
- do {
- int low = seed & _MASK32;
- seed = (seed - low) ~/ _POW2_32;
- int high = seed & _MASK32;
- seed = (seed - high) ~/ _POW2_32;
- int tmplow = low << 21;
- int tmphigh = (high << 21) | (low >> 11);
- tmplow = (~low & _MASK32) + tmplow;
- low = tmplow & _MASK32;
- high = (~high + tmphigh + ((tmplow - low) ~/ 0x100000000)) & _MASK32;
- tmphigh = high >> 24;
- tmplow = (low >> 24) | (high << 8);
- low ^= tmplow;
- high ^= tmphigh;
- tmplow = low * 265;
- low = tmplow & _MASK32;
- high = (high * 265 + (tmplow - low) ~/ 0x100000000) & _MASK32;
- tmphigh = high >> 14;
- tmplow = (low >> 14) | (high << 18);
- low ^= tmplow;
- high ^= tmphigh;
- tmplow = low * 21;
- low = tmplow & _MASK32;
- high = (high * 21 + (tmplow - low) ~/ 0x100000000) & _MASK32;
- tmphigh = high >> 28;
- tmplow = (low >> 28) | (high << 4);
- low ^= tmplow;
- high ^= tmphigh;
- tmplow = low << 31;
- tmphigh = (high << 31) | (low >> 1);
- tmplow += low;
- low = tmplow & _MASK32;
- high = (high + tmphigh + (tmplow - low) ~/ 0x100000000) & _MASK32;
- tmplow = _lo * 1037;
- _lo = tmplow & _MASK32;
- _hi = (_hi * 1037 + (tmplow - _lo) ~/ 0x100000000) & _MASK32;
- _lo ^= low;
- _hi ^= high;
- } while (seed != empty_seed);
- if (_hi == 0 && _lo == 0) {
- _lo = 0x5A17;
- }
- _nextState();
- _nextState();
- _nextState();
- _nextState();
- }
- void _nextState() {
- int tmpHi = 0xFFFF0000 * _lo;
- int tmpHiLo = tmpHi & _MASK32;
- int tmpHiHi = tmpHi - tmpHiLo;
- int tmpLo = 0xDA61 * _lo;
- int tmpLoLo = tmpLo & _MASK32;
- int tmpLoHi = tmpLo - tmpLoLo;
- int newLo = tmpLoLo + tmpHiLo + _hi;
- _lo = newLo & _MASK32;
- int newLoHi = newLo - _lo;
- _hi = ((tmpLoHi + tmpHiHi + newLoHi) ~/ _POW2_32) & _MASK32;
- assert(_lo < _POW2_32);
- assert(_hi < _POW2_32);
- }
- int nextInt(int max) {
- if (max <= 0 || max > _POW2_32) {
- throw new RangeError("max must be in range 0 < max ≤ 2^32, was $max");
- }
- if ((max & (max - 1)) == 0) {
- _nextState();
- return _lo & (max - 1);
- }
- int rnd32;
- int result;
- do {
- _nextState();
- rnd32 = _lo;
- result = ((__x27) => DDC$RT.cast(__x27, num, int, "CastGeneral",
- """line 424, column 16 of dart:math: """, __x27 is int,
- true))(rnd32.remainder(max));
- } while ((rnd32 - result + max) >= _POW2_32);
- return result;
- }
- double nextDouble() {
- _nextState();
- int bits26 = _lo & ((1 << 26) - 1);
- _nextState();
- int bits27 = _lo & ((1 << 27) - 1);
- return (bits26 * _POW2_27_D + bits27) / _POW2_53_D;
- }
- bool nextBool() {
- _nextState();
- return (_lo & 1) == 0;
- }
-}
+external double atan2(num a, num b);
+external num pow(num x, num exponent);
+external double sin(num x);
+external double cos(num x);
+external double tan(num x);
+external double acos(num x);
+external double asin(num x);
+external double atan(num x);
+external double sqrt(num x);
+external double exp(num x);
+external double log(num x);
« no previous file with comments | « test/dart_codegen/expect/core/uri.dart ('k') | test/dart_codegen/expect/math/random.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698