Commit Graph

149 Commits

Author SHA1 Message Date
Martin Kustermann ad7fbb6dd7 [VM] Fix flow graph builder to not generate different code in unoptimized/optimized mode
Change-Id: I752be6bd97dcd892ea6ba5d7fdd30575d4cee489
Reviewed-on: https://dart-review.googlesource.com/c/84720
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2018-11-22 14:05:47 +00:00
asiva 0ca1c57593 Reland "[VM] Remove unused flags"
This is a reland of 1a4cff1bd4

Original change's description:
> [VM] Remove unused flags
> 
> Remove the following flags which are always ON
> --strong
> --reify_generic_functions
> 
> and these flags which are not applicable anymore
> --error-on-bad-override
> --error-on-bad-type
> --enable-type-checks
> 
> Change-Id: I6e1aeb68e663953f4ae49ca94ea0daa87b661900
> Reviewed-on: https://dart-review.googlesource.com/c/79431
> Commit-Queue: Siva Annamalai <asiva@google.com>
> Reviewed-by: Alexander Markov <alexmarkov@google.com>
> Reviewed-by: Régis Crelier <regis@google.com>

Change-Id: Ib4452c22fb05eed38820708abb648939e03b1df0
Reviewed-on: https://dart-review.googlesource.com/c/84923
Reviewed-by: Siva Annamalai <asiva@google.com>
2018-11-20 17:25:42 +00:00
Siva Annamalai f6c41ac3bc Revert "[VM] Remove unused flags"
This reverts commit 1a4cff1bd4.

Reason for revert: The precompiled arm bot failed a test.

Original change's description:
> [VM] Remove unused flags
> 
> Remove the following flags which are always ON
> --strong
> --reify_generic_functions
> 
> and these flags which are not applicable anymore
> --error-on-bad-override
> --error-on-bad-type
> --enable-type-checks
> 
> Change-Id: I6e1aeb68e663953f4ae49ca94ea0daa87b661900
> Reviewed-on: https://dart-review.googlesource.com/c/79431
> Commit-Queue: Siva Annamalai <asiva@google.com>
> Reviewed-by: Alexander Markov <alexmarkov@google.com>
> Reviewed-by: Régis Crelier <regis@google.com>

TBR=rmacnak@google.com,alexmarkov@google.com,asiva@google.com,regis@google.com

Change-Id: Ib0fe4f33c044047ef1cb31bca9d38591176b7d40
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/84883
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Siva Annamalai <asiva@google.com>
2018-11-20 07:32:11 +00:00
asiva 1a4cff1bd4 [VM] Remove unused flags
Remove the following flags which are always ON
--strong
--reify_generic_functions

and these flags which are not applicable anymore
--error-on-bad-override
--error-on-bad-type
--enable-type-checks

Change-Id: I6e1aeb68e663953f4ae49ca94ea0daa87b661900
Reviewed-on: https://dart-review.googlesource.com/c/79431
Commit-Queue: Siva Annamalai <asiva@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Régis Crelier <regis@google.com>
2018-11-20 06:41:06 +00:00
Vyacheslav Egorov ddbe22190c [vm/compiler] Refactor representation of stores and loads in IL.
Make StoreIntanceField and LoadField instructions use a single uniform
abstraction: Slot (used to be called NativeFieldDesc), which represents
either a real Dart field (i.e. a field that has a corresponding Field object)
or a native VM field that does not have a corresponding Field object.

This refactoring eliminates raw stores/loads that were just using offsets
before - now we always know what kind of slots we are accessing and
this yields better aliasing information.

Change-Id: I2f48332d58258219565bd961764e8cc9dd4d75ce
Reviewed-on: https://dart-review.googlesource.com/c/74582
Commit-Queue: Vyacheslav Egorov <vegorov@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2018-11-16 17:57:29 +00:00
Martin Kustermann 27537b458a [VM] Ensure parameters from unchecked entrypoints have type attached
For functions without optional parameters this is done in the
ParameterInstr::ComputeType directly whereas for optional parameters,
where the prologue is not built 2 times, we use redefinitions.

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

