Commit Graph

2345 Commits

Author SHA1 Message Date
Zach Anderson 76b8e397ed Revert "Reland "[VM runtime] Switch intrinsics from old to new Bigint implementation.""
This reverts commit be62fff82f.

Reason for revert: See https://github.com/dart-lang/sdk/issues/32465

Original change's description:
> Reland "[VM runtime] Switch intrinsics from old to new Bigint implementation."
> 
> The change was reverted (thanks Slava) because gen_snapshot was failing to
> find the core lib class _BigIntImpl on flutter.
> The PR https://github.com/flutter/engine/pull/4735 fixed that issue on flutter.
> 
> Change-Id: Id6863d79f7fdb17f0076b63b0168394d5e95ec8d
> Reviewed-on: https://dart-review.googlesource.com/44660
> Reviewed-by: Alexander Markov <alexmarkov@google.com>

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

# Not skipping CQ checks because original CL landed > 1 day ago.

Change-Id: I412f5143442ca6ad43784b037c01fcf9bb42c348
Reviewed-on: https://dart-review.googlesource.com/45800
Reviewed-by: Zach Anderson <zra@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Zach Anderson <zra@google.com>
2018-03-09 08:59:58 +00:00
Zach Anderson 2cb80620bd Revert "[vm/simarm] Fix VRECPS/VRSQRTSQS instruction implementation."
This reverts commit 3da9c349d4.

Reason for revert: Broke the build on vm-kernel-precomp-linux-release-simarm

Original change's description:
> [vm/simarm] Fix VRECPS/VRSQRTSQS instruction implementation.
> 
> This instruction handles 0.0 and infinity operands
> specially because otherwise it produces NaN where it
> should produce appropriate infinity or zero.
> 
> Fixes https://github.com/dart-lang/sdk/issues/24399
> Fixes https://github.com/dart-lang/sdk/issues/26675
> 
> Change-Id: I0741d0daa8b92b4dcd780b1453c9ec449552b1fd
> Reviewed-on: https://dart-review.googlesource.com/45382
> Reviewed-by: Zach Anderson <zra@google.com>

TBR=whesse@google.com,vegorov@google.com,alexmarkov@google.com,zra@google.com

Change-Id: I413be56fdce8afa0e2faa6ed2b16ef0f68b795b0
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/45683
Reviewed-by: Zach Anderson <zra@google.com>
Commit-Queue: Zach Anderson <zra@google.com>
2018-03-09 06:09:40 +00:00
Vyacheslav Egorov 3da9c349d4 [vm/simarm] Fix VRECPS/VRSQRTSQS instruction implementation.
This instruction handles 0.0 and infinity operands
specially because otherwise it produces NaN where it
should produce appropriate infinity or zero.

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

Change-Id: I0741d0daa8b92b4dcd780b1453c9ec449552b1fd
Reviewed-on: https://dart-review.googlesource.com/45382
Reviewed-by: Zach Anderson <zra@google.com>
2018-03-08 17:50:29 +00:00
Ben Konyi e3ecc87eb9 [VM / Kernel ] Fixed issue where enum classes were not being marked as such in the VM. Enum class fields are now eagerly initialized.
Change-Id: I6e5a95a3289d417e1f01f14b289960e45cce6c7b
Reviewed-on: https://dart-review.googlesource.com/45365
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
2018-03-08 01:11:45 +00:00
Erik Corry 235e62264e [VM] Reland Support some 32bit instructions in 64bit assemblers.
These instructions will soon be used for for smaller (32 bit) Smis.
Also fix broken ubfiz instruction in ARM64 assembler.

This reland fixes the disassembler test that used Stop
instructions which disassemble differently on Mac
because constants have higher addresses.

Originally reviewed at
https://dart-review.googlesource.com/c/sdk/+/43668

Fix assembler test on Mac

R=kustermann@google.com

Change-Id: I61f8626184af495f18a74b5fef07bad02b6615e9
Reviewed-on: https://dart-review.googlesource.com/45240
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Erik Corry <erikcorry@google.com>
2018-03-06 10:50:21 +00:00
Erik Corry 3ac86d759e Revert "[VM] Support some 32bit instructions in 64bit assemblers."
This reverts commit a5f173f165.

Reason for revert: Some test failures.

