Commit Graph

30 Commits

Author SHA1 Message Date
Stephen Adams 231de7d3c2 Int64 improvements
1. Avoid test for JavaScript vs VM
2. strengthen & and | masking to help infer uint31 types in tests

R=cbracken@google.com

Review URL: https://codereview.chromium.org/1520773002 .
2015-12-14 13:50:11 -08:00
Stephen Adams 7926e2630f Better errors for pkg/fixnum
Replace `new ArgumentError(x)` with `new ArgumentError.value(x)`.
Throw RangeError for bad radix arguments.

R=cbracken@google.com

Review URL: https://codereview.chromium.org//1184183006.
2015-06-19 12:35:07 -07:00
sra@google.com 609875aaa2 Int64 tweaks for better type infererence
In some programs Int64._l was inferred as possibly null.

BUG=
R=herhut@google.com

Review URL: https://codereview.chromium.org//950733002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@43998 260f80e4-7a28-3924-810f-c04153c831b5
2015-02-24 20:52:00 +00:00
jacobr@google.com 3a82813e87 Cleanup IntX to implement Comparable<FixNum> which is more descriptive than Comparable as it would be unsafe to attempt to sort an array with both int and FixNum.
BUG=
R=sra@google.com

Review URL: https://codereview.chromium.org//875323002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@43365 260f80e4-7a28-3924-810f-c04153c831b5
2015-02-02 22:53:27 +00:00
sra@google.com 30366cf249 Int64 tweaks for type inference
We can cause _l, _m and _h to be inferred by dart2js as a non-negative 31-bit int which leads to better code for shifts.

R=floitsch@google.com

Review URL: https://codereview.chromium.org//404453002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@38680 260f80e4-7a28-3924-810f-c04153c831b5
2014-07-29 16:51:13 +00:00
kevmoo@google.com 7ebebc7d74 use proper notation for true, false, and null in doc comments
BUG= https://code.google.com/p/dart/issues/detail?id=16193
R=lrn@google.com

Review URL: https://codereview.chromium.org//140783013

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@31947 260f80e4-7a28-3924-810f-c04153c831b5
2014-01-19 19:24:06 +00:00
cbracken@google.com 8d55ace137 Eliminate deprecated Int32/Int64.fromInt() constructors
BUG=
R=sra@google.com

Review URL: https://codereview.chromium.org//38113004

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@29202 260f80e4-7a28-3924-810f-c04153c831b5
2013-10-24 20:17:12 +00:00
cbracken@google.com d520000fe9 Throw FormatException when Int32/Int64.parseRadix() encounters bad digit
BUG=
R=sra@google.com

Review URL: https://codereview.chromium.org//34223002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@29109 260f80e4-7a28-3924-810f-c04153c831b5
2013-10-23 19:04:43 +00:00
cbracken@google.com 8e3a216f33 Added bitLength, clamp(), toDouble(), toSigned(), toUnsigned().
BUG=
R=sra@google.com

Review URL: https://codereview.chromium.org//24388004

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@27862 260f80e4-7a28-3924-810f-c04153c831b5
2013-09-25 00:02:28 +00:00
cbracken@google.com 0b68c45e9c Int32, Int64 default constructor now takes an optional int parameter.
Deprecated.fromInt().

BUG=
R=sra@google.com

Review URL: https://codereview.chromium.org//24372002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@27777 260f80e4-7a28-3924-810f-c04153c831b5
2013-09-23 16:52:36 +00:00
sra@google.com 7b8bb93212 New divide uses local variables rather than many temporary objects.
Removing mutators allows Int64 to have final fields and an (internal) const constructor.

R=cbracken@google.com

Review URL: https://codereview.chromium.org//23541010

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@27588 260f80e4-7a28-3924-810f-c04153c831b5
2013-09-18 01:02:20 +00:00
sra@google.com 15fc29db41 Fix assert in int64 and add test
Review URL: https://codereview.chromium.org//23490010

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@26816 260f80e4-7a28-3924-810f-c04153c831b5
2013-08-28 20:52:07 +00:00
sra@google.com bed52fac0d More efficient Int64 parsing and printing.
This replaces code that generates lots of temporary Int64 objects with
code that works almost entirely usings SMI values in local variables.
Printing generates numbers several digits at a time.

Speedup is 10x for parsing and 100x for printing on dart2js and a little over 5x each on the VM.

Printing produces hex digits in the same case as int.toString.

R=cbracken@google.com

Review URL: https://codereview.chromium.org//23441004

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@26760 260f80e4-7a28-3924-810f-c04153c831b5
2013-08-28 01:34:06 +00:00
kathyw@google.com 210edb7a54 Update meta and logging library descriptions; tweak fixnum
R=mcampione@google.com

Review URL: https://codereview.chromium.org//23220007

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@26562 260f80e4-7a28-3924-810f-c04153c831b5
2013-08-22 22:17:10 +00:00
cbracken@google.com d352df8d05 Added fixnum package docs.
Original bug:
http://dartbug.com/7834

BUG=
R=kathyw@google.com

Review URL: https://codereview.chromium.org//23173002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@26134 260f80e4-7a28-3924-810f-c04153c831b5
2013-08-14 18:30:55 +00:00
cbracken@google.com 25ed5a4234 Clean up exceptions thrown in pkg/fixnum.
* Throw ArgumentError rather than string.
* Don't wrap ArgumentError params in strings.

