Commit graph

12001 commits

Author SHA1 Message Date
Alexander Aprelev
8cd713bed3 Introduce dart_host_toolchain argument for generate_patch_sdk.gni. This allows for Flutter build to make sure that host_toolchain used for patched_sdk generation word size matches target platform.
Flutter Dart in product configuration doesn't allow --checked option. So remove '--checked' from invocation.

R=rmacnak@google.com

BUG:https://github.com/flutter/flutter/issues/10841
Review-Url: https://codereview.chromium.org/2944103003 .
2017-06-22 12:41:31 -07:00
Siva Chandra
8b40507be3 Reland "Load service isolate from a .dill file."
This reverts commit e90aa9cb5f.

Because of 2883d7f416, it is expected that
this change will do better on the bots.

R=asiva@google.com

Review-Url: https://codereview.chromium.org/2952913002 .
2017-06-22 10:10:45 -07:00
Devon Carew
ae80af3abb Add a missing comma.
BUG=
R=rmacnak@google.com

Review-Url: https://codereview.chromium.org/2949243002 .
2017-06-22 09:58:52 -07:00
Ryan Macnak
bcb4fcfa11 [vm-service] Encode ticks directly as integers, since they are expect to stay in JS integer range.
Fixes #29957

R=cbernaschina@google.com

Review-Url: https://codereview.chromium.org/2951803004 .
2017-06-22 09:50:36 -07:00
Ryan Macnak
1daac1c651 [vm-service] Use consistent success response for _requestHeapSnapshot.
Fixes #29956

R=cbernaschina@google.com

Review-Url: https://codereview.chromium.org/2951903002 .
2017-06-22 09:47:07 -07:00
Zachary Anderson
ac16656161 Remove MIPS support
R=asiva@google.com

Review-Url: https://codereview.chromium.org/2858623002 .
2017-06-22 08:49:22 -07:00
Erik Corry
8378b8fdbf VM: Reland Inline instance object hash code into object header on 64bit.
Inline instance object hash code into object header on 64 bit.

64 bit objects have 32 bits of free space in the header word.
This is used for the hash code in string objects. We take it
for the default hash code on all objects that don't override
the hashCode getter.

This is both faster and a memory reduction. Eg it makes the
MegaHashCode part of the Megamorphic benchmark 6 times faster.

This is a reland of https://codereview.chromium.org/2912863006/
It fixes issues with the 32 bit compare-swap instruction on
ARM64 and fixes a fragile tree shaking test that is sensitive
to which private methods are in the core libraries.

R=kustermann@google.com, vegorov@google.com
BUG=

Review-Url: https://codereview.chromium.org/2954453002 .
2017-06-22 14:56:24 +02:00
Aske Simon Christensen
cec963f028 The current growth strategy for growable arrays allocates a backing array of size 2 at (empty) creation and doubles the size whenever the capacity is insufficient while adding elements.
I collected statistics for the sizes and capacities of growable arrays which are promoted to old-space or survive an old-space gc when running dart2js and Fasta. For these applications, the vast majority of arrays stay empty. More than half of the total object size of promoted backing arrays is backing for empty growable arrays.

Furthermore, since the overhead for an array is 3 words (header, type parameters and length), and object sizes are rounded up to an even number of words, we waste one word for all even-sized arrays.

This CL changes the growth strategy so that empty growable arrays are created with a shared, zero-sized array as backing, avoiding the allocation of a backing array if no elements are added. When the array needs to grow, it starts out at 3 and grows to double size plus one each time: 7, 15, 31, ...

A few places in the VM code need to handle these shared, zero-sized arrays specially. In particular, the Array::MakeArray function needs to allocate a new, empty array if its result is to be returned to Dart code.

Benchmarks suggest that the change improves memory usage by a few percent overall and does not significantly affect run time.

BUG=
R=erikcorry@google.com

Review-Url: https://codereview.chromium.org/2949803002 .
2017-06-22 10:51:54 +02:00
Erik Corry
847cd093ba Revert "Inline instance object hash code into object header on 64 bit."
This reverts commit ac6310d5f3 because
of test failures on real ARM64 hardware as opposed to the DartVM
simulator.  Original review: https://codereview.chromium.org/2912863006/

R=kustermann@google.com
BUG=

