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

Unified Diff: tests/compiler/dart2js_extra/constant_javascript_semantics3_test.dart

Issue 11086046: Add another test for JS semantics. (range propagation). (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 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
« no previous file with comments | « no previous file | tests/compiler/dart2js_extra/dart2js_extra.status » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/compiler/dart2js_extra/constant_javascript_semantics3_test.dart
diff --git a/tests/compiler/dart2js_extra/constant_javascript_semantics2_test.dart b/tests/compiler/dart2js_extra/constant_javascript_semantics3_test.dart
similarity index 56%
copy from tests/compiler/dart2js_extra/constant_javascript_semantics2_test.dart
copy to tests/compiler/dart2js_extra/constant_javascript_semantics3_test.dart
index af4872fd2b066b46cfd00062dfb04b78f0bc6771..b21674d2bac51a93a7232318dc4d8ac0177c2202 100644
--- a/tests/compiler/dart2js_extra/constant_javascript_semantics2_test.dart
+++ b/tests/compiler/dart2js_extra/constant_javascript_semantics3_test.dart
@@ -6,16 +6,28 @@
// In this case we test that the value-range analysis uses JavaScript semantics
// too.
-int inscrutable(int x) => x == 0 ? 0 : x | inscrutable(x & (x - 1));
+int inscrutable(int x) {
+ if (x == 0) return 0;
+ return x | inscrutable(x & (x - 1));
+}
foo() {
- var a = const [1, 2];
- var i = 0x100000000;
+ var a = const [1, 2, 3, 4];
+ var i = 8007199254740992;
if (inscrutable(i) == 0) {
- i = 0x100000001;
+ i++;
}
- i = 0xFFFFFFFFF & i; // In JS semantics [:i:] will be truncated to 32 bits.
- i = 0x100000001 - i;
+ i += 1000000000000000;
+ // [i] is now at its maximum 53 bit value. The following increments will not
+ // have any effect.
+ i++;
+ i++;
+ i++;
+ i -= 1000000000000000;
+ i--;
+ i--;
+ i--;
+ i -= 8007199254740992; // In JS semantics [i] would be -3, now.
return a[i];
}
« no previous file with comments | « no previous file | tests/compiler/dart2js_extra/dart2js_extra.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698