Original change's description:
> [VM] Support some 32bit instructions in 64bit assemblers.
> 
> These instructions will soon be used for for smaller (32 bit) Smis.
> 
> Also fix broken ubfiz instruction in ARM64 assembler.
> 
> R=​kustermann@google.com
> 
> Change-Id: I9068a1c4281047dbd7c1c447fc32ac0e92c89e9d
> Reviewed-on: https://dart-review.googlesource.com/43668
> Reviewed-by: Martin Kustermann <kustermann@google.com>
> Reviewed-by: Vyacheslav Egorov <vegorov@google.com>

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

Change-Id: I0991712936d903f2cb1f3851c919ed6171a96711
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/44981
Reviewed-by: Erik Corry <erikcorry@google.com>
Commit-Queue: Erik Corry <erikcorry@google.com>
2018-03-05 15:29:56 +00:00
Erik Corry a5f173f165 [VM] Support some 32bit instructions in 64bit assemblers.
These instructions will soon be used for for smaller (32 bit) Smis.

Also fix broken ubfiz instruction in ARM64 assembler.

R=kustermann@google.com

Change-Id: I9068a1c4281047dbd7c1c447fc32ac0e92c89e9d
Reviewed-on: https://dart-review.googlesource.com/43668
Reviewed-by: Martin Kustermann <kustermann@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2018-03-05 14:45:23 +00:00
Martin Kustermann 2c956749a5 [VM] Add support to HierarchyInfo to not only create [CidRangeVector]s of subtypes but also subclasses
Issue https://github.com/dart-lang/sdk/issues/31798

Change-Id: I1df4b9238500a1f78b5237ee6a6be4154e7f41d2
Reviewed-on: https://dart-review.googlesource.com/44543
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2018-03-02 17:02:49 +00:00
Martin Kustermann 5d92543f42 [VM] Fix accidental double assignment
This broke ARM on a non-standard compiler.

Change-Id: Idf4e7d5ea9072e6e07d796dc676ec3e7afd6f235
Reviewed-on: https://dart-review.googlesource.com/44786
Reviewed-by: William Hesse <whesse@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2018-03-02 15:40:14 +00:00
Martin Kustermann 80805ff1c1 [VM] Make FlowGraphCompiler::EmitTestAndCallCheckCid static and therefore usable from stubs
Issue https://github.com/dart-lang/sdk/issues/31798

Change-Id: I375cc01bf59d848a203dbcdbd59377d55e9aafe4
Reviewed-on: https://dart-review.googlesource.com/44540
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2018-03-02 15:11:59 +00:00
Régis Crelier be62fff82f Reland "[VM runtime] Switch intrinsics from old to new Bigint implementation."
The change was reverted (thanks Slava) because gen_snapshot was failing to
find the core lib class _BigIntImpl on flutter.
The PR https://github.com/flutter/engine/pull/4735 fixed that issue on flutter.

Change-Id: Id6863d79f7fdb17f0076b63b0168394d5e95ec8d
Reviewed-on: https://dart-review.googlesource.com/44660
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2018-03-02 00:01:54 +00:00
Vyacheslav Egorov 4fb15fcbf2 [vm/compiler] Consolidate compiler passes and share them between JIT and AOT.
Passes bodies are moved into compiler_pass{.cc,.h}.

Invoking a pass is just INVOKE_PASS(Name) now, instead of putting a bunch of
if-s and calls in compiler.cc or precompiler.cc.

We also consolidate ability to print IL and enable-disable passes under a
single flag --compiler-passes, e.g.

--compiler-passes=-Inlining,-CSE    disable inlining and CSE passes

--compiler-passes=Inlining+         print IL after Inlining pass and all
                                    subsequent passes

Change-Id: I90ff54b04a54f20099f5bf38dd45b16b8e3c4781
Reviewed-on: https://dart-review.googlesource.com/43968
Commit-Queue: Vyacheslav Egorov <vegorov@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2018-03-01 16:43:58 +00:00
Martin Kustermann 52bc1ac4d7 [VM] Ensure we use the most specific types for fields
The VM uses normally strong mode types for LoadField instructions.
Though for certain fields we have known class-ids which we attach to the
Field instructions.

Before we had a case where the strong mode type was dynamic, but we had
a very specific cid for the Field.  Though when using the [CompileType]
afterwards via [CompileType()->ToAbstractType()] it was returning
`dynamic`.

We should use CompileType::ComputeRefineType() to get the most specific
one of those two.

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

