Commit Graph

61 Commits

Author SHA1 Message Date
Lasse R.H. Nielsen d22ac9f071 Faster first/last on VM implementation of (Linked)HashSet.
See issue #31470

The performance numbers from the example in that issue improved as follows:

Before:
Set.first  2669 ms
Set.last  15509 ms
HashSet.first  2845 ms
HashSet.last  22053 ms

After:
Set.first  1244 ms
Set.last  1422 ms
HashSet.first  1075 ms
HashSet.last  4552 ms

Bug: http://dartbug.com/31470
Change-Id: I8afc91ad8835ac18bcc37737570c7f4be0bb6e8a
Reviewed-on: https://dart-review.googlesource.com/44782
Commit-Queue: Lasse R.H. Nielsen <lrn@google.com>
Reviewed-by: Erik Corry <erikcorry@google.com>
2018-03-06 12:50:21 +00:00
Dmitry Stefantsov 47fbe76d03 Avoid patching with redirecting factories in vm-related patches
Change-Id: Id45696a38b281b1b75a9a0e26d89216388a4ec19
Reviewed-on: https://dart-review.googlesource.com/39942
Commit-Queue: Dmitry Stefantsov <dmitryas@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2018-02-08 14:11:50 +00:00
Lasse R.H. Nielsen 6f78471687 New methods on Iterable, List, Set, Queue, Map.
Changes signature of Iterable.singleWhere.
Makes LinkedHashMap no longer be a HashMap.

Change-Id: I7a12fea533d42b0fc8357086649df38ad01f3cdd
Reviewed-on: https://dart-review.googlesource.com/39140
Commit-Queue: Leaf Petersen <leafp@google.com>
Reviewed-by: William Hesse <whesse@google.com>
Reviewed-by: Leaf Petersen <leafp@google.com>
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
2018-02-07 06:12:53 +00:00
William Hesse 9c35cff5cd Revert "New methods on Iterable, List, Set, Queue, Map."
This reverts commit 0b59f24f97.

Reason for revert: Creates crashes in dart2js with kernel, see
https://luci-milo.appspot.com/buildbot/client.dart/dart2js-linux-d8-minified-1-5-be/9751

Original change's description:
> New methods on Iterable, List, Set, Queue, Map.
> Changes signature of Iterable.singleWhere.
> Makes LinkedHashMap no longer be a HashMap.
> 
> Change-Id: Ibd7e56e1ac03cb9fb10d19d1328d452fcd06d89f
> Reviewed-on: https://dart-review.googlesource.com/32541
> Commit-Queue: Lasse R.H. Nielsen <lrn@google.com>
> Reviewed-by: Leaf Petersen <leafp@google.com>

TBR=lrn@google.com,leafp@google.com

Change-Id: Iab904f5885a5213ae2e16ef496eed0b6843185f3
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/39060
Reviewed-by: William Hesse <whesse@google.com>
2018-02-06 13:32:19 +00:00
Lasse R.H. Nielsen 0b59f24f97 New methods on Iterable, List, Set, Queue, Map.
Changes signature of Iterable.singleWhere.
Makes LinkedHashMap no longer be a HashMap.

Change-Id: Ibd7e56e1ac03cb9fb10d19d1328d452fcd06d89f
Reviewed-on: https://dart-review.googlesource.com/32541
Commit-Queue: Lasse R.H. Nielsen <lrn@google.com>
Reviewed-by: Leaf Petersen <leafp@google.com>
2018-02-06 11:17:46 +00:00
Paul Berry 6f9d6965fe Insert implicit downcasts for simple assignments.
Notes on test changes:

- This revealed runtime failures in some tests in
  pkg/front_end/testcases/inference.  Since these tests were never
  meant to exercise runtime behavior in the first place, I just
  changed them so that main() does nothing.

- This revealed runtime failures in some tests in tests/language_2.
  These tests began failing because they used "var" for a fields and
  then later assigned a value to the field that was incompatible with
  the inferred type.  It looks like the intent was for these fields to
  have type "dynamic", so I changed the tests accordingly.

Change-Id: I0ddb2063427b52b5e4be1884fa333e25be4bf4f3
Reviewed-on: https://dart-review.googlesource.com/16881
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2017-10-27 18:27:09 +00:00
Vyacheslav Egorov 64f6b38a6e [VM] Cleanup typing issues in collection_patch
Parameterize hash map entries and iterators with appropriate type arguments.

