Commit Graph

2008 Commits

Author SHA1 Message Date
Martin Kustermann dbb1d3d44f Revert "[VM] Introduction of type testing stubs - Part 1-4"
This reverts commit 2c52480ec8.
This reverts commit 25f98bcc75.
This reverts commit f226c22424.
This reverts commit 165c583d57.

Change-Id: I3892d672b9ca0b0acc0b9b83c32ecc92355839c2
Reviewed-on: https://dart-review.googlesource.com/49843
Reviewed-by: Martin Kustermann <kustermann@google.com>
2018-04-06 08:35:01 +00:00
Martin Kustermann 165c583d57 [VM] Introduction of type testing stubs - Part 1
This CL:

  * Adds a field to [RawAbstractType] which will always hold a pointer
    to the entrypoint of a type testing stub

  * Makes this new field be initialized to a default stub whenever a
    instances are created (e.g. via Type::New(), snapshot reader, ...)

  * Makes the clustered snapshotter write a reference to the
    corresponding [RawInstructions] object when writing the field and do
    the reverse when reading it.

  * Makes us call the type testing stub for performing assert-assignable
    checks.

To reduce unnecessary loads on callsites, we store the entrypoint of the
type testing stubs directly in the type objects.  This means that the
caller of type testing stubs can simply branch there without populating
a code object first.  This also means that the type testing stubs
themselves have no access to a pool and we therefore also don't hold on
to the [Code] object, only the [Instruction] object is necessary.

The type testing stubs do not setup a frame themselves and also have no
safepoint.  In the case when the type testing stubs could not determine
a positive answer they will tail-call a general-purpose stub.

The general-purpose stub sets up a stub frame, tries to consult a
[SubtypeTestCache] and bails out to runtime if this was unsuccessful.

This CL is just the the first, for ease of reviewing.  The actual
type-specialized type testing stubs will be generated in later CLs.

Issue https://github.com/dart-lang/sdk/issues/31798

Change-Id: I174a11b3b812799f399a60af799144c2ba3c26ec
Reviewed-on: https://dart-review.googlesource.com/44787
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Reviewed-by: Régis Crelier <regis@google.com>
2018-04-06 07:00:50 +00:00
Samir Jindel 83c5778345 [kernel/vm] Cleanup NSM forwarding.
Change-Id: Ia2077d2752fbeb45da7d1051cdab0c16d67377d0
Reviewed-on: https://dart-review.googlesource.com/48420
Commit-Queue: Samir Jindel <sjindel@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2018-03-26 22:34:02 +00:00
Martin Kustermann 31dd6683f8 [VM] Optimize performance of dart_boostrap in debug-kernel-strong mode.
Since the kernel reading helpers have been extended to not only work
with a kernel blob in C heap, but also work based on a [TypedData]
buffer in the VM heap, access to the [TypedData] buffer is on the hot
path now.

This hot path is slowing things down considerably, in particular due
to NoSafepoingScope's.

This CL removes a critical NoSafepoingScope when accessing the
[TypedData] in read-only mode.  It also allows passing in the [Thread]
directly, to avoid TLS lookups.

Issue https://github.com/dart-lang/sdk/issues/32603

Change-Id: I91955bea5cd4eddbbd21c5d3bc6813504c2cece9
Reviewed-on: https://dart-review.googlesource.com/47222
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2018-03-21 10:24:29 +00:00
Vyacheslav Egorov f0455493de [vm/kernel] Do not skip type checks on closure functions.
Fixes https://github.com/dart-lang/sdk/issues/32502

Bug: 32502
Change-Id: I3e4e9d6dd884f9660380994b24b7a263777f1a18
Reviewed-on: https://dart-review.googlesource.com/46066
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Vyacheslav Egorov <vegorov@google.com>
2018-03-12 17:13:20 +00:00
Jens Johansen 80e2d30c20 [vm] Fix issue causing recursive_mixin_test to crash
In the VM, TypeRef (extending AbstractType) did _not_ implement
error(), meaning that callong error() on such a type would call it in
AbstractType which basically just says `UNREACHABLE();`.

This fixes the issue.

Change-Id: I6cb9ebe8f814296db8383c187c880f367b096312
Reviewed-on: https://dart-review.googlesource.com/44420
Commit-Queue: Vyacheslav Egorov <vegorov@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Reviewed-by: Régis Crelier <regis@google.com>
2018-03-02 17:39:39 +00:00
Alexander Markov 68fd91b5bb [vm] Fix field initialization during isolate reload in kernel mode
Closes https://github.com/dart-lang/sdk/issues/32273

