Commit graph

78 commits

Author SHA1 Message Date
Liam Appelbe 5b72293f49 Reland "[vm] Create offsets_extractor tool."
This reverts commit 224f82c21c.

Reason for revert: Just need to split DBC section into 32 and 64 bit

Original change's description:
> Revert "[vm] Create offsets_extractor tool."
>
> This reverts commit 3015d79371.
>
> Reason for revert: Fails the Flutter build
> /b/s/w/ir/cache/builder/mac_sdk -mmacosx-version-min=10.12 -m32  -fno-strict-aliasing -fstack-protector-all -fcolor-diagnostics -Wall -Wextra -Wendif-labels -Werror -Wno-missing-field-initializers -Wno-unused-parameter -Wunguarded-availability -fvisibility=hidden -stdlib=libc++ -Wheader-hygiene -Wstring-conversion -Wthread-safety -O2 -fno-ident -fdata-sections -ffunction-sections -g2 -Werror -Wall -Wextra -Wno-unused-parameter -Wno-unused-private-field -Wnon-virtual-dtor -Wvla -Wno-conversion-null -Woverloaded-virtual -Wno-comments -g3 -ggdb3 -fno-rtti -fno-exceptions -Wimplicit-fallthrough -O3 -fvisibility-inlines-hidden -std=c++14 -fno-rtti -fno-exceptions  -c ../../third_party/dart/runtime/vm/dart.cc -o clang_x86/obj/third_party/dart/runtime/vm/libdart_vm_nosnapshot_with_precompiler.dart.o
> In file included from ../../third_party/dart/runtime/vm/dart.cc:9:
> ../../third_party/dart/runtime/vm/compiler/runtime_offsets_extracted.h:958:50: error: implicit conversion from 'long long' to 'const dart::word' (aka 'const long') changes value from 576460752303423487 to -1 [-Werror,-Wconstant-conversion]
> static constexpr dart::word Array_kMaxElements = 576460752303423487;
>                             ~~~~~~~~~~~~~~~~~~   ^~~~~~~~~~~~~~~~~~
> ../../third_party/dart/runtime/vm/compiler/runtime_offsets_extracted.h:965:51: error: implicit conversion from 'long long' to 'const dart::word' (aka 'const long') changes value from 2305843009213693951 to -1 [-Werror,-Wconstant-conversion]
> static constexpr dart::word String_kMaxElements = 2305843009213693951;
>                             ~~~~~~~~~~~~~~~~~~~   ^~~~~~~~~~~~~~~~~~~
> 2 errors generated.
>
> Change-Id: Iaf509c6ee7a2ce75664935519ac02a933a9eb2bf
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/104402
> Reviewed-by: Siva Annamalai <asiva@google.com>
> Commit-Queue: Siva Annamalai <asiva@google.com>
> Auto-Submit: Siva Annamalai <asiva@google.com>

TBR=asiva@google.com

Change-Id: Ibf749ceee274b03cdffa6d7ed46fcbe75d1a1e94
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/104620
Reviewed-by: Liam Appelbe <liama@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Liam Appelbe <liama@google.com>
2019-06-03 22:14:16 +00:00
asiva 224f82c21c Revert "[vm] Create offsets_extractor tool."
This reverts commit 3015d79371.