Change-Id: Ib0b7a596449cba0bc53e118ee603b2039aa312b3
Reviewed-on: https://dart-review.googlesource.com/43422
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2018-03-01 15:06:58 +00:00
Martin Kustermann 9104b5d387 [VM] Eliminate more type checks when not needed
Clear out generic-covariant-{impl,interface} on parameters which are
statically checked on call site.  If all call sites are this-dispatches then
we are guaranteed to not need the checks.

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

Change-Id: I5452a1c9eb3c3e36c1dfc978327bfdcb256cc003
Reviewed-on: https://dart-review.googlesource.com/43421
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2018-03-01 14:31:38 +00:00
Ryan Macnak 558a931409 [vm] Move some string utils from runtime/vm to runtime/platform.
Change-Id: I552086445a7e07792f9da85afa5edf23b6c450d5
Reviewed-on: https://dart-review.googlesource.com/44402
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2018-03-01 02:07:46 +00:00
Vyacheslav Egorov 471f9a0a63 [vm/aot] Ensure that types and type arguments are handled correctly in tree-shaking
Move the code deciding whether instance needs to be handled specially
into AddConstObject, instead of having it spread around - this ensures
uniform handling.

Fixes https://github.com/flutter/flutter/issues/14891

Bug: 14891
Change-Id: I92b6383f37f6b6cf2e917013d17e8ae7ee977150
Reviewed-on: https://dart-review.googlesource.com/44300
Commit-Queue: Vyacheslav Egorov <vegorov@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2018-02-28 21:23:33 +00:00
Vyacheslav Egorov 4a11a27b53 Revert "[VM runtime] Switch intrinsics from old to new Bigint implementation."
This reverts commit 9ba8c08953.

Reason for revert: broke Flutter, to reproduce build Flutter engine with HEAD dart and try running animation benchmark in release or profile mode in --preview-dart-2, gen_snapshot would crash. Similarly this also breaks Flutter tests in --preview-dart-2 mode.

Original change's description:
> [VM runtime] Switch intrinsics from old to new Bigint implementation.
> 
> Change-Id: I43dfbdf76267bb96d1b1ce4aeb695d02bb18b7f8
> Reviewed-on: https://dart-review.googlesource.com/44025
> Reviewed-by: Alexander Markov <alexmarkov@google.com>
> Commit-Queue: Régis Crelier <regis@google.com>

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

Change-Id: I926cc72e1ed89d8631e33ebcc8198853c05a08dc
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/44065
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Commit-Queue: Vyacheslav Egorov <vegorov@google.com>
2018-02-28 11:27:45 +00:00
Régis Crelier 9ba8c08953 [VM runtime] Switch intrinsics from old to new Bigint implementation.
Change-Id: I43dfbdf76267bb96d1b1ce4aeb695d02bb18b7f8
Reviewed-on: https://dart-review.googlesource.com/44025
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Régis Crelier <regis@google.com>
2018-02-28 01:37:06 +00:00
Vyacheslav Egorov 9e7279bce9 [vm/compiler] Fix illegal code motion where LoadField is hoisted past CheckNull.
Canonicalizer should not remove Redefinitions that have no uses before LICM
happens. Even though Redefinition itself has no uses it might be still
dominating uses of the original value - is we expect RenameUsesDominatedByRedefinitions
that is run before LICM to normalize the graph by routing those uses
through Redefinition.

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

Bug: 32322
Change-Id: Ice310aaf8ab62cd6d3ec575876c12e8634a91dce
Reviewed-on: https://dart-review.googlesource.com/44040
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Vyacheslav Egorov <vegorov@google.com>
2018-02-27 20:45:59 +00:00
Dmitry Stefantsov e7830a9f7b Add a flag to Procedures indicating that it's a redirecting factory
Fixes #32282

Bug: http://dartbug.com/32282
Change-Id: Iee8535b053ced415e3047e990a0940d859faa86a
Reviewed-on: https://dart-review.googlesource.com/43440
Commit-Queue: Dmitry Stefantsov <dmitryas@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Reviewed-by: Kevin Millikin <kmillikin@google.com>
2018-02-27 10:42:07 +00:00
Jens Johansen df92e14975 [kernel/vm] Initial obfuscate support for kernel pipeline
Change-Id: I72ca9f690ad46578b963f06af24c3b85d960cac5
Reviewed-on: https://dart-review.googlesource.com/42240
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2018-02-27 10:11:17 +00:00
Alexander Markov 111ea256ad [vm/kernel/aot] Generate list of precompiler entry points during build
This CL adds auto-generation of entry points JSON file for standalone VM
during build (in runtime_kernel target, as it is only used for
kernel-based transformation).

