Commit graph

13573 commits

Author SHA1 Message Date
Samir Jindel 3d2b66074c Reland "[vm] Support definition of entry-points via @pragma('vm.extern') annotations.""
When the constant transformation is enabled on annotations, we need to fix handling
of @ExternalName annotations in the kernel_loader to ensure that we are setting
is_external = false on native methods.

The original revision is in patchset 1.

# Test Plan

The only regression was on benchmarks, Golem results are pending.

Change-Id: Ib80bb9f532299056e770a3b378cc5ad9ee451f57
Reviewed-on: https://dart-review.googlesource.com/56960
Commit-Queue: Samir Jindel <sjindel@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2018-05-30 20:06:40 +00:00
Paul Berry bfeb80a0c9 Observatory strong mode fixes: fix some int/double mismatches.
Change-Id: I22db86e2ecd579c165536a1178ff9eba6963735a
Reviewed-on: https://dart-review.googlesource.com/57381
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2018-05-30 18:10:21 +00:00
Paul Berry 7fc88c494b Observatory strong mode fix: add required calls to .toList().
Change-Id: Ie3e3d4c52c64d9fe1c4ab000315b3a959f6f336a
Reviewed-on: https://dart-review.googlesource.com/57382
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2018-05-30 18:08:43 +00:00
Ankur Mittal f50873d345 [fuchsia] Renaming component FIDL to fuchsia.sys.
Bug: https://fuchsia.atlassian.net/browse/CP-39
Change-Id: Id66157f592a005d555d6f406e56a75a8cf6aeb48
Reviewed-on: https://dart-review.googlesource.com/57160
Reviewed-by: Zach Anderson <zra@google.com>
2018-05-30 14:48:59 +00:00
Vyacheslav Egorov 3b86f823d0 [vm/corelib] Remove GrowableArrayMarker hack.
GrowableArrayMarker was a class that implemented int and was used to
enable implementation of default List factory constructor in pure Dart:

  factory List([int length = GROWABLE_ARRAY_MARKER]) {
    return identical(length, GROWABLE_ARRAY_MARKER) ? new _GrowableList<E>(0)
                                                    : new _List<E>(length);
  }

Its existence complicated all kinds of things in the VM and it is finally
time to remove it.

Instead we build List factory body directly in IL.

This CL also provides inlining rule for `new List(n)` case.

Change-Id: I870751658a4ac17fce649c9ac70395ff88a5436c
Reviewed-on: https://dart-review.googlesource.com/57262
Commit-Queue: Vyacheslav Egorov <vegorov@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2018-05-30 13:44:43 +00:00
Vyacheslav Egorov 03cb46a229 [vm/perf] Fix JITDUMP integration.
* Use 3-arg variant of open() to fix compilation on GCC and also to ensure
that created file is readable/writable by all users.
* Avoid changing protection on code pages emitted into VM isolate heap: this
allows to profile stubs.

Change-Id: I2b621596405ad78f54a63cfebde7a1af9fa15911
Reviewed-on: https://dart-review.googlesource.com/57263
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Vyacheslav Egorov <vegorov@google.com>
2018-05-30 13:28:13 +00:00
Ryan Macnak aa8e2ee178 Revert "[vm] Add tests for determinism of script and AppJIT snapshots."
This reverts commit aac0478fad.

Reason for revert: Some configurations are still not deterministic

Original change's description:
> [vm] Add tests for determinism of script and AppJIT snapshots.
> 
> Fix non-determinism in unused bits of RawFunction::kind_tag_.
> 
> Leave some build-time-disabled debugging aids for tracking down which parts of snapshots are non-deterministic.
> 
> Bug: https://github.com/dart-lang/sdk/issues/31427
> Bug: https://github.com/dart-lang/sdk/issues/33264
> Change-Id: I4e373a8886c0abd7c03b8f3b980e308bee2ef324
> Reviewed-on: https://dart-review.googlesource.com/56720
> Commit-Queue: Ryan Macnak <rmacnak@google.com>
> Reviewed-by: Vyacheslav Egorov <vegorov@google.com>

TBR=vegorov@google.com,rmacnak@google.com,zra@google.com

Change-Id: I6c658c070f8df57625484449aafdf3f682841341
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: https://github.com/dart-lang/sdk/issues/31427, https://github.com/dart-lang/sdk/issues/33264
Reviewed-on: https://dart-review.googlesource.com/57200
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2018-05-30 00:53:08 +00:00
Ryan Macnak aac0478fad [vm] Add tests for determinism of script and AppJIT snapshots.
Fix non-determinism in unused bits of RawFunction::kind_tag_.

Leave some build-time-disabled debugging aids for tracking down which parts of snapshots are non-deterministic.

Bug: https://github.com/dart-lang/sdk/issues/31427
Bug: https://github.com/dart-lang/sdk/issues/33264
Change-Id: I4e373a8886c0abd7c03b8f3b980e308bee2ef324
Reviewed-on: https://dart-review.googlesource.com/56720
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2018-05-29 22:59:37 +00:00
Ryan Macnak c30af41b96 Reapply "[mirrors] Add IsolateMirror.loadUri."
- Forward only kImportTag requests to DFE. This restores the current handling of a kScriptTag request when loading the kernel isolate in the simulators.
 - Mark dynamic_load_test as failing in the reload stress tests (reload fails to preserve library identity).

Change-Id: Ibe6f0a3505b99736a38d566abf3b2151505d7a7e
Reviewed-on: https://dart-review.googlesource.com/56706
Reviewed-by: Siva Annamalai <asiva@google.com>
2018-05-29 22:01:01 +00:00
Paul Berry a40993a6af Observatory strong mode fix: Fix incorrect types in DebuggerStackElement.
Change-Id: Ib882fa965b3ce9af377e89cc3666cbde04d2d657
Reviewed-on: https://dart-review.googlesource.com/57004
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2018-05-29 21:42:06 +00:00
Paul Berry 0fdfc9aa3b Observatory strong mode fix: Add a needed implements clause.
Add a clause indicating that FunctionCallTreeNode (in
lib/src/sample_profile/sample_profile.dart) implements
M.FunctionCallTreeNode.  This allows the two types for `root`
inherited by FunctionCallTree to be consistent with each other: the
type inherited from CallTree<FunctionCallTreeNode> is
FunctionCallTreeNode whereas the type inherited from
M.FunctionCallTree is M.FunctionCallTreeNode.

