Commit graph

12525 commits

Author SHA1 Message Date
Zachary Anderson dcd275fa74 [dart:io] Begins work on mocking support
Change-Id: I770ed9485a934af07e570fbad3f3fb84ebef973d
Reviewed-on: https://dart-review.googlesource.com/3302
Commit-Queue: Zach Anderson <zra@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Florian Loitsch <floitsch@google.com>
2017-10-10 17:39:12 +00:00
Vyacheslav Egorov a771e05fa4 [VM] Fix typing issues in convert_patch.dart
Bug: https://github.com/dart-lang/sdk/issues/31052
Change-Id: I65cea214cb4f053850a05c107f78a8af1bdde81f
Reviewed-on: https://dart-review.googlesource.com/12446
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Vyacheslav Egorov <vegorov@google.com>
2017-10-10 11:09:11 +00:00
Vyacheslav Egorov 5b14ee115a [VM] Make _StringBase implement String
_StringBase is used everywhere as if it was assignable to String,
however it itself does not implement String, its subclasses do.

This change addresses this.

Also removes unused native runtime method from one of subclasses.

Bug: https://github.com/dart-lang/sdk/issues/31052
Change-Id: Iea2389d1b48a3689fb11c99c0e230747ab1c5962
Reviewed-on: https://dart-review.googlesource.com/12444
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Vyacheslav Egorov <vegorov@google.com>
2017-10-10 10:33:31 +00:00
Alexander Markov 14f6276945 [Kernel, VM] Add null checking to devirtualization
Devirtualization optimization now adds metadata to kernel AST instead
of transforming nodes to Direct* ones. The direct call metadata
provides information about checking receiver for null, while
Direct* kernel nodes do not support null checking.

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

Issue: https://github.com/dart-lang/sdk/issues/30480
Change-Id: I57f56fbf4a8981d33b1571c0d93105cf8ca71d76
Reviewed-on: https://dart-review.googlesource.com/12260
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2017-10-10 00:50:31 +00:00
Ryan Macnak 3609522166 printf format checking is a compiler feature, not a platform feature.
Change-Id: Ib3e0beb814b5cae6f2b4be13f055069f682674f5
Reviewed-on: https://dart-review.googlesource.com/11645
Reviewed-by: Zach Anderson <zra@google.com>
2017-10-09 22:26:01 +00:00
Siva Chandra 0eb9528be8 [vm/kernel_binary.h] Make few asserts stricter.
This makes the compiler happy under -Wstrict-overflow.

Change-Id: Ic91ccd9d716c866e11d6b00de7b95916a73ea5d7
Reviewed-on: https://dart-review.googlesource.com/12346
Commit-Queue: Siva Chandra <sivachandra@google.com>
Reviewed-by: Zach Anderson <zra@google.com>
2017-10-09 21:17:48 +00:00
Zachary Anderson 11177ce405 [android] Fix build
Change-Id: I33fe71898d0d1defd9c55f0a53a1b0748ddfb820
Reviewed-on: https://dart-review.googlesource.com/12345
Reviewed-by: Zach Anderson <zra@google.com>
2017-10-09 19:31:40 +00:00
Zachary Anderson 7fd15110fe [dart:io] chdir, getcwd when in a namespace
This change does a couple things:
- When there is a non-default namespace, on Linux, Android, and Fuchsia
  the current working directory is per-Isolate.
- On Fuchsia, it caches the fd from fdio_ns_t instead of recomputing it
  on every fs access.

Change-Id: I3735330884de51ca853a17d66dcfcfa984b9a041
Reviewed-on: https://dart-review.googlesource.com/9367
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Zach Anderson <zra@google.com>
2017-10-09 19:14:58 +00:00
Ryan Macnak 140dfd6d89 [vm] Consider a reload with no changed files as a reload for _getUnusedChangesInLastReload.
Add missing messages for various vm-service error codes.

