Commit Graph

105 Commits

Author SHA1 Message Date
Erik Corry c8ae9bf77b [VM] Stop treating 0x180e as whitespace
This aligns us with JS engines and Unicode 6.3

R=lrn@google.com

Bug: 29060
Change-Id: I0b6356f0e652f7c9841bcf6485aa591a3d835061
Reviewed-on: https://dart-review.googlesource.com/35560
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
Commit-Queue: Erik Corry <erikcorry@google.com>
2018-01-18 10:37:15 +00:00
Paul Berry 846832e55b [VM,Libs] Strong mode fix for string_patch.dart
The runtime type of the list passed to makeListFixedLength<int> must
be List<int>.

Change-Id: I3fcc6a53a8b40e97b8b76b125d9ed71bacf96358
Bug:
Reviewed-on: https://dart-review.googlesource.com/19222
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2017-11-08 16:11:05 +00:00
Vyacheslav Egorov faff8765c4 [VM] Fix typing issues in _List and _GrowableList
Bug: https://github.com/dart-lang/sdk/issues/31052
Change-Id: I4ef4d1f1fbaefa1a39b56a7ad00c8b365a5e5202
Reviewed-on: https://dart-review.googlesource.com/14842
Reviewed-by: Erik Corry <erikcorry@google.com>
Commit-Queue: Vyacheslav Egorov <vegorov@google.com>
2017-10-19 15:27:15 +00:00
Vyacheslav Egorov 49eb9ed58e [VM] Cleanup typing issues in regexp_patch.
RegExp implementation expects to see:

- _groupCount on all RegExp objects;
- _substringUnchecked on all String objects;

Bug: https://github.com/dart-lang/sdk/issues/31052
Change-Id: I81f705d85a4b1325941562a0287870c7a8edad9c
Reviewed-on: https://dart-review.googlesource.com/15123
Reviewed-by: Erik Corry <erikcorry@google.com>
Commit-Queue: Vyacheslav Egorov <vegorov@google.com>
2017-10-19 14:00:57 +00:00
Vyacheslav Egorov dcfb7b9a4c [VM] Fix typing violations in string_patch.dart.
Bug: https://github.com/dart-lang/sdk/issues/31052
Change-Id: I1a0a94ce19bb54cb4273d1508b6ed08b94c60307
Reviewed-on: https://dart-review.googlesource.com/14840
Commit-Queue: Vyacheslav Egorov <vegorov@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2017-10-19 06:42:37 +00:00
Vyacheslav Egorov 5b14ee115a [VM] Make _StringBase implement String
_StringBase is used everywhere as if it was assignable to String,
however it itself does not implement String, its subclasses do.

This change addresses this.

Also removes unused native runtime method from one of subclasses.

Bug: https://github.com/dart-lang/sdk/issues/31052
Change-Id: Iea2389d1b48a3689fb11c99c0e230747ab1c5962
Reviewed-on: https://dart-review.googlesource.com/12444
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Vyacheslav Egorov <vegorov@google.com>
2017-10-10 10:33:31 +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
Peter von der Ahé 327d8d1b0d Fix various warnings found in runtime patches.
Change-Id: I2dd82849df1bfe32c99577f6604e6a4501759697
Reviewed-on: https://dart-review.googlesource.com/7709
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
Commit-Queue: Peter von der Ahé <ahe@google.com>
2017-09-22 13:12:48 +00:00
Erik Corry aa6353b6da Dart SDK Spelling b, c, and d.
R=kmillikin@google.com
BUG=

Review-Url: https://codereview.chromium.org/2850783002 .
2017-05-01 08:28:10 +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é ab45caba0f Fix errors in VM patch files.
R=vegorov@google.com

Review-Url: https://codereview.chromium.org/2717573003 .
2017-02-27 08:55:17 +01: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
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 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
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
Florian Schneider c1e6aef400 VM: Optimized code for all of [External]{One|Two}ByteString::codeUnitAt.
Added support for external string using flow graph based intrinsics
which helps with precompiled code, but also polymorphic calls in jitted code.
I also added support for the missing cases in the flow graph optimizer.

BUG=
R=vegorov@google.com

Review URL: https://codereview.chromium.org/1961393002 .
2016-05-11 09:29:28 +02:00
Ryan Macnak e048774776 Precompilation: Specialize instance calls when the call receiver is the method receiver and the method class has a small number of concrete subclasses (currently 5).
CompileOnceHelloHtml (ARMv7HF) +17.194%
DeltaBlueClosures (ARMv7HF) +28.379%
DeltaBlue (ARMv7HF) +30.190%

precompiled dart2js arm 19071745 -> 19504726 (+2.3%)

R=fschneider@google.com

Review URL: https://codereview.chromium.org/1867913004 .
2016-04-11 12:52:28 -07:00
Stephen Adams dce10bba79 VM library tweaks to avoid megamorphic calls in dart2js
Problems this addresses:

1. dart2js has hashCode functions like

   get hashCode = this.x.hashCode + 17 * this.y.hashCode

When x and y are ints or bools VM optimizing compiler inlined the call
to Object.hashCode and generated MegamorphicLookups for
Object._identityHashCode.

2. HashMaps with _Smi keys had a double MegamorphicLookup: The hash
table reasonably calls MegamorphicLookup(get:hashCode) which returns
Object.hashCode; the compiled Object.hashCode is essentially
MegamorphicLookup(get:_identityHashCode), which returns
_Smi._identityHashCode which finally returns 'this'.