Cleanup code that was declaring local variables with unnecessary explicit types,
while at the same time dropping relevant type arguments (e.g. List instead of
List<_HashMapEntry<K, V>>).

Bug: https://github.com/dart-lang/sdk/issues/31052
Change-Id: I420e84e9ba549d7a9713970c85dbccc19d26761f
Reviewed-on: https://dart-review.googlesource.com/15121
Reviewed-by: Erik Corry <erikcorry@google.com>
Commit-Queue: Vyacheslav Egorov <vegorov@google.com>
2017-10-19 13:07:57 +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
Erik Corry 8f5a106e2f VM: Remove old LinkedHashMap implementation that is no longer used
There may be some reason that I am overlooking why we can't do this.
It works fine in the default VM config.
R=zra@google.com
BUG=

Review-Url: https://codereview.chromium.org/2984683002 .
2017-07-28 14:17:20 +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
Lasse Reichstein Holst Nielsen 7957a1c256 Make EfficientLength extend Iterable.
This should help least-upper-bound computations to not think of EfficientLength
as completely separate from Iterable even though they are always used together.

It doesn't solve all problems with the least-upper-bound computation,
but at least some of the more often occuring ones.

R=floitsch@google.com

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

Committed: https://github.com/dart-lang/sdk/commit/b08fb1373f88121bb4056adce9b71849a5bede2a
2016-11-28 08:04:04 +01:00
Ryan Macnak 6cf5c3baa3 Revert "Make EfficientLength extend Iterable."
This reverts commit b08fb1373f.

TBR=lrn@google.com

Review URL: https://codereview.chromium.org/2467283003 .
2016-11-02 13:20:41 -07:00
Lasse R.H. Nielsen b08fb1373f Make EfficientLength extend Iterable.
This should help least-upper-bound computations to not think of EfficientLength
as completely separate from Iterable even though they are always used together.

It doesn't solve all problems with the least-upper-bound computation,
but at least some of the more often occuring ones.

R=floitsch@google.com

Review URL: https://codereview.chromium.org/2467113003 .
2016-11-02 14:05:35 +01:00
Vyacheslav Egorov eb8c24e133 Reland "Merge more Kernel infrastructure from kernel_sdk SDK fork."
R=zra@google.com
BUG=

Review URL: https://codereview.chromium.org/2451623006 .
2016-10-27 10:09:22 +02:00
Vyacheslav Egorov 12968edb9c Revert "Reland "Merge more Kernel infrastructure from kernel_sdk SDK fork.""
This reverts commit 4e7a31262e.

Windows bots are broken now.

R=zra@google.com
BUG=

Review URL: https://codereview.chromium.org/2451893004 .
2016-10-26 17:07:18 +02:00
Vyacheslav Egorov 4e7a31262e Reland "Merge more Kernel infrastructure from kernel_sdk SDK fork."
This relands commit 2fed1c3905 with fixes to ensure that analyzer summaries are correctly created and XARM build does not try to use target binaries on the host.

R=zra@google.com
BUG=

Review URL: https://codereview.chromium.org/2453773002 .
2016-10-26 16:48:28 +02:00
Vyacheslav Egorov cf7ff42e60 Revert "Merge more Kernel infrastructure from kernel_sdk SDK fork."
This reverts commit 2fed1c3905.

SDK builds are failing

TBR=zra@google.com

Review URL: https://codereview.chromium.org/2455593002 .
2016-10-26 13:06:27 +02:00
Vyacheslav Egorov 2fed1c3905 Merge more Kernel infrastructure from kernel_sdk SDK fork.
- bring patched SDK generation scripts and VM patch tweaks that allow VM patch files to be parsed by analyzer front-end;
  Patched SDK is an SDK with all VM patches spliced into it. Kernel compiler is based on the analyzer front-end which does
  not have any patch files support/model so for it to produce Kernel files that match VM we need to generate a such patched SDKs.

- bring test script modifications that allow to test Kernel pipeline

BUG=
R=asiva@google.com, kmillikin@google.com, whesse@google.com, zra@google.com