Original Issue:
https://code.google.com/p/dart/issues/detail?id=9909

BUG=
R=justinfagnani@google.com

Review URL: https://codereview.chromium.org//21155004

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@25635 260f80e4-7a28-3924-810f-c04153c831b5
2013-07-30 20:40:00 +00:00
cbracken@google.com 0bcf5eff82 Int32 constants should be const.
BUG=
R=justinfagnani@google.com

Review URL: https://codereview.chromium.org//21169002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@25634 260f80e4-7a28-3924-810f-c04153c831b5
2013-07-30 20:34:00 +00:00
cbracken@google.com 6a728556d1 Rename int{x,32,64} to Int{X,32,64} in line with naming guidelines.
BUG=
R=justinfagnani@google.com

Review URL: https://codereview.chromium.org//21085005

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@25584 260f80e4-7a28-3924-810f-c04153c831b5
2013-07-29 21:19:59 +00:00
cbracken@google.com 79bd97594e Don't throw exception for non-integer args to fixnum int32,int64 op ==
Original bug
https://code.google.com/p/dart/issues/detail?id=12073

BUG=
R=justinfagnani@google.com

Review URL: https://codereview.chromium.org//20803006

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@25577 260f80e4-7a28-3924-810f-c04153c831b5
2013-07-29 17:56:29 +00:00
cbracken@google.com 85462a9c08 Migrate fixnum tests to unittest. Fix int32 rollover bug.
- Migrated tests to unittest
- Reorganized tests by operator
- Test coverage for +/- overflow/rollover
- Test coverage for null args
- Test coverage for unary -
- Test coverage for comparison operators

BUG=
R=justinfagnani@google.com

Review URL: https://codereview.chromium.org//19669002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@25176 260f80e4-7a28-3924-810f-c04153c831b5
2013-07-18 20:44:47 +00:00
lrn@google.com 6b4f4b1bab Change new List(n) to return fixed length list.
Deprecate List.fixedLength, add List.filled.

Make Iterable.toList and List.from take "growable" argument,
defaulting to false.

Review URL: https://codereview.chromium.org//12328104

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@19112 260f80e4-7a28-3924-810f-c04153c831b5
2013-02-27 08:45:04 +00:00
lrn@google.com 3c0ac360e7 Remove deprecated string features.
Make String.codeUnits return a List.

Review URL: https://codereview.chromium.org//12282038

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@18960 260f80e4-7a28-3924-810f-c04153c831b5
2013-02-25 10:48:09 +00:00
lrn@google.com bbfe7b02dc Reapply "Make Comparable generic."
Avoid concurrent modification in dart2js.
Avoid crash in VM by not using self-referential type bound.

Review URL: https://codereview.chromium.org//12288040

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@18667 260f80e4-7a28-3924-810f-c04153c831b5
2013-02-19 10:29:44 +00:00
kasperl@google.com d4feeb4910 Revert "Make Comparable generic."
This reverts commit dd714db881a0ad63eaa1e5491e93dd8843eb5929.

R=lrn@google.com
BUG=

Review URL: https://codereview.chromium.org//12298027

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@18657 260f80e4-7a28-3924-810f-c04153c831b5
2013-02-19 08:06:03 +00:00
lrn@google.com a0f22b77be Make Comparable generic.
It's now allowed to write "class X implements Comparable<X>" to make
X comparable only to X's. The argument type of Comparable<T>.compareTo
is now T.

Review URL: https://codereview.chromium.org//12255055

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@18655 260f80e4-7a28-3924-810f-c04153c831b5
2013-02-19 07:52:24 +00:00
floitsch@google.com 4a7dfd2da3 Big merge from experimental to bleeding edge.
Review URL: https://codereview.chromium.org//11783009

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@16687 260f80e4-7a28-3924-810f-c04153c831b5
2013-01-07 11:23:16 +00:00
lrn@google.com 22309b260c Remove NullPointerException.
Accessing non-existing members on null now throws NoSuchMethodError.
Throwing a null value fails by throwing a NullThrownError.
Methods checking for null now generally throw new ArgumentError(null).

Committed: https://code.google.com/p/dart/source/detail?r=15061

Review URL: https://codereview.chromium.org//11415028

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@15136 260f80e4-7a28-3924-810f-c04153c831b5
2012-11-20 09:21:52 +00:00
lrn@google.com 0c8dce77f1 Revert "Remove NullPointerException."
Crashes in the x64 VM.

Review URL: https://codereview.chromium.org//11417058

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@15065 260f80e4-7a28-3924-810f-c04153c831b5
2012-11-19 09:59:59 +00:00
lrn@google.com e211c2f0ee Remove NullPointerException.
Accessing non-existing members on null now throws NoSuchMethodError.
Throwing a null value fails by throwing a NullThrownError.
Methods checking for null now generally throw new ArgumentError(null).

Review URL: https://codereview.chromium.org//11415028

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@15061 260f80e4-7a28-3924-810f-c04153c831b5
2012-11-19 08:51:49 +00:00
rnystrom@google.com 016676683a Update fixnum to new package guidelines.
BUG=

Review URL: https://codereview.chromium.org//11405003

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@14760 260f80e4-7a28-3924-810f-c04153c831b5
2012-11-09 21:28:21 +00:00