pkg/vm/tool/precompiler2 script is changed to automatically pass
auto-generated entry points to gen_kernel.

New option --entry-points is added to pkg/vm/bin/gen_kernel.dart in order to
specify custom entry points files.

Checked-in entry_points.json is still used for testing and in gen_kernel
if --entry-points is not specified.

Issue: https://github.com/dart-lang/sdk/issues/30480
Change-Id: I39c4461e48763f40d7565656dc33e23fc5d9c2cb
Reviewed-on: https://dart-review.googlesource.com/42521
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Zach Anderson <zra@google.com>
2018-02-23 18:30:46 +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
Jens Johansen ac7f580005 Support Kernel Instantiation node in VMs constant evaluator
Fixes #32268.

Bug: 32268
Change-Id: I7d2ebc28d19aca623460cd1dacc86b64893810ac
Reviewed-on: https://dart-review.googlesource.com/42949
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2018-02-23 07:02:45 +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
Régis Crelier b761571bf3 [VM runtime] Remove reference to old Bigint class from intrinsics (that will be
reused to support new Bigint implementation) by introducing a global constant.
Add asserts and comments in old Bigint implementation.

Change-Id: Id647ffb6ae6557457ccf52fde4f0e6eb3d06c0b5
Reviewed-on: https://dart-review.googlesource.com/43280
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Régis Crelier <regis@google.com>
2018-02-23 01:23:33 +00:00
Ryan Macnak 6ae272becf [vm] Make --compile_all retain the compiled code.
Change-Id: I5595c5855d638b5ed144e3591348ddb9080f9e81
Reviewed-on: https://dart-review.googlesource.com/42886
Reviewed-by: Zach Anderson <zra@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2018-02-22 22:56:01 +00:00
Alexander Aprelev ec7029daf6 Workaround deferred library limitation.
Introduce no-op LoadLibrary, CheckLibraryIsLoaded into kernel_binary_flowgraph.cc

Bug: https://github.com/dart-lang/sdk/issues/32245
Change-Id: If93a4d717844dcb8a5d45d0237660ec764a6f738
Reviewed-on: https://dart-review.googlesource.com/42461
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Reviewed-by: Kevin Millikin <kmillikin@google.com>
Commit-Queue: Alexander Aprelev <aam@google.com>
2018-02-22 20:34:39 +00:00
Kevin Millikin ffc5a96074 Reland "Fix a bug in Kernel's mixin elimination"
Reland
https://github.com/dart-lang/sdk/commit/52d1b4e96d0a384b08aafc184785d1c74cb74efc
with a fix to the test so that it does not use super mixins.

Change-Id: Id1283b1066e853baca4c39402c255ceaa90662f4
Reviewed-on: https://dart-review.googlesource.com/43002
Reviewed-by: Jens Johansen <jensj@google.com>
Commit-Queue: Kevin Millikin <kmillikin@google.com>
2018-02-22 11:52:24 +00:00
William Hesse 7bb941a60c Revert "Fix a bug in Kernel's mixin elimination"
This reverts commit 52d1b4e96d.

Reason for revert: Analyzer and DDC do not support the super-mixin fix and flag, so the new test fails on them.  The test needs to either be marked as failing on them, or support needs to be added and work in the test framework.

Original change's description:
> Fix a bug in Kernel's mixin elimination
> 
> Mixin elimination copied factory constructors from the mixin class to
> the mixin application class.  This could be observed as an unbound
> type parameter which led to a crash in the VM.  Fixes
> https://github.com/dart-lang/sdk/issues/32267.
> 
> Change-Id: I87b70a35d11c364739d01e261adf5329d492d8cf
> Reviewed-on: https://dart-review.googlesource.com/42922
> Reviewed-by: Jens Johansen <jensj@google.com>
> Reviewed-by: Vyacheslav Egorov <vegorov@google.com>

TBR=vegorov@google.com,jensj@google.com,kmillikin@google.com