Change-Id: Ief0dfaa735e29619a1541b890069f4618906440d
Reviewed-on: https://dart-review.googlesource.com/43260
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2018-02-23 17:44:24 +00:00
Ryan Macnak 6664e3c02a [vm, dbc] Implement lazily-linked natives for DBC and enable AppJIT.
Because DBC still uses code patching to implement breakpoints, running a program from DBC AppJIT may trigger a crash attempting to set a breakpoint.

Change-Id: I5d761aacec6629be946d7d2510ec3f1e3f03f4a4
Reviewed-on: https://dart-review.googlesource.com/42584
Reviewed-by: Zach Anderson <zra@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2018-02-23 02:20:12 +00:00
Vyacheslav Egorov 7dccc7ea99 [vm/kernel] Skip argument type checks in constructors too.
Reduces Flutter Gallery AOT code size by ~600k.

Change-Id: I6f3cac8020db4f667c8f8a86ba7c20385727f3e3
Reviewed-on: https://dart-review.googlesource.com/42242
Commit-Queue: Vyacheslav Egorov <vegorov@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2018-02-20 16:06:45 +00:00
Jens Johansen 90a7599d05 [vm] Make mint constants use hash set instead of plain list.
This the second part of fixing #32077 - dealing with mints.

Example:
The runtime of a program adding 100,000 different mints to
a list and prints the last one:
Before: ~12.5 seconds
Now: ~1.2 seconds.

Change-Id: Iad6da1749886bab4e4d3941748cdbab51661c2c3
Reviewed-on: https://dart-review.googlesource.com/41161
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
2018-02-14 11:25:42 +00:00
Jens Johansen 9fbbd2dd41 [vm] Make double constants use hash set instead of plain list.
This the first part of fixing #32077 - dealing with doubles.

Example:
The runtime of a program adding 100,000 different doubles to
a list and prints the last one:
Before: ~12 seconds
Now: ~1.3 seconds.