Reason for revert: Fails the Flutter build
/b/s/w/ir/cache/builder/mac_sdk -mmacosx-version-min=10.12 -m32  -fno-strict-aliasing -fstack-protector-all -fcolor-diagnostics -Wall -Wextra -Wendif-labels -Werror -Wno-missing-field-initializers -Wno-unused-parameter -Wunguarded-availability -fvisibility=hidden -stdlib=libc++ -Wheader-hygiene -Wstring-conversion -Wthread-safety -O2 -fno-ident -fdata-sections -ffunction-sections -g2 -Werror -Wall -Wextra -Wno-unused-parameter -Wno-unused-private-field -Wnon-virtual-dtor -Wvla -Wno-conversion-null -Woverloaded-virtual -Wno-comments -g3 -ggdb3 -fno-rtti -fno-exceptions -Wimplicit-fallthrough -O3 -fvisibility-inlines-hidden -std=c++14 -fno-rtti -fno-exceptions  -c ../../third_party/dart/runtime/vm/dart.cc -o clang_x86/obj/third_party/dart/runtime/vm/libdart_vm_nosnapshot_with_precompiler.dart.o
In file included from ../../third_party/dart/runtime/vm/dart.cc:9:
../../third_party/dart/runtime/vm/compiler/runtime_offsets_extracted.h:958:50: error: implicit conversion from 'long long' to 'const dart::word' (aka 'const long') changes value from 576460752303423487 to -1 [-Werror,-Wconstant-conversion]
static constexpr dart::word Array_kMaxElements = 576460752303423487;
                            ~~~~~~~~~~~~~~~~~~   ^~~~~~~~~~~~~~~~~~
../../third_party/dart/runtime/vm/compiler/runtime_offsets_extracted.h:965:51: error: implicit conversion from 'long long' to 'const dart::word' (aka 'const long') changes value from 2305843009213693951 to -1 [-Werror,-Wconstant-conversion]
static constexpr dart::word String_kMaxElements = 2305843009213693951;
                            ~~~~~~~~~~~~~~~~~~~   ^~~~~~~~~~~~~~~~~~~
2 errors generated.

Change-Id: Iaf509c6ee7a2ce75664935519ac02a933a9eb2bf
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/104402
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Siva Annamalai <asiva@google.com>
Auto-Submit: Siva Annamalai <asiva@google.com>
2019-06-01 00:51:58 +00:00
Liam Appelbe 3015d79371 [vm] Create offsets_extractor tool.
First sub-CL of https://dart-review.googlesource.com/c/sdk/+/100644

A big chunk of the original CL is to do with switching anything that tries
to get the offset of a field in a class to do so using constants generated
by offsets_extractor, rather than introspecting the C++ classes with macros.

This CL just checks in the offsets_extractor tool and its output, as well as
a few bits and pieces needed to make it run.

Bug: https://github.com/dart-lang/sdk/issues/36839
Change-Id: I0d2055c21e2d19260cd77abea7e0a1d880bea6d7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/103487
Commit-Queue: Liam Appelbe <liama@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2019-05-30 18:41:56 +00:00
Martin Kustermann aa9ce0f122 Revert "[vm] Repair the resolver abstraction, take 2."
This reverts commit d79787771e.

Reason for revert:

