Commit graph

59 commits

Author SHA1 Message Date
Lasse Reichstein Holst Nielsen 68818315b5 Make core libraries use generic method syntax.
Removes comment syntax where possible for the following platform libraries:
* async
* collection
* convert
* core
* internal
* io
* math

The HTML related libraries are not changed. The templates used to build them
must be changed as well.

R=floitsch@google.com

Review URL: https://codereview.chromium.org/2529393002 .
2016-12-14 11:32:16 +01: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: b08fb1373f
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
Stephen Adams 127b419fc1 Add WhereIterable.map
This makes some nice code improvements for dart2js. dart2js can't
inline the MappedIterable factory constructor and specialize by
optimization, so specializing by hand removes the test "is
EfficientLength" for code like "x.where(f).map(g)".

R=lrn@google.com

Review URL: https://codereview.chromium.org/2354093002 .
2016-09-22 10:36:16 -07:00
Stephen Adams b37747934e Specialize Symbol.hashCode
Patch internal.Symbol.hashCode and specialize JS version to avoid
recomputing String.hashCode

R=sigmund@google.com

Review URL: https://codereview.chromium.org/2038853003 .
2016-06-03 15:10:51 -07:00
Jacob Richman 6cb121f847 Make sort method generic. This eliminates a large number of dynamic calls that slow down sorting under ddc.
BUG=
R=leafp@google.com

Review URL: https://codereview.chromium.org/2008373002 .
2016-05-25 12:33:41 -07:00
Stephen Adams 73c236a3a4 Revert "Library changes to align with DDC."
TBR=floitsch@google.com
BUG=

Review URL: https://codereview.chromium.org/1970653002 .
2016-05-10 19:42:51 -07:00
Stephen Adams 260eb5534a Library changes to align with DDC.
Mostly adding a few types and formatting changes since DDC uses dartfmt.

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

Committed: 308cb34a7c

Reverted: facb3eb9dc

Review URL: https://codereview.chromium.org/1952183002 .
2016-05-10 18:38:19 -07:00
Stephen Adams facb3eb9dc Revert "Library changes to align with DDC."
TBR=floitsch@google.com

Review URL: https://codereview.chromium.org/1969643002 .
2016-05-10 17:42:02 -07:00
Stephen Adams 308cb34a7c Library changes to align with DDC.
Mostly adding a few types and formatting changes since DDC uses dartfmt.

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

Review URL: https://codereview.chromium.org/1952183002 .
2016-05-10 17:36:16 -07:00
Florian Loitsch 4be9d36961 Make dart:internal strong-mode clean.
R=leafp@google.com

Review URL: https://codereview.chromium.org/1890323002 .
2016-04-21 13:53:51 +02:00
Leaf Petersen 92edd907c1 Add generic annotations to more SDK APIs.
Fixes https://github.com/dart-lang/sdk/issues/25860 .

BUG=
R=floitsch@google.com

Review URL: https://codereview.chromium.org/1815583002 .
2016-03-28 17:52:40 -07:00
Johnni Winther 149ad3a2e9 Remove unused BidirectionalIterator from dart:_internal.
BUG=
R=floitsch@google.com

Review URL: https://codereview.chromium.org/1799113002 .
2016-03-15 09:37:09 +01:00
Lasse R.H. Nielsen 08efdd3f30 Remove junk code in ExpandIterator.
R=kmillikin@google.com

Review URL: https://codereview.chromium.org/1406283014 .
2015-11-04 13:13:04 +01:00
Terry L. Lucas 7b322c246c Dartium JS Enabled take 2
TBR=alanknight@google.com

Review URL: https://codereview.chromium.org//1348173002 .
2015-09-16 07:13:53 -07:00
Terry L. Lucas 09c804aa78 Revert "Dartium JS Interop enabled."
This reverts commit 403bd1698d.

TBR=alanknight@google.com

Review URL: https://codereview.chromium.org//1345083002 .
2015-09-15 19:44:26 -07:00
Terry L. Lucas 403bd1698d Dartium JS Interop enabled.
TBR=alanknight@google.com

Review URL: https://codereview.chromium.org//1349493003 .
2015-09-15 17:36:47 -07:00
Terry L. Lucas 9b0d2582fc Revert "Dartium w/ JsInterop enabled"
This reverts commit 346af54711.

TBR=alanknight@google.com

Review URL: https://codereview.chromium.org//1330163010 .
2015-09-09 17:33:24 -07:00
Terry L. Lucas 346af54711 Dartium w/ JsInterop enabled
TBR=alanknight@google.com

Review URL: https://codereview.chromium.org//1321613005 .
2015-09-09 17:01:40 -07:00
Terry L. Lucas 012c998f64 Revert "Patched in Dartium JsInterop"
This reverts commit 4bb2e617db.

TBR=alanknight@google.com

Review URL: https://codereview.chromium.org//1327083002 .
2015-09-08 13:35:03 -07:00
Terry L. Lucas 4bb2e617db Patched in Dartium JsInterop
TBR=alanknight@google.com

