Commit Graph

2345 Commits

Author SHA1 Message Date
Alexander Markov 618bff43ea [VM] Clean up bigints from assembler_dbc_test
In preparation for Dart 2.0 fixed-size integers, simdbc/simdbc64 C++
unit tests are cleaned up to avoid bigints.

Change-Id: I0c63d4cbd9d1903c92b3cb52dee0b38ed9085df4
Reviewed-on: https://dart-review.googlesource.com/32449
Reviewed-by: Zach Anderson <zra@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2018-01-04 22:53:16 +00:00
Kevin Millikin 6fa813d818 Change handling of Kernel static errors
Before: Kernel static errors were represented by throwing a distinguished
error or else by calling a distinguished library const constructor.

Now: Kernel static errors are represented by InvalidExpression.  To support
error reporting, InvalidExpression has an optional message and a file
offset.  A back end can choose to signal these errors at any time; for
example, when deserializing the binary, or when compiling the procedure
containing the static error, or when the erroneous expression is evaluated
at run time.

InvalidStatement is removed because it can be encoded as ExpressionStatement
of InvalidExpression.

Future work:

* supporting static errors where an expression cannot appear in the AST
* allowing InvalidExpression to contain an Expression for error recovery
* adding a top-level list of static errors and warnings to the binary

Bug: https://github.com/dart-lang/sdk/issues/29840
Change-Id: Ifdfe9a76cee6cefed28061bf245be70531d2f413
Reviewed-on: https://dart-review.googlesource.com/31320
Commit-Queue: Kevin Millikin <kmillikin@google.com>
Reviewed-by: Dan Rubel <danrubel@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2018-01-04 11:00:25 +00:00
Martin Kustermann 0e6bfc66fd [VM] Use ^= (which allows "null") instead of RawCast
Change-Id: Ib22e6c38bb50128c6af83e044b42658aedbbe87d
Reviewed-on: https://dart-review.googlesource.com/31985
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2018-01-03 17:43:05 +00:00
Martin Kustermann c309dde6a9 [VM] Enable strengthening of AssertAssignableInstr's in strong mode
Currently we only enable the strengthening of AssertAssignableInstr's
when having asserts enabled (which happens in checked mode).  But in
strong mode we use these instructions as well, so we need to enable the
optimization as well.

Change-Id: If889d0e14b590e77377c9828e80a00e4852fed42
Reviewed-on: https://dart-review.googlesource.com/31944
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Commit-Queue: Vyacheslav Egorov <vegorov@google.com>
2018-01-03 16:55:35 +00:00
Martin Kustermann 2158398434 [VM] Implement missing AssertSubtypeInstr::Canonicalize()
Change-Id: I3372d179b201fd55a88ec296f00ecb3dabaff11e
Reviewed-on: https://dart-review.googlesource.com/32040
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2018-01-03 14:00:29 +00:00
Erik Corry 8d58c13ca2 [VM] Use new Write barrier filters.
R=vegorov@google.com

Bug:
Change-Id: Icec38f730157448b47f5bf5a43dc582e4064e98e
Reviewed-on: https://dart-review.googlesource.com/30861
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Commit-Queue: Erik Corry <erikcorry@google.com>
2017-12-21 09:59:03 +00:00
Jens Johansen 4e162c5318 [kernel] Fix vm crash when trying to break on default constructor
Writing "break Foo" in observatory with a file including
```
class Foo { }
```

would crash them VM.

This CL introduces a test that reproduces it and fixes the issue.

Bug:
Change-Id: I24780d9204117ade19a0cb590c45aa31b7c04f7e
Reviewed-on: https://dart-review.googlesource.com/30445
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Reviewed-by: Kevin Millikin <kmillikin@google.com>
2017-12-20 13:02:12 +00:00
Vyacheslav Egorov c41e92de84 [vm/aot] Ignore artificial methods when computing single target.
When AOT call specializer computes single target for a method
invocation it needs to ignore artificial methods like field
dispatchers and method extractors that are lazily injected
by the precompiler as compilation of the whole application
progresses.

Lazy injections means that we don't have complete knowledge
when we compile a single method.