Bug: https://github.com/flutter/flutter/issues/12300
Change-Id: I1f3607f94c5ab2fb770813f0502c3b1c9c40fdf4
Reviewed-on: https://dart-review.googlesource.com/11642
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Siva Annamalai <asiva@google.com>
2017-10-09 16:31:05 +00:00
Siva Chandra bf096c2bb4 Copy library specific kernel binary data to VM heap.
Before this change, each function and field had its own kernel data blob
in the VM heap. With this change, the entire kernel data of a library is
stored as one single blob in the VM heap. Functions and fields store an
offset which points to the kernel data, specific to them, in that single
blob.

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

Change-Id: Ie03e738c4d20f16056a5ef04341b75506fda9c60
Bug:
Reviewed-on: https://dart-review.googlesource.com/6601
Commit-Queue: Siva Chandra <sivachandra@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
2017-10-09 15:03:15 +00:00
Peter von der Ahé 90587a6837 vmservice_libraries.json is no longer generated.
Fixes #31034.

Change-Id: Ifb9ed97fe8cddb317cb63e7d66f262ef9e68ee75
Reviewed-on: https://dart-review.googlesource.com/12282
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Peter von der Ahé <ahe@google.com>
2017-10-09 13:37:55 +00:00
Vyacheslav Egorov cc4e76664f [VM] Relax kernel::StreamingConstantEvaluator::IsAllowedToEvaluate()
When precompiling we might trigger optimizing compilation eagerly
so constant evaluation did not have a chance to run.

It is totally fine though because precompiler does not use
background thread.

Bug:
Change-Id: I6e889284d9ef9be8b09c6f4fe7695c82a78bcee4
Reviewed-on: https://dart-review.googlesource.com/12280
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2017-10-08 17:46:14 +00:00
Vyacheslav Egorov 552d09715d [VM] Cleanup SIMD related IL instructions.
This CL unifies 31 diverse Simd instructions into a single flexible SimdOp instruction.

These instructions were not different enough to warrant being implemented 
as separate IL instructions. The separation did not bring any benefit but
instead we payed the price with considerable amounts of duplicated code 
across the pipeline.

Main motivation for this refactoring is to reduce the surface of our IL.