Review-Url: https://codereview.chromium.org/2953753002 .
2017-06-22 10:22:48 +02:00
Erik Corry
ac6310d5f3 Inline instance object hash code into object header on 64 bit.
64 bit objects have 32 bits of free space in the header word.
This is used for the hash code in string objects. We take it
for the default hash code on all objects that don't override
the hashCode getter.

This is both faster and a memory reduction.  Eg it shaves about
70% off the running time of this microbenchmark:

List list = [];

class Thing {
  get hashCode => 42;
}

class Thing2 {
  get hashCode => 42;
}

class Thing3 { }
class Thing4 { }

main() {
  int sum = 103;
  for (int i = 0; i < 10000000; i++) {
    list = [];
    list.add("foo");
    list.add(123);
    list.add(1.23);
    list.add(new Object());
    list.add(new Thing());
    list.add(new Thing2());
    list.add(new Thing3());
    list.add(new Thing4());
    for (int j = 0; j < 2; j++) {
      sum ^= biz(list);
    }
  }
  print(sum);
}

int biz(List list) {
  int sum = 103;
  for (var x in list) {
    sum ^= x.hashCode;
  }
  return sum;
}

R=rmacnak@google.com, vegorov@google.com
BUG=

Review-Url: https://codereview.chromium.org/2912863006 .
2017-06-22 09:25:52 +02:00
Siva Chandra
2883d7f416 Remove API_TIMELINE_DURATION from Dart_ReadKernelBinary.
This allows Dart_ReadKernelBinary to be called before Dart_Initialize.

R=rmacnak@google.com

Review-Url: https://codereview.chromium.org/2951213002 .
2017-06-21 16:15:50 -07:00
Ryan Macnak
1eee6d8af3 Mostly revert "[fuchsia] Prepare for setting the Dart target architecture appropriately in the host binaries."
This reverts commit 9ab39ae099.

Keep removal of bad assert in loader.dart.  Keep using script snapshot in cross builds.

We expect to use a checked-in SDK in the Fuschia build instead.

R=zra@google.com