Bug:
Change-Id: I249ca397bb3da89f512a1ace49b198a0ffc9bf97
Reviewed-on: https://dart-review.googlesource.com/30520
Commit-Queue: Vyacheslav Egorov <vegorov@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2017-12-20 12:35:42 +00:00
Jens Johansen 45a59597fc [kernel] Allow collection of token positions for unfinalized classes
E.g.
```
main() {
  new Foo();
}

class Foo {
  Foo() {
    print("hello from foo");
  }
}
```

debugging with --pause_isolates_on_start, the constructor (or anything else
in class Foo) would not be breakable from the Observatory interface.

This CL fixes that by collecting token positions from unfinalized classes.

Bug:
Change-Id: I93a20f3322b0a343a619625c71236b59c885cb7e
Reviewed-on: https://dart-review.googlesource.com/30441
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Reviewed-by: Kevin Millikin <kmillikin@google.com>
2017-12-20 11:59:47 +00:00
Vyacheslav Egorov d290d8ecf4 [vm] Detect and expand calls through getters in AOT call specializer.
If we know that receiver is a subclass of a certain type and that this
type has accessor get:m then call o.m(...) is guaranteed to be an
invocation through a getter. Such invocations are executed most
efficiently when expanded into o.get:m().call(...).

Source based pipeline handles this case (at least for invocations on
`this`) directly in the parser, but Kernel based graph builder does not
have this sort of special case.

Instead of teaching Kernel flow graph builder to specially handle
invocations on `this` we teach AOT call specializer to specially handle
all invocations where receiver is known to be a subclass of certain
class. Such optimization is more generic and handles things that
previously were not handled by the optimization.

AOT compiler also has heuristics for injecting field dispatchers into
classes but these heuristics only handle fields of function type and
don't work for fields like `Function f` or `var f`.

Improves ParserCombinators benchmark by 4x.

This relands eea2c168f9 with a fix.

Change-Id: I13a41544c737b980efd431e31e4d15ad31da853e
Reviewed-on: https://dart-review.googlesource.com/30455
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Vyacheslav Egorov <vegorov@google.com>
2017-12-19 21:02:04 +00:00
Alexander Markov d8f27c3841 [VM] Enable optimizations based on strong mode types
Strong mode types are queried from:

* Return types of interface targets of instance calls.
* Return types of static calls.
* Types of instance and static fields.
* Types of local variables (for initial types of phis).

The strong mode types are used to specialize int and double operations
and optimize 'is' checks.

https://github.com/dart-lang/sdk/issues/30480
Change-Id: I2302509f396eacfcab8ed41e3f50e8c74dd662fd
Reviewed-on: https://dart-review.googlesource.com/30386
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2017-12-19 19:23:22 +00:00
Martin Kustermann 32c4480403 [VM] Fix various issues in the VM, mainly simdbc64 related
* Fixes kernel flow graph builder to use instantiated type argumenst
    for CreateArray

  * Fixes prologue builder to mask the positon of named arguments in the
    arguments descriptor array

  * Add a SmiBitAndTOS instruction to DBC

  * Implement missing AssertSubtype DBC instruction

  * Ensure we don't use field guards in DBC mode

  * Remove incorrect assertions in LoadIndexedUnsafe/StoreIndexedUnsafe

  * Save argdesc_ in DBC simulator when calling the runtime to optimize
    a function (which can call re-entrant to Simulator via const
    evalulation)

Issue https://dart-review.googlesource.com/c/sdk/+/29581

Change-Id: Ia14b657db66f90643822b6986ec7f75f746ab0d8
Reviewed-on: https://dart-review.googlesource.com/30340
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2017-12-19 14:49:52 +00:00
Vyacheslav Egorov 7aeb94423f Revert "[vm] Detect and expand calls through getters in AOT call specializer."
This reverts commit eea2c168f9.

Reason for revert: standalone_2/io/test_runner_test times out

python tools/test.py -m release -c precompiler -r dart_precompiled -a simarm64 --use-blobs standalone_2/io/test_runner_test