Bug:
Change-Id: Ie8e39fecd2a51cb8edffdfe9c22e76835f912a9b
Reviewed-on: https://dart-review.googlesource.com/10120
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Zach Anderson <zra@google.com>
2017-10-07 13:25:13 +00:00
Sigmund Cherem 80e7d3b35f Build a strong version of outline.dll, and use it for front end strong mode tests.
(rebases CL 11366 after Peter's changes)

Change-Id: If9f3d331fb953a9890fa7952bd472cc39f541e84
Reviewed-on: https://dart-review.googlesource.com/11965
Reviewed-by: Paul Berry <paulberry@google.com>
2017-10-06 20:12:59 +00:00
Régis Crelier a6fc7321f8 Temporarily restore option --assert_initializer as a no-op (always on), because
it is still referenced from various scripts.

Change-Id: I852f952dfb2afb769de03bb8bbb180a1042dbf50
Reviewed-on: https://dart-review.googlesource.com/12123
Reviewed-by: Zach Anderson <zra@google.com>
2017-10-06 20:11:28 +00:00
Régis Crelier 98a253186c [VM parser] Disallow implicit reference to 'this' in assertion initializer (fixes #29784).
Add regression test.
Adjust various status files.

Change-Id: I97bdf960260f0a13c2cfc6d95299d67a44c2238d
Reviewed-on: https://dart-review.googlesource.com/11247
Reviewed-by: Siva Annamalai <asiva@google.com>
2017-10-06 18:40:14 +00:00
James Robinson d7874036a9 [fuchsia] Update path to netconfig header, add explicit build dep
This updates the include path by which the runtime include fuchsia's
netconfig header to its current location and adds an explicit GN build
dependency on the target defining the interface so we can configure
include paths in a nicer way.

Change-Id: I2bddc452e5ded5de44c7a7087ac5457f0f07609b
Reviewed-on: https://dart-review.googlesource.com/11761
Reviewed-by: Zach Anderson <zra@google.com>
2017-10-06 16:32:22 +00:00
Peter von der Ahé 16aa720d27 Remove compiling platform.dill from patch_sdk.dart
This separates compiling platform.dill files from the patch_sdk.dart
script. The motivation for that is that I'm working on reading patch
files directly from Fasta, so we can completely remove the build step
for generating patched_sdk and dart2js_patched_sdk.

Short-term this should allow Paul to add a strong-mode version of
platform.dill without causing to many conflicts with my work on
patches.

Change-Id: I1150845b2986348d4fffe27092701d8a9b57ea54
Reviewed-on: https://dart-review.googlesource.com/11506
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2017-10-06 15:34:37 +00:00
Vyacheslav Egorov 05a28ab557 [VM] Introduce new way to define instruction backends (Reland).
Rewrite most SIMD instructions on ARM using this new way.

Our current way for defining instruction backends -- a pair of two virtual
methods called MakeLocationSummary and EmitNativeCode, leads to unnecessary
duplicated and verbose code. Code generation happens in three steps:

1. For each instruction in the graph MakeLocationSummary is called to
constructing a location summary object encoding register allocation constraints;
2. When all register constraints are collected a register allocation is performed
and results are filled back into the location summaries;
3. For each instruction in the graph EmitNativeCode is called. It unpacks
location summary attached to the instruction into actual machine registers and
emits native code.

There is usually a lot of duplication between declaring register constraints in
MLS and unpacking them in ENC which this CL is trying to remove.

The new way is centered on the concept of an *emitter function* which encodes
in its signature register constraints for a particular instruction.

We use a combination of templates and macroses to enable writing

    DEFINE_BACKEND(BinaryFloat32x4Op,
                   (QRegister result, QRegister left, QRegister right)) {
      // ...
    }

Instead of

    LocationSummary* BinaryFloat32x4OpInstr::MakeLocationSummary(Zone* zone,
                                                                 bool opt) const {
      const intptr_t kNumInputs = 2;
      const intptr_t kNumTemps = 0;
      LocationSummary* summary = new (zone)
          LocationSummary(zone, kNumInputs, kNumTemps, LocationSummary::kNoCall);
      summary->set_in(0, Location::RequiresFpuRegister());
      summary->set_in(1, Location::RequiresFpuRegister());
      summary->set_out(0, Location::RequiresFpuRegister());
      return summary;
    }

    void BinaryFloat32x4OpInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
      const QRegister left = locs()->in(0).fpu_reg();
      const QRegister right = locs()->in(1).fpu_reg();
      const QRegister result = locs()->out(0).fpu_reg();
      // ...
    }

This change also introduces a new, more handy way to work with S/D components of QRegisters, QRegister_ wrapper type.

Bug: https://github.com/dart-lang/sdk/issues/30949
Change-Id: I7bb0fc9672c89acc3d3d9b5e9859ae5a5471f420
Reviewed-on: https://dart-review.googlesource.com/11820
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2017-10-06 11:48:02 +00:00
Ryan Macnak a2f146eea3 [vm] Forward all weak table entries during become, not just the identity hash.
Bug: https://github.com/dart-lang/sdk/issues/30978
Change-Id: I305e59c9e87c7b87aa8df4365831f401234f2df6
Reviewed-on: https://dart-review.googlesource.com/11248
Reviewed-by: Erik Corry <erikcorry@google.com>
2017-10-05 23:58:26 +00:00
Ryan Macnak aef928698e [vm] Rebuild the store buffer when following forwarding pointers.
For compaction, we cannot leave forwarding corpses in the store buffer because their pages will be freed.

Bug: https://github.com/dart-lang/sdk/issues/30978
Change-Id: If70d8536129801eac0456ed806473bc02549bb21
Reviewed-on: https://dart-review.googlesource.com/11249
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Erik Corry <erikcorry@google.com>
2017-10-05 23:32:13 +00:00
William Hesse 6043dbb6d8 Revert "[VM] Introduce new way to define instruction backends."
This reverts commit 04aa2b0186.

Reason for revert: Compilation is failing on some Windows builders.  It may be the version of MSVC running on those machines that makes the difference.  But I think we need to revert until we figure it out.  The error is "runtime\vm\compiler\backend\locations_helpers_test.cc(111): error C2466: cannot allocate an array of constant size 0"

Original change's description:
> [VM] Introduce new way to define instruction backends.
> 
> Rewrite most SIMD instructions on ARM using this new way.
> 
> Our current way for defining instruction backends -- a pair of two virtual
> methods called MakeLocationSummary and EmitNativeCode, leads to unnecessary
> duplicated and verbose code. Code generation happens in three steps:
> 
> 1. For each instruction in the graph MakeLocationSummary is called to
> constructing a location summary object encoding register allocation constraints;
> 2. When all register constraints are collected a register allocation is performed
> and results are filled back into the location summaries;
> 3. For each instruction in the graph EmitNativeCode is called. It unpacks
> location summary attached to the instruction into actual machine registers and
> emits native code.
> 
> There is usually a lot of duplication between declaring register constraints in
> MLS and unpacking them in ENC which this CL is trying to remove.
> 
> The new way is centered on the concept of an *emitter function* which encodes
> in its signature register constraints for a particular instruction.
> 
> We use a combination of templates and macroses to enable writing
> 
>     DEFINE_BACKEND(BinaryFloat32x4Op,
>                    (QRegister result, QRegister left, QRegister right)) {
>       // ...
>     }
> 
> Instead of
> 
>     LocationSummary* BinaryFloat32x4OpInstr::MakeLocationSummary(Zone* zone,
>                                                                  bool opt) const {
>       const intptr_t kNumInputs = 2;
>       const intptr_t kNumTemps = 0;
>       LocationSummary* summary = new (zone)
>           LocationSummary(zone, kNumInputs, kNumTemps, LocationSummary::kNoCall);
>       summary->set_in(0, Location::RequiresFpuRegister());
>       summary->set_in(1, Location::RequiresFpuRegister());
>       summary->set_out(0, Location::RequiresFpuRegister());
>       return summary;
>     }
> 
>     void BinaryFloat32x4OpInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
>       const QRegister left = locs()->in(0).fpu_reg();
>       const QRegister right = locs()->in(1).fpu_reg();
>       const QRegister result = locs()->out(0).fpu_reg();
>       // ...
>     }
> 
> This change also introduces a new, more handy way to work with S/D components of QRegisters, QRegister_ wrapper type.
> 
> Bug: https://github.com/dart-lang/sdk/issues/30949
> Change-Id: I7f2beb106d1458facf4a3d75cae123e1fc25d8b5
> Reviewed-on: https://dart-review.googlesource.com/11507
> Reviewed-by: Zach Anderson <zra@google.com>
> Reviewed-by: Alexander Markov <alexmarkov@google.com>
> Commit-Queue: Vyacheslav Egorov <vegorov@google.com>

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

