Commit Graph

40 Commits

Author SHA1 Message Date
Vyacheslav Egorov a9a756df8e VM: Allow configuring use_field_guards on the per-isolate basis and include it into snapshot features.
We have tests that disable it but we train app-jit snapshot for Kernel with field guards enabled so
we need to make sure that Kernel isolate runs with correct settings matching the settings at the time
when app-jit snapshot was created.

BUG=
R=rmacnak@google.com

Review-Url: https://codereview.chromium.org/2715213008 .
2017-02-28 21:17:17 +01:00
Erik Corry c0404e4f23 Propagate this-specialization to regular (megamorphic) calls
R=vegorov@google.com
BUG=

Review-Url: https://codereview.chromium.org/2716593002 .
2017-02-27 13:28:54 +01:00
Martin Kustermann 20130a2d43 VM: [Kernel] Ensure we record [FieldLoadInstr]s in the ParsedFunction when using field guards
R=vegorov@google.com

Review-Url: https://codereview.chromium.org/2704623003 .
2017-02-17 13:10:20 +01:00
Regis Crelier dc0605012f Move Null type to the Bottom in the VM (fixes #28025).
Fix wrong comments.

R=asiva@google.com

Review-Url: https://codereview.chromium.org/2608373002 .
2017-01-05 10:05:31 -08:00
Florian Schneider 5399d8acf6 Fix Flutter profile_unopt and release_unopt builds
Fixes #27862.

R=johnmccutchan@google.com

Review URL: https://codereview.chromium.org/2516033002 .
2016-11-20 12:17:50 -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
Vyacheslav Egorov 0635b57d43 Reland "Recognize and optimize a.runtimeType == b.runtimeType pattern."
This relands commit f4ec20abac.

BUG=
R=rmacnak@google.com

Review URL: https://codereview.chromium.org/2465793003 .
2016-11-01 16:49:02 +01:00
Vyacheslav Egorov 16e4f2f1c2 Revert "Revert "Revert "Recognize and optimize a.runtimeType == b.runtimeType pattern."""
This reverts commit e495e100dd.

Commit breaks bots that are using Android devices (SIMARM is unaffected).

R=rmacnak@google.com
BUG=

Review URL: https://codereview.chromium.org/2449013004 .
2016-10-26 16:53:32 +02:00
Vyacheslav Egorov e495e100dd Revert "Revert "Recognize and optimize a.runtimeType == b.runtimeType pattern.""
This reverts commit 890f694de5.

Previous commit was passing field_type_map_ down in a place where it was not passed down before.

This caused some handles to be used across zones, which caused crashes.

BUG=

Review URL: https://codereview.chromium.org/2453463006 .
2016-10-26 12:25:48 +02:00
Ryan Macnak 890f694de5 Revert "Recognize and optimize a.runtimeType == b.runtimeType pattern."
This reverts commit f4ec20abac.

Revert "Use ZoneHandle when creating ConstantInstr"

This reverts commit cb87f2d82f.

This change introduced crashes on AOT and runtime errors on the GN SDK build.

TBR=vegorov@google.com

Review URL: https://codereview.chromium.org/2451893002 .
2016-10-25 13:19:33 -07:00
Vyacheslav Egorov f4ec20abac Recognize and optimize a.runtimeType == b.runtimeType pattern.
Start by removing all get:runtimeType overrides in the patch files to have a single point computing the runtime type - Object.get:runtimeType. Handle string, double and integer types inside both intrinsic and runtime call to unify their handling and guarantee that code works even with intrinsifier disabled.

With overrides removed we can easily check that get:runtimeType is unique function name within the application that is being precompiled and use that to convert InstanceCall(get:runtimeType, ...) into StaticCall even nothing is known about the receiver.

This enables us to check if both left side and right side of comparison are StaticCall(Object.get:runtimeType, ...) when specializing InstanceCall(==, x, y). If they are we convert InstanceCall(==, StaticCall(get:runtimeType, a), StaticCall(get:runtimeType, b)) into StaticCall(Object._hasSameRuntimeType, a, b). A canonicalization rule will later delete unused get:runtimeType invocations.

Object._hasSameRuntimeType is implemented in C++ and intrinsified. It operates without creating new runtime types (except for Closures - where it does for simplicity). Cases of different class ids (i.e. a.[cid] != b.[cid]) and non-parameterized types are handled completely in the intrinsic. The rest is handled in the runtime code.

Microbenchmarking results:

Same parameterized classes: 15x improvement
Different parameterized classes: 300x improvement
Different/same non-parameterized classes: 2x improvement

BUG=
R=fschneider@google.com, regis@google.com

Review URL: https://codereview.chromium.org/2379733002 .
2016-10-25 10:03:06 +02:00
Florian Schneider 7d6f78b88f VM: More refactoring of recognized methods inlining.
Move inlining OneByteString._setAt, List constructor, Object constructor
and a few math function to the flow-graph inliner.

Enable inlining of trigonometric math functions in AOT that were previously not inlined.

BUG=
R=rmacnak@google.com

Review URL: https://codereview.chromium.org/2273943002 .
2016-08-24 10:35:05 -07:00
Florian Schneider 8eaa762d4a VM: Remove more duplicate code between AOT and JIT compiler.
BUG=
R=rmacnak@google.com

Review URL: https://codereview.chromium.org/2265873005 .
2016-08-22 15:20:54 -07:00
Florian Schneider 1e7dc8a5e8 Move inlining of recognized SIMD methods to the flow-graph inliner.
This allows inlining of these methods in the AOT optimizer.

Also fix missing inlining of some SIMD constructors (Float32x4FromInt32x4Bits and Int32x4FromFloat32x4Bits)

BUG=
R=rmacnak@google.com

Review URL: https://codereview.chromium.org/2254053002 .
2016-08-18 12:50:37 -07:00
Lars Bak 21a3a27aff Made simple instance-of checks fast for unoptimized code.
This change makes dart2js 15% faster when compiling 60KLOC. 15sec -> 13sec.

BUG=
R=regis@google.com

Review URL: https://codereview.chromium.org/2147123002 .
2016-07-14 11:11:17 -07:00
Florian Schneider c09e9ffc91 VM: Move inlining of _bitAndFromSmi to the flow graph inliner.
Also move the check for number of checks to a common place when
replacing recognized methods in the optimizer.

BUG=
R=vegorov@google.com

Review URL: https://codereview.chromium.org/2127273002 .
2016-07-12 14:06:33 -07:00
Stephen Adams 38fdb4bd4a vm: Generate 'and' instruction for Smi values.
This pattern ensures the generation of 'and' instructions on the Smi x Smi path of a polymorphic & operation.

There are two 'and' operations on most simple _InternalLinkedHashMap and _CompactLinkedHashSet operations. One of the inputs, the hashCode, is occasionally a _Bigint.  This change ensures that the usual case path has an 'and' instruction instead of a call to _IntegerImplementation.&

R=regis@google.com

Review URL: https://codereview.chromium.org/1913663002 .
2016-07-04 16:27:57 -07:00
Florian Schneider 7f0273f83e Remove invalid assertion in the optimizer.
We can have stores inlined in the optimizer that are not initializing stores.

Mark initializing stores in the parser instead to distinguish
initializing- and non-initializing stores more precisely.

BUG=
R=vegorov@google.com

Review URL: https://codereview.chromium.org/2112973002 .
2016-07-01 09:55:35 -07:00
Siva Annamalai 006bab2c47 Land Ivan's change of 'Remove support for verified memory handling'
R=fschneider@google.com

Review URL: https://codereview.chromium.org/2112043002 .
2016-07-01 09:21:01 -07:00
Florian Schneider a3dcdb35aa Refactor inlining of recognized methods.
Move some common code into the FlowGraphInliner to avoid duplication.

Also, only emit the receiver class check when necessary in the first place.

There is more duplicate code in jit_optimizer.cc and aot_optimizer.cc which is
independent of the compilation mode. This CL is just a step.

Removed receiver class check for SIMD operations that require unboxing: The unbox operation already checks the argument type.

BUG=
R=vegorov@google.com

Review URL: https://codereview.chromium.org/2102663003 .
2016-06-28 11:25:21 -07:00
John McCutchan c0eb4d9dc0 Remember inside an ICData if it is for a static call or an instance call
- [x] Add an is static call bit to ICData
- [x] Rewrite the reset ICData iterators to rely on that bit rather than the function's ic data map

BUG=

Review URL: https://codereview.chromium.org/2064693003 .
2016-06-13 13:23:57 -07:00
Florian Schneider 6afbb17cec VM: Fix assertion failure from background compiler.
The background compiler expects only cloned Field objects.

BUG=#26540
R=vegorov@google.com

Review URL: https://codereview.chromium.org/2016653002 .
2016-05-26 12:18:36 +02:00
Vyacheslav Egorov 65f2e015ca VM: Fix race between background compiler and guarded cid update.
Rework how we check guarded state consistency in background compiler.

Background compiler was storing original fields inside guarded fields list. This caused a race during inlining when inliner would copy guarded fields one by one from the callee function into the caller, because ParsedFunction::AddToGuardedFields looks at the guarded_cid to filter out those fields that should not be guarded.

As a result if some guarded field transitioned to unguarded (kDynamicCid) after callee graph construction but before list of guarded fields were copied then AddToGuardedFields would simply skip that field because it now has guarded_cid() == kDynamicCid.

We fix this race by always placing copies into the list of guarded fields and unwrapping them only in FinalizeCode.

Placing the copies also allows us to simplify a lot of code that was trying to verify guarded state consistency before committing the generated optimized code - now that we store copies in the list we can just compare their state to the originals and abort if the state is different.

Additionally fix deduplication check that was comparing original fields with copies - resulting in adding the same field into the list multiple times.

Add an assertion that verifies that we are not trying to access guarded_cid of original field from background compiler.

R=fschneider@google.com
BUG=

Review URL: https://codereview.chromium.org/2006793002 .
2016-05-24 14:52:02 +02:00
Vyacheslav Egorov 6bb73bd2e4 Background compiler should validate CHA decisions before committing the code.
CHA::HasOverride skips non-finalized classes when looking for overrides which means that we will install incorrect code if some subclass with an override was finalized while compilation was in progress.

To catch situations like this we record the number of finalized subclasses that class had
when CHA made the first negative decision about it (e.g. that it has no subclasses or that it has no overrides for some function) and before installing the code we check that number of subclasses matches.

Additionally renamed "leaf classes" to "guarded classes" because those classes are not necessarily leaf.

R=fschneider@google.com
BUG=

Review URL: https://codereview.chromium.org/2002583002 .
2016-05-20 13:48:29 +02:00
Florian Schneider c1e6aef400 VM: Optimized code for all of [External]{One|Two}ByteString::codeUnitAt.
Added support for external string using flow graph based intrinsics
which helps with precompiled code, but also polymorphic calls in jitted code.
I also added support for the missing cases in the flow graph optimizer.

BUG=
R=vegorov@google.com

Review URL: https://codereview.chromium.org/1961393002 .
2016-05-11 09:29:28 +02:00
Florian Schneider 1217e539e9 VM: Remove _leftShiftWithMask32.
It was used for the Javascript integer overflow warnings which were already
removed from the VM.

BUG=
R=regis@google.com, srdjan@google.com

Review URL: https://codereview.chromium.org/1900863004 .
2016-04-19 19:06:53 +02:00
Srdjan Mitrovic e334f2628c Simple fixes
BUG=
R=regis@google.com

Review URL: https://codereview.chromium.org/1897053003 .
2016-04-18 15:48:02 -07:00
Ryan Macnak e048774776 Precompilation: Specialize instance calls when the call receiver is the method receiver and the method class has a small number of concrete subclasses (currently 5).
CompileOnceHelloHtml (ARMv7HF) +17.194%
DeltaBlueClosures (ARMv7HF) +28.379%
DeltaBlue (ARMv7HF) +30.190%

precompiled dart2js arm 19071745 -> 19504726 (+2.3%)

R=fschneider@google.com

Review URL: https://codereview.chromium.org/1867913004 .
2016-04-11 12:52:28 -07:00
Ryan Macnak 34e4107c0d Add flag to disable string externalization, allowing the compiler to rely on string class checks remaining valid across calls.
R=fschneider@google.com

Review URL: https://codereview.chromium.org/1859273002 .
2016-04-07 13:24:44 -07:00
Florian Schneider 21e069a009 Reland "VM: Improve single-target polymorphic calls."
This reverts commit 53e92a31ae.

Reverted to check if this CL had anything to do with Dartium test failures. Turns out it does not.

TBR=srdjan@google.com,

BUG=

Review URL: https://codereview.chromium.org/1853003002 .
2016-04-02 18:08:32 -07:00
Florian Schneider 53e92a31ae Revert "VM: Improve single-target polymorphic calls."
This reverts commit f6c19ee595.

Likely cause of Dartium test failures.

TBR=rmacnak

BUG=

Review URL: https://codereview.chromium.org/1852433006 .
2016-04-01 15:09:51 -07:00
Florian Schneider f6c19ee595 VM: Improve single-target polymorphic calls.
Use the existing class-id check for dense ranges in more places.
Previously we would fall back to megamorphic lookup with >4 cids,
even though we can check cid ranges up to word-size efficiently.

Next step is to generalize the dense class id checks to multiple
word-sizes.

BUG=
R=vegorov@google.com

Review URL: https://codereview.chromium.org/1847293002 .
2016-04-01 09:59:27 -07:00
Florian Schneider 2783afd607 VM: Fix receiver type propagation in presence of try-catch.
With catch blocks appearing as additional function entry blocks,
there can be phis for the receiver (parameter 0).

This CL fixes the problem that the receiver type information
was lost in the presence of try-catch.

BUG=
R=vegorov@google.com

Review URL: https://codereview.chromium.org/1841073003 .
2016-03-30 15:55:11 -07:00
Florian Schneider a91f758b86 VM: Fix incorrect debug assertion.
BUG=

Review URL: https://codereview.chromium.org/1840173003 .
2016-03-29 18:10:18 -07:00
Florian Schneider 15f23eedc9 VM: Fix --no-use-field-guards.
Fields read from the snapshot must be initialized in the same way
as when allocated with Field::New.

BUG=https://github.com/dart-lang/sdk/issues/25957
R=rmacnak@google.com

Review URL: https://codereview.chromium.org/1842853002 .
2016-03-29 17:40:58 -07:00
Regis Crelier ba69c8a898 Enumerate URIs of all types in type errors in order to help the user diagnose
the error (it was previously only printed for types with identical names).
Cleanup and simplify construction of type errors.

R=hausner@google.com, srdjan@google.com

Review URL: https://codereview.chromium.org/1778133002 .
2016-03-09 15:16:47 -08:00
Srdjan Mitrovic 20c17d9e41 More fixes for background compilation
BUG=
R=fschneider@google.com

Review URL: https://codereview.chromium.org/1745453002 .
2016-02-26 10:58:17 -08:00
Srdjan Mitrovic 5a69e3661b In background compilation make a copy of Field in order to freeze its state. Add flag --force_clone_compiler_objects for debugging purpose.
BUG=
R=asiva@google.com

Review URL: https://codereview.chromium.org/1722733002 .
2016-02-26 09:07:49 -08:00
Ivan Posva 8d18298fed - Remove Isolate::Flags structure and store flags directly in isolate.
- Make enable_asserts, enable_type_checks, error_on_bad_override and
  error_on_bad_type release mode flags only.

BUG=
R=fschneider@google.com

Review URL: https://codereview.chromium.org/1737693003 .
2016-02-25 18:06:56 -08:00
Florian Schneider df4f508483 Rename FlowGraphOptimizer -> JitOptimizer, clean up optimizer code.
BUG=
R=rmacnak@google.com

Review URL: https://codereview.chromium.org/1732483002 .
2016-02-24 07:18:12 -08:00