Original change's description:
> [vm] Detect and expand calls through getters in AOT call specializer.
> 
> If we know that receiver is a subclass of a certain type and that this
> type has accessor get:m then call o.m(...) is guaranteed to be an
> invocation through a getter. Such invocations are executed most
> efficiently when expanded into o.get:m().call(...).
> 
> Source based pipeline handles this case (at least for invocations on
> `this`) directly in the parser, but Kernel based graph builder does not
> have this sort of special case.
> 
> Instead of teaching Kernel flow graph builder to specially handle
> invocations on `this` we teach AOT call specializer to specially handle
> all invocations where receiver is known to be a subclass of certain
> class. Such optimization is more generic and handles things that
> previously were not handled by the optimization.
> 
> AOT compiler also has heuristics for injecting field dispatchers into
> classes but these heuristics only handle fields of function type and
> don't work for fields like `Function f` or `var f`.
> 
> Improves ParserCombinators benchmark by 4x.
> 
> Bug:
> Change-Id: I365d4fb2140577d02aefbf16fcf6be1bd12413a6
> Reviewed-on: https://dart-review.googlesource.com/29840
> Commit-Queue: Vyacheslav Egorov <vegorov@google.com>
> Reviewed-by: Alexander Markov <alexmarkov@google.com>
> Reviewed-by: Martin Kustermann <kustermann@google.com>

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

Change-Id: I2b891b1674dd07fa43d6414428438c41e3332391
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/30400
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Commit-Queue: Vyacheslav Egorov <vegorov@google.com>
2017-12-18 22:21:07 +00:00
Vyacheslav Egorov eea2c168f9 [vm] Detect and expand calls through getters in AOT call specializer.
If we know that receiver is a subclass of a certain type and that this
type has accessor get:m then call o.m(...) is guaranteed to be an
invocation through a getter. Such invocations are executed most
efficiently when expanded into o.get:m().call(...).

Source based pipeline handles this case (at least for invocations on
`this`) directly in the parser, but Kernel based graph builder does not
have this sort of special case.

Instead of teaching Kernel flow graph builder to specially handle
invocations on `this` we teach AOT call specializer to specially handle
all invocations where receiver is known to be a subclass of certain
class. Such optimization is more generic and handles things that
previously were not handled by the optimization.

AOT compiler also has heuristics for injecting field dispatchers into
classes but these heuristics only handle fields of function type and
don't work for fields like `Function f` or `var f`.

Improves ParserCombinators benchmark by 4x.

Bug:
Change-Id: I365d4fb2140577d02aefbf16fcf6be1bd12413a6
Reviewed-on: https://dart-review.googlesource.com/29840
Commit-Queue: Vyacheslav Egorov <vegorov@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2017-12-18 16:34:26 +00:00
Florian Loitsch f3e845cf48 Revert "Reland: [dart:io] Adds waitForEventSync"
This reverts commit 3ea5e13ad7.

Change-Id: Ic9fae69f3b7ef6e41aac3c7ebca3e1d288dbffb1
Reviewed-on: https://dart-review.googlesource.com/29589
Reviewed-by: Florian Loitsch <floitsch@google.com>
2017-12-14 14:10:45 +00:00
Sigmund Cherem f34af36ef9 [pkg:kernel] Add fileUri to Constructors
We have a fileUri for fields and procedures and it was missing in constructors.

This is needed to be able to correctly store the patch URI in patched
constructors and to be able to workaround
https://github.com/dart-lang/sdk/issues/31579.
Change-Id: Ic80d3dc87450ada8b39b555e9b16e162d0e40b45
Reviewed-on: https://dart-review.googlesource.com/29003
Commit-Queue: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
Reviewed-by: Kevin Millikin <kmillikin@google.com>
2017-12-13 19:35:34 +00:00
Martin Kustermann cf1de7d46c [VM] Replace hand-written assembly prologues with IR
As part of the prologue changes we get rid of the empty context as well.

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

Change-Id: I707e23c631bcfbbad6c91c4963d0c10f7a0be625
Reviewed-on: https://dart-review.googlesource.com/25320
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2017-12-13 16:04:34 +00:00
Zachary Anderson 3ea5e13ad7 Reland: [dart:io] Adds waitForEventSync
The only fix needed for relanding is adding _ensureScheduleImmediate
to the list of vm entrypoints in //runtime/vm/compiler/aot/precompiler.cc

Original commit message:

Adds a top-level call waitForEventSync to dart:io that blocks the
thread an Isolate is running on until messages are available.
Before the thread blocks, the microtask queue is drained.
Before waitForEventSync returns, all messages are handled.

Lifting this up from a comment:

This is apropos of the request that nweiz@ sent to the mailing list a
couple weeks back. I'm not sure we should land this. We certainly
shouldn't land it without some annotations that will make the analyzer
complain a lot in most configurations, but I don't know what those
annotations are.

