Alexander Markov
c3b5939965
[vm] Remove --limit-ints-to-64-bits option and old _Bigint class
...
Closes https://github.com/dart-lang/sdk/issues/33306
Change-Id: I7088d8b7143edbe24f5cefe4be037ad2006e0625
Reviewed-on: https://dart-review.googlesource.com/58101
Commit-Queue: Alexander Markov <alexmarkov@google.com >
Reviewed-by: Régis Crelier <regis@google.com >
Reviewed-by: Ryan Macnak <rmacnak@google.com >
2018-06-04 20:10:40 +00:00
Alexander Markov
fc27a2c9d4
[vm/corelib] Fix int/double comparisons in num.compareTo
...
* double.compareTo(int) is fixed to handle integers which are not
precisely representable as doubles.
* int.compareTo(double) is fixed to properly handle doubles which
are clamped when converted to integers (with Dart 2.0 fixed-size
integers).
* Test for num.compareTo is updated for fixed-size integers; more corner
cases added.
Closes https://github.com/dart-lang/sdk/issues/31917
Change-Id: I8e98c3627f032082ab6a397713dece436585afd1
Reviewed-on: https://dart-review.googlesource.com/35004
Commit-Queue: Alexander Markov <alexmarkov@google.com >
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com >
Reviewed-by: Régis Crelier <regis@google.com >
2018-01-22 18:22:28 +00:00
Paul Berry
ba2417fdc0
Fix SDK errors due to inconsistent inheritance of Operator==.
...
The informal spec for strong mode top level inference
(https://github.com/dart-lang/sdk/pull/28218 ) says "If there are
multiple overridden/implemented methods, and any two of them have
non-equal types (declared or inferred) for a parameter position which
is being inferred for the overriding method, it is an error."
This CL fixes several SDK errors that arise from this rule. For
example, the classes _Closure, Function, and Object contained members
declared as follows:
class _Closure implements Function {
bool operator ==(other) ...
}
class Function {
bool operator ==(Object other) ...
}
class Object {
bool operator ==(other) ...
}
The type of Object's operator == was (dynamic) -> bool; the type of
Function's operator == was (Object) -> bool; therefore the type of
_Closure's operator == (which overrides both, since _Closure extends
Object and implements Function) cannot be inferred and must be
specified.
A similar situation exists for _Double and _IntegerImplementation
(both implement num, which declares operator == to have type (Object)
-> bool), and _Uri (which implements Uri, which declares operator ==
to have type (Object) -> bool).
This CL fixes the error by specifying the type explicitly in the
classes _Closure, _Double, _IntegerImplementation, and _Uri.
Change-Id: I91f7ceef8549399d438ba4be8c408493b3f338db
Reviewed-on: https://dart-review.googlesource.com/28100
Reviewed-by: Vyacheslav Egorov <vegorov@google.com >
2017-12-11 13:02:19 +00:00
Lasse R.H. Nielsen
0b58c4bd10
Change some constant declarations to lowerCase.
...
Retain the old values.
Reapply of https://dart-review.googlesource.com/c/sdk/+/20680 with fixes
for VM method fingerprints.
Change-Id: Ie14e7ccc3194d5561983348e6b6752728913ff4d
Reviewed-on: https://dart-review.googlesource.com/20664
Reviewed-by: Erik Ernst <eernst@google.com >
Commit-Queue: Lasse R.H. Nielsen <lrn@google.com >
2017-11-14 12:59:14 +00:00
Lasse R.H. Nielsen
e61fc07b58
Revert "Change some constant declarations to lowerCase."
...
This reverts commit c048cfb178 .
Reason for revert: VM code fingerprints needs update.
Original change's description:
> Change some constant declarations to lowerCase.
>
> Retain the old values.
>
> Change-Id: I03bd326f379fe5f96d8f6081a7133de956d745c0
> Reviewed-on: https://dart-review.googlesource.com/11520
> Commit-Queue: Lasse R.H. Nielsen <lrn@google.com >
> Reviewed-by: Florian Loitsch <floitsch@google.com >
TBR=lrn@google.com ,floitsch@google.com
Change-Id: I095e8198304ca4e59b39d30b0fdf0af4945e5231
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/20680
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com >
Commit-Queue: Lasse R.H. Nielsen <lrn@google.com >
2017-11-14 11:23:08 +00:00
Lasse R.H. Nielsen
c048cfb178
Change some constant declarations to lowerCase.
...
Retain the old values.
Change-Id: I03bd326f379fe5f96d8f6081a7133de956d745c0
Reviewed-on: https://dart-review.googlesource.com/11520
Commit-Queue: Lasse R.H. Nielsen <lrn@google.com >
Reviewed-by: Florian Loitsch <floitsch@google.com >
2017-11-14 11:13:04 +00:00
Alexander Markov
c84e2968ac
[VM] Avoid dynamic call in _Double.==
...
Change-Id: Iab301370f33c375db1cd52f8eb87500955dfab09
Reviewed-on: https://dart-review.googlesource.com/17722
Reviewed-by: Vyacheslav Egorov <vegorov@google.com >
Commit-Queue: Alexander Markov <alexmarkov@google.com >
2017-10-31 22:01:09 +00:00
Kasper Lund
1db8615e29
Avoid just truncating to the nearby int in double.hashCode.
...
Preserves the property that doubles and ints that are equal
share the same hash code, but gives different doubles a much
higher chance of having different hash codes.
BUG=https://github.com/dart-lang/sdk/issues/2884
Change-Id: Ia97164087db568f26ffbbd6854ed9c19f81e9611
Reviewed-on: https://dart-review.googlesource.com/15140
Commit-Queue: Kasper Lund <kasperl@google.com >
Reviewed-by: Vyacheslav Egorov <vegorov@google.com >
2017-10-23 06:47:20 +00:00
Peter von der Ahé
e8aef37eac
Clean up patches so they can be compiled by Fasta.
...
Change-Id: Ie436375c78496366accf0ba82938e54cbe30b143
Reviewed-on: https://dart-review.googlesource.com/3001
Commit-Queue: Peter von der Ahé <ahe@google.com >
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com >
Reviewed-by: Vyacheslav Egorov <vegorov@google.com >
Reviewed-by: Johnni Winther <johnniwinther@google.com >
2017-10-05 14:05:50 +00:00
Jacob Richman
4360e99d18
Revert "Fix observatory tests broken by running dartfmt."
...
This reverts commit b1f7e6d94673b098c93c187fe3efc45c15f27edc.
BUG=
Committed: https://github.com/dart-lang/sdk/commit/62be0eacfbb36bdc92a05c7c35bb4506621b6a3a
Review-Url: https://codereview.chromium.org/2767533002 .
2017-03-21 10:07:26 -07:00
Jacob Richman
62be0eacfb
Revert "Fix observatory tests broken by running dartfmt."
...
This reverts commit b1f7e6d94673b098c93c187fe3efc45c15f27edc.
BUG=
Review-Url: https://codereview.chromium.org/2767533002 .
2017-03-20 22:19:22 -07:00
Jacob Richman
88f8aacd5f
Re-apply rolled back CL to apply dartfmt to runtime.
...
Fix observatory tests broken by running dartfmt due to line and column changes.
Temporarily reverted formatting for evaluate_activation_test.dart as dartfmt doesn't yet handle multitests.
BUG=
R=johnmccutchan@google.com
Review-Url: https://codereview.chromium.org/2759973004 .
2017-03-20 21:44:59 -07:00
Ryan Macnak
ea4744a06f
Revert "Run dartfmt on all files under runtime."
...
This reverts commit 15f393f189 .
The change caused many service test failures due to changed line numbers.
TBR=jacobr@google.com
Review-Url: https://codereview.chromium.org/2762583003 .
2017-03-20 13:42:55 -07:00
Jacob Richman
15f393f189
Run dartfmt on all files under runtime.
...
I've omitted files where the formatter output is significantly uglier
than the original code and I'll send those files in a separate CL
with options for how to make the code look reasonable while still
taking advantage of the formatter.
BUG=
R=johnmccutchan@google.com
Review-Url: https://codereview.chromium.org/2751423005 .
2017-03-20 13:13:50 -07:00
Regis Crelier
80f289e54d
Remove getter p on double in the VM to control fractional precision.
...
R=asiva@google.com
Review URL: https://codereview.chromium.org/2489713002 .
2016-11-09 10:56:55 -08:00
Vyacheslav Egorov
0635b57d43
Reland "Recognize and optimize a.runtimeType == b.runtimeType pattern."
...
This relands commit f4ec20abac .
BUG=
R=rmacnak@google.com
Review URL: https://codereview.chromium.org/2465793003 .
2016-11-01 16:49:02 +01:00
Vyacheslav Egorov
16e4f2f1c2
Revert "Revert "Revert "Recognize and optimize a.runtimeType == b.runtimeType pattern."""
...
This reverts commit e495e100dd .
Commit breaks bots that are using Android devices (SIMARM is unaffected).
R=rmacnak@google.com
BUG=
Review URL: https://codereview.chromium.org/2449013004 .
2016-10-26 16:53:32 +02:00
Vyacheslav Egorov
e495e100dd
Revert "Revert "Recognize and optimize a.runtimeType == b.runtimeType pattern.""
...
This reverts commit 890f694de5 .
Previous commit was passing field_type_map_ down in a place where it was not passed down before.
This caused some handles to be used across zones, which caused crashes.
BUG=
Review URL: https://codereview.chromium.org/2453463006 .
2016-10-26 12:25:48 +02:00
Ryan Macnak
890f694de5
Revert "Recognize and optimize a.runtimeType == b.runtimeType pattern."
...
This reverts commit f4ec20abac .
Revert "Use ZoneHandle when creating ConstantInstr"
This reverts commit cb87f2d82f .
This change introduced crashes on AOT and runtime errors on the GN SDK build.
TBR=vegorov@google.com
Review URL: https://codereview.chromium.org/2451893002 .
2016-10-25 13:19:33 -07:00
Vyacheslav Egorov
f4ec20abac
Recognize and optimize a.runtimeType == b.runtimeType pattern.
...
Start by removing all get:runtimeType overrides in the patch files to have a single point computing the runtime type - Object.get:runtimeType. Handle string, double and integer types inside both intrinsic and runtime call to unify their handling and guarantee that code works even with intrinsifier disabled.
With overrides removed we can easily check that get:runtimeType is unique function name within the application that is being precompiled and use that to convert InstanceCall(get:runtimeType, ...) into StaticCall even nothing is known about the receiver.
This enables us to check if both left side and right side of comparison are StaticCall(Object.get:runtimeType, ...) when specializing InstanceCall(==, x, y). If they are we convert InstanceCall(==, StaticCall(get:runtimeType, a), StaticCall(get:runtimeType, b)) into StaticCall(Object._hasSameRuntimeType, a, b). A canonicalization rule will later delete unused get:runtimeType invocations.
Object._hasSameRuntimeType is implemented in C++ and intrinsified. It operates without creating new runtime types (except for Closures - where it does for simplicity). Cases of different class ids (i.e. a.[cid] != b.[cid]) and non-parameterized types are handled completely in the intrinsic. The rest is handled in the runtime code.
Microbenchmarking results:
Same parameterized classes: 15x improvement
Different parameterized classes: 300x improvement
Different/same non-parameterized classes: 2x improvement
BUG=
R=fschneider@google.com , regis@google.com
Review URL: https://codereview.chromium.org/2379733002 .
2016-10-25 10:03:06 +02:00
Regis Crelier
fbbedf4f18
Introduce getter p on double in the VM to control fractional precision.
...
Add test.
R=asiva@google.com , fschneider@google.com
Review URL: https://codereview.chromium.org/2208473006 .
2016-08-04 15:18:00 -07:00
Lars Bak
bc6358e5ef
Sped up hashCode by removing megamorphic call to _identityHashCode.
...
Microbenchmark measuring megamorhic hashCode access shows 25% speedup.
BUG=
R=asiva@google.com
Review URL: https://codereview.chromium.org/2137673002 .
2016-07-08 15:19:55 -07:00
Regis Crelier
fcb02325cc
Cleanup various argument and range errors in double.dart and integers.dart.
...
R=hausner@google.com
Review URL: https://codereview.chromium.org/1985823002 .
2016-05-16 14:31:26 -07:00
Regis Crelier
845a447f9d
Faster dispatch of integer operations on double.
...
R=iposva@google.com
Review URL: https://codereview.chromium.org/1974533002 .
2016-05-12 16:54:15 -07:00
Florian Schneider
be298b60e9
VM: Remove unnecessary _Num class from runtime/lib.
...
BUG=
R=rmacnak@google.com
Review URL: https://codereview.chromium.org/1874853002 .
2016-04-08 16:25:52 -07:00
Florian Schneider
bcde4eee0b
VM: Add double unary minus intrinsic.
...
Also remove an extra indirection in the unary minus operator for Double.
BUG=
R=rmacnak@google.com
Review URL: https://codereview.chromium.org/1422753004 .
2015-10-29 22:58:33 +01:00
Florian Schneider
b19d518ede
VM: Use const instead of final for constants in runtime libraries.
...
It does not make a difference for optimized code (final does not help in
optimized code either btw), but allows using those constants directly in
unoptimized code.
BUG=
R=srdjan@google.com
Review URL: https://codereview.chromium.org//1284873002 .
2015-08-12 09:40:22 +02:00
Srdjan Mitrovic
c0824e7725
Fix 23563: double unary- operator unstable for NANs
...
BUG=
R=koda@google.com
Review URL: https://codereview.chromium.org//1160453003
2015-06-03 11:00:28 -07:00
regis@google.com
9ff3cd3342
Fix wrong conversion from double to bigint in overriden operators of new bigint.
...
Fix ambiguous call to pow on Windows.
Fix big_integer_vm_test to use numbers large enough to actually be bigint.
Re-enable dart2js tests.
R=srdjan@google.com
Review URL: https://codereview.chromium.org//559203003
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@40122 260f80e4-7a28-3924-810f-c04153c831b5
2014-09-10 22:26:59 +00:00
regis@google.com
0220e41d72
New bigint implementation in the vm.
...
R=srdjan@google.com
Review URL: https://codereview.chromium.org//509153003
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@40061 260f80e4-7a28-3924-810f-c04153c831b5
2014-09-09 21:47:44 +00:00
koda@google.com
a4f45a89a0
Optimize number-to-string conversions.
...
Add lookup table for ints in [-99, 99] and a cache for doubles.
R=iposva@google.com
Review URL: https://codereview.chromium.org//518093002
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@39710 260f80e4-7a28-3924-810f-c04153c831b5
2014-08-29 21:13:33 +00:00
koda@google.com
c22d3cf74a
Avoid UTF-8 decoding in num.toString.
...
4-7% speedup on SplayHarder.
Introduce _Num class to make Dart and VM hierarchies match and enable sharing code between integers and doubles.
R=iposva@google.com
Review URL: https://codereview.chromium.org//473673004
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@39383 260f80e4-7a28-3924-810f-c04153c831b5
2014-08-19 21:15:39 +00:00
lrn@google.com
86edf90273
Add num.sign getter.
...
BUG= http://dartbug.com/15580
R=sgjesse@google.com
Review URL: https://codereview.chromium.org//113833002
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@31126 260f80e4-7a28-3924-810f-c04153c831b5
2013-12-13 12:10:23 +00:00
lrn@google.com
b8a3d75996
Add isFinite getter to num.
...
R=floitsch@google.com
Review URL: https://codereview.chromium.org//28973002
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@29067 260f80e4-7a28-3924-810f-c04153c831b5
2013-10-23 10:21:13 +00:00
lrn@google.com
eb185354cd
Document equality and compareTo of numbers.
...
R=floitsch@google.com
Review URL: https://codereview.chromium.org//27302003
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@28635 260f80e4-7a28-3924-810f-c04153c831b5
2013-10-15 11:58:06 +00:00
srdjan@google.com
1676113897
Fix runtimeType for strings, integers and double: return their interface type.
...
R=asiva@google.com
Review URL: https://codereview.chromium.org//25674017
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@28286 260f80e4-7a28-3924-810f-c04153c831b5
2013-10-04 22:08:55 +00:00
lrn@google.com
c03e58cd99
Add Object.hashCodeOf to get the default hashCode of an object.
...
BUG= http://dartbug.com/13404
R=floitsch@google.com , iposva@google.com
Review URL: https://codereview.chromium.org//24280003
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@27865 260f80e4-7a28-3924-810f-c04153c831b5
2013-09-25 08:15:41 +00:00
lrn@google.com
653ee92bfb
Remove int.pow and double.pow from VM library.
...
BUG= http://dartbug.com/10268
R=regis@google.com
Review URL: https://codereview.chromium.org//23129005
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@26340 260f80e4-7a28-3924-810f-c04153c831b5
2013-08-20 08:13:13 +00:00
floitsch@google.com
cead1d41f1
ceil/floor/truncate/round return integers.
...
This CL supercedes https://codereview.chromium.org/11748016/
Review URL: https://codereview.chromium.org//12317107
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@19810 260f80e4-7a28-3924-810f-c04153c831b5
2013-03-11 18:54:37 +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
floitsch@google.com
8e6f238f86
a === b -> identical(a, b)
...
Replace === null with == null.
BUG=http://dartbug.com/6380
Review URL: https://codereview.chromium.org//11361190
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@14794 260f80e4-7a28-3924-810f-c04153c831b5
2012-11-12 17:19:58 +00:00
floitsch@google.com
27cadf2b66
isEven, isOdd, isNegative, isMaxValue, isMinValue, isInfinite, isPositive, isSingleValue.
...
Review URL: https://codereview.chromium.org//11227042
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@13974 260f80e4-7a28-3924-810f-c04153c831b5
2012-10-23 16:15:36 +00:00
floitsch@google.com
9074fd0178
Make hashCode a getter and not a method.
...
Review URL: https://codereview.chromium.org//11191078
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@13866 260f80e4-7a28-3924-810f-c04153c831b5
2012-10-22 12:41:04 +00:00
ager@google.com
7ce8d31093
Cleaning up in VM number hierarchy which was exposing a bunch
...
of implementation details as public methods.
The only remaining thing is that int and double have a pow
method in the VM which is not officially a part of corelib.
Maybe it should be so I have left that out of this change
and maybe we should add it to num and implement in dart2js
too?
R=sgjesse@google.com ,lrn@google.com
BUG=
Review URL: https://codereview.chromium.org//11019011
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@13066 260f80e4-7a28-3924-810f-c04153c831b5
2012-10-01 13:31:18 +00:00
iposva@google.com
2f455ce6a4
- Move double and int implementations into dart:core and make them private.
...
Review URL: https://codereview.chromium.org//10918213
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@12330 260f80e4-7a28-3924-810f-c04153c831b5
2012-09-13 14:13:55 +00:00
kasperl@google.com
55140fd125
Remove support for operator negate and replace occurrences with unary
...
operator -.
In the VM, I have disabled the operator negate support in the parser but I
have not removed the keyword because the token is used in quite a few other
places.
R=ahe@google.com ,iposva@google.com ,hausner@google.com
BUG=
Review URL: https://chromiumcodereview.appspot.com//10911206
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@12233 260f80e4-7a28-3924-810f-c04153c831b5
2012-09-12 05:29:03 +00:00
kasperl@google.com
72e668595d
Use new try-catch syntax in runtime/, tools/, and utils/.
...
R=ngeoffray@google.com
BUG=
Review URL: https://chromiumcodereview.appspot.com//10887023
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@11514 260f80e4-7a28-3924-810f-c04153c831b5
2012-08-29 11:58:58 +00:00