Review URL: https://codereview.chromium.org/2434123003 .
2016-10-26 13:02:54 +02: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
Lasse R.H. Nielsen babcd4e9c0 Revert "Make EfficientLength public, as EfficientLengthIterable."
It's still not a good solution for detecting an Iterable with an efficient
length. It's not inherited by, e.g., a DelegatingIterable wrapper or similar
generic Iterable transformers.

Keep this as an internal optimization for quickly detecting the most common
efficient-length Iterable classes (List, Set, Queue, Map.keys/values), but
don't make it public.

A *real* solution would be adding a hasEfficientLength getter to Iterable, or
adding an efficientLength getter that may return null if it's not efficient.
This would something that a wrapper can attach to.

R=sgjesse@google.com

Review URL: https://codereview.chromium.org//1154263003
2015-05-29 12:52:45 +02:00
Daniel Andersson ea46192ca3 VM-internalize the default Map implementation.
Make the compact linked hash map, which is the default implementation for Map
(including map literals), a VM-internal class.

This makes it easy to have more efficient serialization of maps (although for
now, the implementation is straight-forward).

Refactor the compact hash class hierarchy to enable the VM-internal class and
the rest (also the Set classes) to share a maximal amount of code, by using
two different bases for implicit/explicit fields.

Remove existing proof-of-concept, C++-based internal VM-class.

BUG=http://dartbug.com/22982
R=asiva@google.com

Review URL: https://codereview.chromium.org//1151523002
2015-05-28 09:32:54 -07:00
lrn@google.com 92c526b2a2 Make EfficientLength public, as EfficientLengthIterable.
R=iposva@google.com, sgjesse@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@45556 260f80e4-7a28-3924-810f-c04153c831b5
2015-05-06 09:00:45 +00:00
koda@google.com 784c1e4f88 Replace Linked{Identity,Custom}Hash{Map,Set} with compact implementation; remove old code and flag.
R=iposva@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@44294 260f80e4-7a28-3924-810f-c04153c831b5
2015-03-06 15:13:01 +00:00
koda@google.com 1d7ca12fdc Compact LinkedHashMap/Set implementation.
Add GC-friendly replacement for default Map/Set:
* open-addressing hash table, avoiding the overhead of chained entries
* index separate from the keys/values, allowing more of it to fit in the cache
* new keys are always appended, to allow insertion-order iteration
* spare bits in index entries are used to store hashes
* index is typed data, so can be ignored by GC

Enable it with --use_compact_hash (disabled by default).

Reduces Dart2JS compilation time for huge codebase (N=200) by ~30%, due to reduced time in GC. Slightly slower for small maps and maps with deletions: json benchmarks regress by ~5%.

R=vegorov@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@43840 260f80e4-7a28-3924-810f-c04153c831b5
2015-02-18 13:58:32 +00:00
lrn@google.com 4d4c8a6332 Make Iterable.toSet say that it returns a Set with the same equality as the Iterable's contains method.
Let's consider whether this is really desirable once more.
It seems messy, but so does not doing it.

R=ajohnsen@google.com, floitsch@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@40893 260f80e4-7a28-3924-810f-c04153c831b5
2014-10-03 07:43:10 +00:00
koda@google.com 1cdcb12b4e Add VM class for Map/LinkedHashMap.
Introduces a new internal class for the most common case, the default Map.

Passes all functionality tests.
Slow: Dart side simply calls into runtime for now.
Hidden behind "--use_internal_hash_map".

Add copies of hash map tests to exercise this implementation.

R=asiva@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@38588 260f80e4-7a28-3924-810f-c04153c831b5
2014-07-25 20:04:11 +00:00
kasperl@google.com 7087c8a7b6 Make the JSON decoder (parser) create Dart maps lazily when no reviver is provided (common case).
R=floitsch@google.com, lrn@google.com
BUG=http://dartbug.com/19649

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@37858 260f80e4-7a28-3924-810f-c04153c831b5
2014-07-01 09:53:18 +00:00
fschneider@google.com 8621f8bda9 VM: Remove explicit field initialization with null from library classes.
It is redundant since fields are implicitly null-initialized.

R=ajohnsen@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@37261 260f80e4-7a28-3924-810f-c04153c831b5
2014-06-12 10:59:20 +00:00
lrn@google.com e8247e4b4a Add SetBase/SetMixin.
Depends on adding cloneEmpty method to Set class and toSet creating a clone.