Change-Id: Id6f86610ecbde090ca1596d6fabdf7f2a8bcd5e2
Reviewed-on: https://dart-review.googlesource.com/c/83020
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2018-11-09 16:40:21 +00:00
Samir Jindel d11b74d1f3 [vm] Use unchecked entry-point for super calls.
Change-Id: Ie1abd050203f2d9806ebeedbec47292892fc9b0e
Reviewed-on: https://dart-review.googlesource.com/c/79960
Commit-Queue: Samir Jindel <sjindel@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2018-10-25 12:48:09 +00:00
Martin Kustermann 06f9a9e354 [VM] Introduce function and osr entrypoints to the VM's IR
Similar to how we treat catch entry instructions, this cl adds new
function and osr entry instructions. The [FunctionEntry] and
[OsrEntry] - just like [CatchBlockEntry] - have now their own initial
definitions. The [GraphEntry] has only initial definitions for
constants.

Explicit phis are inserted for all parameter / special parameter
instructions if necessary.

Future work is:

  a) Minimize parallel moves due to the phis on parameters
  b) Cleanup frame setup: Move it entirely into FunctionEntry/CatchEntry
    (instead of the split version we have now)

Fixes https://github.com/dart-lang/sdk/issues/34435
Fixes https://github.com/dart-lang/sdk/issues/34287

Change-Id: Iefa0280a709716f748d6fb0523b8d0f4d8de1fec
Reviewed-on: https://dart-review.googlesource.com/c/74782
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2018-10-15 13:02:51 +00:00
Zach Anderson b4004f6476 [vm] Reland: Move the interpreter under a flag.
After this CL, the interpreter is included by default in the
JIT VM under the flag --enable-interpreter.

Reland with fix to NativeArgument setup in simulator_arm.cc

Change-Id: Ib9b4df6eb4d997dfbe361188b8a127828c1d9c6f
Reviewed-on: https://dart-review.googlesource.com/74003
Reviewed-by: Siva Annamalai <asiva@google.com>
Reviewed-by: Régis Crelier <regis@google.com>
Commit-Queue: Zach Anderson <zra@google.com>
2018-09-07 19:25:31 +00:00
Zach Anderson 21406f576a Revert "[vm] Move the interpreter under a flag."
This reverts commit 715ab7b30b.

Reason for revert: simarm and kernel precomp builds failing

Original change's description:
> [vm] Move the interpreter under a flag.
> 
> After this CL, the interpreter is included by default in the
> JIT VM under the flag --enable-interpreter.
> 
> Change-Id: I06458f20288d67981822788ee6e867c2127ebdd3
> Reviewed-on: https://dart-review.googlesource.com/71800
> Commit-Queue: Zach Anderson <zra@google.com>
> Reviewed-by: Alexander Markov <alexmarkov@google.com>
> Reviewed-by: Siva Annamalai <asiva@google.com>
> Reviewed-by: Régis Crelier <regis@google.com>
> Reviewed-by: Ryan Macnak <rmacnak@google.com>

TBR=rmacnak@google.com,alexmarkov@google.com,zra@google.com,asiva@google.com,regis@google.com

Change-Id: I3622f4dbe53288d07fc21b34ee5ff68f2682b36d
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/74001
Reviewed-by: Zach Anderson <zra@google.com>
Commit-Queue: Zach Anderson <zra@google.com>
2018-09-07 17:14:21 +00:00
Zach Anderson 715ab7b30b [vm] Move the interpreter under a flag.
After this CL, the interpreter is included by default in the
JIT VM under the flag --enable-interpreter.

Change-Id: I06458f20288d67981822788ee6e867c2127ebdd3
Reviewed-on: https://dart-review.googlesource.com/71800
Commit-Queue: Zach Anderson <zra@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
Reviewed-by: Régis Crelier <regis@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2018-09-07 16:46:07 +00:00
Vyacheslav Egorov 80615aed27 [vm] Implement static type exactness tracking for method receivers.
Change-Id: I35ffcee7dfa741d2095b711d402a6caae388b2c4
Reviewed-on: https://dart-review.googlesource.com/68943
Commit-Queue: Vyacheslav Egorov <vegorov@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2018-08-29 10:11:17 +00:00
Samir Jindel 60757d0873 [vm/kernel] Fix bug with optimization of this-invocations.
Fixes #34268.

Change-Id: Ie6a70f80d4e01d83e0381412c1c908d241e33ecd
Reviewed-on: https://dart-review.googlesource.com/71640
Commit-Queue: Samir Jindel <sjindel@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2018-08-28 12:22:20 +00:00
Samir Jindel c691a85b92 [vm/kernel] Fix type arguments handling in IL construction.
Thanks to Alex Markov for the test case!

Fixes #34269.