Review URL: https://codereview.chromium.org//1310363006 .
2015-09-08 12:46:41 -07:00
Anders Johnsen 114c37738d Fix signature of UnmodifiableListMixin.insert to match List.insert.
BUG=
R=lrn@google.com

Review URL: https://codereview.chromium.org//1160423002
2015-06-03 09:32:49 +02: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
Lasse R.H. Nielsen dcf0286f53 Add Iterable.empty constructor.
Convenience constructor giving an easy/quick way to create an empty iterable.

R=sgjesse@google.com

Review URL: https://codereview.chromium.org//1152483002
2015-05-22 10:39:58 +02: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
lrn@google.com b3ee3a85bf Improve return type of markUnmodifiableList to JSArray instead of List.
R=sgjesse@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@45372 260f80e4-7a28-3924-810f-c04153c831b5
2015-04-23 10:20:53 +00:00
lrn@google.com f139d0e93b Add List.unmodifiable constructor.
R=sgjesse@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@45334 260f80e4-7a28-3924-810f-c04153c831b5
2015-04-22 10:48:22 +00:00
sra@google.com 39dfecbfb5 Revert "Change ListIterator to only check for concurrent modification at each iteration"
Revert "Fix ListIterator.iterator function hash for VM."

This is not as easy to optimize for dart2js as initially thought.
Revert this change while we discuss.

R=floitsch@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@45216 260f80e4-7a28-3924-810f-c04153c831b5
2015-04-16 18:53:39 +00:00
lrn@google.com 5a79c03e09 Change ListIterator to only check for concurrent modification at each iteration
in checked mode.

It also checks at the end in all cases.

Iteration only goes from 0 to the original length of the list.
This ensures that iterating a list while adding to it (like by x.addAll(x))
is caught instead of growing until out-of-memory.
For well-behaved programs this makes no difference since length and original
length stay the same.
Also, it means that calling moveNext again later, after increasing the length,
will not make iteration continue. After returning false, iteration is always
done.
However, it means that reducing the length causes an out-of-range read before
reaching the end, and before a concurrent modification error can happen.

R=sra@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@45198 260f80e4-7a28-3924-810f-c04153c831b5
2015-04-16 09:07:58 +00:00
lrn@google.com 0e22f7402f Move implementation from IterableBase to Iterable.
Keep IterableBase around, but just extend Iterable.

There is no good reason to have IterableBase different from Iterable. The only argument is to be consistent with ListBase, but that's also inconsistent with, e.g., Stream.
ListBase only exists because List uses the default List constructor, so it's not a good super-class. As a usability-tradeoff, the ListBase class exists as a super-class.
Iterable doesn't have the same problem, so applying that "trade-off" has no up-side.

(A better long-term solution would be to be able to designate another constructor as the default "super()" constructor to call, so List could be used as a superclass).

R=sgjesse@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@45096 260f80e4-7a28-3924-810f-c04153c831b5
2015-04-13 12:26:15 +00:00
sra@google.com 4930144c17 Delete IterableMixinWorkaround
Most code in IterableMixinWorkaround was unused.  The remaining O(20)
methods have been moved to their only use on JSArray.

I looked into using ListMixin on JSArray.  The code was clearly worse
- nearly 1% bloat on swarm and some less precise inference.  I think
it is reasonable to have the JSArray methods special-cased for
performance reasons.

R=lrn@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@44006 260f80e4-7a28-3924-810f-c04153c831b5
2015-02-24 22:57:28 +00:00
lrn@google.com 62adbb7ab0 Let Uint16List.setRange detect a String.codeUnits object, and copy directly from the string.
R=vegorov@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@43327 260f80e4-7a28-3924-810f-c04153c831b5
2015-01-30 09:46:04 +00:00
jacobr@google.com 5fe403d861 Fix a couple type bugs in dart html and what seems like strange type choices in dart:core
BUG=
R=vsm@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@42550 260f80e4-7a28-3924-810f-c04153c831b5
2014-12-22 18:49:07 +00:00
lrn@google.com 05031864ee Change incorrect limit check in IterableMixinWorkaround.insertAllList.
Review URL: https://codereview.chromium.org//740653003

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@41896 260f80e4-7a28-3924-810f-c04153c831b5
2014-11-21 12:00:11 +00:00
lrn@google.com ce08b80b53 Fix incorrect type variable usage in copied code.
Review URL: https://codereview.chromium.org//752513002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@41895 260f80e4-7a28-3924-810f-c04153c831b5
2014-11-21 11:18:58 +00:00
lrn@google.com 6ae29ec58e Create generic check methods for RangeError causing checks.
Use them where appropriate in core libraries.

There are many more possible uses in vm- and dart2js-libraries.

R=sgjesse@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@41893 260f80e4-7a28-3924-810f-c04153c831b5
2014-11-21 10:29:15 +00:00
lrn@google.com 42dac4c7b4 Add some ArgumentError and RangeError constructors that capture more information.
Switch some uses of RangeError.range to RangeError.index.
Fix bug in Queue where elementAt allowed `length` as input.

