This reverts commit fde6a5917e.
Reason for revert: This commit looks to be causing new test failures on dart2js. While there are some odd results on some builders that look like infra failures, some builders (for example, dart2js-minified-strong-linux-x64-d8) show the new failing tests clearly.
Original change's description:
> [vm, compiler] Unoptimized megamorphic calls.
>
> When an instance call in unoptimized code creates more than FLAG_max_polymorphic_checks cases, switch the call to use a MegamorphicCache instead of ICData. The prevents unbounded collection of type feedback, and gives improvements on microbenchmarks in the 3-8% range for unoptimized code.
>
> It also leads to a loss of target frequency information for the optimizer, leading to different ordering for range checks in polymorphic inlining. This leads to changes on megamorphic microbenchmarks from -31% to +60%, weighted toward the negative end.
>
> In practice the frequency information seems unimportant, as dart2js has 4.01% geomean improvement.
>
> This is a step toward direct monomorphic calls in unoptimized code, which will also make use of the patching and type feedback extraction added here.
>
> Bug: https://github.com/dart-lang/sdk/issues/26780
> Bug: https://github.com/dart-lang/sdk/issues/36409
> Bug: https://github.com/dart-lang/sdk/issues/36731
> Change-Id: I29f53f23b6794c5f5f0db8b8184788cee16fd9c5
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/99270
> Reviewed-by: Alexander Markov <alexmarkov@google.com>
TBR=rmacnak@google.com,alexmarkov@google.com,ajcbik@google.com
Change-Id: Icad46b93cdf8541a00563f49da6b4ac0a4df1ba1
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: https://github.com/dart-lang/sdk/issues/26780, https://github.com/dart-lang/sdk/issues/36409, https://github.com/dart-lang/sdk/issues/36731
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/103440
Reviewed-by: Teagan Strickland <sstrickl@google.com>
Commit-Queue: Teagan Strickland <sstrickl@google.com>
When an instance call in unoptimized code creates more than FLAG_max_polymorphic_checks cases, switch the call to use a MegamorphicCache instead of ICData. The prevents unbounded collection of type feedback, and gives improvements on microbenchmarks in the 3-8% range for unoptimized code.
It also leads to a loss of target frequency information for the optimizer, leading to different ordering for range checks in polymorphic inlining. This leads to changes on megamorphic microbenchmarks from -31% to +60%, weighted toward the negative end.
In practice the frequency information seems unimportant, as dart2js has 4.01% geomean improvement.
This is a step toward direct monomorphic calls in unoptimized code, which will also make use of the patching and type feedback extraction added here.
Bug: https://github.com/dart-lang/sdk/issues/26780
Bug: https://github.com/dart-lang/sdk/issues/36409
Bug: https://github.com/dart-lang/sdk/issues/36731
Change-Id: I29f53f23b6794c5f5f0db8b8184788cee16fd9c5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/99270
Reviewed-by: Alexander Markov <alexmarkov@google.com>
This removes the 3 fields from the classes in Dart and instead describes
the layout in C++ via a RawTypedDataView class (as already do with
normal RawTypedData). The existing "semi" TypedDataView handle class is
changed to be a real handle class.
This decreases performance of some microbenchmarks due to field guards
not being used anymore (before the JIT could add a field guard to view classes
guarding that only normal typed data is used as backing store (and not e.g. external
typed data)
Issue https://github.com/dart-lang/sdk/issues/35154
Issue https://github.com/dart-lang/sdk/issues/31954
Change-Id: I7a0022b843a4c0fa69f53dedcc4c7bd2117cdc37
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/96806
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
For some reason this code used deopt_id from the environment attached
to the AssertAssignable instruction, rather than deopt_id from the
instruction itself.
Under certain conditions this deopt_id is -1 which usually does
not cause any problems because no other code uses it.
Compiler is now changed in a way that only sets Environment::deopt_id_
for outer environments and innermost environment always has deopt_id_ set
to DeoptId::kNone.
This bug manifested itself as a very rare crash on lib_2/convert/chunked_conversion_utf8_test.dart
test on optcounter bot.
This change also converts an assertion that verifies that deoptimization target
always exists into a FATAL to make such crashes more informative.
TEST=runtime/tests/vm/dart/licm_and_assert_strengthening_test.dart
Change-Id: Ib58237b0f4ae279dcf9d88cac031156e88bf4828
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/96657
Auto-Submit: Vyacheslav Egorov <vegorov@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Vyacheslav Egorov <vegorov@google.com>
Also move deopt id computation logic into a separate class and add a comment
explaining while deopt ids are incremented by 2.
Change-Id: Ife489be7d10c7198a8e7adf9e97e0c516d78ea55
Reviewed-on: https://dart-review.googlesource.com/72685
Commit-Queue: Vyacheslav Egorov <vegorov@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Coverage uses the value of an execution counter to detect executed functions. However non-positive execution counter does not necessary mean that a function was never executed because we sometimes reset the counter.
Introduce additional bit on a function that is set whenever we reset positive execution counter and use this bit when generating coverage data.
Bug: https://github.com/dart-lang/sdk/issues/31326
Change-Id: I5357109603defad7e7c9415c433203f16bcf88f4
Reviewed-on: https://dart-review.googlesource.com/19760
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
New folder structure (nested under vm/):
- compiler/
- jit/ - JIT specific code
- aot/ - AOT specific code
- backend/ - all middle-end and back-end code (IL, flow graph)
- assembler/ - assemblers and disassemblers
- frontend/ - front ends (AST -> IL, Kernel -> IL)
compiler/README.md would be the documentation root for the compiler
pipeline
Bug: https://github.com/dart-lang/sdk/issues/30575
Change-Id: I2dfd9688793bff737f7632ddc77fca766875ce36
Reviewed-on: https://dart-review.googlesource.com/2940
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Commit-Queue: Vyacheslav Egorov <vegorov@google.com>
Simplify handling of closures as deferred objects.
The name "type_arguments_" is confusing, because class Closure is not generic.
Class Closure was forcefully made (kinda) generic by setting its
type_arguments_field_offset_in_words_ field to a valid value, so that the
type_arguments_ field in closure instances could be accessed similarly as in
generic instances. With generic functions, closures will potentially have more
than one instantiator and the name type_arguments_ becomes nonsensical.
R=johnmccutchan@google.com
Review-Url: https://codereview.chromium.org/2719603002 .
They were used as the class of closure instances and as the type class of
function types.
All closure instances now have class _Closure and function types are represented
by a new class FunctionType extending AbstractType.
Fix issue 24567 and add regression test.
R=asiva@google.com, rmacnak@google.com
Review URL: https://codereview.chromium.org/1584223006 .
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 .
Deferred objects are malloced, and there is no need to allocate one
for the stub pc-marker (smi zero).
This is also part of preparing for running precompiled stub code: when
changing the pc-marker to hold the stub's code object, we want to materialize
it eagerly, so that the stack frame is valid after DeoptimizeFillFrame.
BUG=
R=rmacnak@google.com
Review URL: https://codereview.chromium.org//1289243002 .
This adds meta-information to object pool entries to allow storing
untagged immediates or code addresses (ExternalLabel) directly.
This eliminates the need to generate extra code to preserve the LSB
when storing immediates as smis (x64, arm64).
BUG=
Review URL: https://codereview.chromium.org//1175523002.
Add deferred deoptimization instructions for return address, pc marker and
object pool pointer. This enables generating unoptimized code lazily
on deoptimization.
This CL does not change the way unoptimized code is generated or collected
yet, but just provides the mechanisms needed. This can be used to allow
code GC for the unoptimized code of optimized functions.
R=iposva@google.com
Review URL: https://codereview.chromium.org//1052563003
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@44934 260f80e4-7a28-3924-810f-c04153c831b5
Uninitialized instances (e.g. closures) can't be printed using ToCString.
Print just the class instead.
Print values/addresses consistently with our disassembly output (no leading zeros)
This makes searching in the trace output easier.
Limit printing source lines to max 80 chars. Otherwise the trace output for
minified Dart code gets unreadable.
R=srdjan@google.com
Review URL: https://codereview.chromium.org//658773002
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@41134 260f80e4-7a28-3924-810f-c04153c831b5
Instead of having special handling for closure calls, pass
the number of input operands down so that the correct lazy
deoptimization environment is generated at calls.
There is no functional change here - this is to simplify
having calls with pushed arguments and input operands
(like closure calls).
Runtime calls still do not have a correct lazy deoptimization environment
the environment should only be used for creating stack traces
from optimized code.
Fix a bug with --trace-deoptimization-verbose printing: We
cannot call ToCString on objects when the slots have not
been filled in yet. (e.g. Closures)
R=vegorov@google.com
Review URL: https://codereview.chromium.org//575443002
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@40306 260f80e4-7a28-3924-810f-c04153c831b5
- Improve escape/alias analysis:
-- Storing an object into a field of another object does not mean that this object escapes (or has aliases) as long as that object does not have any loads from the same place;
-- Places like X.f and Y.f don't alias if X and Y are two different allocation instructions even if X and Y themselves potentially have aliases;
-- Improve precision of alias analysis for indexed properties;
- Support dematerialization and rematerialization of objects that are referenced by other dematerialized objects.
-- Use fix-point algorithm to collect candidates for allocation sinking;
-- Support aborting unsuccessful allocation sinking.
R=fschneider@google.com, johnmccutchan@google.com
Review URL: https://codereview.chromium.org//395943003
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@38404 260f80e4-7a28-3924-810f-c04153c831b5
1. When the input to a BoxInteger operation is in smi-range, we can eliminate
the range check and just perform a smi-tag operation on the input.
2. There was a bug in checking for smi-overflow for range boundaries: Calling Smi::IsValid
with a int64_t argument resulted in silent truncation of the input and therefore a wrong result.
Compiling with -Wconversion would have caught this, but currently we cannot compile with this flag
because of too many broken places.
Instead, I removed Smi::IsValid64 and created one variant Smi::IsValid that is specialized for the
input type with a template parameter. This way calling Smi::IsValid is always safe and will never
result in silent alteration of the input argument.
R=vegorov@google.com
Review URL: https://codereview.chromium.org//353513002
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@37657 260f80e4-7a28-3924-810f-c04153c831b5
On the slow path for a stack overflow check we manually spill the live
registers before our call to the runtime function. We were updating
all uses of these spilled registers in the Environment object but this
was not enough - we also need to update any uses of these spilled
registers in MaterializeObjectInstrs which are hanging off of the
Environment.
This would fail when a deoptimization was triggered during a stack
overflow check and a materialized object happened to refer to
registers.
I've been chasing this for a while and I was able to get it to
reliably reproduce by using the --stacktrace_every=N and the
--stacktrace_filter flags, which were added for this purpose.
ALSO:
Set the top context to null on exceptions/errors. This is needed for
the --verify-incoming-context flag.
Minor printing improvements.
R=fschneider@google.com
Review URL: https://codereview.chromium.org//246303004
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@35443 260f80e4-7a28-3924-810f-c04153c831b5
When untagged values flow into a exception-throwing instruction
they need to be converted eagerly. Catch block entries assume all
values are tagged at the entry.
I changed the generation of moves at throwing
instructions in try-catch: Instead of manuallu emitting moves,
construct a parallel move and use the resolver to emit the native code.
This eliminates a lot of duplicated code from all platforms.
It will also allow to re-use stack space that is currently allocated
separately for each individual try-catch in a function.
I added a few more unrelated minor changes in various parts of the VM
* Simpilify guard code generation
* Resolve refactoring TODO in deoptimization
* Improve names
R=johnmccutchan@google.com
Review URL: https://codereview.chromium.org//125103002
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@31536 260f80e4-7a28-3924-810f-c04153c831b5
This CL has no change in functionality and is purely clean up and
refactoring. Instead of manually generating the moves at throwing
instructions in try-catch, construct a parallel move and use the resolver
to emit the native code. This eliminates a lot of duplicated code
from all platforms.
It will also allow to re-use stack space that is currently allocated
separately for each individual try-catch in a function.
I added a few more unrelated minor changes in various parts of the VM
* Simpilify guard code generation
* Resolve refactoring TODO in deoptimization
* Improve names
R=johnmccutchan@google.com
Review URL: https://codereview.chromium.org//119213002
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@31326 260f80e4-7a28-3924-810f-c04153c831b5
Primarily this change moves deoptimization state/code out of Isolate
and into DeoptContext (formerly DeoptimizationContext). The lifetime
of DeoptizationContext changes to survive through the entire
deoptimization process.
Some minor renaming. DeoptizationContext -> DeoptContext to make it
consistent with DeoptInstr and to save my wrists.
New files deferred_object.{cc,h} contain a bunch of the stuff lifted
from isolate.{cc,h}.
R=fschneider@google.com, srdjan@google.com
Review URL: https://codereview.chromium.org//24834002
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@28112 260f80e4-7a28-3924-810f-c04153c831b5