Change-Id: I66371532b40984c58332ee43c99e744d746ecfae
Reviewed-on: https://dart-review.googlesource.com/71540
Commit-Queue: Samir Jindel <sjindel@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2018-08-27 19:39:27 +00:00
Samir Jindel 2beb05b829 [vm] Re-land use of multiple entrypoints for closure calls.
Original patchset is in revision 1.

Change-Id: I29ab0dbc3711f99895fd4f04a49d4185463a1602
Cq-Include-Trybots: luci.dart.try:vm-kernel-win-release-x64-try,vm-kernel-optcounter-threshold-linux-release-x64-try,vm-kernel-precomp-linux-debug-x64-try,vm-kernel-precomp-linux-release-simarm-try,vm-kernel-precomp-linux-release-simarm64-try,vm-kernel-precomp-linux-release-x64-try,vm-kernel-precomp-win-release-x64-try,vm-kernel-linux-release-simarm-try,vm-kernel-linux-release-simarm64-try,vm-kernel-reload-linux-debug-x64-try,vm-kernel-reload-linux-release-x64-try
Reviewed-on: https://dart-review.googlesource.com/71241
Commit-Queue: Samir Jindel <sjindel@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2018-08-23 17:54:19 +00:00
Samir Jindel 569290dbf5 Revert "[vm] Use multiple entrypoints to remove unnecessary checks on statically-typed closure calls."
This reverts commit 19126e861e.

Reason for revert: Breaks several bots.

Original change's description:
> [vm] Use multiple entrypoints to remove unnecessary checks on statically-typed closure calls.
> 
> Test Plan:
> 
> Behavioral correctness should be ensured by existing tests. Tests in vm/dart/entrypoints
> ensure that the unchecked entrypoint is used in cases where the optimization should trigger.
> 
> Bug: https://github.com/dart-lang/sdk/issues/31798
> 
> Change-Id: Id25ecba86e20c22f0678c12986ad620db312ddaa
> Cq-Include-Trybots: luci.dart.try:vm-kernel-win-release-x64-try,vm-kernel-optcounter-threshold-linux-release-x64-try,vm-kernel-precomp-linux-debug-x64-try,vm-kernel-precomp-linux-release-simarm-try,vm-kernel-precomp-linux-release-simarm64-try,vm-kernel-precomp-linux-release-x64-try,vm-kernel-precomp-win-release-x64-try
> Reviewed-on: https://dart-review.googlesource.com/69743
> Commit-Queue: Samir Jindel <sjindel@google.com>
> Reviewed-by: Vyacheslav Egorov <vegorov@google.com>

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

Change-Id: Ia33e9d141827d3c990c65d839333443c224dc85d
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: https://github.com/dart-lang/sdk/issues/31798
Cq-Include-Trybots: luci.dart.try:vm-kernel-win-release-x64-try, vm-kernel-optcounter-threshold-linux-release-x64-try, vm-kernel-precomp-linux-debug-x64-try, vm-kernel-precomp-linux-release-simarm-try, vm-kernel-precomp-linux-release-simarm64-try, vm-kernel-precomp-linux-release-x64-try, vm-kernel-precomp-win-release-x64-try
Reviewed-on: https://dart-review.googlesource.com/70920
Reviewed-by: Samir Jindel <sjindel@google.com>
Commit-Queue: Samir Jindel <sjindel@google.com>
2018-08-21 17:10:56 +00:00
Samir Jindel 19126e861e [vm] Use multiple entrypoints to remove unnecessary checks on statically-typed closure calls.
Test Plan:

Behavioral correctness should be ensured by existing tests. Tests in vm/dart/entrypoints
ensure that the unchecked entrypoint is used in cases where the optimization should trigger.

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

Change-Id: Id25ecba86e20c22f0678c12986ad620db312ddaa
Cq-Include-Trybots: luci.dart.try:vm-kernel-win-release-x64-try,vm-kernel-optcounter-threshold-linux-release-x64-try,vm-kernel-precomp-linux-debug-x64-try,vm-kernel-precomp-linux-release-simarm-try,vm-kernel-precomp-linux-release-simarm64-try,vm-kernel-precomp-linux-release-x64-try,vm-kernel-precomp-win-release-x64-try
Reviewed-on: https://dart-review.googlesource.com/69743
Commit-Queue: Samir Jindel <sjindel@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2018-08-21 16:00:57 +00:00
Samir Jindel d8a4a3896a [vm] Multiple entrypoints: backend/assembler support.
Test Plan:

Will be tested by following revisions which introduce optimizations that invoke the
new entrypoint.

Change-Id: I56d714bceb92c44a13c46d52457154b82577aa8c
Cq-Include-Trybots: luci.dart.try:vm-kernel-win-release-x64-try,vm-kernel-optcounter-threshold-linux-release-x64-try,vm-kernel-precomp-linux-debug-x64-try,vm-kernel-precomp-linux-release-simarm-try,vm-kernel-precomp-linux-release-simarm64-try,vm-kernel-precomp-linux-release-x64-try,vm-kernel-precomp-win-release-x64-try
Reviewed-on: https://dart-review.googlesource.com/67345
Commit-Queue: Samir Jindel <sjindel@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2018-08-16 17:15:32 +00:00
Vyacheslav Egorov aa8145a03d [vm/kernel] Add a transformation that annotates invocations with receiver type.
Currently we only annotate those call-sites that would result
in generic covariant checks performed on the callee side.

Bug: https://github.com/dart-lang/sdk/issues/31798
Change-Id: Ifcf60032036575f615015d716276484a7c1236b3
Reviewed-on: https://dart-review.googlesource.com/69580
Commit-Queue: Vyacheslav Egorov <vegorov@google.com>
Reviewed-by: Kevin Millikin <kmillikin@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2018-08-16 12:30:56 +00:00
Samir Jindel 8d3d82ab39 [vm/kernel] Untangle the spaghetti-code in BuildGraphOfFunction and fix bugs.
Also remove Fragment initializer-list constructor.

Bugs:

1. We were always building the body of a constructor even if the initializers
   graph was closed. This would confuse the inliner exit collector which was
   informed about return instructions inside the body which were never linked
   into the graph.

2. We were not checking for stack overflow on each call to an sync-yielding
   closure; only on the first call.

3. Not a behavioral bug, but the prologue flow graph is no longer built out of
   order (dartbug.com/29737).

Change-Id: I467fbf171fd627492bf01cd96d6353c57e143eaa
Reviewed-on: https://dart-review.googlesource.com/67561
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Commit-Queue: Samir Jindel <sjindel@google.com>
2018-08-03 16:32:02 +00:00
Vyacheslav Egorov 4fa139b4b8 [vm/compiler] Rework how logical expressions are compiled to IL.
When logical expression is evaluated in the control context (e.g. if (cond) { ... })
avoid materializing a boolean value and then dispatching on it. Instead connect
true and false successors directly to then and else branches.

This CL also improves IL generated when logical expression is evaluated for value
(e.g. x = (cond)): we similarly avoid materializing intermediate results and also
avoid comparisons that are not needed, e.g. when evaluating x = A && B we construct
graph x = A ? B : false, instead of x = A ? (B == true ? true : false) : false style
of graph.

Change-Id: I204d414cc6751949641b6c46423a6319f6e2d89b
Reviewed-on: https://dart-review.googlesource.com/67562
Commit-Queue: Vyacheslav Egorov <vegorov@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2018-08-02 10:51:53 +00:00
Alexander Markov 8245707b4c [vm] Refactoring: remove misuses of StreamingFlowGraphBuilder
In certain cases StreamingFlowGraphBuilder was used not for building
flow graph, but as an advanced kernel reader. This CL extracts all such
functionality from StreamingFlowGraphBuilder and revises all such uses.

StreamingFlowGraphBuilder constructors without FlowGraphBuilder are
removed. After this CL StreamingFlowGraphBuilder is only used to build
flow graph, as intended.

Change-Id: I69b08e24d37f8f2f336bee85334af11be1639b24
Reviewed-on: https://dart-review.googlesource.com/64821
Reviewed-by: Régis Crelier <regis@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Reviewed-by: Zach Anderson <zra@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2018-07-17 16:36:50 +00:00
Alexander Markov 7f8db8d06f [vm] Refactoring: extract constant evaluator and fingerprints helper
This CL continues refactoring aimed at isolating StreamingFlowGraphBuilder.

StreamingFlowGraphBuilder dependency is removed from classes
* StreamingConstantEvaluator (it still depends on FlowGraphBuilder)
* ConstantHelper
* SimpleExpressionConverter
and several methods in object.cc.

StreamingConstantEvaluator and ConstantHelper are moved from
kernel_binary_flowgraph{.h, .cc} to a new source file
constant_evaluator{.h, .cc}. StreamingConstantEvaluator is renamed
to ConstantEvaluator.