3. _interpolateSingle's call to o.toString() is megamorphic. We can
avoid it for the common case of String arguments, this is often
comming from StringBuffer.write() with a literal or interpolated
argument.

R=srdjan@google.com

Review URL: https://codereview.chromium.org/1820653002 .
2016-03-21 09:38:13 -07:00
Lasse R.H. Nielsen edff0face7 Make String.allMatches lazy.
R=floitsch@google.com, iposva@google.com

Review URL: https://codereview.chromium.org//1273713003 .
2015-08-12 11:01:21 +02:00
Srdjan Mitrovic 56c91201c3 Fix issue 24043: do not trust the pattern. Enable a 'hidden' test.
If there is a performance issues, I can add specialized code for String patterns.

BUG=24043
R=rmacnak@google.com

Review URL: https://codereview.chromium.org//1286823003 .
2015-08-11 14:46:17 -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
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 f0a07f1eb0 Cleanup URI and use String.replaceRange.
R=sgjesse@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@44023 260f80e4-7a28-3924-810f-c04153c831b5
2015-02-25 14:27:10 +00:00
lrn@google.com 20653fc1fb Add String.replaceRange and use it in replaceFirst{,Mapped}.
R=floitsch@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@44022 260f80e4-7a28-3924-810f-c04153c831b5
2015-02-25 12:17:27 +00:00
lrn@google.com 0b1bb96146 Change _interpolateSingle to use the same value in errors as _interpolate.
R=iposva@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@43942 260f80e4-7a28-3924-810f-c04153c831b5
2015-02-23 08:09:50 +00:00
lrn@google.com a4dc421974 Fix last-minute-typo.
Review URL: https://codereview.chromium.org//921713002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@43721 260f80e4-7a28-3924-810f-c04153c831b5
2015-02-12 10:37:40 +00:00
lrn@google.com 688d50f1c9 Add String.replaceFirstMapped.
Also refactory VM implementation of checking if a string is one-byte,
and adds dart2js implementation of replaceFirst for non-string/regexp pattern.

BUG= http://dartbug.com/2979
R=floitsch@google.com, iposva@google.com

Committed: https://code.google.com/p/dart/source/detail?r=43716

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@43718 260f80e4-7a28-3924-810f-c04153c831b5
2015-02-12 09:16:57 +00:00
lrn@google.com 7c9248c642 Revert "Add String.replaceFirstMapped."
Changes to interpolation should be separate CL.

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@43717 260f80e4-7a28-3924-810f-c04153c831b5
2015-02-12 09:12:06 +00:00
lrn@google.com 6b9ff4c4d4 Add String.replaceFirstMapped.
Also refactory VM implementation of checking if a string is one-byte,
and adds dart2js implementation of replaceFirst for non-string/regexp pattern.

BUG= http://dartbug.com/2979
R=floitsch@google.com, iposva@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@43716 260f80e4-7a28-3924-810f-c04153c831b5
2015-02-12 09:04:09 +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
lrn@google.com ab51ccc9f0 Create string efficiently from Uint16List/View.
R=asiva@google.com, fschneider@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@43235 260f80e4-7a28-3924-810f-c04153c831b5
2015-01-28 12:44:44 +00:00
lrn@google.com ab2d914ae3 Avoid extra duplication of substrings during string.replaceAll.
R=asiva@google.com, zerny@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@43059 260f80e4-7a28-3924-810f-c04153c831b5
2015-01-22 08:27:42 +00:00
lrn@google.com 28937c86ae Optimize _GrowableArray._join and _StringBase._interpolate.
R=fschneider@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@40800 260f80e4-7a28-3924-810f-c04153c831b5
2014-09-30 08:28:00 +00:00
lrn@google.com 2ef0e0b993 Fix bad call of RangeError.value in String.fromCharCodes.
Review URL: https://codereview.chromium.org//608213002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@40760 260f80e4-7a28-3924-810f-c04153c831b5
2014-09-29 09:33:08 +00:00
lrn@google.com de514055bf Change restrictions on start/end on String.fromCharCodes.
Must now be 0 <= start <= end <= iterable.length.

R=sgjesse@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@40755 260f80e4-7a28-3924-810f-c04153c831b5
2014-09-29 08:15:49 +00:00
lrn@google.com d57732d359 Optimize int.parse with a radix.
Handles bignums by parsing chunks of of digits into smis, then
combining the smi into a (potential) bignum, using smi arithmetic as
much as possible.
Use the optimized version for radix 10 and 16 too, instead of going to runtime.

R=fschneider@google.com

Committed: https://code.google.com/p/dart/source/detail?r=40702

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@40703 260f80e4-7a28-3924-810f-c04153c831b5
2014-09-26 12:13:47 +00:00
lrn@google.com 15ad26af35 Optimize int.parse with a radix.
Handles bignums by parsing chunks of of digits into smis, then
combining the smi into a (potential) bignum, using smi arithmetic as
much as possible.
Use the optimized version for radix 10 and 16 too, instead of going to runtime.

R=fschneider@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@40702 260f80e4-7a28-3924-810f-c04153c831b5
2014-09-26 12:04:43 +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
lrn@google.com 54ffc4f000 Call special VM interpolate for single element interpolation.
Fixed at the intermediate language level.

R=fschneider@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@40232 260f80e4-7a28-3924-810f-c04153c831b5
2014-09-15 07:19:23 +00:00