fixes #31102

Change-Id: Id96de46cc5f10e1847045cfafb7cfed6a38bce16
Reviewed-on: https://dart-review.googlesource.com/28920
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Zach Anderson <zra@google.com>
2017-12-12 23:16:50 +00:00
Alexander Markov 73b265e348 [VM/AOT] Fix handling of errors from compiling static initializers
* CompileStaticInitializer() should check result of Compile()
  and should not leave sticky error. If left, this sticky error
  could be picked up by compilation of some unrelated static
  initializer. Also, assertions are added to make sure that code
  which explicitly or implicitly relies on sticky errors is not
  getting an error on entry.

* CompileStaticInitializerIgnoreErrors() clears sticky errors to
  ignore them.

* Added inline bailout reason for cyclic static fields.
  This guards against inlining of code which uses a field into static
  initializer. This code might not be called so it should not trigger
  compilation error eagerly.

Change-Id: I52da6f4cd05556125fd1a628b665dcc11621a4f7
Reviewed-on: https://dart-review.googlesource.com/28523
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2017-12-12 19:29:08 +00:00
Erik Corry 1dec18e2cf [VM] Make x64 assembler more regular
Apart from removing almost 1000 lines of very repetitive code, the idea here is
to change the assembler from a huge pile of arbitrary code into something that
can be used to generate tables of opcodes and their structure. Later, I'd like to
use this to make the disassembler more table driven and less arbitrary, and
perhaps build an x86 simulator in the same vein as the ARM simulator, which
would help me debug (I find the ARM simulator very useful when making low level
changes to the VM and miss its functionality on x86).

R=vegorov@google.com

Bug:
Change-Id: I1ae2c1696f88b67862843c9ac05c827a7c9b9a6e
Reviewed-on: https://dart-review.googlesource.com/25241
Commit-Queue: Erik Corry <erikcorry@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2017-12-12 14:14:45 +00:00
Samir Jindel 756c2984a4 [kernel] Fix crashes in ArgumentCheckBitsForInvocation.
Change-Id: Ie2d7d9d9d6cff008740a2b2d660d73c6155e5cf1
Reviewed-on: https://dart-review.googlesource.com/27361
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Samir Jindel <sjindel@google.com>
2017-12-12 13:43:42 +00:00
Paul Berry ba2417fdc0 Fix SDK errors due to inconsistent inheritance of Operator==.
The informal spec for strong mode top level inference
(https://github.com/dart-lang/sdk/pull/28218) says "If there are
multiple overridden/implemented methods, and any two of them have
non-equal types (declared or inferred) for a parameter position which
is being inferred for the overriding method, it is an error."

This CL fixes several SDK errors that arise from this rule.  For
example, the classes _Closure, Function, and Object contained members
declared as follows:

    class _Closure implements Function {
      bool operator ==(other) ...
    }
    class Function {
      bool operator ==(Object other) ...
    }
    class Object {
      bool operator ==(other) ...
    }

The type of Object's operator == was (dynamic) -> bool; the type of
Function's operator == was (Object) -> bool; therefore the type of
_Closure's operator == (which overrides both, since _Closure extends
Object and implements Function) cannot be inferred and must be
specified.

A similar situation exists for _Double and _IntegerImplementation
(both implement num, which declares operator == to have type (Object)
-> bool), and _Uri (which implements Uri, which declares operator ==
to have type (Object) -> bool).

This CL fixes the error by specifying the type explicitly in the
classes _Closure, _Double, _IntegerImplementation, and _Uri.

Change-Id: I91f7ceef8549399d438ba4be8c408493b3f338db
Reviewed-on: https://dart-review.googlesource.com/28100
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2017-12-11 13:02:19 +00:00
Alexander Markov 587fc724b7 [VM] Fix speculative inlining of StaticCalls to _TypedList._set* methods
Calls to these methods could be devirtualized and converted from
InstanceCall to a StaticCall instructions. In such case, speculative
inliner should not crash.