KernelFingerprintHelper and KernelSourceFingerprintHelper are moved to
a new source file kernel_fingerprints{.h, .cc}.

Instances of kernel::FlowGraphBuilder no longer contain back reference
to a StreamingFlowGraphBuilder. In order to drop this circular dependency
TranslateFinallyFinalizers() is moved from FlowGraphBuilder to
StreamingFlowGraphBuilder.

Change-Id: Id550d22b3567dea9512328a900935bd6145a8107
Reviewed-on: https://dart-review.googlesource.com/64463
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Zach Anderson <zra@google.com>
Reviewed-by: Régis Crelier <regis@google.com>
2018-07-11 21:30:13 +00:00
Alexander Markov e5d31282eb [vm] Support Dart metadata on libraries and library dependencies in Dart 2 mode
Fixes https://github.com/dart-lang/sdk/issues/33774

Change-Id: I0b34cdf2bee099076e29bec6cfb849b0b250f690
Reviewed-on: https://dart-review.googlesource.com/64245
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2018-07-09 23:58:26 +00:00
Jens Johansen d26dba1619 More positions in dart2 constant evaluator
Use positions already available in for instance AsExpressions,
also adds new offsets in the kernel format to
SuperInitializer and RedirectingInitializer.

Bug: #33216
Change-Id: I542967ddc6ec782e6513d62fce038a49239e1622
Reviewed-on: https://dart-review.googlesource.com/63883
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2018-07-09 07:31:44 +00:00
Alexander Markov 98391f2737 [vm] Refactoring: move StreamingScopeBuilder out of kernel_binary_flowgraph
After previous refactoring, StreamingScopeBuilder no longer depends on
StreamingFlowGraphBuilder.

This CL moves StreamingScopeBuilder to a separate file
vm/compiler/frontend/scope_builder{.h, .cc}.

Also:
* StreamingScopeBuilder is renamed to ScopeBuilder.
* IntMap is moved to hash_map.h.
* Minor cleanup of unused forward declarations and friend classes.
Change-Id: I5e780a53f37935c0a1d563d4fbaec3a92ae13d6a
Reviewed-on: https://dart-review.googlesource.com/63692
Reviewed-by: Zach Anderson <zra@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2018-07-07 19:00:12 +00:00
Alexander Markov 620ab34de6 [vm] Implement reading of parameter annotations from kernel
Fixes https://github.com/dart-lang/sdk/issues/33207

Change-Id: I201d262bb913c342b705a607b0d88ba345e759e0
Reviewed-on: https://dart-review.googlesource.com/63644
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2018-07-03 23:23:06 +00:00
Alexander Markov f39eaf937c [vm] Refactoring: remove dependency of StreamingScopeBuilder on StreamingFlowGraphBuilder
StreamingScopeBuilder does not build a flow graph, but it was creating
and using StreamingFlowGraphBuilder under the hood (in order to read kernel).

This change makes StreamingScopeBuilder independent of StreamingFlowGraphBuilder
and prepares StreamingScopeBuilder to be moved out of kernel_binary_flowgraph.

Also, several unused classes, fields and parameters are removed.

Change-Id: I40ff983caf0e548529b3c52f44dcb785bd4e9f40
Reviewed-on: https://dart-review.googlesource.com/63305
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2018-07-03 21:04:06 +00:00
Alexander Markov 8c63d578a6 [vm] Refactoring: move out classes independent of StreamingFlowGraphBuilder
This change continues refactoring to split kernel_binary_flowgraph and
kernel_to_il and move out parts which have no dependencies on flow graph
construction.

Bytecode reading is moved to a separate file bytecode_reader{.h, .cc}.

Metadata helpers, TypeTranslator, ActiveClass and other Active* are moved
to kernel_translation_helper.

Removed dependency of ICData tags on IL Instruction tags, so ICData objects
can be created by bytecode reader without depending on IL.

Unused AlternativeScriptScope is removed.

Change-Id: Ic9f98af82697b48013fb89802076b56833acf55d
Reviewed-on: https://dart-review.googlesource.com/63262
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Reviewed-by: Régis Crelier <regis@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2018-07-03 19:02:54 +00:00
Alexander Markov 7d03796193 [vm] Refactoring: make reading of kernel metadata and types independent of StreamingFlowGraphBuilder
This CL removes all dependencies on StreamingFlowGraphBuilder from
all metadata helpers and StreamingDartTypeTranslator.

This further decouples parts which are not related to flow graph building
and prepares them for moving.

