Commit graph

82 commits

Author SHA1 Message Date
Daco Harkes 14ff2110ce [vm] refactor native entry and native entry type arguments
Change-Id: I03efbbf4340de1c8f23c60854ed991671ca2b647
Reviewed-on: https://dart-review.googlesource.com/c/87077
Commit-Queue: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Samir Jindel <sjindel@google.com>
2018-12-13 19:29:26 +00:00
Ryan Macnak 94f93f788a [vm] Remove Dart scanner.
Change-Id: I6435aef9574167dda71f7d15852e32e40d38e381
Reviewed-on: https://dart-review.googlesource.com/c/83224
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2018-11-09 00:13:26 +00:00
Ryan Macnak 30b0b9b723 [vm] Code size reductions:
- Remove dead Isolate::IsTopLevelParsing.
 - Remove dead TraceFunctionEntry/Exit.
 - Migrate more tracing flags to flag_list.h to allow code elimination in non-debug modes.
 - Require an explicit Zone parameter for CheckedHandles.
 - Remove side-effects from RuntimeEntry constructor.

out/ProductX64/exe.stripped/dart_precompiled_runtime 4063464 -> 4046952 (-16k)

Change-Id: Iffd3de25a03d2354cdecf2d79aa761c33ab08bd3
Reviewed-on: https://dart-review.googlesource.com/c/83120
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2018-11-08 02:02:39 +00:00
Alexander Markov 57c0fc9593 [vm/corelib] More cleanup in integer operations after _Bigint is removed
Change-Id: I41da6a37e554ffb8b77f51fda3fee5a15f2b8045
Reviewed-on: https://dart-review.googlesource.com/60441
Reviewed-by: Régis Crelier <regis@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2018-06-18 18:16:51 +00:00
Ryan Macnak 9b5a931b06 [vm] Replace most runtime/vm uses of OS::Print with OS::PrintErr.
Leave --print-snapshot-sizes on stdout because it is parsed by Flutter benchmarks.

Replace all runtime/bin uses of OS::Print with Log::Print.

Bug: https://github.com/dart-lang/sdk/issues/32134
Change-Id: I74aacfb410cdfa9270d06e7f6ab0534520c7c7ba
Reviewed-on: https://dart-review.googlesource.com/60021
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Zach Anderson <zra@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2018-06-13 19:51:40 +00:00
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 bc937b3b6b Reapply CL "Option to truncate integers to 64 bits, part 2"
This is the 2nd attempt to land the CL
abed3c2a70

Original review: https://codereview.chromium.org/2982823002
No extra changes were made. Large literals in the Dart core library
which caused failures during the previous attempt to land this CL have
been fixed separately.

Description of the CL:

In --limit-ints-to-64-bits mode:
* Integer constructors return Integer::null if integer is out of range.
* Error is reported for integer literals which are out of range.
* Dart API is revised to return errors if integers are out of range.

Bigint::IsDisabled() method is introduced to be able to enable/disable
Bigints independently of --limit-ints-to-64-bits mode in future.

Deprecated constructor Integer::NewFromUint64 is replaced with
Integer::New in certain cases.

R=regis@google.com

Issue: https://github.com/dart-lang/sdk/issues/30103
Review-Url: https://codereview.chromium.org/2980223002 .
2017-07-17 12:20:17 -07:00
Alexander Markov 776aef9ff0 Revert "Option to truncate integers to 64 bits, part 2"
This reverts commit abed3c2a70.

TBR

Review-Url: https://codereview.chromium.org/2977143002 .
2017-07-14 14:40:58 -07:00
Alexander Markov abed3c2a70 Option to truncate integers to 64 bits, part 2
In --limit-ints-to-64-bits mode:
* Integer constructors return Integer::null if integer is out of range.
* Error is reported for integer literals which are out of range.
* Dart API is revised to return errors if integers are out of range.

Bigint::IsDisabled() method is introduced to be able to enable/disable
Bigints independently of --limit-ints-to-64-bits mode in future.

Deprecated constructor Integer::NewFromUint64 is replaced with
Integer::New in certain cases.

R=zra@google.com

Issue: https://github.com/dart-lang/sdk/issues/30103
Review-Url: https://codereview.chromium.org/2982823002 .
2017-07-14 13:24:53 -07:00
Zachary Anderson 6cd8a79078 VM: Re-format to use at most one newline between functions
R=asiva@google.com

Review-Url: https://codereview.chromium.org/2974233002 .
2017-07-13 08:08:37 -07:00
Alexander Markov 7a20b6b8d8 Option to truncate integers to 64 bits, part 1 (core VM changes)
This changeset revises --limit-ints-to-64-bits option to
change range of integers from unlimited to int64.
On overflow, integer arithmetic operations silently wrap around and
discard extra bits. No Bigints are allocated in case of overflow.