Change-Id: I4a0bcf0b323c9adef7e5dc7d9019b6aafe40509d
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/42960
Reviewed-by: William Hesse <whesse@google.com>
2018-02-22 10:09:09 +00:00
Kevin Millikin 52d1b4e96d Fix a bug in Kernel's mixin elimination
Mixin elimination copied factory constructors from the mixin class to
the mixin application class.  This could be observed as an unbound
type parameter which led to a crash in the VM.  Fixes
https://github.com/dart-lang/sdk/issues/32267.

Change-Id: I87b70a35d11c364739d01e261adf5329d492d8cf
Reviewed-on: https://dart-review.googlesource.com/42922
Reviewed-by: Jens Johansen <jensj@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2018-02-22 08:51:09 +00:00
Jens Johansen 0c8704ef89 Revert "Revert "[kernel] Don't always treat doubles as constants""
This reverts commit ef51b33f22.

Reason for revert: Issue from initial land was fixed in 076db33f03.

Original change's description:
> Revert "[kernel] Don't always treat doubles as constants"
> 
> This reverts commit 12407c3ea0.
> 
> Reason for revert: co19/Language/Expressions/Object_Identity/double_t01 fails in -c dartkp -r dart_precompiled mode.
> 
> Original change's description:
> > [kernel] Don't always treat doubles as constants
> > 
> > Previously, when the VM parsed a doubles from the dill file it passed
> > control over to the constant evaluator which would then case the
> > value and canonicalize it.
> > That doesn't really seem to make sense when its not used in a const
> > context, nor is it done the same way for integers for instance.
> > 
> > This CL changes that and treats doubles the same way as integers.
> > 
> > Below timings are statistics run through "ministat" based on 5 runs
> > of each configuration (now and before). The timings is for running
> > the dill file with the VM, i.e. the dill file was precompiled via
> > fasta.
> > 
> > Program adding 50,000 doubles to a list and prints the last one:
> > 
> >         -56.6 +/- 28.2389
> >         -10.9988% +/- 5.48753%
> >   (~510 ms -> ~460 ms)
> > 
> > Program adding 1,000,000 doubles to a list and prints the last one:
> > 
> >         -3177.2 +/- 263.54
> >         -31.4643% +/- 2.60987%
> >   (~10 seconds -> ~7 seconds)
> > 
> > Hello world program:
> > 
> > No difference proven at 95.0% confidence
> > 
> > Change-Id: I7dd748e759b3e433bc806b2ef2505d29f0b109b6
> > Reviewed-on: https://dart-review.googlesource.com/42000
> > Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
> > Commit-Queue: Jens Johansen <jensj@google.com>
> 
> TBR=ahe@google.com,vegorov@google.com,jensj@google.com
> 
> Change-Id: If8efa9917c009f2df68a3ef00331ab45bf8bf67b
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Reviewed-on: https://dart-review.googlesource.com/41981
> Reviewed-by: Jens Johansen <jensj@google.com>
> Commit-Queue: Jens Johansen <jensj@google.com>

TBR=ahe@google.com,vegorov@google.com,jensj@google.com

# Not skipping CQ checks because original CL landed > 1 day ago.

Change-Id: I3c20797f585057e8f77e917918926dcfa921df0a
Reviewed-on: https://dart-review.googlesource.com/42720
Reviewed-by: Jens Johansen <jensj@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
2018-02-21 14:38:16 +00:00
Jens Johansen 076db33f03 [vm] Fix constant propagators version of identical for integers and doubles
Before this CL the constant propagator relied on two objects being identical
only if a.raw() == b.raw().
This is only the case if they have been canonicalized, which doubles and
ints shouldn't have to be.

This CL fixes it and introduces a few tests (one of which -cdartkp would have
failed prior to this CL).

NOTE: This should only change the behavior of precompiled mode, and only so
that it is more correct.
Change-Id: I4380ce4d3292fa15d728b0572403cb7ed4d0582c
Reviewed-on: https://dart-review.googlesource.com/42620
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Kevin Millikin <kmillikin@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2018-02-21 11:58:44 +00:00
Vyacheslav Egorov ed5b6a3e8e [vm/kernel] Ensure that ScopeBuilder visits parameter types
Parameter types of local functions might refer to type arguments of
the receiver which means that receiver needs to be captured even
if it is not explicitly used inside a local function.

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