Issue: https://github.com/dart-lang/sdk/issues/30480
Change-Id: I987017ed8e75f9275dccff892a82e13283d803d4
Reviewed-on: https://dart-review.googlesource.com/27926
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2017-12-08 23:20:20 +00:00
Alexander Markov a8a8f879c7 [VM] Introduce non-speculative mode for certain IL instructions
This CL extends RelationalOpInstr, BinaryInt64OpInstr, BinaryDoubleOpInstr,
UnaryDoubleOpInstr and unboxing instructions (UnboxInstr, UnboxIntegerInstr,
UnboxInteger32Instr, UnboxUint32Instr, UnboxInt32Instr and UnboxInt64Instr)
with non-speculative mode, when types of the inputs are not checked.

The non-speculative mode is used when generating double and int64 operations
in AOT using strong mode types.

Also, this CL disables couple of cases in --experimental-strong-mode which
do not work yet. This is a preparation for turning --experimental-strong-mode
on by default.

Issue: https://github.com/dart-lang/sdk/issues/30480
Change-Id: Ic1f89e7f6fd9592d5a92671963283c7181ce1504
Reviewed-on: https://dart-review.googlesource.com/27841
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2017-12-08 20:57:30 +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
Martin Kustermann a1cbc7b226 [VM] Ensure allocations go into the right space during flowgraph building
We must prevent unconditional new-space allocations during flow graph building.

Instead we need to direct it to a configurable allocation space, which will be
initialized depending on whether we run on the mutator thread or
somewhere else.

Change-Id: I9cbbf17f918fe2808fb37796943e9d056e292c81
Reviewed-on: https://dart-review.googlesource.com/27760
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2017-12-08 15:34:09 +00:00
Alexander Markov c6cf6b36e0 [VM] Fix a crash in --print-flow-graph while printing AssertSubtypeInstr
Change-Id: Ic654cc0a4569f9d063d6d13006304c34348d7023
Reviewed-on: https://dart-review.googlesource.com/27463
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2017-12-08 01:51:19 +00:00
Alexander Markov 57d070909c [VM] Workaround for broken mode '-m debug -c dartkp --strong'
After setting a dispatchCategory for PropertySet in https://github.com/dart-lang/sdk/commit/d35f6c79cdae0d859ad8fad8c883daaec0bb95ea,
debug/dartkp/strong is badly broken: there are a lot of crashes in
ArgumentCheckBitsForSetter as interface_target is still null.

This change is a quick workaround for these crashes to keep bots green
until ArgumentCheckBitsForSetter is properly fixed.

Issue: https://github.com/dart-lang/sdk/issues/31576
Change-Id: I36e316c963572a0394fc5e69a92afc259f98eebb
Reviewed-on: https://dart-review.googlesource.com/27302
Reviewed-by: Paul Berry <paulberry@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2017-12-07 19:44:38 +00:00
Alexander Markov a05bba126a [VM] Enable reading of interface targets from kernel in strong mode
Change-Id: I94f03deffcd2595979f40c88e23edc2e87dbad90
Reviewed-on: https://dart-review.googlesource.com/26462
Reviewed-by: Samir Jindel <sjindel@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2017-12-07 17:08:59 +00:00
Vyacheslav Egorov cc35ba4a1e [vm] Split _List&_GrowableList []= into checked and unchecked parts
This allows us to avoid going into runtime even if strong mode is
enabled: type checking is handled in the []= operator itself and
_setIndexed does not need to check types and thus can be intrinsified.

This CL also removes inline type checking done in ia32 version,
not other platform had it.

# Performance Impact

Mostly noticable on Dart v2 AOT configuration where AOT compiler
did not inline []=:

Richards  +26.27%
Meteor  +33.63%
BuildTableInterpolation +68.98%
DeltaBlueClosures +46.43%
StarryStrings +22.08%
NavierStokes  +94.81%
JsonParseCustomReviver  +45.22%
DeltaBlue +56.44%
BuildTableBufferWithCodes +84.40%
JsonParseDefaultReviver +46.13%
BuildTableBuffer  +125.8%
BuildTableIdiomatic +125.8%
StringBuffer  +127.3%
StringIdiomatic +127.2%
JsonObjectRoundTrip +95.42%
JsonStringifyFinancialOnce  +125.7%
JsonRoundTrip +96.01%

Bug:
Change-Id: Ie6d33ac55b5a0c0909ca06e0c88a60d8e0d2604e
Reviewed-on: https://dart-review.googlesource.com/26800
Commit-Queue: Vyacheslav Egorov <vegorov@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2017-12-07 13:09:55 +00:00
Alexander Markov e299963a3c [VM] Fix out of range immediates on ARM/ARM64
Code generation is changed to handle correctly values of
 * ArgumentsDescriptor::TypeArgsLenField::mask_in_place()
 * ArgumentsDescriptor::PositionalCountField::mask_in_place()