Change-Id: I0b48c57f84681a7d40afadfb59c72501cfe38577
Reviewed-on: https://dart-review.googlesource.com/57002
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2018-05-29 21:12:29 +00:00
Paul Berry 209029ab8e Observatory strong mode fix: Pass through a type parameter in the implements clause for GuardedMock.
Change-Id: Ia28bcff6594b82bf8a45ddf79510d3bd73903d1e
Reviewed-on: https://dart-review.googlesource.com/57003
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2018-05-29 21:12:06 +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
Zach Anderson 736ddd9b0e [Observatory] Refactor observatory build to prepare for Fuchsia prebuilt
This splits create_archive.py into two steps. One that creates the .tar
and one that creates the .cc for the .tar. This way on Fuchsia, the
second step will take the prebuilt instead of building it.

Change-Id: I7f407f9e70db3135884eeeb61aa5aec3091f1fcc
Reviewed-on: https://dart-review.googlesource.com/56291
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2018-05-29 16:35:34 +00:00
Lasse R.H. Nielsen 6bc7288e70 Fix fused UTF-8/JSON decoding.
The VM version's parser did not allow a leading BOM, and it failed to parse a top-level integer.

Added test to check this.

Fixes #33251

Bug: http://dartbug.com/33251
Change-Id: I51e429082f0e9baac81e20f73b0885922b40b0b8
Reviewed-on: https://dart-review.googlesource.com/56860
Commit-Queue: Lasse R.H. Nielsen <lrn@google.com>
Reviewed-by: Florian Loitsch <floitsch@google.com>
2018-05-29 12:34:25 +00:00
Alexander Thomas 2a3d1dc9ed [vm] Prepare status for app_jitk builders (#33126)
Change-Id: Iec5347b5f091b9fd6ff3c24047b011527f8b08ee
Reviewed-on: https://dart-review.googlesource.com/56802
Commit-Queue: Alexander Thomas <athom@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2018-05-29 11:43:25 +00:00
Samir Jindel 58dc4e476d Revert "[vm] Support definition of entry-points via @pragma('vm.extern') annotations."
This reverts commit 3e50ea32b5.

Reason for revert: Severe performance regressions on many aot-v2 benchmarks.

Original change's description:
> [vm] Support definition of entry-points via @pragma('vm.extern') annotations.
> 
> The `@pragma` annotations are evaluated by the constants transformation and
> visible to TFA and the precompiler, which match on the "options" field of the
> annotation to determine whether to mark the class/procedure as a root.
> 
> This required enabling the transformation of annotation constants by default.
> 
> # Test Plan
> 
> The "vmservice_io.main" entry-point is removed from `main.cc` and annotated with
> `@pragma`. All precompiler tests will crash if "vmservice_io.main" is not
> available at runtime.
> 
> Debug/release precompiler bots are visible in "cl-linux" button.
> 
> Change-Id: I03c5d6ba7918672ed9905fcaee8dabe675a93a5d
> Reviewed-on: https://dart-review.googlesource.com/56660
> Commit-Queue: Samir Jindel <sjindel@google.com>
> Reviewed-by: Vyacheslav Egorov <vegorov@google.com>

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

Change-Id: I779c17d003659129a4b3fcf284423104948f60e2
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/56820
Reviewed-by: Samir Jindel <sjindel@google.com>
Commit-Queue: Samir Jindel <sjindel@google.com>
2018-05-28 19:23:16 +00:00
Samir Jindel 3e50ea32b5 [vm] Support definition of entry-points via @pragma('vm.extern') annotations.
The `@pragma` annotations are evaluated by the constants transformation and
visible to TFA and the precompiler, which match on the "options" field of the
annotation to determine whether to mark the class/procedure as a root.

This required enabling the transformation of annotation constants by default.

# Test Plan

The "vmservice_io.main" entry-point is removed from `main.cc` and annotated with
`@pragma`. All precompiler tests will crash if "vmservice_io.main" is not
available at runtime.

Debug/release precompiler bots are visible in "cl-linux" button.

Change-Id: I03c5d6ba7918672ed9905fcaee8dabe675a93a5d
Reviewed-on: https://dart-review.googlesource.com/56660
Commit-Queue: Samir Jindel <sjindel@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2018-05-28 15:13:55 +00:00
Régis Crelier 4d271519a1 [VM Bigint] Fix arm64 intrinsic for _estimateQuotientDigit (loop missing jump back).
Add regression test.
Fix arm64 disassembler (was printing "unknow" instructions).
Make decoding stricter in arm64 simulator.
This fix addresses https://github.com/a14n/dart-rational/issues/19

Change-Id: I1b2ccb4bd560b588d0c4860c904cc398fba9014f
Reviewed-on: https://dart-review.googlesource.com/56740
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Régis Crelier <regis@google.com>
2018-05-26 01:19:03 +00:00
Adam Barth 57d256377c [fuchsia] Update for port API change
zx_port_wait and zx_port_queue no longer take an unused count parameter.

Change-Id: I62f03871282d076638c51527603473252821d316
Reviewed-on: https://dart-review.googlesource.com/56705
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Adam Barth <abarth@google.com>
2018-05-25 19:43:15 +00:00
Paul Berry c09e0121f7 Observatory strong mode fixes: add explicit downcasts to button onClick callbacks.
Since the downcast is explicit (using "as") the type will be checked
even in unchecked mode, so technically there is a slight risk of
breakage.  But since the callback is so near the creation of the
ButtonElement, I'm not concerned.  Also, I'm not concerned about the
performance penalty of the explicit downcast because the cost is only
paid once per user click.

Change-Id: I64fbb442985f6ba6f745f665b36a3321498025e4
Reviewed-on: https://dart-review.googlesource.com/56704
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2018-05-25 19:38:13 +00:00
Paul Berry a5bf688622 Observatory strong mode fix: Avoid a String/Uri type mismatch.
Change-Id: Ie4871b7467bd00e594f7df397909690461fe358a
Reviewed-on: https://dart-review.googlesource.com/56702
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2018-05-25 19:30:18 +00:00
Paul Berry 1b0c2f4507 Observatory strong mode fix: Add VM.target getter.
This allows code to access a VM object's target without having to
downcast it to a more specific type.

Change-Id: I42f329e205c2da0137be2440f0d3088a7137bc55
Reviewed-on: https://dart-review.googlesource.com/56703
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2018-05-25 19:30:08 +00:00
Paul Berry 210d175cc0 Observatory strong mode fix: Fix a callback parameter type using an explicit downcast.
For brevity we explicitly downcast the parameter type (using "as")
rather than implicitly downcasting it (by assigning to a fresh
variable).  Since this is test code, I'm not concerned about the
performance penalty of the explicit downcast.

Change-Id: I2bf1556ec11db124978c6631df8fcdd5adbc298d
Reviewed-on: https://dart-review.googlesource.com/56701
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2018-05-25 19:22:13 +00:00
Paul Berry 08d0dcb4b0 Observatory strong mode fixes: specify some list literal types.
In some cases we need to specify a type because the inferred type
would be too specific.  For example, in the code:

    final content = [new SampleBufferControlElement(...)];
    ...
    content.addAll([new BRElement(), ...]);

Strong mode would infer a type of `List<SampleBufferControlElement>`
for `content`, making it impossible to add other kinds of HTML
elements to the list later.  So we have to specify explicitly that the
list element type is meant to be `HTMLElement`.

In other cases we need to specify a type because the inferred type is
too general.  For example, in the code:

    Future<List<String>> complete(...) {
      var result = [];
      ...add values of type String to `result`...
      return new Future.value(result);
    }

Strong mode would infer a type of `List<dynamic>` for `result`, making
it impossible to enclose in a `Future<List<String>>`.  So we have to
specify explicitly that the list element type is meant to be `String`.

Change-Id: I1b1c884529de2775898dfff800d250cd10629811
Reviewed-on: https://dart-review.googlesource.com/56700
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2018-05-25 19:22:03 +00:00
Paul Berry 462e350a6a Observatory strong mode fixes: Change types of InstanceMock/Instance members.
The types now correspond in the two classes, so we avoid invalid
override errors.

Change-Id: Iceeb324e6adf7573ae39d7250184f7eb58656498
Reviewed-on: https://dart-review.googlesource.com/56021
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2018-05-25 19:02:03 +00:00
Paul Berry 2d527801b2 Observatory strong mode fixes: fix several type annotations.
Change-Id: I647480f1f03be1d182afe98f6aa22c43a937aba3
Reviewed-on: https://dart-review.googlesource.com/56028
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2018-05-25 12:42:11 +00:00
Paul Berry 0125a5a235 Observatory strong mode fixes: Fix callback parameter types using implicit casts.
Change-Id: I0ee40677e13f82ca94238b98dcb50188063f9260
Reviewed-on: https://dart-review.googlesource.com/56026
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2018-05-25 12:32:01 +00:00
Paul Berry c85b2fc7be Observatory strong mode fixes: Fix an int/double type mismatch
Change-Id: I78cfc41dc328a40ba7650a492235d51663132130
Reviewed-on: https://dart-review.googlesource.com/56027
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2018-05-25 12:17:21 +00:00
Paul Berry 3fb22040cb Observatory strong mode fixes: make iteration types more specific.
Change-Id: I8031625bd676aadb0bf20e3b2642f0b7e84af747
Reviewed-on: https://dart-review.googlesource.com/56025
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2018-05-25 12:15:41 +00:00
Paul Berry 2165d2d797 Observatory strong mode fixes: safe uses of dynamic and covariant.
This CL makes the following changes, which should be safe since they
don't affect Dart 1.0 semantics:

- Explicitly declare the types of certain variables as `dynamic` to
  avoid strong mode inferring a type that leads to errors.

- Explicitly cast certain expressions to `dynamic` to allow access to
  members that are dynamically known to be present.

- Add `covariant` annotation to method parameters that are a subtype
  of the corresponding parameter in the base class.

Change-Id: Ibefe4d9591f70ea954373ca4d521bc54179cca9b
Reviewed-on: https://dart-review.googlesource.com/55900
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2018-05-25 11:54:20 +00:00
Paul Berry 7b3c3991ea Observatory strong mode fixes: add implicit downcasts.
Change-Id: I17d10ec4c69f9d3fa1cda3ec11df3e96749ade29
Reviewed-on: https://dart-review.googlesource.com/56022
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2018-05-25 05:20:25 +00:00
Paul Berry d17859ca11 Observatory strong mode fixes: make callback parameter types more general.
This CL addresses a code pattern where a method expects its parameter
to have a certain type, but that method is torn off and passed as a
callback to another method expecting its parameter type to be more
general.  For example:

    void f(int i) { ... }
    void g(void callback(Object o)) { ... }
    void h() {
      g(f); // Error: () -> int is not a subtype of () -> Object
    }

This is a strong mode error because the type system cannot guarantee
that the value pased to f will be an int.  The solution is to broaden
the type of the callback parameter so that it matches the type
expected for the callback.  In most cases, we insert an implicit
downcast (by reassigning the parameter to a local variable with the
expected type), which in Dart 2.0 semantics will result in a runtime
check (similar to what happens in Dart 1.0 checked mode).

Since the downcasts are implicit, the Dart 1.0 semantics are
unchanged, so this should be a safe change.

Change-Id: I9583ea194343b89b39305c9796cfad299a47943f
Reviewed-on: https://dart-review.googlesource.com/55907
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2018-05-24 23:07:55 +00:00
asiva 922f9697a0 [VM] Fix for issue 32901 - Isolate.resolvePackageUri has inconsistent behavior when called from a script launched via relative path.
Change-Id: I6ea0868936ff972def1f66c94509f7afed7c4c87
Reviewed-on: https://dart-review.googlesource.com/56622
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Siva Annamalai <asiva@google.com>
2018-05-24 22:08:40 +00:00
Ryan Macnak ec19ebd684 [vm] Fix feature detection of DBC32 versus DBC64 in snapshots with code.
At a minimium, the image portion of the snapshot is sensitive to word size.

Change-Id: I1056a726c7b773f3ef65608f3244aaa01a366ec4
Reviewed-on: https://dart-review.googlesource.com/56023
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2018-05-24 21:26:45 +00:00
Ryan Macnak de545b4079 Revert "[mirrors] Add IsolateMirror.loadUri."
This reverts commit ad4cfa0260.

Reason for revert: Assertion failures on DBC

Original change's description:
> [mirrors] Add IsolateMirror.loadUri.
> 
> This allows a programmer to dynamically load code into an isolate. The closest existing API is Isolate.spawnUri, but communication with the dynamically loaded code in that case is limited to asynchronous message passing of JSON-like objects.
> 
> Change-Id: Icb23e9dacfb0035622c119f11d4e0f892ba2ccd1
> Reviewed-on: https://dart-review.googlesource.com/45363
> Reviewed-by: Zach Anderson <zra@google.com>

TBR=rmacnak@google.com,zra@google.com,asiva@google.com,kmillikin@google.com

Change-Id: I80669188b9f40b3b527e8e268ade0d0d514a8753
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/56640
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2018-05-24 20:03:40 +00:00
Ben Konyi 1be13871bb [ VM ] Addressed additional comments from CL 56461.
Change-Id: I396a4e1038ccc7ae4f504d817ee6790aeb8d2003
Reviewed-on: https://dart-review.googlesource.com/56620
Reviewed-by: Zach Anderson <zra@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
2018-05-24 20:01:51 +00:00
Ryan Macnak ad4cfa0260 [mirrors] Add IsolateMirror.loadUri.
This allows a programmer to dynamically load code into an isolate. The closest existing API is Isolate.spawnUri, but communication with the dynamically loaded code in that case is limited to asynchronous message passing of JSON-like objects.

Change-Id: Icb23e9dacfb0035622c119f11d4e0f892ba2ccd1
Reviewed-on: https://dart-review.googlesource.com/45363
Reviewed-by: Zach Anderson <zra@google.com>
2018-05-24 17:07:15 +00:00
Vyacheslav Egorov 7c43cfad9f [vm] Mark superclasses of interfaces implemented.
Previously we would only mark immediate superinterfaces
as implemented which is not enough.

Bug: b/80154489
Change-Id: I0751d4326b1ac8930b7fdfb35e0c3fdd5d0b71dd
Reviewed-on: https://dart-review.googlesource.com/56485
Reviewed-by: Martin Kustermann <kustermann@google.com>
Reviewed-by: Régis Crelier <regis@google.com>
Commit-Queue: Vyacheslav Egorov <vegorov@google.com>
2018-05-24 16:35:13 +00:00
Ben Konyi 2f7874ab99 [ VM ] Updated include path for typed_data_utils.h which was causing Flutter build to fail.
Change-Id: Id70533ec5237579719cfc061fab93bd659c20b1f
Reviewed-on: https://dart-review.googlesource.com/56560
Commit-Queue: Ben Konyi <bkonyi@google.com>
Reviewed-by: Zach Anderson <zra@google.com>
2018-05-24 16:15:03 +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
Samir Jindel 02bcbc12fa [vm/kernel] Fix partial instantiation implementation in StreamingConstantEvaluator.
# Summary

As part of commit 772c9bb5f, we changed the representation of partially
instantiated closures to facilitate partial instantiation of local functions.
The compile-time constant evaluator was not updated -- this revision implements
that update.

Fixes task 33211.

# Test Plan

Updated `partial_tearoff_instantiation_test.dart` to test the case which caused
incorrect behavior in task 33211.

Change-Id: I7bbd4fb83a5aea86ffc85c1d9952f1202f098d6b
Reviewed-on: https://dart-review.googlesource.com/56346
Reviewed-by: Régis Crelier <regis@google.com>
Commit-Queue: Samir Jindel <sjindel@google.com>
2018-05-24 12:20:42 +00:00
Martin Kustermann b84f18e392 [VM] Mark seemingly consistently failing test on windows
Issue https://github.com/dart-lang/sdk/issues/33224

Change-Id: If9437c7791efd23dd98ad41cf3cf16173046cdaf
Reviewed-on: https://dart-review.googlesource.com/56501
Reviewed-by: Martin Kustermann <kustermann@google.com>
2018-05-24 09:17:27 +00:00
Ben Konyi c541cda216 [ VM ] Fixed issue where error code was being clobbered by call to Dart_TypedDataReleaseData on Windows, resulting in OSError returning a 0 error instead of the true error code.
Bug: 2
Change-Id: I33e9319f57de73d9435936ddf853968834fb5a16
Reviewed-on: https://dart-review.googlesource.com/56461
Commit-Queue: Ben Konyi <bkonyi@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2018-05-24 02:07:39 +00:00
Ben Konyi 3ab7cf0590 Revert "[dart:io] Revert recent non-utf8 path handling"
This reverts commit 42bcdcd332.

Change-Id: I11fb7db2aac3b7dc15cb35a22fea38b31069cbc0
Reviewed-on: https://dart-review.googlesource.com/55502
Reviewed-by: Zach Anderson <zra@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
2018-05-23 21:01:44 +00:00
Ben Konyi e35ed9c749 [ VM / Build ] Added '--no-include-kernel-service' to build.py. By default, the kernel service is now included in all build modes, including product mode. Providing '--no-include-kernel-service' will build the specified configuration without the kernel service.
Change-Id: I682cd7c2895a9bcb215948615f2bdc627abe8d08
Reviewed-on: https://dart-review.googlesource.com/56286
Commit-Queue: Ben Konyi <bkonyi@google.com>
Reviewed-by: Zach Anderson <zra@google.com>
2018-05-23 20:35:53 +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
Martin Kustermann e0144d51bb [VM] Add UNREACHABLE() to AOT constant evaluator in the VM
Since commit 775eeece we use a kernel2kernel constant evaluator for
AOT compilations. We can now start to ensure we never hit the constant
evaluator in the VM anymore.

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

Change-Id: If0e3b5c89fba64a7f93af606e7146e52c45b38df
Reviewed-on: https://dart-review.googlesource.com/56340
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2018-05-23 16:01:45 +00:00
Samir Jindel 7583fb882a [vm] Refactor state bits to free up two bits on Function.
This was pulled out of old revision by Slava.

Change-Id: I9fa276b0768f4aa908754fec8369b1272ec465be
Reviewed-on: https://dart-review.googlesource.com/56108
Commit-Queue: Samir Jindel <sjindel@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2018-05-23 13:59:25 +00:00
Martin Kustermann 3582e30d8e [VM] Remove unused _Random._A field in Dart sources and make constant in C++ code instead
Issue https://github.com/dart-lang/sdk/issues/33185

Change-Id: I256a66ebf81d4433bded15f19b4147327df9b588
Reviewed-on: https://dart-review.googlesource.com/56329
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2018-05-23 13:06:25 +00:00
Martin Kustermann f8cca09ce3 [VM] Do not invoke the empty StackOverflowError/OutOfMemoryError constructors
Issue https://github.com/dart-lang/sdk/issues/33185

Change-Id: If5bf7269cede7ed4a643bc338c964dacdc03cdaf
Reviewed-on: https://dart-review.googlesource.com/56324
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2018-05-23 12:52:08 +00:00
Ben Konyi 6d8f473d4f [ VM / Hot Reload ] Updated kernel_service and hot reload behavior to run as long as the compiler returns valid kernel.
Change-Id: Id2b20d95488ccd374f4ca337355dde9f5057292a
Reviewed-on: https://dart-review.googlesource.com/46820
Reviewed-by: Siva Annamalai <asiva@google.com>
2018-05-22 23:50:28 +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
Aske Simon Christensen e191d4feb5 Simplify errors on invalid arguments
Change-Id: I1bd94725b4e4e44e706c6d22543bbea22649ec69
Reviewed-on: https://dart-review.googlesource.com/55680
Commit-Queue: Aske Simon Christensen <askesc@google.com>
Reviewed-by: Peter von der Ahé <ahe@google.com>
2018-05-22 11:14:22 +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
Alexander Aprelev e71bd048e5 [vm, kernel] Fix async stack code traversal in dart2.
With this change debugger requests yield(await) positions from kernel builder so it can confirm which frame handles what exceptions.
This also renames ':completer' to ':async_completer' in constructed kernel, so it is compliant with what VM expects to see(and updates test expectations accordingly).
Further it fixes async stack navigation for sync-async that became default in dart vm since first version went for the review((uses `future` getter, rather than property).
It also makes `future` getter non-debuggable to allow stepping-out of async methods.

Make Handle zone-scoped. Clean up frame counter var name.

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

Change-Id: Ia71f3c851a6b313655b57dad28c296f5dd081eda
Reviewed-on: https://dart-review.googlesource.com/54640
Commit-Queue: Alexander Aprelev <aam@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
2018-05-22 00:27:01 +00:00
Paul Berry bbb8905075 Observatory strong mode fixes: specify type argument to .map when not inferable.
This ensures that the resulting Iterable will have the proper type
when run with strong mode semantics.

In Dart 1.0 semantics, the type argument to .map is ignored, so this
change should be safe.

Change-Id: I34924bc7e803b1520af7d174cfe80f5be6b7ac0f
Reviewed-on: https://dart-review.googlesource.com/55908
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2018-05-21 20:28:48 +00:00
Paul Berry 841a91b3a0 Observatory strong mode fixes: Add abstract Location.toUserString to Location.
This is necessary because many call sites invoke toUserString without
first casting to one of the derived classes.

This should be safe since both derived classes (SourceLocation and
UnresolvedSourceLocation) contain a definition of toUserString.

Change-Id: I69eeda326883d87fc4e8cedd732881d250cae8cb
Reviewed-on: https://dart-review.googlesource.com/55909
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2018-05-21 20:07:39 +00:00
Alexander Aprelev fc206a7589 Add Kill isolate service request.
This is useful when embedder needs to kill an isolate that might be paused on a breakpoint.

Change-Id: If54decda5d16c694b81a25ae43d37f8eb41e8105
Reviewed-on: https://dart-review.googlesource.com/55276
Commit-Queue: Alexander Aprelev <aam@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2018-05-21 20:00:58 +00:00
Paul Berry aad3270ab8 Observatory strong mode fixes: fix C-style parameter declarations.
This CL fixes some cases where Observatory mistakenly tried to use a
C-style parameter declaration, e.g.

    void foo(String);

The intent is to declare the parameter to have type `String`, but Dart
interprets the parameter as having *name* `String` and type `dynamic`.

In most cases the fix applies to abstract method declarations, whose
types aren't semantically relevant in Dart 1.0, so these parts of the
CL should be safe.

In one case it applies to a typedef, IsConnectedVMTargetDelegate.  The
only use of this typedef is as the type of
TargetRepository._isConnectedVMTarget, whose value is always the
static function ObservatoryApplication.isConnectedVMTarget.  The type
of ObservatoryApplication.isConnectedVMTarget matches the typedef
(according to Dart 1.0 rules) both before and after the change, so
this should be safe as well.

Change-Id: Ia67f5f14d5a012ccb8a44cbd88a8233f8c9ad171
Reviewed-on: https://dart-review.googlesource.com/55901
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2018-05-21 19:58:38 +00:00
Paul Berry ea4d10915c Observatory strong mode fixes: make return types more specific.
This CL addresses a code pattern where a method has a more general
return type than it needs, causing a strong mode error at the site
where the method is called or torn off.  For example:

    Object f() => 'x';
    void g(String callback()) { ... }
    void h() {
      g(f); // Error: () -> Object is not a subtype of () -> String
    }

The solution is to tighen up the return type.  In all cases in this
CL, it is obvious from the method definition that the value returned
at runtime will satisfy the tighter return type, so this should be a
safe change.

Change-Id: Ifbd476d969274342653d2619c1c81e2e014817c4
Reviewed-on: https://dart-review.googlesource.com/55904
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2018-05-21 19:52:38 +00:00
Aart Bik 0f506ba3ae Added period to comment for consistency.
Rationale:
Getting familiar with the Dart workflow.

Bug: none
Change-Id: If145b28fd3d6868b2208fa0239fd3ea5a88e79b9
Reviewed-on: https://dart-review.googlesource.com/55584
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Vyacheslav Egorov <vegorov@google.com>
2018-05-21 19:04:38 +00:00
Ryan Macnak 5ab4294074 [vm] Allow for creating a CoreJIT snapshot from a kernel file.
Change-Id: Ibc0ea5c75393c88bf70520fca6ff218ada0cd928
Reviewed-on: https://dart-review.googlesource.com/55840
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2018-05-21 18:20:06 +00:00
Ryan Macnak 4d3ebab589 [vm] Fix error message when an API function is called without a current isolate.
Change-Id: Id29fe5d14a58d85984902952dc53cc56cda16ccc
Reviewed-on: https://dart-review.googlesource.com/55842
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2018-05-21 16:27:48 +00:00
Samir Jindel c31b9a461d [vm/kernel] Reference constants in Dill by offset into constants table.
Summary:

The constants table contains a concatenation of the variable-length encodings of
each constant used in the serialized component. Previously, we referenced the
constants in the code by index into the constants table, which requires reading
potentially the entire constants table to dereference. Now, we refer to the
constant by the binary offset into the constants table, which allows us to peek
into it in constant time.

Test Plan:

The constants table is used by all the precompiler modes, so the new encoding
will inherit the coverage of the existing encoding.

Results from debug and release precompiler bots are available under the
"cl-linux-try" button.

Change-Id: I4782bc0035d0b0cbd5bd6b9d086561ea601286c8
Reviewed-on: https://dart-review.googlesource.com/55470
Commit-Queue: Samir Jindel <sjindel@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2018-05-21 15:54:08 +00:00
Zach Anderson c38bca632d [fuchsia] Fix bad state error on namespace cleanup
We have to close the fds we got from the namespace before destroying
the namespace.

Change-Id: I3298868a444d262b4ded147a1dc8eb1a99c92a1c
Reviewed-on: https://dart-review.googlesource.com/55983
Reviewed-by: Zach Anderson <zra@google.com>
2018-05-18 22:19:23 +00:00
Ben Konyi 7aacf7e188 [ VM / dart:io ] Fixed memory leak in SecurityContext on MacOS.
Fixes #33114.

Change-Id: I6e2272c6d63b11bbd82c3d5b7c3aedf75306ba05
Reviewed-on: https://dart-review.googlesource.com/55523
Commit-Queue: Ben Konyi <bkonyi@google.com>
Reviewed-by: Zach Anderson <zra@google.com>
2018-05-18 20:17:49 +00:00
asiva 02e47a9731 [VM] Fix for issue 32188 (cannot use pub with --preview-dart-2)
- Fix for 'unable to read .packages file' error when generating
  kernel file (script snapshot).
- Make sync-async an isolate specific flag and turn it off for
  the kernel isolate as it runs in Dart 1 mode
- Include 'reify-generic-functions' and 'sync-async' flags to the
  list of flags to check an app JIT snapshot against.

Change-Id: I2b16270f65705213660487f9c15fe0348fc84c8b
Reviewed-on: https://dart-review.googlesource.com/55589
Commit-Queue: Siva Annamalai <asiva@google.com>
Reviewed-by: Zach Anderson <zra@google.com>
2018-05-18 18:12:08 +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
Zach Anderson c26435f18f [dart:io] Add length check assert to x509 code
Change-Id: I42c29e43f34cceea90caa5b99c4249ddaabe968c
Reviewed-on: https://dart-review.googlesource.com/55763
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Zach Anderson <zra@google.com>
2018-05-17 21:49:17 +00:00
Martin Kustermann 510669a0b4 [VM] Address uncovered issues, mark test as passing
Change-Id: Ie2c5eb055ce6138952af145ce6fdb972c057bd16
Reviewed-on: https://dart-review.googlesource.com/55780
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2018-05-17 19:21:35 +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
Zach Anderson e7495e427c [dart:io] Adds X509Certificate.der and X509Certificate.pem
fixes #33115

Change-Id: I7ccf5998b23e936040fe65792824f09d3f494cf7
Reviewed-on: https://dart-review.googlesource.com/55505
Commit-Queue: Zach Anderson <zra@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
2018-05-17 16:20:06 +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
Samir Jindel 23c8c4d101 [vm/kernel] Pass type variables through ActivationFrame for expression compilation.
Fixes https://github.com/dart-lang/sdk/issues/32376.

Change-Id: I37bbda2dbc6052925aa840865c62a170604c6cdd
Reviewed-on: https://dart-review.googlesource.com/44784
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Samir Jindel <sjindel@google.com>
2018-05-17 13:59:57 +00:00
Martin Kustermann 1be81b4a96 [VM] Skip vm/dart/appjit_test on opt-counter builder
It is quite slow on those builders and causes timeouts.

Change-Id: I876bba2c8e0d4e06dd9dff94e421d35e3f0236d1
Reviewed-on: https://dart-review.googlesource.com/55684
Reviewed-by: Martin Kustermann <kustermann@google.com>
2018-05-17 11:53:33 +00:00
P.Y. Laligand 499c25d886 [fuchsia] Update FIDL include paths.
Change-Id: I42b0f0acc8385d567971c044bb31f9348e982c44
Reviewed-on: https://dart-review.googlesource.com/55503
Reviewed-by: Zach Anderson <zra@google.com>
2018-05-16 20:41:04 +00:00
Régis Crelier c60ea740cb [VM runtime] The 'checked' parameter of Isolate.spanwUri should control asserts
only, but not type checks in Dart2 strong mode (fixes #33120).

Change-Id: Ib8ca63aa3113b80243b6f8eb4015cb5c24140a88
Reviewed-on: https://dart-review.googlesource.com/55442
Commit-Queue: Régis Crelier <regis@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2018-05-16 18:13:22 +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
Ryan Macnak 069febad9c [vm] Ensure remainder bits in StackMaps are zero-initialized.
Bug: https://github.com/dart-lang/sdk/issues/31427
Change-Id: I3d956ceae1c7b60ea74dda4b4b727772e540dfe1
Reviewed-on: https://dart-review.googlesource.com/55300
Reviewed-by: Siva Annamalai <asiva@google.com>
Reviewed-by: Zach Anderson <zra@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2018-05-16 16:28:21 +00:00
Zach Anderson 42bcdcd332 [dart:io] Revert recent non-utf8 path handling
Reason for revert: Breaking API change blocks Flutter rolls. Reverting
to reconsider, work around, etc..

Revert "[ VM ] Fixed issue where backing array was deleted from an ExternalTypedData before the ExternalTypedData was used."

This reverts commit 916b9da48d.

Revert "[ VM ] Fixed tests for non-UTF8 paths on Windows / Macos."

This reverts commit 6327fe91c2.

Revert "[ VM ] Fix failing tests on Windows bots after non-UTF-8 paths change."

This reverts commit b51f4b7956.

Revert "[ VM ] Updated non-UTF-8 tests to expect exceptions on OSX/iOS."

This reverts commit bcb36247d2.

Revert "Revert "[ VM ] Updated non-UTF-8 tests to expect exceptions on OSX/iOS.""

This reverts commit 24450c79a5.

Change-Id: I756f74f4acdde168d0984fe130f05f9252366334
Reviewed-on: https://dart-review.googlesource.com/55441
Reviewed-by: Todd Volkert <tvolkert@google.com>
Commit-Queue: Zach Anderson <zra@google.com>
2018-05-16 15:47:10 +00:00
Martin Kustermann aafc2a6d43 Reland "[vm/kernel] Enable kernel2kernel "constants" transformation in AOT mode (after running TFA)"
The CL was originally committed in 039e8a175 (and reverted in
46ab040e5). The fix for the issue has landed in 9d9ce8d69 .

This time the CL will land in "disabled" form and will be enabled in a separate CL.

Change-Id: I3d5eb952230aee99875e3c58a6595691c5145e25
Reviewed-on: https://dart-review.googlesource.com/55361
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2018-05-16 12:48:38 +00:00
Lasse R.H. Nielsen bf77f064c1 Mark NoSuchMethodError constructor as deprecated.
Move implementation details into patch files, it does not belong in the interface.
Actually implement NoSuchMethod.withInvocation in dart2js.

Change-Id: I37049c258067b962d18eff42196e37aa127f0dea
Reviewed-on: https://dart-review.googlesource.com/55166
Commit-Queue: Lasse R.H. Nielsen <lrn@google.com>
Reviewed-by: Leaf Petersen <leafp@google.com>
2018-05-16 09:09:08 +00:00
Ben Konyi 63242ca459 [ VM ] Fix issue where IsServiceIsolate may fail in the isolate shutdown callback when the service isolate is shutting down
Change-Id: I6dc9786394450ff587ceb45bfa60fd9d40224af6
Reviewed-on: https://dart-review.googlesource.com/55322
Commit-Queue: Ben Konyi <bkonyi@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
2018-05-16 00:28:48 +00:00
Ben Konyi 7cea07e4bc [ VM / Dart 2 ] Fixed DartAPI_IsolateShutdownRunDartCode for Dart 2.
Change-Id: Ieb39c988fad925c8c4cd6250ea3cda3283b1b2fc
Reviewed-on: https://dart-review.googlesource.com/55023
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
2018-05-15 23:21:08 +00:00
Ben Konyi 916b9da48d [ VM ] Fixed issue where backing array was deleted from an ExternalTypedData before the ExternalTypedData was used.
Reland "Fix issues with FileSystemEntities which have non-UTF8 paths causing exceptions to be thrown when converting to/from a Dart VM String."

This reverts commit 4f549e2900.

Change-Id: Ia27c8c300beb178fa7b08ffe0bfcb2d61f65bbb5
Reviewed-on: https://dart-review.googlesource.com/55271
Reviewed-by: Zach Anderson <zra@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
2018-05-15 21:54:46 +00:00
Vyacheslav Egorov d96e1de0bf [vm] Snapshot class'es dependent code array when generating app-jit snapshot
If this array is not snapshotted then optimized code is not invalidated
when new subclasses are finalized leading to execution of incorrect code.

Change-Id: Ib28609a5e6499aedb1b2c19de40ab00fd5a786bc
Reviewed-on: https://dart-review.googlesource.com/55240
Reviewed-by: Martin Kustermann <kustermann@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Vyacheslav Egorov <vegorov@google.com>
2018-05-15 17:33:37 +00:00
Ryan Macnak 6e3f15c109 [vm] Don't serialize the uninitialized alignment gaps in ExceptionHandlers.
Bug: https://github.com/dart-lang/sdk/issues/31427
Change-Id: Ia2c2b30a2b3e5dd9140851f274a85c0883637ef2
Reviewed-on: https://dart-review.googlesource.com/55041
Reviewed-by: Zach Anderson <zra@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2018-05-15 17:24:36 +00:00
Vyacheslav Egorov 7348aa5b6a [vm] Reimplement perf-inject JITDUMP support.
This enables the following profiling workflow on Linux:

  $ perf record -k mono dart --generate-perf-jitdump benchmark.dart
  $ perf inject -j -i perf.data -o perf.data.jitted
  $ perf report -i perf.data.jitted

and allows perf-annotate to recognize and annotate JIT generated code.

Change-Id: Ifd0cb2c9111ef766cc8c3a7634ccf0aefab60bd8
Reviewed-on: https://dart-review.googlesource.com/54912
Commit-Queue: Vyacheslav Egorov <vegorov@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2018-05-15 16:31:46 +00:00
Samir Jindel 12c65eaeb4 [vm/kernel] Add flag to disable Kernel-based expression compilation.
Change-Id: Ibaa2ccd282b467e2b5ecda09fb86620409d7214b
Reviewed-on: https://dart-review.googlesource.com/55220
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Samir Jindel <sjindel@google.com>
2018-05-15 14:55:37 +00:00
Samir Jindel 39c93a2b19 Revert "Revert "[vm/kernel] Expression execution through Kernel."
This reverts commit b5154dd01e.

Original revision is in patchset 1.

Change-Id: Ic0776011c6fdbd64c025086535351474a9a88b6e
Reviewed-on: https://dart-review.googlesource.com/54407
Commit-Queue: Samir Jindel <sjindel@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
2018-05-15 12:03:22 +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
Martin Kustermann 45c524e106 [VM] Mark functions on BG compiler bailouts specially, allow them to be re-optimized on main thread
In some cases, bailouts in the bg compiler, e.g. caused by class
finalization, mark functions as unoptimizable, which can significantly
slow down an application.

Instead of doing this, we mark these functions as non-optimizable on the
BG compiler and trigger re-compilations on the main thread.

Change-Id: Ifbb6aa7972818be8fa1313427e38d8b5576053e3
Reviewed-on: https://dart-review.googlesource.com/54886
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2018-05-15 09:34:22 +00:00
Alexander Markov 344c68e54c [kernel, vm] Revise how metadata is written in kernel binaries
Metadata is no longer written ahead of all nodes. Instead, metadata for
each node is written in the same context as the node itself (into a separate
buffer). This allows metadata to contain (serialize) arbitrary nodes
(for example, arbitrary DartTypes) and use serialization context of parent
nodes (such as declared type parameters).

However, with this change metadata looses the ability to reference
arbitrary AST nodes. This ability was overly restricted and had no
practical uses. (It was not possible to reference nodes which are not
reachable from root Component. As a consequence, it was not possible to
write references to arbitrary DartTypes.)

This change aligns the serialization capabilities of metadata with
how kernel AST nodes are serialized.

Change-Id: I027299a33b599b62572eccd4aa7083ad1dd2b3b3
Reviewed-on: https://dart-review.googlesource.com/54481
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
2018-05-15 00:41:08 +00:00
Ben Konyi 4f549e2900 Revert "Fix issues with FileSystemEntities which have non-UTF8 paths causing exceptions to be thrown when converting to/from a Dart VM String."
This reverts commit ba342a94ec.

Reason for revert: Bots are red.

Original change's description:
> Fix issues with FileSystemEntities which have non-UTF8 paths causing exceptions to be thrown when converting to/from a Dart VM String.
> 
> Continuation of PR #32583 by powdercloud
> 
> Fixes #29451
> 
> Change-Id: I4bdf24f9c8ead425a4f0cad33b642908f1ec203d
> Reviewed-on: https://dart-review.googlesource.com/51580
> Commit-Queue: Ben Konyi <bkonyi@google.com>
> Reviewed-by: Zach Anderson <zra@google.com>

TBR=bkonyi@google.com,rmacnak@google.com,zra@google.com,tvolkert@google.com

Change-Id: I12850f178a13a75289d18af4e565bd73c59b14ad
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/55060
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
2018-05-14 23:40:29 +00:00
Ben Konyi ba342a94ec Fix issues with FileSystemEntities which have non-UTF8 paths causing exceptions to be thrown when converting to/from a Dart VM String.
Continuation of PR #32583 by powdercloud

Fixes #29451

Change-Id: I4bdf24f9c8ead425a4f0cad33b642908f1ec203d
Reviewed-on: https://dart-review.googlesource.com/51580
Commit-Queue: Ben Konyi <bkonyi@google.com>
Reviewed-by: Zach Anderson <zra@google.com>
2018-05-14 23:06:57 +00:00
Zach Anderson fe9f22aa83 [windows] Fix 'all' target
Change-Id: I5f6b4b56115f353deed2a332a6b27835bb559e8f
Reviewed-on: https://dart-review.googlesource.com/55020
Reviewed-by: Régis Crelier <regis@google.com>
Commit-Queue: Zach Anderson <zra@google.com>
2018-05-14 22:17:38 +00:00
Zach Anderson 72921342c8 [Fuchsia] Small buildfile fix for scudo malloc
Change-Id: I92e9a3193d25b6032eae95bbd193190a09bf052b
Reviewed-on: https://dart-review.googlesource.com/54624
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Zach Anderson <zra@google.com>
2018-05-14 21:49:08 +00:00