Bug: 32204
Change-Id: I448f0c8cbce12e9b58e1c3de9b2630ee22031d92
Reviewed-on: https://dart-review.googlesource.com/42441
Commit-Queue: Vyacheslav Egorov <vegorov@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2018-02-20 19:09:15 +00:00
Ryan Macnak 04100796c1 [vm, aot] Further debugging aids for null function encountered when writing DWARF inlining data.
Bug: https://github.com/dart-lang/sdk/issues/31952
Change-Id: Iaf677c2dd15567772d1bb9f2482e749ef1139fe2
Reviewed-on: https://dart-review.googlesource.com/42060
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2018-02-16 20:48:59 +00:00
Alexander Markov 31b0cc6ac1 [vm,aot] Generate more efficient code for UnboxInt64 if it takes Smi
Change-Id: I7e2b1cabfa749cd781927a32e652f1f59a1c7667
Reviewed-on: https://dart-review.googlesource.com/41925
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2018-02-16 17:57:57 +00:00
Vyacheslav Egorov eb997b2818 [vm/kernel] Support as{TypeError} as a constant expressions.
Under certain conditions front-end currently generates as{TypeError}
type checks in constant expressions. Support evaluating these type
checks as constant expressions instead of rejecting them.

Change-Id: Id432c4c5062d7bab89c29fef308b42b2cbd64de8
Reviewed-on: https://dart-review.googlesource.com/41761
Commit-Queue: Vyacheslav Egorov <vegorov@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2018-02-16 13:37:37 +00:00
Jens Johansen ef51b33f22 Revert "[kernel] Don't always treat doubles as constants"
This reverts commit 12407c3ea0.

Reason for revert: co19/Language/Expressions/Object_Identity/double_t01 fails in -c dartkp -r dart_precompiled mode.

Original change's description:
> [kernel] Don't always treat doubles as constants
> 
> Previously, when the VM parsed a doubles from the dill file it passed
> control over to the constant evaluator which would then case the
> value and canonicalize it.
> That doesn't really seem to make sense when its not used in a const
> context, nor is it done the same way for integers for instance.
> 
> This CL changes that and treats doubles the same way as integers.
> 
> Below timings are statistics run through "ministat" based on 5 runs
> of each configuration (now and before). The timings is for running
> the dill file with the VM, i.e. the dill file was precompiled via
> fasta.
> 
> Program adding 50,000 doubles to a list and prints the last one:
> 
>         -56.6 +/- 28.2389
>         -10.9988% +/- 5.48753%
>   (~510 ms -> ~460 ms)
> 
> Program adding 1,000,000 doubles to a list and prints the last one:
> 
>         -3177.2 +/- 263.54
>         -31.4643% +/- 2.60987%
>   (~10 seconds -> ~7 seconds)
> 
> Hello world program:
> 
> No difference proven at 95.0% confidence
> 
> Change-Id: I7dd748e759b3e433bc806b2ef2505d29f0b109b6
> Reviewed-on: https://dart-review.googlesource.com/42000
> Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
> Commit-Queue: Jens Johansen <jensj@google.com>

TBR=ahe@google.com,vegorov@google.com,jensj@google.com

Change-Id: If8efa9917c009f2df68a3ef00331ab45bf8bf67b
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/41981
Reviewed-by: Jens Johansen <jensj@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
2018-02-16 11:08:18 +00:00
Jens Johansen 12407c3ea0 [kernel] Don't always treat doubles as constants
Previously, when the VM parsed a doubles from the dill file it passed
control over to the constant evaluator which would then case the
value and canonicalize it.
That doesn't really seem to make sense when its not used in a const
context, nor is it done the same way for integers for instance.

This CL changes that and treats doubles the same way as integers.

Below timings are statistics run through "ministat" based on 5 runs
of each configuration (now and before). The timings is for running
the dill file with the VM, i.e. the dill file was precompiled via
fasta.

Program adding 50,000 doubles to a list and prints the last one:

        -56.6 +/- 28.2389
        -10.9988% +/- 5.48753%
  (~510 ms -> ~460 ms)

Program adding 1,000,000 doubles to a list and prints the last one:

        -3177.2 +/- 263.54
        -31.4643% +/- 2.60987%
  (~10 seconds -> ~7 seconds)

Hello world program:

No difference proven at 95.0% confidence

Change-Id: I7dd748e759b3e433bc806b2ef2505d29f0b109b6
Reviewed-on: https://dart-review.googlesource.com/42000
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
2018-02-16 10:21:47 +00:00
Alexander Markov dc1b07af7f [vm,aot] Refine types of uses after specializing a call
After replacing a call with specialized instruction it makes sense
to update types of uses immediately to open more opportunities for
specialization of calls which use result of a replaced call.