which cannot be represented as immediates on ARM/ARM64.

Closes https://github.com/dart-lang/sdk/issues/31559

Change-Id: I94bb470bf95dcdde48dca56e7128d00b95a974da
Reviewed-on: https://dart-review.googlesource.com/27081
Commit-Queue: Vyacheslav Egorov <vegorov@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2017-12-07 05:17:51 +00:00
Peter von der Ahé e14726a3f4 Use absolute URIs instead of relative paths
We change the type of FileUriNode.fileUri from String to Uri, which in principle
doesn't change the binary format. However, we did notice that LibraryParts
weren't serialized as specified in binary.md, so we also fixed that.

Since fileUris are stored as strings in a separate table, Uri.parse is only called
once per unique URI.

Fasta only uses relativizeUri when printing diagnostics, and URIs stored in
expectation files (golden files) are relativized using String.replaceAll.

Change-Id: Ib2dc1b80c03a0cdaf84e48b8b3ba73b16bdf8a40
Reviewed-on: https://dart-review.googlesource.com/25421
Commit-Queue: Peter von der Ahé <ahe@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2017-12-04 11:34:24 +00:00
Samir Jindel bf797e6507 [kernel] Re-land assert initializers.
This change updates Dart2js and DDC.
Thanks to johnniwinther@ for the Dart2js updates.

The original revision is in patchset 2.