StreamingDartTypeTranslator is also renamed to TypeTranslator.

Change-Id: I4cb90a214fae4f979160cca7ddc3f7fae1c637e8
Reviewed-on: https://dart-review.googlesource.com/62961
Reviewed-by: Régis Crelier <regis@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2018-06-29 16:13:10 +00:00
Alexander Markov f304948807 [vm] Refactoring: extract kernel translation helpers to a separate file
Change-Id: I228165e1ff768eacc7ee54ff787675931504e450
Reviewed-on: https://dart-review.googlesource.com/62722
Reviewed-by: Samir Jindel <sjindel@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2018-06-28 15:43:35 +00:00
Alexander Markov a7f0f7ea89 [vm] Add source positions to stack traces of bool checks
If a condition has a source position in kernel, this source position is
now used in stack traces for bool checks.

Issue: https://github.com/dart-lang/sdk/issues/33584
Change-Id: Idb833abbaeaa32e6c5deb0d383cc4215642d3f2a
Reviewed-on: https://dart-review.googlesource.com/62360
Reviewed-by: Samir Jindel <sjindel@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2018-06-27 16:54:39 +00:00
Vyacheslav Egorov 20ca5bbb05 [vm/jit] Introduce dynamic invocation forwarders that perform type checking
This forwarders are used at dynamic call-sites and perform type checking
for all non-generic-covariant arguments. This allows to skip the same
type checks in the actual method body.

This yield on average 10% improvement in performance across the body of
benchmarks including dart2js compilation times.

Bug: https://github.com/dart-lang/sdk/issues/33257
Change-Id: If3fc94a2e0a6f496ec0633f0b379d053a54a40ca
Reviewed-on: https://dart-review.googlesource.com/61244
Commit-Queue: Vyacheslav Egorov <vegorov@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2018-06-25 07:27:04 +00:00
Alexander Markov eafa9ae4b6 [vm/kernel] Fix StreamingConstantEvaluator to handle non-const variables
Fixes https://github.com/dart-lang/sdk/issues/33214

Change-Id: I7991b537204f160b2991abf9995685e4cae69f88
Reviewed-on: https://dart-review.googlesource.com/61682
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2018-06-22 17:16:45 +00:00
Ryan Macnak fa7c38dec5 [vm, standalone] Do not copy when loading kernel.
In a topaz release build with JIT apps,
mondrian(flutter_runner):      PSS 44.4M -> 35.8M (-19.4%)
ledger_dashboard(dart_runner): PSS 15.2M -> 12.0M (-21.1%)

Change-Id: I501c24de56a5a7c65a2f03b87709cb09bb95d465
Reviewed-on: https://dart-review.googlesource.com/60202
Reviewed-by: Zach Anderson <zra@google.com>
Reviewed-by: Régis Crelier <regis@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2018-06-21 23:27:53 +00:00
Jens Johansen e2ce88dfcc Add startFileOffset on procedures et al, enable VMs GetSource
Prior to this change we only had fileOffset which points to the name.
This CL adds a field - startFileOffset - that points to the start
(e.g. 'static', 'factory', the return type or any presiding annotation
(including '@')), as well as fixing `Function::GetSource` in the VM to
fix a crash when using mirrors to ask for the source of a function or
constructor.

The field is added to procedures, constructors and classes.
The latter changes the location of classes with annotations to be
the position of the annotation. This is on-par with --no-preview-dart-2.
The change in regards to procedures and constructors mean, that both
the location and the source (from .location and .source on a
MethodMirror) will change to include any annotations. This is a
different behavior than --no-preview-dart-2.

Closes #33271.

Change-Id: I90f1232c5ec2d01e60e0bab070d44c37232b2730
Reviewed-on: https://dart-review.googlesource.com/60560
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Kevin Millikin <kmillikin@google.com>
2018-06-21 13:10:04 +00:00
Régis Crelier 12b33ada44 [VM interpreter] Support NativeCall kernel bytecode.
Change-Id: I89c905d17fb48447239ee4b0c1c8c50060239b88
Reviewed-on: https://dart-review.googlesource.com/59560
Commit-Queue: Régis Crelier <regis@google.com>
Reviewed-by: Zach Anderson <zra@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2018-06-13 23:30:44 +00:00
Alexander Markov 5bfe8d454e [vm/kernel] Set active class when evaluating Dart annotations, take 2
In https://github.com/dart-lang/sdk/commit/4fb0c6093879f7383ad597b04b3c89f3384dec19
active class was set in StreamingDartTypeTranslator, but it turns out
this is not enough. This CL sets active class in StreamingFlowGraphBuilder;
all dependent helper objects should pick it automatically.

