Commit Graph

52 Commits

Author SHA1 Message Date
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
Martin Kustermann 3582e30d8e [VM] Remove unused _Random._A field in Dart sources and make constant in C++ code instead
Issue https://github.com/dart-lang/sdk/issues/33185

Change-Id: I256a66ebf81d4433bded15f19b4147327df9b588
Reviewed-on: https://dart-review.googlesource.com/56329
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2018-05-23 13:06:25 +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
Paul Berry 3e85ad23cf Fix strong mode issue in math_patch.dart.
In the implementations of min and max, when a and b are doubles and a
== 0.0, we have special case logic to return `(a + b) * a * b` and `a
+ b`, respectively.  These expressions both have type `double`,
whereas the return type is required to be `T`, and the type system
can't guarantee that `double` is assignable to `T`, because all that
is known is that `T` extends `num`.

(Note: a human reader can see that since a and b are doubles, and a
and b have static type `T`, it follows that double must be a subtype
of `T`.  But the type system doesn't have the ability to reach this
conclusion).

To work around this issue we assign to a temporary variable of type
`num`.  Since `T` extends `num`, it is safe to return the temporary
variable.

Fixes #31162

Change-Id: I7eeea43384ce134f3b44d266af908a87f8e0e36a
Reviewed-on: https://dart-review.googlesource.com/18515
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2017-11-03 21:30:00 +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
Bob Nystrom 4145a49503 Move Dart versions of math.min() and math.max() into VM patch file.
For DDC and dart2js, we call the corresponding JS function. This is
shorter and avoids a strong mode type error in the Dart implementation.

R=jmesserly@google.com, lrn@google.com

Review-Url: https://codereview.chromium.org/2858353003 .
2017-05-05 15:15:21 -07:00
Lasse R.H. Nielsen 7998f590b1 Update documentation on trignometric functions.
Fixes #17515
BUG= http://dartbug.com/17515
R=floitsch@google.com

Committed: https://github.com/dart-lang/sdk/commit/40220ec0766bb2b179d3623d3f298223df842279
Review-Url: https://codereview.chromium.org/2852053002 .
2017-05-03 09:49:14 +02:00
Florian Loitsch 05e0e1ea40 Revert trigonometric function updates.
The VM has a fingerprint on the function and failed during compilation.

Revert "Fix patch errors."

This reverts commit ff1d7488d9.

Revert "Update documentation on trignometric functions."

This reverts commit 40220ec076.

BUG=

Review-Url: https://codereview.chromium.org/2851163003 .
2017-05-01 16:06:56 +02:00
Florian Loitsch ff1d7488d9 Fix patch errors.
Review-Url: https://codereview.chromium.org/2853813002 .
2017-05-01 15:57:40 +02: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
Peter von der Ahé 00bed94e0c Fix various nits in VM patch files.
R=vegorov@google.com

Review-Url: https://codereview.chromium.org/2705593002 .
2017-02-17 16:28:57 +01:00
Kevin Millikin 50348f5f22 Fixes to patch files necessary to use the analyzer
The analyzer has a stricter patch parser than the VM.  Patch files
cannot change signatures of patched members.  Specifically, they cannot
change:

  - the return type
  - a parameter's name
  - a parameter to an initializing formal
  - an optional parameter's default value

BUG=
R=asiva@google.com

Review-Url: https://codereview.chromium.org/2612043002 .
2017-01-05 12:23:51 +01:00
Matthias Hausner 1a6d1eca32 Implement @patch annotation for patch class members
Allow members of patch classes to be annotated with @patch. The VM
ignores the annotation. I simply replaces the original method
if the name matches, or reports an error if field names match.

Adding a bit is_patched to members to do more checking remains a
TODO. There are currently no unused bits available, and I don’t want
to increase the size of Function objects for this.

BUG=
R=asiva@google.com

Review URL: https://codereview.chromium.org/2230383003 .
2016-08-10 12:54:57 -07:00
Matthias Hausner e11ca24053 Use metadata annotation @patch for patch classes
Annotate patch classes and top-level patch functions with @patch
instead of the pseudo-keyword patch. This allows the analyzer
to read patch files, and matches the syntax that dart2js uses.