R=sgjesse@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@41653 260f80e4-7a28-3924-810f-c04153c831b5
2014-11-11 07:55:47 +00:00
lrn@google.com e2e17c3f26 Make JSON parsing work as a chunked conversion sink.
This allows JSON parsing to work on individual chunks of source instead
of collecting and concatenating all the parts before parsing.

This is made in anticipation of having a UTF-8 version that parses directly
on the input codes, without creating a String first.

R=sgjesse@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@41311 260f80e4-7a28-3924-810f-c04153c831b5
2014-10-27 12:11:39 +00:00
lrn@google.com cd16d94f1e Add concurrent modification check to ListMixin/IterableMixin.reduce.
Add tests of reduce and fold.

BUG= http://dartbug.com/21289
R=ajohnsen@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@41093 260f80e4-7a28-3924-810f-c04153c831b5
2014-10-14 09:12:21 +00:00
lrn@google.com a2685542da Fix bad default value for SubListIterable.toList.
Analyzer is not happy.

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@40674 260f80e4-7a28-3924-810f-c04153c831b5
2014-09-25 12:06:26 +00:00
lrn@google.com 8bba32d131 Make String.fromCharCodes take start/end.
This avoids having to make a sublist of a list of character codes before passing it to String.fromCharCodes.

    new String.fromCharCodes(codes.sublist(start, end))

becomes just

    new String.fromCharCodes(codes, start, end)

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

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@40672 260f80e4-7a28-3924-810f-c04153c831b5
2014-09-25 10:45:24 +00:00
rmacnak@google.com 3a40319ed2 Remove hard limit from mirrors accessor caches.
Avoids treadmilling the cache when the working set is larger than the cache size, such as the observe loop of a very large Angular app.

BUG=http://dartbug.com/20196
R=iposva@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@39057 260f80e4-7a28-3924-810f-c04153c831b5
2014-08-08 22:20:36 +00:00
lrn@google.com 729de01f79 Make IterableMixinWorkaround using classes return correctly typed Iterables.
BUG= http://dartbug.com/13646
R=floitsch@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@38372 260f80e4-7a28-3924-810f-c04153c831b5
2014-07-18 08:08:16 +00:00
rmacnak@google.com 81d0f25293 Reapply "Implement an LRU cache in dart:_internal and use it for the getter/setter caches in the VM's mirrors." Reapply "Use mirror-free LRU test for dart2js"
BUG=http://dartbug.com/18445
R=asiva@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@38167 260f80e4-7a28-3924-810f-c04153c831b5
2014-07-11 18:59:06 +00:00
rmacnak@google.com f346a00c0f Revert r37059 and dependent r37589. This effectively reduced the size of the getter and setter caches, exposing http://dartbug.com/18284 in a C1 application.
Revert "Implement an LRU cache in dart:_internal and use it for the getter/setter caches in the VM's mirrors."
Revert "Use mirror-free LRU test for dart2js"

BUG=http://dartbug.com/19909
BUG=http://dartbug.com/18284
BUG=http://dartbug.com/18445
R=asiva@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@38076 260f80e4-7a28-3924-810f-c04153c831b5
2014-07-09 00:18:15 +00:00
lrn@google.com 1ec6c5c1db Revert "Add "last" setter to List."
After discussion, we decided not to change the List interface for something that is just a convenience.

Also revert "Mark pkgbuild/pkg/collection as failing when using repository packages"

R=sgjesse@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@37307 260f80e4-7a28-3924-810f-c04153c831b5
2014-06-13 09:40:22 +00:00
lrn@google.com f528beb9f2 Add "last" setter to List.
This allows assigning directly as `list.last = value` instead of
having to use the longer `list[list.length - 1] = value`.
It's just an abbreviation, like `list.last` is for reading.

If you use a List as a stack (which is a perfectly good use of it),
modifying the last element like this is a natural operation.

R=sgjesse@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@37255 260f80e4-7a28-3924-810f-c04153c831b5
2014-06-12 08:11:22 +00:00
rmacnak@google.com 7f84fb2b7f Implement an LRU cache in dart:_internal and use it for the getter/setter caches in the VM's mirrors.
BUG=http://dartbug.com/18445
R=iposva@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@37059 260f80e4-7a28-3924-810f-c04153c831b5
2014-06-06 00:45:01 +00:00
lrn@google.com 989709f3a8 Reinstall previous behavior for Set and Queue toString.
A previous change made these omit elements to keep the toString length down.
That could break code that expects the original behavior.

This still avoids using IterableMixinWorkaround.

Add static toString methods on ListBase, SetBase, IterableBase so that users can
get the same behavior as our toString methods, and with the same cycle detection
safety.

Unify all collection toString methods in two methods:
- IterableBase.iterableToShortString
- IterableBase.iterableToFullString

R=floitsch@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@36616 260f80e4-7a28-3924-810f-c04153c831b5
2014-05-26 06:08:20 +00:00