Issue: https://github.com/dart-lang/sdk/issues/30480
Change-Id: I87d64ff190cebd4fcd1d2ac678859f2bc6612f6d
Reviewed-on: https://dart-review.googlesource.com/41602
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2018-02-16 01:25:08 +00:00
Alexander Markov a9586c6147 [vm,aot] Recognize haveSameRuntimeType pattern after devirtualization
This CL teaches AotCallSpecializer to recognize and optimize
haveSameRuntimeType pattern after TFA devirtualizes 'operator=='.

Issue: https://github.com/dart-lang/sdk/issues/30480
Change-Id: I172384c8113d2f0954ac141e8f2c1050bc850306
Reviewed-on: https://dart-review.googlesource.com/41572
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2018-02-16 00:26:50 +00:00
Alexander Markov 32fb103713 [vm/aot] Recognize int operations after devirtualization
TFA devirtualizes calls to int methods and converts them to
static calls to _IntegerImplementation methods.

This CL teaches AotCallSpecializer to recognize int operations
after devirtualization.

Issue: https://github.com/dart-lang/sdk/issues/30480
Change-Id: I94be77675fdabef52861869aa4a8ef36946258ae
Reviewed-on: https://dart-review.googlesource.com/41540
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2018-02-15 19:14:35 +00:00
Vyacheslav Egorov c2899e424f [vm/kernel/aot] Keep type checks in setters for covariant fields
Fixes issue instroduced by 286b123d35

Change-Id: I10444a7ecbb5c03e052df720f3dc1694983e6423
Reviewed-on: https://dart-review.googlesource.com/41263
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2018-02-15 07:21:32 +00:00
Régis Crelier 933a0ae895 [Kernel] Check return type of native functions in strong mode (fixes #32090).
[VM] Check return type of all functions in strong mode.

Change-Id: I01ff80e9ec5c625a0855a22498f9c2d738de4678
Reviewed-on: https://dart-review.googlesource.com/40641
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Commit-Queue: Régis Crelier <regis@google.com>
2018-02-14 20:30:43 +00:00
Alexander Markov c823888580 [vm] Avoid setting result type to dynamic for recognized methods
The list of recognized methods in the VM includes information about
result type. If there is no known/concrete result cid, the list
contains dynamic. When StaticCallInstr for recognized method is created,
its result type was pulled from the list even if it was dynamic.

This change avoids setting result type to dynamic in such case
and fixes the assertion for conflicting result types from the list of
recognized methods and from global type inference.
Now, if list of recognized methods has dynamic, and inferred type
is available, the latter will be used.

Change-Id: I7da7313f93ca08a142226026a4645124c30cfd8f
Reviewed-on: https://dart-review.googlesource.com/41080
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2018-02-14 17:29:23 +00:00
Vyacheslav Egorov 286b123d35 [vm/kernel/aot] Remove type checks from non-dynamically-invoked implicit setters
This applies optimization from d117760 to implicit setters.

(This CL also reformats kernel_binary_flowgraph.cc because some previous CL
was pushed without proper formatting)

Bug: https://github.com/dart-lang/sdk/issues/31798
Change-Id: I6f1590bfd40e36b972b857c49d6ce8435bb25187
Reviewed-on: https://dart-review.googlesource.com/41300
Commit-Queue: Vyacheslav Egorov <vegorov@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2018-02-14 16:24:03 +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
Alexander Markov 6ed2ebf6b0 [vm/kernel/aot] Infer parameter types in type flow analysis
Issue: https://github.com/dart-lang/sdk/issues/30480
Change-Id: Iea1480ce2f20b6cb08b4eb57eef5ca14a002e6e0
Reviewed-on: https://dart-review.googlesource.com/40400
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2018-02-13 01:11:18 +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
Samir Jindel 65b0982ac9 Remove dead code around argument checks in the VM.
Change-Id: I6a04b3b5971b3ae3bc8996ebe6b8f33fa12bd43d
Reviewed-on: https://dart-review.googlesource.com/40524
Reviewed-by: Kevin Millikin <kmillikin@google.com>
Commit-Queue: Samir Jindel <sjindel@google.com>
2018-02-12 15:22:47 +00:00