This caused significant performance regressions on our protobuf_decode* benchmarks (probably on more benchmarks, but we don't yet have results due to some perf infra issue).

To avoid letting the regressions land for downstream users we'll revert it.

We should measure performance impact before landing this again.

Original change's description:
> [vm] Repair the resolver abstraction, take 2.
> 
>  - Move resolution logic that accumulated in the runtime entries into Resolver.
>  - Improve NoSuchMethodError for closures when --no-lazy-dispatchers
>  - Fix concurrent modification of Null class by nullability propagation.
> 
> Change-Id: Ib05b431a289d847785032dda46e1bbcb524b7343
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/98428
> Commit-Queue: Ryan Macnak <rmacnak@google.com>
> Reviewed-by: Régis Crelier <regis@google.com>

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

Change-Id: I4f0f0a0d7c6018fc5968aafdce30f6d2e7495059
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/99140
Reviewed-by: Martin Kustermann <kustermann@google.com>
2019-04-11 09:57:25 +00:00
Ryan Macnak d79787771e [vm] Repair the resolver abstraction, take 2.
- Move resolution logic that accumulated in the runtime entries into Resolver.
 - Improve NoSuchMethodError for closures when --no-lazy-dispatchers
 - Fix concurrent modification of Null class by nullability propagation.

Change-Id: Ib05b431a289d847785032dda46e1bbcb524b7343
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/98428
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Régis Crelier <regis@google.com>
2019-04-10 21:57:43 +00:00
Ryan Macnak e979895efb Revert "[vm] Repair the resolver abstraction."
This reverts commit 3fd124db1f.

Reason for revert: Provokes existing bug in hot reload call site reset

Original change's description:
> [vm] Repair the resolver abstraction.
> 
>  - Move resolution logic that accumulated in the runtime entries into Resolver.
>  - Improve NoSuchMethodError for closures when --no-lazy-dispatchers
>  - Fix concurrent modification of Null class by nullability propagation.
> 
> Change-Id: Id979459bea43d318a4bb8fd904ef7f23e2711342
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/97846
> Commit-Queue: Ryan Macnak <rmacnak@google.com>
> Reviewed-by: Régis Crelier <regis@google.com>

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

Change-Id: Ife28f28fff7394dca3fc27e2745370030572720e
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/98427
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2019-04-01 21:57:06 +00:00
Ryan Macnak 3fd124db1f [vm] Repair the resolver abstraction.
- Move resolution logic that accumulated in the runtime entries into Resolver.
 - Improve NoSuchMethodError for closures when --no-lazy-dispatchers
 - Fix concurrent modification of Null class by nullability propagation.

Change-Id: Id979459bea43d318a4bb8fd904ef7f23e2711342
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/97846
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Régis Crelier <regis@google.com>
2019-04-01 16:22:53 +00:00
Régis Crelier 25851db73d [vm/bytecode] Replace InstanceCall instruction with InterfaceCall and DynamicCall.
Dispatch interface calls via hashtable rather than inline cache.
InterfaceCall doesn't need to take arguments descriptor into account
when doing method lookup.

Change-Id: I30eae6ea638d1d2ad2cf3ff073c653fee3377f31
Reviewed-on: https://dart-review.googlesource.com/c/86106
Reviewed-by: Zach Anderson <zra@google.com>
Commit-Queue: Régis Crelier <regis@google.com>
2018-12-14 16:51:51 +00:00
Ben Konyi 07852532e3 [ VM ] Additional cleanup in Dart_Initialize and Dart_Cleanup
Change-Id: I6dc02b3d9de16cc176eb97613bc0c7f0bb9b16eb
Reviewed-on: https://dart-review.googlesource.com/77013
Commit-Queue: Ben Konyi <bkonyi@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Auto-Submit: Ben Konyi <bkonyi@google.com>
2018-09-28 23:18:59 +00:00
Alexander Markov c6c4748185 [vm/bytecode] Bytecode compilation
Change-Id: I09192e4e929a397920c217b605580f8c4880e7c2
Reviewed-on: https://dart-review.googlesource.com/74002
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Reviewed-by: Régis Crelier <regis@google.com>
2018-09-14 22:02:29 +00:00
Régis Crelier 41fcbd097c [VM runtime] Initial version of Kernel Bytecode interpreter in VM runtime.
Not fully working yet, only x64, no gc, no frame walking, etc...

Change-Id: I4d8357f6d46371bf21c3d54266cfe26163e3c8dc
Reviewed-on: https://dart-review.googlesource.com/50021
Commit-Queue: Régis Crelier <regis@google.com>
Reviewed-by: Zach Anderson <zra@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2018-05-09 20:29:27 +00:00
Martin Kustermann 17d6d470a2 [VM] Remove experimental, unused, argument bits from argdesc and reduce prologue size
Change-Id: I1411b718e20394297aa2b761ab47970fcdc36c52
Reviewed-on: https://dart-review.googlesource.com/50920
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2018-04-12 12:54:29 +00:00
Zachary Anderson 9c40a7e662 Reland: [dart:cli] Adds waitFor(Future)
This is a reland of https://dart-review.googlesource.com/#/c/sdk/+/28920/
with the following changes:
- It creates a new library dart:cli
- waitFor(Future) goes in dart:cli instead of dart:io
- Removes a flaky test, and adds a missing precompiler entrypoint
- Adds waitFor(Future)
- Improves doc comments

fixes #31102

Change-Id: I04d2c46fd0afac049dd4fd1353905dc20da18f90
Reviewed-on: https://dart-review.googlesource.com/29449
Commit-Queue: Zach Anderson <zra@google.com>
Reviewed-by: Natalie Weizenbaum <nweiz@google.com>
Reviewed-by: Keerti Parthasarathy <keertip@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
2018-01-18 16:38:54 +00:00
Florian Loitsch f3e845cf48 Revert "Reland: [dart:io] Adds waitForEventSync"
This reverts commit 3ea5e13ad7.

Change-Id: Ic9fae69f3b7ef6e41aac3c7ebca3e1d288dbffb1
Reviewed-on: https://dart-review.googlesource.com/29589
Reviewed-by: Florian Loitsch <floitsch@google.com>
2017-12-14 14:10:45 +00:00
Zachary Anderson 3ea5e13ad7 Reland: [dart:io] Adds waitForEventSync
The only fix needed for relanding is adding _ensureScheduleImmediate
to the list of vm entrypoints in //runtime/vm/compiler/aot/precompiler.cc

Original commit message:

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

Lifting this up from a comment:

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

fixes #31102

Change-Id: Id96de46cc5f10e1847045cfafb7cfed6a38bce16
Reviewed-on: https://dart-review.googlesource.com/28920
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Zach Anderson <zra@google.com>
2017-12-12 23:16:50 +00:00
Zach Anderson 9d8e6453d2 Revert "[dart:io] Adds waitForEventSync"
This reverts commit 2aed87a133.

Reverting for failures on precompiled bots.

Change-Id: I758bfc72d8f5e67b0e5e12a7367a47f1df9364e2
Reviewed-on: https://dart-review.googlesource.com/28900
Reviewed-by: Zach Anderson <zra@google.com>
Commit-Queue: Zach Anderson <zra@google.com>
2017-12-12 21:05:01 +00:00
Zachary Anderson 2aed87a133 [dart:io] Adds waitForEventSync
Adds a top-level call waitForEventSync to dart:io that blocks the
thread an Isolate is running on until messages are available.
Before the thread blocks, the microtask queue is drained.
Before waitForEventSync returns, all messages are handled.

Lifting this up from a comment:

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

Change-Id: If8286f4525994a162dd4f4563fefccb9d0984f7c
Reviewed-on: https://dart-review.googlesource.com/25281
Commit-Queue: Zach Anderson <zra@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
2017-12-12 19:12:58 +00:00
Ryan Macnak d01d0ea8e6 [vm] Check for stack headroom before starting a hot reload.
Split up the StackOverflow runtime entry.

Bug: https://github.com/dart-lang/sdk/issues/31578
Change-Id: Ibe26101db1651d6e776c3da5fde6b44fd27cd00e
Reviewed-on: https://dart-review.googlesource.com/27414
Reviewed-by: Zach Anderson <zra@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2017-12-08 18:07:31 +00:00
Samir Jindel be07555207 Revert "Revert "[kernel] Implementation of fine-grained strong mode argument type-checks, phase 2""
This fixes some incorrect asserts that were breaking the debug bots.
The original revision is available in Patchset 1.

This reverts commit 26735519cb.

Bug:
Change-Id: Ifa599b7bff752dec4c505e10fd6db206e1abd977
Reviewed-on: https://dart-review.googlesource.com/23820
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Commit-Queue: Samir Jindel <sjindel@google.com>
2017-11-27 18:25:31 +00:00
Vyacheslav Egorov 26735519cb Revert "[kernel] Implementation of fine-grained strong mode argument type-checks, phase 2"
This reverts commit f13f772bb2.

Reason for revert: dartk(p)-strong debug mode is completely broken
because we convert int values non-representable as Smi to Smi, which
triggers that assert. The code that does tagging checks that
Untag(Tag(x)) == x, however for our purposes this identity does not
need to hold because we only care about lower bits and ignore the sign.

Reverting to restore green-ness of DEBUG builds.

TBR=sjindel@google.com

Bug:
Change-Id: Id436cbe000d6dec8db3469070ed531327cc82d89
Reviewed-on: https://dart-review.googlesource.com/23661
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2017-11-26 10:21:01 +00:00
Samir Jindel f13f772bb2 [kernel] Implementation of fine-grained strong mode argument type-checks, phase 2
This revision continues the implementation of:
https://docs.google.com/document/d/1KK8b6kzr0pQev5YNftSZhN3M6I8HcvOJwJ6U-cW4nfw/edit?ts=5a05b3e9#heading=h.7j21arix8p2

* Add argument checking bits for named arguments in the arguments descriptor.
* Add argument checking bits for type arguments.
* Calculate argument checking bits for setters.
* Add dispatch category to PropertySet and DirectPropertySet.

Bug:
Change-Id: Ieb0a4a99c401f53a72de473fda7bab61581f9996
Reviewed-on: https://dart-review.googlesource.com/22700
Commit-Queue: Samir Jindel <sjindel@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Reviewed-by: Régis Crelier <regis@google.com>
2017-11-24 18:23:57 +00:00
Samir Jindel a991c17dc9 [kernel] Implementation of fine-grained strong mode argument type-checks, phase 1
The revision begins the implementation of:
https://docs.google.com/document/d/1KK8b6kzr0pQev5YNftSZhN3M6I8HcvOJwJ6U-cW4nfw/edit?ts=5a05b3e9#heading=h.7j21arix8p2

* The ArgumentsDescriptor is updated to hold a bitvector for positional arguments.
* The kernel flowgraph builder is updated to calculate the appropriate bits from
  the interface target and pass them through the ArgumentsDescriptor
  for regular MethodInvocations.

Bug:
Change-Id: I1cd9f43f697df1dd4f36103bbdfc0ba000125c02
Reviewed-on: https://dart-review.googlesource.com/21541
Commit-Queue: Samir Jindel <sjindel@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Reviewed-by: Régis Crelier <regis@google.com>
2017-11-21 15:35:48 +00:00
Régis Crelier beedd2e103 [VM generic function reification] Fix megamorphic cache lookup when calling
reified generic function.
Clean up code to avoid similar issue in the future, i.e. make it clear whether
the passed type argument vector is counted or not by using better names.

Change-Id: I60fd6f6acb302235d8c1ae4f2bc4bf459724421e
Reviewed-on: https://dart-review.googlesource.com/3400
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2017-09-06 00:36:19 +00:00
Régis Crelier c29f5dd4f5 [VM DBC compiler and simulator] Support reified generic functions.
R=vegorov@google.com

Review-Url: https://codereview.chromium.org/2987323003 .
2017-08-16 10:48:07 -07:00
Alexander Markov 203955bc48 Reapply "Improve hashCode for closure objects" with fixes.
This CL includes the following fixes:
* Fix for incorrect non-nullable assumption about _Closure._hash field.
* Add error handling into BecomeMapTraits::Hash.
* Correct assertions for validating layout of Closure objects.
* Add identityHashCode to the list of VM entry points in precompiler.

Closes #30211.

Original code review:

https://codereview.chromium.org/2983823002/

Original CL description:

This performance improvement is inspired by Flutter listeners stored in
the HashSet (see ObserverList) and frequently checked using
HashSet.contains(). If there are many such listeners and they are
implicit instance closures (for example, created by
'new Listenable.merge(...)'), HashSet.contains() becomes very slow.
It spends a lot of time in Closure_equals native method due to hash
collisions between closure objects with same function
but different receivers.

This CL improves hashCode() calculation for implicit instance closures
by mixing function hashcode with identity hashcode of the receiver.
For explicit closures and static implicit closures hashCode() is
improved by using identityHashCode() of a closure object.

Also, hashcode is calculated once and cached in each closure instance.
The size of a closure instance doesn't grow up because there was unused
word-size padding both on 32-bit and 64-bit architectures.

The execution time of the following micro-benchmark is reduced from
47665ms to 135ms on my Linux/x64 box.

-------------------------------------

import "dart:collection";

class Foo {
  int _a;
  Foo(this._a);
  void bar() {}
}

main() {
  HashSet hs = new HashSet();
  for (int i = 0; i < 1000; ++i) {
    hs.add(new Foo(i).bar);
  }

  var watch = new Stopwatch()..start();

  for (int i = 0; i < 1000; ++i) {
    for (var c in hs) {
      hs.contains(c);
    }
  }

  int time = watch.elapsedMilliseconds;
  print("Time: ${time}ms\n");
}

-------------------------------------

R=zra@google.com

Review-Url: https://codereview.chromium.org/2988493002 .
2017-07-20 15:22:18 -07:00
Alexander Markov 51d580d8bf Revert "Improve hashCode for closure objects"
This reverts commit b1197eb714.

Revert "Correct assertions for validating layout of Closure objects"

This reverts commit b1215faa59.

Revert "Add identityHashCode to the list of VM entry points in precompiler"

This reverts commit e1d04cc242.

R=asiva@google.com

Review-Url: https://codereview.chromium.org/2983973002 .
2017-07-20 08:34:28 -07:00
Alexander Markov b1197eb714 Improve hashCode for closure objects
This performance improvement is inspired by Flutter listeners stored in
the HashSet (see ObserverList) and frequently checked using
HashSet.contains(). If there are many such listeners and they are
implicit instance closures (for example, created by
'new Listenable.merge(...)'), HashSet.contains() becomes very slow.
It spends a lot of time in Closure_equals native method due to hash
collisions between closure objects with same function
but different receivers.

This CL improves hashCode() calculation for implicit instance closures
by mixing function hashcode with identity hashcode of the receiver.
For explicit closures and static implicit closures hashCode() is
improved by using identityHashCode() of a closure object.

Also, hashcode is calculated once and cached in each closure instance.
The size of a closure instance doesn't grow up because there was unused
word-size padding both on 32-bit and 64-bit architectures.

The execution time of the following micro-benchmark is reduced from
47665ms to 135ms on my Linux/x64 box.

-------------------------------------

import "dart:collection";

class Foo {
  int _a;
  Foo(this._a);
  void bar() {}
}

main() {
  HashSet hs = new HashSet();
  for (int i = 0; i < 1000; ++i) {
    hs.add(new Foo(i).bar);
  }

  var watch = new Stopwatch()..start();

  for (int i = 0; i < 1000; ++i) {
    for (var c in hs) {
      hs.contains(c);
    }
  }

  int time = watch.elapsedMilliseconds;
  print("Time: ${time}ms\n");
}

-------------------------------------

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

Review-Url: https://codereview.chromium.org/2983823002 .
2017-07-19 14:36:42 -07:00
Zachary Anderson 6cd8a79078 VM: Re-format to use at most one newline between functions
R=asiva@google.com

Review-Url: https://codereview.chromium.org/2974233002 .
2017-07-13 08:08:37 -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
Régis Crelier 9aafded095 Pass type argument vector to generic functions (if --reify-generic-functions is
true, still false per default).
Work in progress, not functional yet (passed vector is still ignored in callee).

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

Review-Url: https://codereview.chromium.org/2859673002 .
2017-05-18 14:03:47 -07:00
John McCutchan dc83d0ad7a Use a better stack bound in DartEntry::InvokeFunction
Fixes https://github.com/dart-lang/sdk/issues/28282
Fixes https://github.com/dart-lang/sdk/issues/28304

BUG=
R=asiva@google.com

Review-Url: https://codereview.chromium.org/2639673003 .
2017-01-18 06:43:21 -08:00
Zachary Anderson a1bcf051d8 clang-format runtime/vm
R=johnmccutchan@google.com

Review URL: https://codereview.chromium.org/2481873005 .
2016-11-08 13:54:47 -08:00
Zachary Anderson 103881d01c Make header include guards great again
i.e. #ifndef VM_WHATEVER -> #ifndef RUNTIME_VM_WHATEVER

This lets us remove a hack from the PRESUBMIT.py script that existed
for reasons that are no longer valid, and sets us up to add some
presubmit checks for the GN build.

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

Review URL: https://codereview.chromium.org/2450713004 .
2016-10-26 00:26:03 -07:00
Vyacheslav Egorov f67ce21068 VM support for running Kernel binaries.
BUG=
R=asiva@google.com, fschneider@google.com

Review URL: https://codereview.chromium.org/2411823003 .
2016-10-15 22:48:46 +02:00
Ryan Macnak 524fbc1e0f Use clustered serialization for full snapshots.
Retain the recursive-descent format for script and message snapshots.

Flutter gallery app on a Nexus 4
 - Snapshot, excluding instruction/rodata sections 3429177 -> 2874997B (-16%)
 - InitOnce 54.1 -> 8.4ms (-84%)
 - InitializeIsolate 374.3 -> 170.8ms (-54%)

R=asiva@google.com

Review URL: https://codereview.chromium.org/2032153003 .
2016-06-29 19:50:06 -07:00
Vyacheslav Egorov ee0f608ce4 Dart Byte Code interpreter.
This version is Clang/GCC only and does not support Windows because it uses computed goto's.

Only unoptimized mode is supported.

Architecture is described in constants_dbc.h and stack_frame_dbc.h.

R=fschneider@google.com, zra@google.com

Review URL: https://codereview.chromium.org/1858283002 .
2016-04-18 23:02:01 +02:00
Florian Schneider bac82e2592 VM: New calling convention for generated code.
Instead of calling code object directly, call indirectly and
pass the code object in a register. The object pool is then loaded from
the code object. This is another preparation step for making generated code
relocatable.

All non-ia32 platforms:
No entry patching.

ARM:
PC marker (now code object) moves to the same place as on x64 (below saved PP, above saved FP).
R9 is now used as PP, R10 as CODE_REG.

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

Committed: 1d343e5a7b

Review URL: https://codereview.chromium.org//1192103004 .
2015-09-19 13:21:09 +02:00
Florian Schneider 7af7a2db87 Revert "VM: New calling convention for generated code."
This reverts commit 1d343e5a7b.

Because of Windows test failures.

BUG=
TBR=whesse@google.com

Review URL: https://codereview.chromium.org//1343373003 .
2015-09-16 13:46:05 +02:00
Florian Schneider 1d343e5a7b VM: New calling convention for generated code.
Instead of calling code object directly, call indirectly and
pass the code object in a register. The object pool is then loaded from
the code object. This is another preparation step for making generated code
relocatable.

All non-ia32 platforms:
No entry patching.

ARM:
PC marker (now code object) moves to the same place as on x64 (below saved PP, above saved FP).
R9 is now used as PP, R10 as CODE_REG.

BUG=
R=rmacnak@google.com

Review URL: https://codereview.chromium.org//1192103004 .
2015-09-16 13:05:58 +02:00
Siva Annamalai 228e8f6edd - Turn on writing of ic_data_array so that we have that information for script snapshots that would allow for code to be optimized right away
- Use snapshot Ids for singleton VM isolate singleton objects instead of writing them out into the snapshot

- Add support for writing function objects as an Id, this is needed to serialize function objects from the core library in a script snapshot (these function objects could potentially appear in the ICData).

BUG=
R=rmacnak@google.com

Review URL: https://codereview.chromium.org//1337083004 .
2015-09-15 17:18:21 -07:00
Ryan Macnak 0ed4d44a99 Toward precompiled snapshots.
Gets as far as encountering null Instructions in the first Dart_Invoke after loading the snapshot.

R=asiva@google.com

Review URL: https://codereview.chromium.org//1318803002 .
2015-09-02 16:15:02 -07:00
John McCutchan 7052bd6bed Rework service extensions to be safe
- When scheduling a service extension to be invoked, store the closure in an array held in the isolate.
- At the tail of IsolateMessageHandler::HandleMessage, invoke all pending service extension closures.

R=iposva@google.com, turnidge@google.com

Review URL: https://codereview.chromium.org//1299493007 .
2015-08-27 11:23:39 -07:00
Daniel Andersson fd890f4097 Cache current thread in a reserved register and use it in LoadIsolate
Add THR register that caches the current thread in generated code.
Shuffle some registers around as needed to free one up.

Note: Assembler::LoadIsolate now always loads the *current* isolate whenever the code is executed, rather than the isolate in which the code was compiled (no existing code was affected by this slight change in semantics).

Rewrite some ia32 stubs to use one less register, and for some ia32 bigint intrinsics, explicitly save THR (like CTX in the past, see r44699).

Next steps:
- pass current thread rather than isolate in NativeArguments
- ditto for exception handler jump
- migrate fields vm_tag, top_exit_frame_info, etc. to thread

R=srdjan@google.com

Review URL: https://codereview.chromium.org//1156593002
2015-05-26 13:46:12 -07:00
fschneider@google.com 876193b31a Make CTX allocatable by the register allocator.
This change makes CTX available by not caching the current
context while in Dart code. Instead the current context
is held in a local variable (:saved_current_context_var) and
is passed as argument in CTX at calls.

This also simplifies a lot of code in the debugger: As a result,
Isolate::top_context is not needed anymore since the current context
can always be extracted from a Dart frame.

R=vegorov@google.com

Review URL: https://codereview.chromium.org//678763004

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@41422 260f80e4-7a28-3924-810f-c04153c831b5
2014-10-30 15:42:38 +00:00
koda@google.com d3b9bc5d2e Add Instance::HashCode that matches hashCode.
Implement in C++ for strings and integers.

This is in preparation for internalized hash maps/sets.

R=rmacnak@google.com

Review URL: https://codereview.chromium.org//358723002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@37763 260f80e4-7a28-3924-810f-c04153c831b5
2014-06-26 21:53:05 +00:00
iposva@google.com fd8565b071 - Add a minimal implementation of Capability.
- Make RawReceivePort and SendPort VM internal objects.
- Rationalize the creation of ports and their handling within the VM.

R=asiva@google.com

Review URL: https://codereview.chromium.org//243973002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@35325 260f80e4-7a28-3924-810f-c04153c831b5
2014-04-23 19:44:03 +00:00
iposva@google.com 0977a3bf2b - First step in refactoring ports with the goal of moving
them closer into the VM implementation.

R=asiva@google.com

Review URL: https://codereview.chromium.org//196443009

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@34438 260f80e4-7a28-3924-810f-c04153c831b5
2014-03-26 17:30:39 +00:00
iposva@google.com 781f737c6a First round of http://dartbug.com/15922:
- Address warnings about 64-bit to 32-bit conversions.
- Remove heap profiler.

R=asiva@google.com

Review URL: https://codereview.chromium.org//139043003

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@31867 260f80e4-7a28-3924-810f-c04153c831b5
2014-01-16 05:05:35 +00:00
johnmccutchan@google.com c76b6eb1c2 Split service into VM and embedder specific bits.
Move most service sources into the VM.

R=asiva@google.com

Review URL: https://codereview.chromium.org//125103004

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@31809 260f80e4-7a28-3924-810f-c04153c831b5
2014-01-14 22:34:43 +00:00
iposva@google.com 1e8061f060 - Remove the reply_port from the VM internal message object.
- Adjust all the uses of this API.

R=johnmccutchan@google.com

Review URL: https://codereview.chromium.org//93873015

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@31205 260f80e4-7a28-3924-810f-c04153c831b5
2013-12-17 21:11:18 +00:00