Fixes https://github.com/dart-lang/sdk/issues/33259

Change-Id: If16afff35de32cbdba23f6260dac0e0fd7e9786a
Reviewed-on: https://dart-review.googlesource.com/57524
Reviewed-by: Samir Jindel <sjindel@google.com>
2018-06-04 19:05:33 +00:00
Alexander Markov 1ca17b6d03 [vm/kernel] Recognize desugared mixin applications in dart:mirrors
Kernel mixin transformation desugars mixin applications into normal
classes. Mixed-in type is pulled into interfaces list.
However, dart:mirrors needs to know the original mixed-in type of
a mixin application.

This change solves this problem by propagating a 'isTransformedMixinApplication'
attribute of a class through kernel AST, kernel binary and VM objects
into dart:mirrors implementation.

Fixes: https://github.com/dart-lang/sdk/issues/33240
Change-Id: I98ca69294e1ad445402a5ca91d90c30447aabcb2
Reviewed-on: https://dart-review.googlesource.com/56721
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
Reviewed-by: Kevin Millikin <kmillikin@google.com>
2018-05-29 18:12:26 +00:00
Samir Jindel 6fc0c1fa4f [vm/kernel] Only create zone handles when necessary (e.g. in IR instructions, LocalVariable).
Summary:

When evaluating constants for direct inspection (and not for injection into the
FG), we store many intermediate values in ZoneHandles. This leaks memory, since
the only need for ZoneHandles is preserving constants which are referenced by
the FG.

Test Plan:

Existing coverage is sufficient since no functionality is changed.

Change-Id: I33951eab762a4ad626f07ebf11118247c5a9ad3e
Reviewed-on: https://dart-review.googlesource.com/56345
Commit-Queue: Samir Jindel <sjindel@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2018-05-24 13:14:29 +00:00
Alexander Markov 4fb0c60938 [vm/kernel] Set active class when evaluating Dart annotations
Without active class, kernel reader is not able to finalize types
and fails to parse type literals.

Fixes https://github.com/dart-lang/sdk/issues/33173