The deprecated syntax is still supported, but a warning is printed when detected.

BUG=

Review URL: https://codereview.chromium.org/2220883004 .
2016-08-09 09:48:03 -07:00
Regis Crelier bb649318e4 Remove support for Javascript warnings in the VM.
This cl is a clone of cl https://codereview.chromium.org/1683363002/ deleted by
accident. Already LGTM'ed.

Review URL: https://codereview.chromium.org/1690903003 .
2016-02-11 09:16:06 -08:00
Regis Crelier 09954546fb Add a 'secure' constructor to Random in dart:math returning a cryptographically
secure random generator which reads from the entropy source provided by the
embedder for every generated random value.
Add a test.
Fixes #1746.

R=lrn@google.com

Review URL: https://codereview.chromium.org/1398453004 .
2015-10-15 10:16:03 -07: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 caa3cce77e Fix some TODOs
BUG=
R=regis@google.com

Review URL: https://codereview.chromium.org//1263963003 .
2015-08-04 17:13:22 -07:00
srdjan@google.com ff45a972b5 Refactor and improve code for pow.
R=zra@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@35946 260f80e4-7a28-3924-810f-c04153c831b5
2014-05-08 22:18:04 +00:00
srdjan@google.com 05633cfa3d Revert unused optimization in math.pow and implement same code in Dart as is done in the inlined version.
R=johnmccutchan@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@35203 260f80e4-7a28-3924-810f-c04153c831b5
2014-04-21 15:02:42 +00:00
srdjan@google.com 833476b2b3 Improve double pow performance for few simple exponents (0.0, 1.0, 2.0, 3.0).
R=iposva@google.com, johnmccutchan@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@35035 260f80e4-7a28-3924-810f-c04153c831b5
2014-04-14 18:04:51 +00:00
iposva@google.com 383f9c03c2 - Avoid exposing the 64-bit state of the PRNG to Dart code.
R=asiva@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@33778 260f80e4-7a28-3924-810f-c04153c831b5
2014-03-17 21:27:24 +00:00
iposva@google.com 214ecc0e2a - Do not rely on time to seed the default PRNG.
R=asiva@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@33704 260f80e4-7a28-3924-810f-c04153c831b5
2014-03-14 17:30:05 +00:00
iposva@google.com 070d3dedf7 - Add a per-isolate pseudo random number generator to the
VM internals. This PRNG is not used to generate random
  numbers in Dart code.
- Use the PRNG to generate JIT cookies for large constants
  if needed during assembly.
- Add the possibility to set an external entropy source
  for the PRNG through the C API.

R=asiva@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@29950 260f80e4-7a28-3924-810f-c04153c831b5
2013-11-06 00:59:46 +00:00
lrn@google.com 479386335b Make pow fail for non-number arguments.
Previous change removed a check that was expected by a co19 test.

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@26351 260f80e4-7a28-3924-810f-c04153c831b5
2013-08-20 12:57:52 +00:00
lrn@google.com 5343ef8d32 Add documentation to dart:math pow function.
Also add test, and modify implementation to match on the single case where it didn't.

BUG= http://dartdog.com/1952
R=floitsch@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@26347 260f80e4-7a28-3924-810f-c04153c831b5
2013-08-20 12:23:00 +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
srdjan@google.com c891612920 Adapt Random class to be able to run in javascript integer compatibility mode.
R=asiva@google.com, zra@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@25753 260f80e4-7a28-3924-810f-c04153c831b5
2013-08-02 23:07:55 +00:00
iposva@google.com 4271b30c89 - Extend the coin test for slightly different scenarios.
- Crank the generator a couple of times before returning
  a newly allocated one.

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@23309 260f80e4-7a28-3924-810f-c04153c831b5
2013-05-28 22:15:07 +00:00
srdjan@google.com 22624fd4e0 Intrinsify random nextState, improve perfromance significantly.
R=zra@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@22912 260f80e4-7a28-3924-810f-c04153c831b5
2013-05-20 23:59:36 +00:00
srdjan@google.com d0c639e474 Fix for issue 10534. Implement int.pow correctly using exponentiation by squaring.
Note that int.pow is now considerably slower than double.pow.