Change-Id: Icfaabe58351a61d4eb50c4f9ac3bbd9677339fe7
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: https://github.com/dart-lang/sdk/issues/30949
Reviewed-on: https://dart-review.googlesource.com/11780
Reviewed-by: William Hesse <whesse@google.com>
2017-10-05 22:55:58 +00:00
Vyacheslav Egorov 04aa2b0186 [VM] Introduce new way to define instruction backends.
Rewrite most SIMD instructions on ARM using this new way.

Our current way for defining instruction backends -- a pair of two virtual
methods called MakeLocationSummary and EmitNativeCode, leads to unnecessary
duplicated and verbose code. Code generation happens in three steps:

1. For each instruction in the graph MakeLocationSummary is called to
constructing a location summary object encoding register allocation constraints;
2. When all register constraints are collected a register allocation is performed
and results are filled back into the location summaries;
3. For each instruction in the graph EmitNativeCode is called. It unpacks
location summary attached to the instruction into actual machine registers and
emits native code.

There is usually a lot of duplication between declaring register constraints in
MLS and unpacking them in ENC which this CL is trying to remove.

The new way is centered on the concept of an *emitter function* which encodes
in its signature register constraints for a particular instruction.

We use a combination of templates and macroses to enable writing

    DEFINE_BACKEND(BinaryFloat32x4Op,
                   (QRegister result, QRegister left, QRegister right)) {
      // ...
    }