R=sgjesse@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@36478 260f80e4-7a28-3924-810f-c04153c831b5
2014-05-22 09:48:24 +00:00
iposva@google.com 6a13da7d7d - More incorrect types fixed.
Review URL: https://codereview.chromium.org//58063002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@29830 260f80e4-7a28-3924-810f-c04153c831b5
2013-11-04 18:17:22 +00:00
sigmund@google.com 7c2e6295aa Fix type errors detected with --error-on-bad-type.
R=nweiz@google.com, regis@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@29047 260f80e4-7a28-3924-810f-c04153c831b5
2013-10-22 23:41:05 +00:00
kevmoo@j832.com cf134382a1 Set.add returns true if item has been added, otherwise false
BUG= https://code.google.com/p/dart/issues/detail?id=3546
R=floitsch@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@28863 260f80e4-7a28-3924-810f-c04153c831b5
2013-10-18 17:24:24 +00:00
lrn@google.com 8922b1065c Add EfficientLength marker interface to some iterabels.
Use that in List.from and other methods to be more efficient when possible.

R=floitsch@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@28575 260f80e4-7a28-3924-810f-c04153c831b5
2013-10-14 10:40:00 +00:00
lrn@google.com 04c230b114 Add Set.lookup method to get the instance in the set.
R=floitsch@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@28499 260f80e4-7a28-3924-810f-c04153c831b5
2013-10-11 07:16:20 +00:00
lrn@google.com 12c9510193 Update implementations to use Object.identityHashCode for identity map/set
Update map/set constructors to have an .identity() constructor as well.

R=floitsch@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@27869 260f80e4-7a28-3924-810f-c04153c831b5
2013-09-25 09:43:43 +00:00
lrn@google.com 63647b485d Remove override of runtimeType from HashMap implementations.
BUG=
R=floitsch@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@27702 260f80e4-7a28-3924-810f-c04153c831b5
2013-09-20 12:36:18 +00:00
lrn@google.com 6d49d9f1ac Reapply "Convert HashSet, LinkedHashSet to factory methods and custom implementations."
R=floitsch@google.com, fschneider@google.com, kasperl@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@27610 260f80e4-7a28-3924-810f-c04153c831b5
2013-09-18 11:36:25 +00:00
lrn@google.com 18362b2cf4 Revert "Convert HashSet, LinkedHashSet to factory methods and custom implementations."
Triggers an error in html tests on dartium.

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@27392 260f80e4-7a28-3924-810f-c04153c831b5
2013-09-11 16:19:45 +00:00
lrn@google.com c5bb6f7b15 Convert HashSet, LinkedHashSet to factory methods and custom implementations.
R=floitsch@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@27378 260f80e4-7a28-3924-810f-c04153c831b5
2013-09-11 12:35:57 +00:00
lrn@google.com 0f1e912d9d Reapply "Make LinkedHashMap also have a factory constructor and be customizable""
The change was reverted due to failing Dartium tests that were not easily handelable on a Friday afternoon.

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@27284 260f80e4-7a28-3924-810f-c04153c831b5
2013-09-09 10:49:32 +00:00
lrn@google.com 761f55b1b9 Revert "Make LinkedHashMap also have a factory constructor and be customizable"
Dartium expectations expects "LinkedHashMap" and gets "_LinkedHashMap".

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@27250 260f80e4-7a28-3924-810f-c04153c831b5
2013-09-06 14:29:04 +00:00
lrn@google.com 64359158ab Make LinkedHashMap also have a factory constructor and be customizable
R=floitsch@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@27246 260f80e4-7a28-3924-810f-c04153c831b5
2013-09-06 13:01:54 +00:00
lrn@google.com 5d8f2cad4e Reapply "Add custom equals and hashCode for HashMap implementation."
Review URL: https://codereview.chromium.org//23493017

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@27179 260f80e4-7a28-3924-810f-c04153c831b5
2013-09-05 08:29:26 +00:00
lrn@google.com c288d7c951 Revert "Add custom equals and hashCode for HashMap implementation."
Review URL: https://codereview.chromium.org//23883003

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@27111 260f80e4-7a28-3924-810f-c04153c831b5
2013-09-04 11:17:15 +00:00
lrn@google.com 76c0e79ff6 Add custom equals and hashCode for HashMap implementation.
R=floitsch@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@27106 260f80e4-7a28-3924-810f-c04153c831b5
2013-09-04 09:42:21 +00:00