Review-Url: https://codereview.chromium.org/2951133002 .
2017-06-21 15:19:21 -07:00
Régis Crelier
eabcc23b33 Fix type argument finalization of some recursive generic types (fixes #29949).
Add regression test.

R=asiva@google.com

Review-Url: https://codereview.chromium.org/2952743003 .
2017-06-21 14:54:12 -07:00
Ben Konyi
86fdbde70a Added timeout parameter to RawSocket and Socket connect, which allows for the specification of a maximum time to wait for a valid connection to be established.
fixes #19120

R=zra@google.com

Review-Url: https://codereview.chromium.org/2946333002 .
2017-06-21 14:31:52 -07:00
Ryan Macnak
e1b31c6b4b [arm, arm64] Convince the Android toolchain not to bypass memcpy in Read/StoreUnaligned.
R=zra@google.com

Review-Url: https://codereview.chromium.org/2953653002 .
2017-06-21 14:03:50 -07:00
Siva Chandra
e90aa9cb5f Revert "Load service isolate from a .dill file."
This reverts commit b0c2a382ca as the
vm-kernel mac bots are unhappy.

R=zra@google.com

Review-Url: https://codereview.chromium.org/2947243002 .
2017-06-21 13:46:17 -07:00
Régis Crelier
1f5f3ed79f Set and keep parent function of signature functions.
Fix function type parameter comparison in type tests.

R=rmacnak@google.com

Review-Url: https://codereview.chromium.org/2951803005 .
2017-06-21 13:16:23 -07:00
Siva Chandra
b0c2a382ca Load service isolate from a .dill file.
R=asiva@google.com

Review-Url: https://codereview.chromium.org/2925203002 .
2017-06-21 12:16:44 -07:00
Ryan Macnak
dddd96cfd2 [arm] Avoid unaligned access fault in Int32x4/Float32x4::value().
R=zra@google.com

Review-Url: https://codereview.chromium.org/2947783002 .
2017-06-21 09:11:04 -07:00
Ryan Macnak
095ff155fd VM: Allow trailing comma in assert statements.
Issue #29959

R=regis@google.com

Review-Url: https://codereview.chromium.org/2946173002 .
2017-06-21 09:08:16 -07:00
Régis Crelier
a62107cfaf Check for a passed-in type argument vector in the prolog of generic functions.
Do this in unoptimized code only, when --reify-generic-functions is specified.
This is still work in progress, and support in optimizer, in inliner, in DBC,
in kernel to ir, and other areas, will follow.
Many small fixes and added todos.

R=rmacnak@google.com, vegorov@google.com

Review-Url: https://codereview.chromium.org/2941643002 .
2017-06-21 09:02:16 -07:00
Jens Johansen
80860e7fb7 [kernel] Stream kernel_reader
Mostly stream kernel_reader, i.e. the code that sets up the libraries,
classes, methods etc.

Mostly because it still takes a "Program" ast node, and looks at the
"Library" ast nodes to get their kernel offset in the binary.
Currently the scripts (containing breakable points etc) are also created
from the ast nodes.

The rest is now streamed.
This also means that more ast visitors could be deleted.

R=kmillikin@google.com

Review-Url: https://codereview.chromium.org/2931813002 .
2017-06-21 14:58:58 +02:00
Dmitry Stefantsov
8d583bde5b Revert "VM(RegExp): Allow OSR optimization of RegExp :matcher functions."
This reverts commit d87cc52c3e.

TBR=vegorov@google.com

Review-Url: https://codereview.chromium.org/2947143002 .
2017-06-21 14:17:21 +02:00
Vyacheslav Egorov
d87cc52c3e VM(RegExp): Allow OSR optimization of RegExp :matcher functions.
Previously these functions would only contain a single CheckStackOverflowInstr
in a backtracking block and that CheckStackOverflowInstr would have a zero
loop_depth - which means it would not be considered eligable for OSR.

This change:

* adds CheckStackOverflowInstr with non-zero loop_depth in two other places
  (Boyer-Moore lookahead skip loop and greedy loop) where loops arise in the
  generated IL;
* sets non-zero loop depth on the CheckStackOverflowInstr in the backtracking
  block;
* adds a flag on CheckStackOverflowInstr that allows optimizing compiler to
  optimize away those checks that were inserted solely to serve as OSR entries.

We allow the optimizing compiler to remove preemption checks from
non-backtracking loops in the regexp code because those loops
unlike backtracking have guaranteed O(input_length) time
complexity.

Performance Implications
------------------------

This change improves performance of regexps in cases where regexp spends a lot
of time in the first invocation (either due to backtracking or due to long non
matching prefix) by allowing VM to optimize the :matcher while :matcher is
running.

For example on regex-redux[1] benchmark it improves Dart performance by 3x
(from ~18s to ~6s on my Mac Book Pro).

[1] https://benchmarksgame.alioth.debian.org/u64q/program.php?test=regexredux&lang=dart&id=2

BUG=
R=erikcorry@google.com

Review-Url: https://codereview.chromium.org/2950783003 .
2017-06-21 13:46:48 +02:00
Jens Johansen
202306f39b [kernel] Fix loading of type argument in catch.
Catch simply gave NullConstant as arguments to _instanceOf,
now I've copied what the IsExpression does, and made
LoadInstantiatorTypeArguments actually work in this case
(by filling out the scopes_->this_variable value,
by actually visiting the catch guard in the scope builder
rather than skipping it).

Fixes #29553.

BUG=
R=kmillikin@google.com

Review-Url: https://codereview.chromium.org/2938173002 .
2017-06-21 10:56:21 +02:00
Jens Johansen
ccf5c13127 [kernel] Update vm.status file for mac
4b9f8eb460 didn't update the status file properly.

BUG=

Review-Url: https://codereview.chromium.org/2945253002 .
2017-06-21 10:34:30 +02:00
Jens Johansen
29036d398b [kernel] Fix loss of supertype arguments.
Before this, if a generic class was instantiated with only dynamic,
TypeArgument::null would be used as the type argument, ignoring
types from the super.
Now it only returns TypeArguments::null if the class directly gives all
type arguments (and they are all dynamic).

Fixes #29537

BUG=
R=kmillikin@google.com

Review-Url: https://codereview.chromium.org/2941983002 .
2017-06-21 10:22:40 +02:00
Jens Johansen
4b9f8eb460 [kernel] Add TokenPosition to AllocateObject, fix some cc tests
- Add TokenPosition to AllocateObject
  meaning that kernel more often has a TokenPosition available.
  This might influence profiling, especially it influences some
  of the vm/cc/Profiler* tests.

- Update profiler_service to also be able to find the current token
  via kernel (as opposed to either returning NULL or crashing).
  This makes use of the source code included in the kernel file.

BUG=
R=kmillikin@google.com, vegorov@google.com

Review-Url: https://codereview.chromium.org/2944433003 .
2017-06-21 09:41:16 +02:00
Jens Johansen
be9a3043aa [kernel] Make fasta call a new constructor on FallThroughError
On a switch fall through error, Fasta currently generates
```
throw new core::FallThroughError::•();
```

which generates the error-message via the VM:
```
'null': Switch case fall-through at line null.
```

This introduces a new constructor taking a url and a linenumber,
which then can give a better error message.

BUG=
R=ahe@google.com

Review-Url: https://codereview.chromium.org/2951453002 .
2017-06-21 08:40:59 +02:00
Terry Lucas
092cbd561d Support for IPV6 for observatory in Dartium.
R=rmacnak@google.com
BUG=62811100

Review-Url: https://codereview.chromium.org/2944303003 .
2017-06-20 19:32:01 -07:00
Ryan Macnak
1905d2bbe2 Consider Contexts to be user objects for purposes of Obervatory's dominator analysis.
User data in may be reachable only through a closure's environment, represented as a Context object. Note we still don't consider Functions to be user objects here, and so avoid blaming the size of compiled code against any user object.

R=cbernaschina@google.com

Review-Url: https://codereview.chromium.org/2947673002 .
2017-06-20 16:59:29 -07:00
Alan Knight
12e93cc41e Revert "Updated parser to produce error when trying to reinitialize final variables in class constructors. Fixes issue #29658."
This reverts commit 9755a98b00.

BUG=

Review-Url: https://codereview.chromium.org/2949943002 .
2017-06-20 15:25:55 -07:00
Ryan Macnak
dd996fc4be [fuchsia] Make symbols in the Dart VM visible, so they are available to the profiler.
R=zra@google.com

Review-Url: https://codereview.chromium.org/2946123002 .
2017-06-20 15:21:07 -07:00
Ben Konyi
9755a98b00 Updated parser to produce error when trying to reinitialize final variables in class constructors. Fixes issue #29658.
BUG=
R=zra@google.com

Example:
Foo {
  final int x = 10;
  Foo(this.x); // Error
  Foo.named() : x = 42; // Error
}
Review-Url: https://codereview.chromium.org/2947043002 .
2017-06-20 14:40:36 -07:00
Siva Chandra
b9bf4fcc48 Remove vmservice_patch.dart.
The code in the patch is now inlined into the vmservice library.
This is being done because, the vmservice related libraries are
now compiled directly from source instead of from the "patched_sdk".
So, what is being compiled now does not have the vmservice_patch
applied. By removing the patch, we are removing the need to
artificially patch the vmservice library and making the
vmservice_io.dill complete.

R=rmacnak@google.com

Review-Url: https://codereview.chromium.org/2946773002 .
2017-06-20 12:24:16 -07:00
Erik Corry
dfb67ecbf8 VM-codegen: Clean up the way we emit code for comparison instructions.
Removes some redundancy in the Emit* methods in intermediate_language_*.cc for
the 6 architectures we support.

This is a reapplication of https://codereview.chromium.org/2937933002/ -
see the comments there.  It fixes a bug in the way the TestCids
instruction was emitted on DBC.

R=vegorov@google.com
BUG=

Review-Url: https://codereview.chromium.org/2947633002 .
2017-06-20 17:41:12 +02:00
Kevin Millikin
9d495064f7 Improve --print-ast printing of LetNode.
I was trying to debug an issue noticed that printing of LetNode is
kind of useless.  It didn't print the variables though they had
references, which seems confusing, and it writes all the initializers
and body nodes at the same nesting level which makes it impossible to
see where one ends and the other begins.

BUG=
R=vegorov@google.com

Review-Url: https://codereview.chromium.org/2946903002 .
2017-06-20 16:49:10 +02:00
Jens Johansen
5472eb7831 [kernel] Don't emit field initializers in a redirecting constructor
BUG=
R=vegorov@google.com

Review-Url: https://codereview.chromium.org/2940323002 .
2017-06-20 13:54:25 +02:00
Jens Johansen
c649557584 [kernel] Check type for list literals
BUG=
R=kmillikin@google.com

Review-Url: https://codereview.chromium.org/2949493002 .
2017-06-20 13:04:08 +02:00
Jens Johansen
0462a5a991 [kernel] Cleanup kernel code.
This deletes some visitors and the can_stream field in the Ast.
This should be seen as a cleanup for now-unused code now that we're streaming.

BUG=
R=kmillikin@google.com

Review-Url: https://codereview.chromium.org/2931803002 .
2017-06-20 09:49:57 +02:00
Jens Johansen
2a7a410c93 [kernel] Streaming refactorings.
Refactorings.
Mostly about only reading FunctionNode one place by introducing a
helper class that will read and skip what it is told.
For 'nested' things inside the function node (e.g. the body),
the caller for the helper still needs to handle it if it shouldn't
just be skipped.
'Non-nested' things (e.g. integers) are saved and can be fetched
by the caller.

R=kmillikin@google.com

Review-Url: https://codereview.chromium.org/2921613003 .
2017-06-20 09:22:52 +02:00
Ben Konyi
a4a227e375 Revert "Updated parser to produce error when trying to reinitialize final variables in class constructors. Fixes issue #29658."
This reverts commit b5cff3f68f.

TBR=zra@google.com

Review-Url: https://codereview.chromium.org/2944223002 .
2017-06-19 17:23:01 -07:00
Ben Konyi
b5cff3f68f Updated parser to produce error when trying to reinitialize final variables in class constructors. Fixes issue #29658.
BUG=
R=asiva@google.com

Example:
Foo {
  final int x = 10;
  Foo(this.x); // Error
  Foo.named() : x = 42; // Error
}
Review-Url: https://codereview.chromium.org/2939553005 .
2017-06-19 12:07:37 -07:00
Ryan Macnak
72e1775fd1 [arm, arm64] Implemented unaligned scalar float access.
[arm64] Fix unaligned (u)int64 stores.

Fix unaligned access test to use host endianness.

Issue #22151

R=zra@google.com

Review-Url: https://codereview.chromium.org/2940883008 .
2017-06-19 10:28:38 -07:00
Kevin Millikin
8340cfda55 Revert "Proper sequencing of _asyncStackTraceHelper in Kernel"
This reverts commit 0489249d29.  The
change causes failures in the front end tests.

BUG=
R=sivachandra@google.com

Review-Url: https://codereview.chromium.org/2949533003 .
2017-06-19 17:21:22 +02:00
Kevin Millikin
0489249d29 Proper sequencing of _asyncStackTraceHelper in Kernel
This helper function was being called before its argument was
initialized so it was passing null.  Instead, it should be called
after its argument is initialized.

Because the initialization happens in Kernel code, it is simplest to
insert the call explicitly in Kernel code as well as part of the async
transformation.  This has the consequence that we now call the helper
function even when the flag causal_async_stacks is false.

Fixes #29771.

BUG=
R=aam@google.com, asiva@google.com

Review-Url: https://codereview.chromium.org/2936793003 .
2017-06-19 16:52:58 +02:00
Erik Corry
1f7d2d5439 Revert "Reduce copying, redundancy & repetition for codegen of comparison instructions"
R=kustermann@google.com
BUG=

This reverts commit e25dfc07d1.
Reason: Failure on SIMDBC64
Review-Url: https://codereview.chromium.org/2949513002 .
2017-06-19 10:28:47 +02:00
Erik Corry
e25dfc07d1 Reduce copying, redundancy & repetition for codegen of comparison instructions
R=vegorov@google.com
BUG=

Review-Url: https://codereview.chromium.org/2937933002 .
2017-06-19 09:45:03 +02:00
Carlo Bernaschina
504125071e Fixed interface documentation
BUG=
R=rmacnak@google.com

Review-Url: https://codereview.chromium.org/2941313002 .
2017-06-16 16:27:35 -07:00
Siva Chandra
bac83e0973 Replace the --platform vm_option with --kernel-binaries option.
This new flag value specifies the directory in which the VM should look
up the platform.dill file. A future change will require the VM to load
another kernel binary from disk. This binary will also live in the same
directory that --kernel-binaries specifies. This way, we avoid adding a
different flag for each of the different binaries.

R=asiva@google.com

Review-Url: https://codereview.chromium.org/2933203004 .
2017-06-16 12:22:31 -07:00