Change-Id: I26db33312f003f88ccccb67b27998ef21a1f667f
Reviewed-on: https://dart-review.googlesource.com/25820
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Kevin Millikin <kmillikin@google.com>
Commit-Queue: Samir Jindel <sjindel@google.com>
2017-12-04 11:22:34 +00:00
Régis Crelier 08b2294713 [kernel] In strong mode, change covariant parameter types to Object in the
implicit closure of a method compiled by kernel (fixes #31305).

Change-Id: Iabeee2e382bf07ff78645054e453e0bd1afd02ab
Reviewed-on: https://dart-review.googlesource.com/24362
Commit-Queue: Régis Crelier <regis@google.com>
Reviewed-by: Samir Jindel <sjindel@google.com>
2017-12-01 18:00:16 +00:00
Samir Jindel 48a927acb2 Revert "[kernel] Introduce assert initializers."
Reverting due to several test failures.

This reverts commit 67adfe741b.

Bug:
Change-Id: Idd1aa15d47df68f2938285468dfa3d5043d8dae2
Reviewed-on: https://dart-review.googlesource.com/25520
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2017-12-01 17:46:05 +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 67adfe741b [kernel] Introduce assert initializers.
Assert initializers in Dart may be compiled directly to this form of initializer,
rather than through local initializers as is done now.

Bug:
Change-Id: Ia149ea3d1df5d1dc18be5636801604ffaf7ca7d8
Reviewed-on: https://dart-review.googlesource.com/14760
Commit-Queue: Samir Jindel <sjindel@google.com>
Reviewed-by: Kevin Millikin <kmillikin@google.com>
2017-12-01 14:04:06 +00:00
Siva Chandra 702e4aecb8 Keep the line starts delta encoded in the VM heap as well - take 2
This reverts commit adf04d0ac6.

The original change used macros from stdint.h and it failed build on
the linux sdk bot:
https://uberchromegw.corp.google.com/i/client.dart/builders/dart-sdk-linux-be/builds/17348

In the newer version, constants from runtime/platform/globals.h are used
instead of the macros from stdint.h. Constants for int8 have been added as
they were not present already.

Change-Id: Ia4f27613fa5dca2cd6dbfeb37715ea70a85cec95
Reviewed-on: https://dart-review.googlesource.com/25083
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Siva Chandra <sivachandra@google.com>
2017-12-01 05:16:48 +00:00
Martin Kustermann 3347b700df [VM] Add support for skipping a prologue range of blocks (for inlining heuristics)
Issue https://github.com/dart-lang/sdk/issues/31495

Change-Id: I876f4e064cfd21f5c3e99b531ff69776eba99635
Reviewed-on: https://dart-review.googlesource.com/25060
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2017-12-01 00:03:56 +00:00
Ryan Macnak 9174a627f5 [vm, gc] Ensure BackgroundCompiler can't be deleted during a safepoint.
Previously, the background compiler was deleted by the thread pool, which could have raced ahead of the mutator clearing its reference. Now it is deleted by the mutator.

Change-Id: Id353a96022f699131ee60fe31156cd0404dfd285
Reviewed-on: https://dart-review.googlesource.com/24342
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
2017-11-30 22:59:51 +00:00
Martin Kustermann 3c0422e6a6 [VM] Make our NativeCallInstr work similar to all other call instructions
This CL makes NativeCallInstr instructions use PushArgument()s when
calling instead of directly using a pointer to the caller-provided
arguments (for functions without optional parameters) or relying on copy
arguments prologue (for functions with optional parameters).

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

Change-Id: I36d4bf1b7dd10f48c7e40b0cafe37f8698aacb71
Reviewed-on: https://dart-review.googlesource.com/24961
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2017-11-30 16:48:24 +00:00
Samir Jindel 50887f3ffa [kernel] Generic tearoffs in VM's Kernel FE.
Bug: #31482
Change-Id: Ice2f19983ac42aba22f6b4cdebf34dbae3cdf1ca
Reviewed-on: https://dart-review.googlesource.com/24960
Commit-Queue: Samir Jindel <sjindel@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2017-11-30 14:56:29 +00:00
Martin Kustermann ada5985e04 [VM] Move removal of unnecessary CheckStackOverflowInstr in leaf functions
Issue https://github.com/dart-lang/sdk/issues/31495

Change-Id: I0c07cdae00152fc6e2dce10e48b8ba99356e2751
Reviewed-on: https://dart-review.googlesource.com/24780
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2017-11-30 14:31:55 +00:00
Martin Kustermann 23e607adf3 [VM] Refactor kernel::FlowGraphBuilder into a re-usable BaseFlowGraphBuilder
Issue https://github.com/dart-lang/sdk/issues/31495

Change-Id: I1d85abddb71af91219e0368f0c4d614f40fabe70
Reviewed-on: https://dart-review.googlesource.com/24823
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2017-11-30 11:41:34 +00:00
Jens Johansen b65d63e8b8 [kernel] Add position to catch
Bug:
Change-Id: Ie4a931ab55e923a3ed2bbf247535bc151c766272
Reviewed-on: https://dart-review.googlesource.com/23671
Reviewed-by: Peter von der Ahé <ahe@google.com>
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
2017-11-30 09:50:01 +00:00
Alexander Thomas adf04d0ac6 Revert "Keep the line starts delta encoded in the VM heap as well."
This reverts commit cd4e5ee866.

Reason for revert: This broke the 32bit Linux SDK build. 

Original change's description:
> Keep the line starts delta encoded in the VM heap as well.
> 
> The line starts in the kernel binary are delta encoded. By decoding and
> storing them as int32 values, we are unneccesarily bloating the VM heap.
> This change keeps the line starts delta encoded in the VM heap as well.
> This brings down the core snapshot size by 275KB (but will of course
> affect the debug performance.)
> 
> Bug:
> Change-Id: I77769efe7339484096d04c37180367adf96e51f4
> Reviewed-on: https://dart-review.googlesource.com/22304
> Commit-Queue: Siva Chandra <sivachandra@google.com>
> Reviewed-by: Siva Annamalai <asiva@google.com>

TBR=sivachandra@google.com,asiva@google.com

Change-Id: I6e78bd510de7033d8583c089c00b5b261fdf69c1
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/24800
Reviewed-by: Alexander Thomas <athom@google.com>
Commit-Queue: Alexander Thomas <athom@google.com>
2017-11-30 09:32:29 +00:00
Siva Chandra cd4e5ee866 Keep the line starts delta encoded in the VM heap as well.
The line starts in the kernel binary are delta encoded. By decoding and
storing them as int32 values, we are unneccesarily bloating the VM heap.
This change keeps the line starts delta encoded in the VM heap as well.
This brings down the core snapshot size by 275KB (but will of course
affect the debug performance.)

Bug:
Change-Id: I77769efe7339484096d04c37180367adf96e51f4
Reviewed-on: https://dart-review.googlesource.com/22304
Commit-Queue: Siva Chandra <sivachandra@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
2017-11-30 08:00:52 +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