Instead of

    LocationSummary* BinaryFloat32x4OpInstr::MakeLocationSummary(Zone* zone,
                                                                 bool opt) const {
      const intptr_t kNumInputs = 2;
      const intptr_t kNumTemps = 0;
      LocationSummary* summary = new (zone)
          LocationSummary(zone, kNumInputs, kNumTemps, LocationSummary::kNoCall);
      summary->set_in(0, Location::RequiresFpuRegister());
      summary->set_in(1, Location::RequiresFpuRegister());
      summary->set_out(0, Location::RequiresFpuRegister());
      return summary;
    }

    void BinaryFloat32x4OpInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
      const QRegister left = locs()->in(0).fpu_reg();
      const QRegister right = locs()->in(1).fpu_reg();
      const QRegister result = locs()->out(0).fpu_reg();
      // ...
    }

This change also introduces a new, more handy way to work with S/D components of QRegisters, QRegister_ wrapper type.

Bug: https://github.com/dart-lang/sdk/issues/30949
Change-Id: I7f2beb106d1458facf4a3d75cae123e1fc25d8b5
Reviewed-on: https://dart-review.googlesource.com/11507
Reviewed-by: Zach Anderson <zra@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Vyacheslav Egorov <vegorov@google.com>
2017-10-05 22:31:43 +00:00
Zachary Anderson c9f72348fd [dart:io] Extra error checking in File_Close
related #30990

Change-Id: I5201bf62ed57309dc0c501abb3c5a3dbd6a67963
Reviewed-on: https://dart-review.googlesource.com/11562
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2017-10-05 19:36:11 +00:00
Zachary Anderson 9fce277b7e [android] Override __cxa_demangle() in PRODUCT mode
Saves at least 90KB of binary size.

Change-Id: I9f40cc9fbd3a80421ed5f4b751e47f593cb8d1d5
Reviewed-on: https://dart-review.googlesource.com/11344
Reviewed-by: Siva Annamalai <asiva@google.com>
2017-10-05 16:56:16 +00:00
Alexander Aprelev d822bdb797 Prefix scripts from core builtin libraries so the URIs are unique.
After https://dart-review.googlesource.com/c/sdk/+/7588 we ended up with two crypto.dart files in the core prebuilt libraries(io and _http), which caused problem with coverage tool that relied on the fact that script uris can uniquely identify files. https://github.com/dart-lang/coverage/issues/194 was filed to handle non-unique uris.
This CL ensures that core builtin libraries URIs stays unique by prefixing them with 'dart:' library prefix. This makes core builtin libraries scripts have names similarly structured to script names for other core libraries.

Bug:
Change-Id: I79960f4f24e6e958836df866365355584c28df27
Reviewed-on: https://dart-review.googlesource.com/11140
Commit-Queue: Alexander Aprelev <aam@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2017-10-05 15:47:43 +00:00
Peter von der Ahé e8aef37eac Clean up patches so they can be compiled by Fasta.
Change-Id: Ie436375c78496366accf0ba82938e54cbe30b143
Reviewed-on: https://dart-review.googlesource.com/3001
Commit-Queue: Peter von der Ahé <ahe@google.com>
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2017-10-05 14:05:50 +00:00
Jens Johansen 89644d89d2 [kernel] Add check to constant evaluator; pass script on error more often.
Change-Id: I655121953c7be2e6c3173a3c186339d31a9be7bc
Reviewed-on: https://dart-review.googlesource.com/11500
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2017-10-05 13:47:20 +00:00
Samir Jindel 3b347f94bc [kernel] Don't erase captured type parameters.
- We no longer erase type parameters of generic non-closures in the body of closures.
- We implement support for captured type parameters in the VM.