Change-Id: Iefe7f33a371f3d4f892f21f8ea0060d70887186c
Reviewed-on: https://dart-review.googlesource.com/56242
Reviewed-by: Martin Kustermann <kustermann@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2018-05-23 16:17:55 +00:00
Vyacheslav Egorov 3f6c87d5ac [vm/compiler] Do not use Constant(#null) to reserve space on the expression stack.
Given IL like this:

  t3 <- Constant(#null)   <--\
  // ... do something ...    |
  StoreLocal(:temp, t4)   ---/
  // Do something else
  StoreIndexed(t1, t2, t3)

Graph builder would use Constant(#null) as an input definition for
StoreIndexed - which leads to wrong generated code in unoptimized mode
on X64 where StoreIndexed has specialization for constant values. In
optimized code SSA renaming would actually replace t3 with a correct
reaching definition.

This CL introduces a new IL instruction MakeTemp(...) which has exactly
the same effect as Constant(#null) on the expression stack, but is
not treated as a constant value by the backend.

The bug was unnoticed because of the loose assertions in the SSA
renaming which permitted replacing Constant-s with non-Constant
reaching definitions. This CL also tightens those assertions to
catch this issue.

Also cleanup the code in SSA renaming a bit to make it a bit easier
to understand.

Fixes https://github.com/dart-lang/sdk/issues/33195

Bug: 33195
Change-Id: I7c914c836d4af7a50e8a8e1a02d03e9413f87779
Reviewed-on: https://dart-review.googlesource.com/56112
Commit-Queue: Vyacheslav Egorov <vegorov@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2018-05-22 18:05:14 +00:00
Régis Crelier 63ff7ee922 [vm/interpreter] Support closures in bytecode.
Support reordered bytecode metadata sections.
For now, read but ignore exceptions table in bytecode metadata.

Change-Id: I86202acc8ea22d746deaa894afd685d2f1daaaf8
Reviewed-on: https://dart-review.googlesource.com/56036
Commit-Queue: Régis Crelier <regis@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2018-05-22 02:37:01 +00:00
Samir Jindel 4bac17655d [kernel/vm] VM support for instantiate-to-bounds.
Dynamic invocations of generic functions might not pass type arguments.
The type arguments need to be filled in with the default type arguments
calculated by the CFE.

Change-Id: I5865e79b2975af97d1ca1680bd88ba8137208bb8
Reviewed-on: https://dart-review.googlesource.com/48423
Commit-Queue: Samir Jindel <sjindel@google.com>
Reviewed-by: Régis Crelier <regis@google.com>
2018-05-18 11:07:17 +00:00
Martin Kustermann 11006c3bac Reland "[VM] Use IR for code in [CatchEntryInstr]s to populate captured exception/stacktrace variables"
This fixes an issue when a program got loaded via dill, a function
with a try-catch got optimized and the exception/stacktrace variables
got captured.

Change-Id: Icb8ea5f3557080f8274f7db2af09e33154820e5b
Reviewed-on: https://dart-review.googlesource.com/55721
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2018-05-17 16:48:56 +00:00
Martin Kustermann e6fc78c87b Revert "Reland "[VM] Use IR for code in [CatchEntryInstr]s to populate captured exception/stacktrace variables""
This reverts commit 23b4a505ec.

Reason for revert: The language_2/custom_await_stack_trace_test started failing.

Original change's description:
> Reland "[VM] Use IR for code in [CatchEntryInstr]s to populate captured exception/stacktrace variables"
> 
> This fixes an issue when a program got loaded via dill, a function
> with a try-catch got optimized and the exception/stacktrace variables
> got captured.
> 
> Change-Id: Icb626965019b248afe3b72a6679c5049ea7b7b00
> Reviewed-on: https://dart-review.googlesource.com/55681
> Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
> Commit-Queue: Martin Kustermann <kustermann@google.com>

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

Change-Id: Ic825c1e3ed14c731da1d43aa6f27d37ed5d36b4c
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/55720
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2018-05-17 15:13:50 +00:00
Martin Kustermann 23b4a505ec Reland "[VM] Use IR for code in [CatchEntryInstr]s to populate captured exception/stacktrace variables"
This fixes an issue when a program got loaded via dill, a function
with a try-catch got optimized and the exception/stacktrace variables
got captured.

Change-Id: Icb626965019b248afe3b72a6679c5049ea7b7b00
Reviewed-on: https://dart-review.googlesource.com/55681
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2018-05-17 14:16:16 +00:00
Martin Kustermann b3affa6721 Revert "[VM] Use IR for code in [CatchEntryInstr]s to populate captured exception/stacktrace variables"
This reverts commit 3531af383e.

Reason for revert: Caused many buildbot failures.

Original change's description:
> [VM] Use IR for code in [CatchEntryInstr]s to populate captured exception/stacktrace variables
> 
> This fixes an issue when a program got loaded via dill, a function
> with a try-catch got optimized.
> 
> Change-Id: I98b2a4aaa7e5472f3e37fd71c1276079102b0142
> Reviewed-on: https://dart-review.googlesource.com/54021
> Commit-Queue: Martin Kustermann <kustermann@google.com>
> Reviewed-by: Vyacheslav Egorov <vegorov@google.com>

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

Change-Id: If4b80128525754d30cec680ad5ff6bc4035296bd
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/55422
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2018-05-16 17:27:13 +00:00
Martin Kustermann 3531af383e [VM] Use IR for code in [CatchEntryInstr]s to populate captured exception/stacktrace variables
This fixes an issue when a program got loaded via dill, a function
with a try-catch got optimized.

Change-Id: I98b2a4aaa7e5472f3e37fd71c1276079102b0142
Reviewed-on: https://dart-review.googlesource.com/54021
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2018-05-16 16:46:42 +00:00
Samir Jindel 1a23ff68a5 Fix incorrect handling of NSM forwarders and pull all logic into CFE. (Take 2)
The behavioral difference is that named and optional arguments are filled in
with their default values in the `Invocation` object passed to `noSuchMethod`.

On the implementation side we make NSM forwarders concrete and fill in their
bodies in the CFE. The custom (and somewhat hacky) VM support is no longer
needed, and Dart2JS can benefit from this implementation as well.

According to discussion on #33031 we will be able to re-land this soon without
breaking Mockito.

Prior failures on precompiler bots are fixed in Patchset 2.

Change-Id: If1b7fe4cf6da5ef38f330e1ad226121bcfc958a1
Reviewed-on: https://dart-review.googlesource.com/54401
Commit-Queue: Samir Jindel <sjindel@google.com>
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
2018-05-15 11:23:32 +00:00