Change-Id: I7f64b8763fdd37dae5d32d3275f8b9c991d4e43a
Reviewed-on: https://dart-review.googlesource.com/40300
Commit-Queue: Vyacheslav Egorov <vegorov@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2018-02-12 17:17:42 +00:00
Régis Crelier e64f37614e [VM runtime] Fix TypeArguments::IsUninstantiatedIdentity() not to return true
for a still unfinalized type argument vector (fixes #31944).
Update status files.

Change-Id: Ib603cd702891dc93775a5fbd09c341bb36922ab3
Reviewed-on: https://dart-review.googlesource.com/39855
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2018-02-08 02:03:24 +00:00
Ryan Macnak 1451cfd741 [vm] Add Dart_NewListOfType to the embedding API.
Change-Id: I4729d9b39b0902ad5b77de2acd9f1e867134a619
Reviewed-on: https://dart-review.googlesource.com/39840
Reviewed-by: Zach Anderson <zra@google.com>
Reviewed-by: Régis Crelier <regis@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2018-02-07 22:05:30 +00:00
Samir Jindel 42a639973d [kernel] Support for partial tearoff type application operator in the VM, take 3.
The original change is available in patchset 1.
The changes since then are just status file updates.

Change-Id: I0c45c4b09a187bdd60c6a38bf23f6b7a0cf80c97
Reviewed-on: https://dart-review.googlesource.com/34400
Reviewed-by: Jens Johansen <jensj@google.com>
2018-01-15 11:24:11 +00:00
Jens Johansen 68c054d27f Revert "[kernel] Unrevert "Support for the partial tearoff type application operator in VM.""
This reverts commit 784ee768d8.

Reason for revert: Turns many kernel bots red.

Original change's description:
> [kernel] Unrevert "Support for the partial tearoff type application operator in VM."
> 
> The original revision is available in the first patchset.
> 
> Change-Id: I579b4b85a19ac17088eed050680a46df7ffc5c0a
> Reviewed-on: https://dart-review.googlesource.com/34102
> Commit-Queue: Samir Jindel <sjindel@google.com>
> Reviewed-by: Martin Kustermann <kustermann@google.com>

TBR=kustermann@google.com,sjindel@google.com

Change-Id: I7262f9b578bf9991f1e79aacb88c446950c79bc7
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/34340
Reviewed-by: Jens Johansen <jensj@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
2018-01-12 08:44:05 +00:00
Samir Jindel 784ee768d8 [kernel] Unrevert "Support for the partial tearoff type application operator in VM."
The original revision is available in the first patchset.

Change-Id: I579b4b85a19ac17088eed050680a46df7ffc5c0a
Reviewed-on: https://dart-review.googlesource.com/34102
Commit-Queue: Samir Jindel <sjindel@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2018-01-11 21:37:38 +00:00
Samir Jindel b74af78ddd [kernel] Avoid unnecessary argument type-checks on static methods in strong mode.
Change-Id: I224c292cf843b6903d695048d023c7365ba9cf53
Reviewed-on: https://dart-review.googlesource.com/33360
Commit-Queue: Samir Jindel <sjindel@google.com>
Reviewed-by: Régis Crelier <regis@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2018-01-11 12:44:18 +00:00
Martin Kustermann 0ea33d4283 Revert "[kernel] Support for the partial type application operator in the VM."
This reverts commit 4f265395e0.

Reason for revert: A lot of failing precompilation builders.

Original change's description:
> [kernel] Support for the partial type application operator in the VM.
> 
> Change-Id: Ieaf5d936676a6e755dab69d70105dcce0bcbfdb6
> Reviewed-on: https://dart-review.googlesource.com/32540
> Commit-Queue: Samir Jindel <sjindel@google.com>
> Reviewed-by: Régis Crelier <regis@google.com>
> Reviewed-by: Martin Kustermann <kustermann@google.com>

TBR=kustermann@google.com,sjindel@google.com,regis@google.com

Change-Id: Iac6a9fe7fb7467cab3818da99043d310d1981c67
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/33940
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2018-01-10 17:05:39 +00:00
Samir Jindel 4f265395e0 [kernel] Support for the partial type application operator in the VM.
Change-Id: Ieaf5d936676a6e755dab69d70105dcce0bcbfdb6
Reviewed-on: https://dart-review.googlesource.com/32540
Commit-Queue: Samir Jindel <sjindel@google.com>
Reviewed-by: Régis Crelier <regis@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2018-01-10 13:57:28 +00:00
Martin Kustermann 5b56dfb77a [VM] Make Object::RawCast() allow "null" objects - similar to Object::^=
Change-Id: I9a05f0c6d36ed3a59d2742c0c84398dd6acba31a
Reviewed-on: https://dart-review.googlesource.com/32280
Reviewed-by: Siva Annamalai <asiva@google.com>
2018-01-05 11:58:13 +00:00
Régis Crelier 548d7dc8a3 [VM runtime] Properly treat Object and void as top types in strong mode type
tests.
Adjust status files.

Change-Id: I4360c0015cfbb97a5599882930810dbc7060d4c0
Reviewed-on: https://dart-review.googlesource.com/30701
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2017-12-20 20:55:59 +00:00
Ryan Macnak fda4ab3dbf [vm] Move the info_array for ObjectPool inline.
The info_array is needed to visit an ObjectPool's pointers, requiring the compactor to move the info_array's body before forwarding the ObjectPool's pointers. Moving the info_array inline remove this constraint on the compactor.

Also saves 3 words per ObjectPool modulo allocation size rounding.

Bug: https://github.com/dart-lang/sdk/issues/30978
Change-Id: I94de0e4b7356d46fb145efee7ab14abd7473eb4c
Reviewed-on: https://dart-review.googlesource.com/27480
Reviewed-by: Erik Corry <erikcorry@google.com>
2017-12-08 20:42:51 +00:00
Régis Crelier a4bcdef9bd [VM runtime] In strong-mode, apply FutureOr subtyping rules (fixes #31377).
Change-Id: Id792eae9fbd08783443ec6341e17208f9e78e5f0
Reviewed-on: https://dart-review.googlesource.com/26720
Reviewed-by: Siva Annamalai <asiva@google.com>
2017-12-07 00:19:27 +00:00
Ryan Macnak 65990d5d7e Don't use heap iteration order when seeding the VM isolate.
Bug: https://github.com/dart-lang/sdk/issues/31427
Change-Id: I74c5c9f6e992bf68913178a49916892c0ef808c9
Reviewed-on: https://dart-review.googlesource.com/26440
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2017-12-06 22:24:25 +00:00
Samir Jindel f5fc335a4c [kernel] Check bounds of type arguments in strong mode.
Change-Id: I2cb230db322cc26fb62e932b40882200de38c3d4
Reviewed-on: https://dart-review.googlesource.com/24180
Commit-Queue: Samir Jindel <sjindel@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2017-12-01 14:55:56 +00:00
Samir Jindel be07555207 Revert "Revert "[kernel] Implementation of fine-grained strong mode argument type-checks, phase 2""
This fixes some incorrect asserts that were breaking the debug bots.
The original revision is available in Patchset 1.

This reverts commit 26735519cb.

Bug:
Change-Id: Ifa599b7bff752dec4c505e10fd6db206e1abd977
Reviewed-on: https://dart-review.googlesource.com/23820
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Commit-Queue: Samir Jindel <sjindel@google.com>
2017-11-27 18:25:31 +00:00
Vyacheslav Egorov 26735519cb Revert "[kernel] Implementation of fine-grained strong mode argument type-checks, phase 2"
This reverts commit f13f772bb2.

Reason for revert: dartk(p)-strong debug mode is completely broken
because we convert int values non-representable as Smi to Smi, which
triggers that assert. The code that does tagging checks that
Untag(Tag(x)) == x, however for our purposes this identity does not
need to hold because we only care about lower bits and ignore the sign.

Reverting to restore green-ness of DEBUG builds.

TBR=sjindel@google.com

Bug:
Change-Id: Id436cbe000d6dec8db3469070ed531327cc82d89
Reviewed-on: https://dart-review.googlesource.com/23661
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2017-11-26 10:21:01 +00:00
Samir Jindel f13f772bb2 [kernel] Implementation of fine-grained strong mode argument type-checks, phase 2
This revision continues the implementation of:
https://docs.google.com/document/d/1KK8b6kzr0pQev5YNftSZhN3M6I8HcvOJwJ6U-cW4nfw/edit?ts=5a05b3e9#heading=h.7j21arix8p2

* Add argument checking bits for named arguments in the arguments descriptor.
* Add argument checking bits for type arguments.
* Calculate argument checking bits for setters.
* Add dispatch category to PropertySet and DirectPropertySet.

Bug:
Change-Id: Ieb0a4a99c401f53a72de473fda7bab61581f9996
Reviewed-on: https://dart-review.googlesource.com/22700
Commit-Queue: Samir Jindel <sjindel@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Reviewed-by: Régis Crelier <regis@google.com>
2017-11-24 18:23:57 +00:00
Erik Corry 1d9ff70a08 [VM] Pick more compact instruction encodings on x64
Several tricks here:
* When zeroing registers we can use xorl instead of xorq because the 'l'
  variant will zero the top bits.
* test and 'and' instructions with immediate arguments can use 8-bit and 32 bit
  variants more heavily.
* mov reg, immediate can use more compact encodings when sign-extension is not
  needed.

Performance is better than +1% when measured on Dart2JS.

R=vegorov@google.com

Intel optimization manual says: "Assembly/Compiler Coding Rule 64. (H impact, M
generality) Use the 32-bit versions of instructions in 64-bit mode to reduce
code size unless the 64-bit version is necessary to access 64-bit data or
additional registers."
Bug:
Change-Id: I2a989315c45f8d8ebab719653fbfa2b18ebb77c9
Reviewed-on: https://dart-review.googlesource.com/23400
Commit-Queue: Erik Corry <erikcorry@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2017-11-24 10:53:17 +00:00
Ryan Macnak d366f9619a [vm] Toward deterministic builds.
- Remove random build-id.
 - Replace build time in embedded version string with commit time.
 - Remove timestamps from Observatory tarball.
 - Zero-initialize skipped bytes in snapshot streams.
 - Fix uninitialized fields in PatchClass, Script and Library.
 - Disable (under flag) random identity hashes and concurrent GC.

Bug: https://github.com/dart-lang/sdk/issues/31427
Change-Id: I3e95de679c8372841cd27ca60df78d9b00ffbfe1
Reviewed-on: https://dart-review.googlesource.com/22901
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Zach Anderson <zra@google.com>
2017-11-23 00:07:56 +00:00
Martin Kustermann d354a28cb2 [kernel] Add kernel2kernel constant evaluation, binary format as well as vm support
The introduced "constants" transformation can evaluate constant expressions.  The
original use-sites of constant expressions are replaced by a new [ConstantExpression]
node, which points to a subclass of a new [Constant] class hierarchy.  Constant
[Field]s and [VariableDeclarations]s will be removed, since all use-sites are
re-written.

The [Constant] class hierarchy is, similarly to the [DartType] class hierarchy, not
part of the AST tree (also has no parent pointer).  The constants form a
DAG (directed acyclic graph).

There is no canonicalization requirement of the [Constant] objects referenced by the
AST (via [ConstantExpression]).  Although it is beneficial to canonicalize them during
construction, since it reduces time spent in operator==/hashCode.

This CL furthermore adds support for a constant table in the binary format.  Similarly
to [String]s, we canonicalize the constants before writing the table to the binary.
The constant table entries in the binary are written in a post-order way, to ensure
easy construction on the backend side.

The text format will be augmented with a "constants { ... }" section at the end,
which lists the constants in the same order as in the binary format.

The transformation can be used by those backends who choose to do so.  It is not
enabled by default atm.  It should therefore not affect analyzer, fasta or other
components.

Change-Id: I57cd9624fedcf537ab6870db76246149647bed21
Reviewed-on: https://dart-review.googlesource.com/14382
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Kevin Millikin <kmillikin@google.com>
2017-11-16 11:08:02 +00:00
Ryan Macnak 374c21ccb4 [vm] Improve packing of StackMaps.
Flutter gallery ARM32:
StackMaps        1248008 ->   898886 (-28.0%)
Total snapshot  11089876 -> 10741228 (-3.1%)

Bug: https://github.com/dart-lang/sdk/issues/31302
Change-Id: I61c6fbf9024648907238d1d835d13d75b17f224a
Reviewed-on: https://dart-review.googlesource.com/20480
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2017-11-14 20:04:14 +00:00
Siva Chandra 2b80ed8290 Make line starts field of RawScript to be a TypedData of int32_t values.
It was previously an array of Smi values. By converting to TypedData
array of int32_t values, we shave off 70+KB from the kernel based core
snapshots. While 70KB might not seem too high, it is 5% of the excess
size we have wrt to the token stream based core snapshots.

Change-Id: I5b58a1d1ac27391eca1efff179301bb04162e97b
Reviewed-on: https://dart-review.googlesource.com/19800
Commit-Queue: Siva Chandra <sivachandra@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
2017-11-14 17:55:06 +00:00
Ryan Macnak 074b43c863 [vm] Don't let the optimizer mislead coverage data.
Coverage uses the value of an execution counter to detect executed functions. However non-positive execution counter does not necessary mean that a function was never executed because we sometimes reset the counter.

Introduce additional bit on a function that is set whenever we reset positive execution counter and use this bit when generating coverage data.

Bug: https://github.com/dart-lang/sdk/issues/31326
Change-Id: I5357109603defad7e7c9415c433203f16bcf88f4
Reviewed-on: https://dart-review.googlesource.com/19760
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2017-11-10 22:35:48 +00:00
Siva Chandra 3289dd2bff Move the kernel offset fields under !defined(DART_PRECOMPILED_RUNTIME).
Also added the missing reading/writing of kernel offsets of libraries
and patch classes in raw_object_snapshot.cc.

Fixes #31258 and #29850.

Change-Id: I7d22ccda9dd1ded9ad1f0963da33bce3975b84ba
Reviewed-on: https://dart-review.googlesource.com/18400
Commit-Queue: Siva Chandra <sivachandra@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
2017-11-03 23:01:40 +00:00
Siva Chandra 9f0175059e Load class members lazily when loading from kernel.
This change brings down core snapshot size by ~750KB, and brings
down app-jit snapshot size of simple "Hello, World" dart script by
~650KB. The bot cycle times will also come down by around ~20%.

Change-Id: I2a01c98bedc7ebfa2a653983995486a71504daf3
Reviewed-on: https://dart-review.googlesource.com/16323
Commit-Queue: Siva Chandra <sivachandra@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
2017-10-31 19:19:25 +00:00
Martin Kustermann b7627da50b [VM] Clone metadata from methods when copying functions into mixin application classes
This allows the normal VM metadata lookup code to find metadata attached
to members which come from mixed-in classes.

This allows e.g. putting a @AlwaysInline / @NeverInline annotation on
methods of mixin classes.

Change-Id: I70639dc78fc5bab98ac7cee107c2042f84d07888
Reviewed-on: https://dart-review.googlesource.com/17164
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2017-10-31 12:23:35 +00:00
Erik Corry ae2d84e51e VM: Speed up output of UTF8 for 1-byte strings.
For 1-byte strings we don't need the full power of UTF-8 conversion with
support for 3 and 4-byte sequences and reassembly of UTF-16 surrogate pairs.

This optimization was originally intended to improve the reverse-complement
benchmark.  It also seems to have a positive effect (ca. 1% on average) on
dart2js.

After implementing this it doesn't seem worth having a special case in
ToCString for ASCII strings. That special case would allocate the string twice
for all Latin1 strings, which feels unfortunate.

R=vegorov@google.com

Bug:
Change-Id: If852f3ecb4e06118da8357cfa2c843ad0df0edb9
Reviewed-on: https://dart-review.googlesource.com/8920
Commit-Queue: Erik Corry <erikcorry@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2017-10-23 10:43:59 +00:00
Régis Crelier 269298fa8e [VM] Remove support for deprecated tear off syntax in the VM.
Change-Id: I2359bb18783cf21eab94001fe401f66c2ce680b7
Reviewed-on: https://dart-review.googlesource.com/14721
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Régis Crelier <regis@google.com>
2017-10-18 01:11:00 +00:00
Siva Chandra 5558fc4370 Add a new VM object type KernelProgramInfo.
This new object points to program wide data like string offsets,
string data etc. It also holds an array of pointers to all Script
objects corresponding scripts in the program's source table.

This new object type is required for two reasons:
1. The Script objects now have a number of fields which point to
program wide data. All Script objects point to the same data in the
VM heap. By introducing an indirection via this new object, we reduce
the number of pointers in Script objects.
2. Lazy loading of VM objects - Kernel nodes of
entities like fields and functions have a field which point to the
source file in which they are defined. This entry is an index into
the program wide source table and helps in associating 
functions/fields with their actual source location. When lazy loading
functions and fields, the pre-loaded script objects in the
program's KernelProgramInfo help in associating the functions and
fields with the correct source script at load time.

Change-Id: Id863284ae7dd98b0832e5dfc115dabad1ed762d8
Reviewed-on: https://dart-review.googlesource.com/13920
Commit-Queue: Siva Chandra <sivachandra@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
2017-10-17 16:57:12 +00:00
Régis Crelier 390c80234a [VM generic functions] Properly instantiate generic signatures by providing the
number of free function type parameters.
Add test and mark status files.

Change-Id: I081de7674693c5ac2071a33948d25aadfc65f4ae
Reviewed-on: https://dart-review.googlesource.com/13901
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Régis Crelier <regis@google.com>
2017-10-16 21:57:05 +00:00
Régis Crelier a73e6832fc [VM generic functions] Remove empty_type_arguments singleton.
This empty vector was added in https://codereview.chromium.org/2818273002/
to properly instantiate generic signatures.
Later on, the implementation of HasInstantiatedSignature() was improved in
https://codereview.chromium.org/2965743002/ making the empty vector unnecessary.
However, the implementation of InstantiateFrom() will also need improvement
as noted by the added TODO.

Change-Id: I042a57b643390c789620b04122084db19ec445ea
Reviewed-on: https://dart-review.googlesource.com/13400
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Régis Crelier <regis@google.com>
2017-10-12 15:21:52 +00:00
Alexander Markov 86fde60e4d [VM] Intrinsify Type.hashCode
This CL optimizes Type.hashCode similarly to String.hashCode, by
introducing intrinsic version of hashCode calculation which uses
hashcode stored in Type instance.

This is important for Flutter's .of pattern, which heavily uses
Maps with Type keys.

Results on Flutter stocks/build_bench.dart microbenchmark:
Before: 4906 µs
After:  4751 µs
(minimum of 5 runs, using tip of Flutter and Flutter engine)

Issue: https://github.com/dart-lang/sdk/issues/31011
Issue: https://github.com/flutter/flutter/issues/11572
Change-Id: Ifbaf721050007db49bbd969dc669d070f4ce839e
Reviewed-on: https://dart-review.googlesource.com/12622
Reviewed-by: Zach Anderson <zra@google.com>
2017-10-10 23:46:09 +00:00
Alexander Markov 14f6276945 [Kernel, VM] Add null checking to devirtualization
Devirtualization optimization now adds metadata to kernel AST instead
of transforming nodes to Direct* ones. The direct call metadata
provides information about checking receiver for null, while
Direct* kernel nodes do not support null checking.

VM's kernel binary loader is extended to extract arbitrary metadata
from kernel binaries and keep it for flow graph builder.
Kernel flow graph builder is extended to take direct call metadata
into account and generate CheckNull/StaticCall instructions
for devirtualized PropertyGet, PropertySet and MethodInvocation nodes.

Issue: https://github.com/dart-lang/sdk/issues/30480
Change-Id: I57f56fbf4a8981d33b1571c0d93105cf8ca71d76
Reviewed-on: https://dart-review.googlesource.com/12260
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2017-10-10 00:50:31 +00:00
Siva Chandra bf096c2bb4 Copy library specific kernel binary data to VM heap.
Before this change, each function and field had its own kernel data blob
in the VM heap. With this change, the entire kernel data of a library is
stored as one single blob in the VM heap. Functions and fields store an
offset which points to the kernel data, specific to them, in that single
blob.

The pointer to the kernel data for a library is saved in two places:
1. With the library objects themselves.
2. With all the patch classes of the library.
3. With the patch classes created during hot reload.

Change-Id: Ie03e738c4d20f16056a5ef04341b75506fda9c60
Bug:
Reviewed-on: https://dart-review.googlesource.com/6601
Commit-Queue: Siva Chandra <sivachandra@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
2017-10-09 15:03:15 +00:00
Alexander Aprelev ce427ac14f Revert "Revert "Introduce StaticCallNode::kNoRebind and use that in implicit closures.""
This reverts commit ade37f931e.

This re-lands RebindRule change with fixes for the "-mdebug--hot-reload" test failures.

Original commit is reverted in patch set 1.
Fixes are in following patch sets.

Bug:
Change-Id: I49375af9b891323fe05c670d77cbf880964aae54
Reviewed-on: https://dart-review.googlesource.com/9361
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Commit-Queue: Alexander Aprelev <aam@google.com>
2017-09-28 19:43:32 +00:00
Dmitry Stefantsov ade37f931e Revert "Introduce StaticCallNode::kNoRebind and use that in implicit closures."
This reverts commit 97393fd961.

TBR=aam@google.com

Change-Id: I8fc5f644e994faa20aa8b5c54f8d6227a054e39d
Reviewed-on: https://dart-review.googlesource.com/9220
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
2017-09-28 08:44:48 +00:00
Alexander Aprelev 97393fd961 Introduce StaticCallNode::kNoRebind and use that in implicit closures.
Change-Id: I6219462fed278dbb90361c2084eed886c9245097

Revert "Revert "Introduce inline cache reload rule attribute to static call AST node and ICData.""

This reverts commit 162283c2f3.

This re-lands the change with original revert in Patch set 1, actual bug fix in next patch set.

Bug:
Change-Id: I6219462fed278dbb90361c2084eed886c9245097
Reviewed-on: https://dart-review.googlesource.com/8760
Commit-Queue: Alexander Aprelev <aam@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2017-09-28 03:26:22 +00:00
Régis Crelier db8b20107b Revert "Revert "Dart Core Lib change to support generic functions in class NoSuchMethodError.""
This reverts commit 8cf9ef22c4.

The expectations in Dart2js and Kernel tests have now been updated.

Change-Id: I9d65ff207490cfc783849b1b726db81cf56ecfc2
Reviewed-on: https://dart-review.googlesource.com/9124
Reviewed-by: Régis Crelier <regis@google.com>
2017-09-28 00:27:24 +00:00
Régis Crelier 8cf9ef22c4 Revert "Dart Core Lib change to support generic functions in class NoSuchMethodError."
This reverts commit db15f5d73b.

Dart2js and Kernel tests are comparing text that has changed because of
the core lib change.

Change-Id: I1d33716a3d6e6a077aa1f1a9ad7cc37825d31fa6
Reviewed-on: https://dart-review.googlesource.com/9082
Reviewed-by: Siva Chandra <sivachandra@google.com>
2017-09-27 21:08:20 +00:00