Bug:
Change-Id: I4f2f19301df1b44108ab2073332934d5d083e219
Reviewed-on: https://dart-review.googlesource.com/10942
Reviewed-by: Régis Crelier <regis@google.com>
Reviewed-by: Kevin Millikin <kmillikin@google.com>
2017-10-05 12:45:36 +00:00
Jens Johansen 21f7da094b [kernel] When building type arguments interpret malformed type as dynamic
Bug:
Change-Id: I996bb912262414bc37fa25b4a335a993d0dce7f0
Reviewed-on: https://dart-review.googlesource.com/10041
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2017-10-05 12:26:20 +00:00
Jens Johansen 5fff3689d6 [kernel] Report error instead of crashing in constant evaluator.
Change-Id: I2c116cdc6add54194d0641631b3603313603c89e
Reviewed-on: https://dart-review.googlesource.com/11442
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2017-10-05 12:13:03 +00:00
Jens Johansen 54f44f2a18 [kernel] Assert not optimizing when running constant evaluator.
Previously we could hit an assert when for instance "42 ~/ 0"
was being optimized by the background compiler. The reason was
that we assert that we're on the "mutator thread" when allocating
memory (which is done as we're evaluating the code - and we're
trying to evaluate it again because evaluating it gives an error,
and errors aren't cached).

However, to create a test for this it would be better if we could
make it always crash, i.e. use something like
```
--optimization_counter_threshold=5 --no-background-compilation
```
to force an optimization, but still make it crash dispite the
optimization happening in mutator thread (because of
--no-background-compilation).

This CL propagates if we're optimizing to the kernel builder,
and in the constant builder further more asserts that we're not.

Additionally it introduces a test that shows the crash and fixes it.

Change-Id: Ic5412ec8b8a1dbc2ba323f0a02a51103a32fab5c
Reviewed-on: https://dart-review.googlesource.com/11380
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2017-10-05 11:48:10 +00:00
Siva Annamalai e1f107973d Delete code related to FLAG_i_like_slow_isolate_spawn which was only used in dartium.
Change-Id: I7dd9d8d825253146c9b1c04216cc63fbf7aa9ba7
Reviewed-on: https://dart-review.googlesource.com/11251
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2017-10-05 00:56:43 +00:00
Siva Annamalai fa57f54572 Remove option --assert_initializer as it is the default now is a fully
supported feature in Dart language specifications.

Bug: 30976
Change-Id: I56bc36d6fbb4eff2fcbf215669843c524f1d3927
Reviewed-on: https://dart-review.googlesource.com/11240
Reviewed-by: Régis Crelier <regis@google.com>
2017-10-04 20:49:45 +00:00
Siva Annamalai af550c9b6c Revert "Revert "1. Remove unused dart debugger API entrypoints which are not used anymore""
This reverts commit e76ea5b604.

1. Remove unused dart debugger API entrypoints which are not used anymore
   as this API has been deprecated and dartium was the last user.

2. Some unit tests are using some of these API entrypoints, so moved them
   over to a test file which will be linked into run_vm_tests

Change-Id: I5a486b98e4b97eb4df2e58d9cc0ba603e96c2e32
Reviewed-on: https://dart-review.googlesource.com/11180
Reviewed-by: Siva Annamalai <asiva@google.com>
2017-10-04 20:19:22 +00:00
Vyacheslav Egorov 579b06ed4c [VM] Improve code patterns for various SIMD instructions on ia32/x64.
There are three types of changes in this CL:

* If there is a repeated per-component sequence of instruction, it is
replaced with a loop (e.g. see Float32x4ConstructorInstr);
* When accessing components in the spilled SIMD values don't use 
hardcoded constants but instead compute the offset from op_kind() 
(e.g. kFloat32x4WithZ accesses component with index kFloat32x4WithZ - kFloat32x4WithX = 2).
This allows to share code.
* Use setcc and arithmetic to materialize result of the comparison instead of branches;
* Use the fact that true and false are consecutive values in the Thread structure to convert
0/1 to true/false (see Int32x4GetFlagInstr)
* Extract Int32x4 components without spilling the whole SIMD value to the 
stack (see Int32x4GetFlagInstr).

This extracted from a larger refactoring CL: https://dart-review.googlesource.com/c/sdk/+/10120

Bug: https://github.com/dart-lang/sdk/issues/30949
Change-Id: Ic3757789a1ca621b267150133991fed5b85da633
Reviewed-on: https://dart-review.googlesource.com/11080
Commit-Queue: Vyacheslav Egorov <vegorov@google.com>
Reviewed-by: Zach Anderson <zra@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2017-10-04 20:03:41 +00:00
Dmitry Stefantsov e7a29d8dfb [kernel] Add annotations for type parameters and variable declarations
Bug: http://dartbug.com/30035
Change-Id: Id122c2d6596bfa3505418ac2f65369a16965bce5
Reviewed-on: https://dart-review.googlesource.com/10300
Commit-Queue: Dmitry Stefantsov <dmitryas@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
2017-10-04 10:29:23 +00:00
Jens Johansen 2e4ffe6808 Service test for breaking in mixed in function
This CL adds a test that tests if we can put a breakpoint in a mixin and
actually break on it even if the function has already been compiled.

Change-Id: I3cd180b48f9e01c98eebc778995a62974be288a4
Reviewed-on: https://dart-review.googlesource.com/10280
Reviewed-by: Siva Chandra <sivachandra@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
2017-10-04 06:18:32 +00:00
Régis Crelier 6cfac06ad2 [gardening] Fix recently added assembly test.
Change-Id: Ibe3b1ec0e8969159fb04dcd5eac67088e05d44e8
Reviewed-on: https://dart-review.googlesource.com/10821
Reviewed-by: Régis Crelier <regis@google.com>
2017-10-04 00:25:38 +00:00
Zachary Anderson 0951ab163b [dart:io] Don't use fexecve. It is weird.
fexecve overwrites argv[0] for cases in which the exec'd binary should
close the fd itself rather than the calling process. This makes it
inappropriate for use in the VM. Instead the VM should use
execveat, however it hasn't been added to the C Library everywhere,
yet.

fixes #30971

Change-Id: I82085f24ded2f0b846d9193ca55903686e1f3585
Reviewed-on: https://dart-review.googlesource.com/10205
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2017-10-03 20:15:03 +00:00
Régis Crelier 11e5848846 [Kernel to flowgraph] Handle TODOs related to generic functions.
Change-Id: Ia6ad450d9f4a9ddc1940d42b844d97414e31d8b0
Reviewed-on: https://dart-review.googlesource.com/10206
Commit-Queue: Régis Crelier <regis@google.com>
Reviewed-by: Samir Jindel <sjindel@google.com>
2017-10-03 16:48:39 +00:00
Lasse Reichstein Holst Nielsen 422bc2ebcc Make X64 assembler setcc operation accept more byte registers.
Bug: http://dartbug.com/30952
Change-Id: If33b439e056b777f723e4be20f892aa2ca64c1ee
Reviewed-on: https://dart-review.googlesource.com/10380
Commit-Queue: Lasse R.H. Nielsen <lrn@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2017-10-03 16:05:39 +00:00
Samir Jindel 6aa6f43815 [kernel] Pass type arguments to method calls.
Bug:
Change-Id: Ic9a29d7c0fc361a3ce9bff6a6ba648fc5a54c86c
Reviewed-on: https://dart-review.googlesource.com/10140
Reviewed-by: Régis Crelier <regis@google.com>
Commit-Queue: Samir Jindel <sjindel@google.com>
2017-10-03 15:20:30 +00:00
Samir Jindel 04c741c4cc [kernel] Pass type arguments to static function calls.
Bug:
Change-Id: If15d952feb782e2848faab36f42d03d818eb669c
Reviewed-on: https://dart-review.googlesource.com/10001
Commit-Queue: Samir Jindel <sjindel@google.com>
Reviewed-by: Régis Crelier <regis@google.com>
2017-10-03 15:19:03 +00:00
Siva Annamalai 1e15e6f2d7 Fix for flutter issue 11260 (flutter/flutter#11260)
Do not rely on the udp_receive_buffer field from IsolateData as a buffer for
reading data in the recvfrom call.

Bug:
Change-Id: I43d19f624fd2a406429cc5387bd536524472b4f7
Reviewed-on: https://dart-review.googlesource.com/10212
Reviewed-by: Zach Anderson <zra@google.com>
2017-10-03 15:09:31 +00:00
Doug Evans 2695ed7489 [fuchsia runtime] Use zircon/system/ulib/trace
Change-Id: Ia05fea6ad80e95f90205ede398bcd9203fb8a451
Reviewed-on: https://dart-review.googlesource.com/10203
Reviewed-by: Zach Anderson <zra@google.com>
2017-10-03 14:53:32 +00:00
Samir Jindel 195c62ff0c [kernel] Begin reducing type erasure.
1. We no longer remove type parameters on functions.
2. We no longer remove type arguments at call sites.
3. We allow non-captured function type parameters to be used outside closures. 

Bug:
Change-Id: I116ec54c90b04be90e1157042c22797e57a7c51c
Reviewed-on: https://dart-review.googlesource.com/9342
Commit-Queue: Samir Jindel <sjindel@google.com>
Reviewed-by: Peter von der Ahé <ahe@google.com>
2017-10-03 14:33:30 +00:00
Jens Johansen 2e75b6cce9 [kernel] Fix closure in for loop
In kernel the loop level wasn't set correctly for for loops, resulting
in the loop variable not always being fresh.

Examples:

```
  // Capture the loop variable, ensure we capture the right value.
  for (int i = 0; i < 10; i++) { if (i == 7) f = () => "i = $i"; }

  print(f());
  // There is only one instance of k. The captured variable continues to change.
  int k;
  for (k = 0; k < 10; k++) { if (k == 7) f = () => "k = $k"; }
  print(f());
```

resulted in
i = 10
k = 10

(i.e. it's wrong)

whereas

```
  // Capture the loop variable, ensure we capture the right value.
  for (int i = 0; i < 10; i++) { if (i == 7) { f = () => "i = $i"; } }
  print(f());
  {
    // There is only one instance of k. The captured variable continues to change.
    int k;
    for (k = 0; k < 10; k++) { if (k == 7) { f = () => "k = $k"; } }
    print(f());
  }
```

resultet in

i = 7
k = 10

(i.e. it's correct).

Now both examples produce the correct result.

Change-Id: I1fb4c888c6a0eaa690f62226e093508992b33ed4
Reviewed-on: https://dart-review.googlesource.com/9961
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2017-10-03 07:56:13 +00:00
Jens Johansen 471d92dfe4 [kernel] Get class type arguments correctly
Previously we got the length of the class' type_parameters().
Now instead we use the class' NumTypeArguments().

Bug:
Change-Id: I3807443765e4926efc17eba54d3bf4f50e8e30c6
Reviewed-on: https://dart-review.googlesource.com/9482
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
2017-10-03 07:26:28 +00:00
George Kulakowski daa92a9401 [fuchsia] Remove some unneeded reinterpret_casts around port syscalls
Shortly, the zx_port_queue and zx_port_wait system calls will take
pointers to zx_port_packet_t instead of void. They currently take void
as the last vestiges of the ports v1 and v2 compatibility story.

All callers are passing actual pointers to zx_port_packet_t, so there
is no real code change.

Change-Id: I8f61791846c7693d70edc8c37c1973e8637949bb
Reviewed-on: https://dart-review.googlesource.com/9796
Reviewed-by: Zach Anderson <zra@google.com>
2017-10-02 18:02:14 +00:00