This changeset is the 1st part in the series of changes, it revises the implementation of integer arithmetic operations. More changes will follow.

R=regis@google.com, zra@google.com

Issue: https://github.com/dart-lang/sdk/issues/30103
Review-Url: https://codereview.chromium.org/2974633003 .
2017-07-10 15:16:40 -07:00
Regis Crelier 54c1cbd6ea Introduce a flag --limit-ints-to-64-bits in the VM in order to investigate the
use of Bigint (see issue #28595).
A RangeError with the message "Integer operand requires conversion to Bigint" is
thrown when a Bigint gets allocated. However, parsing a Bigint literal in Dart
source will not throw the RangeError (as long as the literal is not used).

R=asiva@google.com

Review-Url: https://codereview.chromium.org/2708213004 .
2017-02-22 09:49:03 -08:00
Zachary Anderson 2e4dfd3a2d clang-format runtime/lib
R=johnmccutchan@google.com

Review URL: https://codereview.chromium.org/2468093007 .
2016-11-04 12:14:41 -07:00
Stephen Adams 38fdb4bd4a vm: Generate 'and' instruction for Smi values.
This pattern ensures the generation of 'and' instructions on the Smi x Smi path of a polymorphic & operation.

There are two 'and' operations on most simple _InternalLinkedHashMap and _CompactLinkedHashSet operations. One of the inputs, the hashCode, is occasionally a _Bigint.  This change ensures that the usual case path has an 'and' instruction instead of a call to _IntegerImplementation.&

R=regis@google.com

Review URL: https://codereview.chromium.org/1913663002 .
2016-07-04 16:27:57 -07:00
Zachary Anderson b3e5c5eeed DBC: Adds BinarySmiOp instruction
R=vegorov@google.com

Review URL: https://codereview.chromium.org/2053213004 .
2016-06-15 14:48:11 -07:00
Matthias Hausner 68a6060794 Eliminate GrowableTokenStream
Eliminate building an intermediate array of tokens in the scanner. Build
the compressed TokenStream directly instead.

BUG=
R=asiva@google.com

Review URL: https://codereview.chromium.org/1969563002 .
2016-05-11 14:09:45 -07:00
Florian Schneider 1217e539e9 VM: Remove _leftShiftWithMask32.
It was used for the Javascript integer overflow warnings which were already
removed from the VM.

BUG=
R=regis@google.com, srdjan@google.com

Review URL: https://codereview.chromium.org/1900863004 .
2016-04-19 19:06:53 +02:00
Ryan Macnak f731dd0615 Reapply "- Use a hash table to canonicalize instances/arrays to avoid having to iterate over a linear list and search for canonical instances."
- Rehash constants table during tree-shaking.
 - Rehash constants table on snapshot load.

R=regis@google.com

Review URL: https://codereview.chromium.org/1900863002 .
2016-04-18 16:46:26 -07:00
Siva Annamalai 8ce7b6291a Revert "- Use a hash table to canonicalize instances/arrays to avoid having to iterate over a linear list and search for canonical instances."
This reverts commit 95a2b02a9e.

Once the tree shaker in precompiled code is fixed to treat the constants array in a class as a hash table this CL can be re-applied.

R=rmacnak@google.com

Review URL: https://codereview.chromium.org/1888593003 .
2016-04-13 18:49:53 -07:00
Siva Annamalai 95a2b02a9e - Use a hash table to canonicalize instances/arrays to avoid having to iterate over a linear list and search for canonical instances.
- Some minor cleanups
  - Return an empty array right away in the parser instead of creating an
    empty array and canonicalizing it
  - The canonical bit was not being set for some of the singleton objects.

R=regis@google.com

Review URL: https://codereview.chromium.org/1873143003 .
2016-04-13 10:26:17 -07:00
Florian Loitsch 55630a5e90 Support 'dart.library.X' env variables in the VM.
BUG= http://dartbug.com/24587
R=iposva@google.com, johnmccutchan@google.com

Committed: c2a06e22cb
Reverted: 5eb5b42989

Review URL: https://codereview.chromium.org/1640853004 .
2016-02-29 20:58:32 +01: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
Florian Loitsch 5eb5b42989 Revert "Support 'dart.library.X' env variables in the VM."
This reverts commit c2a06e22cb.

Review URL: https://codereview.chromium.org/1668253002 .
2016-02-04 22:26:06 +01:00
Florian Loitsch c2a06e22cb Support 'dart.library.X' env variables in the VM.
BUG= http://dartbug.com/24587
R=iposva@google.com, johnmccutchan@google.com

Review URL: https://codereview.chromium.org/1640853004 .
2016-02-04 13:04:31 +01:00
Srdjan Mitrovic 465cf10a7c Remove some Isolate::current_zone() calls, as it gets the zone from mutator thread not the current thread
BUG=
R=zra@google.com

Review URL: https://codereview.chromium.org/1414493003 .
2015-10-19 10:27:36 -07:00
regis e8139d4d92 Fix right shifting of a Mint value by an amount larger than 63.
Add regression test.
Enhance existing bit shift test.

Fixes #24283

R=ager@google.com

Review URL: https://codereview.chromium.org//1338233002 .
2015-09-14 18:20:48 +08:00
Srdjan Mitrovic d4365bc6f4 Lookup getter/setter symbols before alllocating them, thus eliminating extra String allocations in new space.
Various old space allocations, cleanups.
Add a test for Symbols concatenation.

BUG=
R=hausner@google.com

Review URL: https://codereview.chromium.org//1320673012 .
2015-09-03 14:09:34 -07:00
Daniel Andersson 6542a451c3 Refactor Isolate -> Thread in NativeArguments and exception handler jump.
Further reduces the one-to-one assumption about isolates and threads: native entries now ask the thread for its isolate, rather than the other way around.

R=srdjan@google.com

Review URL: https://codereview.chromium.org//1156143003
2015-05-26 16:49:51 -07:00
regis@google.com a5ee233d1b Make Bigint instances immutable by removing all setters.
This required rewriting a large portion of bigint.dart.

R=rmacnak@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@43492 260f80e4-7a28-3924-810f-c04153c831b5
2015-02-04 23:56:23 +00:00
regis@google.com 03fa3d1ff4 Mark mutator methods of canonical constants as invisible to reflective access.
R=rmacnak@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@42747 260f80e4-7a28-3924-810f-c04153c831b5
2015-01-09 18:03:31 +00:00
vegorov@google.com 29f021439a Infer range for BIT_XOR.
When selecting representations unbox integer phis that have Int32 range and have only constants or boxing operations flowing into them.

BUG=http://dartbug.com/13869
R=fschneider@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@41667 260f80e4-7a28-3924-810f-c04153c831b5
2014-11-11 14:51:10 +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
iposva@google.com 92f2698abe - Refactor the way X.fromEnvironment is implemented.
- Predefine 'dart.isVM' to be 'true'.

R=srdjan@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@39986 260f80e4-7a28-3924-810f-c04153c831b5
2014-09-08 18:23:05 +00:00
regis@google.com f58908bfdd Tweaks for speed in integer arithmetic runtime.
Unrelated:
Removed annoying svn property on utils.cc (indicated by MM):
  svn propdel svn:eol-style runtime/platform/utils.cc

R=srdjan@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@38090 260f80e4-7a28-3924-810f-c04153c831b5
2014-07-09 17:16:10 +00:00
fschneider@google.com bd110db87a Use range information for optimizing integer boxing and fix bug in range analysis.
1. When the input to a BoxInteger operation is in smi-range, we can eliminate
the range check and just perform a smi-tag operation on the input.

2. There was a bug in checking for smi-overflow for range boundaries: Calling Smi::IsValid
with a int64_t argument resulted in silent truncation of the input and therefore a wrong result.

Compiling with -Wconversion would have caught this, but currently we cannot compile with this flag
because of too many broken places.

Instead, I removed Smi::IsValid64 and created one variant Smi::IsValid that is specialized for the
input type with a template parameter. This way calling Smi::IsValid is always safe and will never
 result in silent alteration of the input argument.

R=vegorov@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@37657 260f80e4-7a28-3924-810f-c04153c831b5
2014-06-24 13:41:48 +00:00
rmacnak@google.com 7ce5c53f0b Pass around the current isolate in exception handling code.
R=asiva@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@37409 260f80e4-7a28-3924-810f-c04153c831b5
2014-06-17 18:17:03 +00:00
ajohnsen@google.com c3dfdbe772 Fix fromEnvironment when called from isolates.
BUG=
R=sgjesse@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@33363 260f80e4-7a28-3924-810f-c04153c831b5
2014-03-06 09:16:41 +00:00
ajohnsen@google.com 1ce402ec78 Revert "Re-apply 'Fix fromEnvironment when called from isolates.'"
This reverts commit 1f2ddd083424a93dc0822c2ae86be971d5a97e21.

BUG=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@33278 260f80e4-7a28-3924-810f-c04153c831b5
2014-03-04 16:05:21 +00:00
ajohnsen@google.com fb97ee0fe1 Re-apply 'Fix fromEnvironment when called from isolates.'
Old Review URL: https://codereview.chromium.org//186393004

BUG=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@33274 260f80e4-7a28-3924-810f-c04153c831b5
2014-03-04 14:22:54 +00:00
ajohnsen@google.com e8ad108bec Revert "Fix fromEnvironment when called from isolates."
This reverts commit f5886c3a1fe96580c13d83d6422a6bb6931ae95a.

BUG=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@33266 260f80e4-7a28-3924-810f-c04153c831b5
2014-03-04 11:06:39 +00:00
ajohnsen@google.com 7e55a59ce4 Fix fromEnvironment when called from isolates.
BUG=
R=sgjesse@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@33264 260f80e4-7a28-3924-810f-c04153c831b5
2014-03-04 10:26:17 +00:00
fschneider@google.com 16857e0b13 Revert r32930 (Add more timing information in the VM to track time...)
It caused severe performance regressions that should be addressed.

TBR=asiva@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@32959 260f80e4-7a28-3924-810f-c04153c831b5
2014-02-24 12:15:55 +00:00
asiva@google.com 6d313d3797 Add more timing information in the VM to track time spent is dart code Vs native code.
R=johnmccutchan@google.com, turnidge@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@32930 260f80e4-7a28-3924-810f-c04153c831b5
2014-02-21 21:30:29 +00:00
lrn@google.com 54a3662ccf Change integer canonicalization to use CheckAndCanonicalize
R=sgjesse@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@29731 260f80e4-7a28-3924-810f-c04153c831b5
2013-11-01 09:42:28 +00:00
lrn@google.com 66959d9dbf Change int.fromEnvironment in VM to use same code as int.parse.
R=fschneider@google.com, sgjesse@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@29670 260f80e4-7a28-3924-810f-c04153c831b5
2013-10-31 13:45:39 +00:00
sgjesse@google.com 36a67fa046 Implement fromEnvironment on bool, int and String
This implements const constructor fromEnvironment on bool, int and
String.

The VM have the added -Dname=value option to define the value for the
properties. All values are provided by using the -D - nothing is read
from the environment.

If the resulting value is null or - in the case of int.fromEnvironment
- not a number an ArgumentError is thrown.

This CL does not have any implementation for dart2js.

This is a continuation of the change
https://chromiumcodereview.appspot.com/24975002 by iposva@
BUG=
R=iposva@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@29642 260f80e4-7a28-3924-810f-c04153c831b5
2013-10-31 05:46:57 +00:00
iposva@google.com d369b7a0c9 - Ensure that the token stream from generated source matches the
original token stream in the presence of combinations of
  multiline string and string interpolation. If not this will
  cause mismatches when accessing code snippets, e.g when
  reporting parser errors or assertions.
- Ensure that ScanAll and ScanTo are in sync when adding or
  counting tokens.
- Added unit test for multiline strings and interpolation.
- Expanded GenerateSource unit test to iterate through all
  loaded libraries.
- Do not report columns for compilation errors in snapshotted
  code.
- Do not report columns from exceptions and errors when dealing
  with snapshotted code.
- Remove length field from TokenDescriptor. It was unused.
- Remove TokenStream::ComputeTokenPosition. It was unused.

R=fschneider@google.com, hausner@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@29110 260f80e4-7a28-3924-810f-c04153c831b5
2013-10-23 19:08:36 +00:00
srdjan@google.com b6b3e1f400 Factor out throwing of argument error.
R=asiva@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@28109 260f80e4-7a28-3924-810f-c04153c831b5
2013-10-01 18:48:37 +00:00
sra@google.com ce4b15c0e9 Esoteric bit operations.
- bit length
- truncate to signed fixed width integer
- truncate to unsigned fixed width integer

This change is motivated by a program that spends 20-30% of its time here:
    // TODO(5828): Replace this with a bit-length method on int when available.
    int n_bitLength = this.n.toRadixString(2).length;

See Also
https://code.google.com/p/dart/issues/detail?id=5828#c3
https://code.google.com/p/dart/issues/detail?id=6486#c2
https://code.google.com/p/dart/issues/detail?id=5798#c5
https://code.google.com/p/dart/issues/detail?id=12008

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

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@27269 260f80e4-7a28-3924-810f-c04153c831b5
2013-09-06 22:22:26 +00:00
floitsch@google.com 8adad2eeb0 Don't throw when there is an "onError" for int.parse.
Even though the error is caught immediately we don't want "break on exception" developer tools stop at the parseInt case if there is a handler.

BUG= http://dartbug.com/12776
R=lrn@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@27005 260f80e4-7a28-3924-810f-c04153c831b5
2013-09-02 09:36:29 +00:00