R=floitsch@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@22635 260f80e4-7a28-3924-810f-c04153c831b5
2013-05-13 17:41:58 +00:00
ager@google.com 431954b584 Rename dart:typeddata to dart:typed_data.
R=asiva@google.com, floitsch@google.com, srdjan@google.com
BUG=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@21871 260f80e4-7a28-3924-810f-c04153c831b5
2013-04-23 11:54:54 +00:00
fschneider@google.com 86da5111ad Replace scalarlist optimizations and split external array loads into two IL instructions.
This CL removes optimized access for scalarlist, and only the new TypedData classes
are optimized. I changed the runtime libraries core and math to use typedData
instead of scalarlist (Uint16List is used in StringBuffer, Uint32List by Math.random).

Instead of using LoadIndexed for internal and external arrays,
split external loads into a load of the backing store and a load
of the element.

v3 <- LoadIndexed(v1, index)

becomes

v2 <- LoadUntagged(v1, ExternalTypedData::data_offset)
v3 <- LoadIndexed(v2, index);

For this I introduce two new representations in the IL:

 kUntagged (for values that hold a untagged pointer) and
 
 kNoRepresentation (for instructions accept any input
 representation)

Deoptimization does not need to know about kUntagged
since these values can never occur in the environment.

Also with this change:
* fix COMPILE_ASSERT and use it in one place.
* Cleanup IL printer output of deopt ids.
Review URL: https://codereview.chromium.org//12871010

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@20198 260f80e4-7a28-3924-810f-c04153c831b5
2013-03-19 12:06:23 +00:00
iposva@google.com b25d694633 - Avoid wrapping into Mints when generating random numbers.
- Update Random number tests.
- Fix String.fromCharCodes signature.
Review URL: https://codereview.chromium.org//12622002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@19642 260f80e4-7a28-3924-810f-c04153c831b5
2013-03-07 17:19: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
floitsch@google.com fb7b9e3c5c Rename Date to DateTime.
BUG=http://dartbug.com/1424

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@17549 260f80e4-7a28-3924-810f-c04153c831b5
2013-01-24 12:16: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
srdjan@google.com 44f4011196 Improve performance of String.split for 1 and 0 character results.
Other cleanups/improvements in Random.
Review URL: https://codereview.chromium.org//11419194

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@15429 260f80e4-7a28-3924-810f-c04153c831b5
2012-11-28 01:17:25 +00:00
iposva@google.com 7ae807a19c - Move MathNatives from dart:core to dart:math.
- Split out double and integer parsing from MathNatives.
Review URL: https://codereview.chromium.org//11316031

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@15032 260f80e4-7a28-3924-810f-c04153c831b5
2012-11-16 19:42:02 +00:00
iposva@google.com 624273f372 - Avoid going into BigInteger domain for most of the Random state calculation.
- Makes it much easier to intrinsify the operation.
Review URL: https://codereview.chromium.org//11339027

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@14235 260f80e4-7a28-3924-810f-c04153c831b5
2012-10-30 00:20:13 +00:00
lrn@google.com a1faa6f135 Change IllegalArgumentException to ArgumentError.
Review URL: https://codereview.chromium.org//10989013

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@12841 260f80e4-7a28-3924-810f-c04153c831b5
2012-09-25 12:27:52 +00:00
iposva@google.com 820d2b33d5 - Fix the implementation of Random.nextBool() and add test.
Review URL: https://codereview.chromium.org//10919323

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@12458 260f80e4-7a28-3924-810f-c04153c831b5
2012-09-17 21:33:39 +00:00
lrn@google.com 26fab5183a Move parseInt parseDouble to int/double classes as a static method.
Remove math dependency from core/coreimpl in dart2js.
The existing Math.parseInt and Math.parseDouble are kept *for now*, but
simply redirect to the static methods.
They will be removed in time (when library code is ready for it).

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@12417 260f80e4-7a28-3924-810f-c04153c831b5
2012-09-17 07:25:38 +00:00
iposva@google.com 327ff5d70e - Change "static final" to "static const" in the runtime/ directory.
- Fixed parsing of top-level static const.
Review URL: https://chromiumcodereview.appspot.com//10883071

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@11425 260f80e4-7a28-3924-810f-c04153c831b5
2012-08-27 23:51:37 +00:00