Commit Graph

136 Commits

Author SHA1 Message Date
Johnni Winther 0a9e57419b [kernel] Make verbose qualified names conditional in toStringInternal
Including the library name/uri in types and member names makes these
unreadable in most cases. This changes that default toStringInternal
to omit the library name/uri but supports a verbose mode that includes
the library name/uri for debugging the rare occasions where they matter.

Change-Id: I783e8bd0ac5d2f19c3051e8e7f226b240c8d1bc8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/141546
Reviewed-by: Jens Johansen <jensj@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2020-03-30 08:41:15 +00:00
Jens Johansen 3e053b7da2 [kernel] Polish toString implementation on AST nodes
Change-Id: I0c21ded156243d8f8ff178d1b31bf0512758ebe1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/141101
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2020-03-27 07:33:38 +00:00
Jens Johansen feefcf0c94 [kernel/CFE] Simplified toString on (ast) nodes
This is a bare-bones implementation (and test) for having an explicit
toString on all `Node`s.
This can then be extended as-needed to better suit our debugging
purposes. It's not allowed to leak, though.

Change-Id: I8d3f5a9cd13b292ed7a6bf33762e507286f3fa7d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/139805
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2020-03-23 10:25:23 +00:00
Johnni Winther 6c6144bb74 [cfe] Implement consolidated in ClassHierarchyBuilder
Closes #40414 and #40156



Change-Id: I066aa8ceef4f998230215fd9e9b446b2281cc3bc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/138294
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
2020-03-13 08:16:49 +00:00
Clement Skau b681bfd8d2 [VM] Fixes bad reuse/typing of temps in async transform invocations.
For a method invocation temps might get allocated for both the receiver
and argument(s) so that:
  A().foo(await null)
becomes:
  Future<void> tmp0
  ...
  tmp0 = A() // <- Type mismatch.
  yield ...
  tmp0 = tmp0.foo(:result) // <- Correct type.

This happens because the liveness analysis finds that the (previously
dynamic) temps can be reused.
Unfortunately 121988 added typing information to these temps, which
means they can't be simply reused in all cases.

This fix makes the temps dynamic again (by removing the type) but adds
unsafecasts to all VariableGets to propagate the know type.

Bug: https://github.com/flutter/flutter/issues/51828
Change-Id: I89c82763e0d4f8b102bb55dec3b694d017345517
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/138500
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Clement Skau <cskau@google.com>
2020-03-06 12:20:45 +00:00
Régis Crelier 5701c4fd3b [VM/nnbd] Remove propagation of library mode to runtime after spec change.
On 1/27/20, the nnbd specification changed weak and strong mode instance checks
to make them behave uniformly across legacy and opted-in libraries.
Therefore, it is not necessary anymore to propagate the library mode in
generated code to the runtime.

Change-Id: I42d3ddc6e9a921899aeac21be6374c7893a6d27c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/138111
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Régis Crelier <regis@google.com>
2020-03-03 20:30:32 +00:00
Johnni Winther 17d8b6b015 [cfe] Do not hoist this expressions
Change-Id: I3ffa0ad7c5c8e98a23c28281ac7840480fd366ce
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/136223
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
2020-02-19 11:31:59 +00:00
Johnni Winther a9485e8b14 [cfe] Encode getter/field invocation as .call on property get
Current semantics with respect to evaluation order is retained.

Change-Id: I6794c8a720237536696afab2fe056042f8464ec8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/129702
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2020-02-17 13:52:45 +00:00
Johnni Winther 80dacdf3a0 [kernel] Add Class.hasConstConstructor and Member.isNonNullableByDefault predicates
Closes #40440

Change-Id: I2776c165d23e2aa2bf5d7515741bd0f0d067b26d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/134292
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
2020-02-06 12:27:37 +00:00
Johnni Winther 54c8066f6f [cfe] Add new flags to AsExpression and IsExpression
Change-Id: I31eba9b4ced051a1067945fd68e60a09b1fa6ed7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/133100
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2020-01-31 19:55:22 +00:00
Régis Crelier b92fefdfe9 [VM/nnbd] Pass nnbd mode from compiler via generated code or bytecode to runtime functions performing type checks or type reification.
This continues the work started in https://dart-review.googlesource.com/c/sdk/+/124105
The nnbd mode is now part of the type arguments instantiation cache,
since the resulting vector depends on the mode.

Change-Id: I803c07fa9473024557db8585e87286f16681169a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/128307
Commit-Queue: Régis Crelier <regis@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Liam Appelbe <liama@google.com>
2019-12-20 03:26:29 +00:00
Samir Jindel 1d4c45d2d0 Re-land "[vm/cfe] Elaborate for-in statements during async transform"
This removes the component of the change which updates the kernel binary
format.

Change-Id: I86dbfe0ea61453bbea6eee200743961d0d0c3814
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/127002
Commit-Queue: Samir Jindel <sjindel@google.com>
Reviewed-by: Teagan Strickland <sstrickl@google.com>
2019-12-05 14:06:08 +00:00
Clement Skau 89e31069e8 Revert "[vm/cfe] Elaborate for-in statements during async transform"
This reverts commit 63333deed6.

Reason for revert: Causes failures on Flutter HHH CI in the "flutter test hostonly_devicelab_tests" step due to kernel binary format version mismatch.

Original change's description:
> [vm/cfe] Elaborate for-in statements during async transform
> 
> This allows us TFA to analyze the iterator calls and we generate much tighter
> code in AOT.
> 
> However, due to the increased inlining opportunities, we end up emitting 0.5%
> more code. Inlining of the _GrowableList iterator specifically also includes the
> concurrent modification check and error handling.
> 
> Calls to get:iterator, moveNext and get:current account for 7.12% of all InstanceCall
> instructions in Flutter Gallery.
> 
> Fixes https://github.com/dart-lang/sdk/issues/39516
> Issue https://github.com/dart-lang/sdk/issues/39566
> Issue https://github.com/dart-lang/sdk/issues/39565
> 
> Change-Id: I8dcc08b7571137e869a16ceea8cc73539eb02a5a
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/126381
> Commit-Queue: Samir Jindel <sjindel@google.com>
> Reviewed-by: Martin Kustermann <kustermann@google.com>

TBR=kustermann@google.com,sjindel@google.com,johnniwinther@google.com

# Not skipping CQ checks because original CL landed > 1 day ago.

Change-Id: I89b88c3d9f7c743fc340ee73a45c3f57059bcf30
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/126734
Reviewed-by: Clement Skau <cskau@google.com>
Reviewed-by: Teagan Strickland <sstrickl@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Clement Skau <cskau@google.com>
2019-12-03 12:29:35 +00:00
Samir Jindel 63333deed6 [vm/cfe] Elaborate for-in statements during async transform
This allows us TFA to analyze the iterator calls and we generate much tighter
code in AOT.

However, due to the increased inlining opportunities, we end up emitting 0.5%
more code. Inlining of the _GrowableList iterator specifically also includes the
concurrent modification check and error handling.

Calls to get:iterator, moveNext and get:current account for 7.12% of all InstanceCall
instructions in Flutter Gallery.

Fixes https://github.com/dart-lang/sdk/issues/39516
Issue https://github.com/dart-lang/sdk/issues/39566
Issue https://github.com/dart-lang/sdk/issues/39565

Change-Id: I8dcc08b7571137e869a16ceea8cc73539eb02a5a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/126381
Commit-Queue: Samir Jindel <sjindel@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2019-11-29 16:42:36 +00:00
Clement Skau d5dbf10672 [SDK] Adds non-eager async stack frame collector.
This is done by collecting all frames on the current stack until an async/async* frame is hit
which has yielded before (i.e. is not in sync-async case).
From there on it finds the closure of the async/async* frame and starts traversing the listeners:
  while (closure != null) {
    yield_index = closure.context[Context::kAsyncJumpVarIndex]
    pc = closure.function.code.pc_descriptors.LookupPcFromYieldIndex(yield_index);
    <emit pc in frame>
    closure = closure.context[Context::kAsyncCompleterVarIndex]._future._resultOrListeners.callback;
  }

Bug: https://github.com/dart-lang/sdk/issues/37668
Change-Id: I97030d22e529bf8a74ecd30a8a2589cfe57ad330
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/122644
Commit-Queue: Clement Skau <cskau@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2019-11-26 11:51:27 +00:00
Johnni Winther 970c164826 [cfe] Use correct types in transformations and start verifying getStaticType
With this fix Expression.getStaticType no longer throws on any known cases.
Users of getStaticType can therefore avoid enclosing static type computation
in try-catch.

Closes #38597

Change-Id: I52eaacd30256333d7c368e5d14f4e4956bafc96f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/121988
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
2019-11-21 22:15:58 +00:00
Alexander Markov fa43799461 [vm/bytecode] Check number of type arguments in non-generic closures
Fixes https://github.com/dart-lang/sdk/issues/39283

Change-Id: I5a5fdf158c6a7ce068be36754ea0487cb754584b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/124470
Reviewed-by: Régis Crelier <regis@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2019-11-08 17:16:37 +00:00
Liam Appelbe c154677699 [vm] Handle trivial initializers for late fields
Bug: https://github.com/dart-lang/sdk/issues/38841
Change-Id: I9db9d4815ad27f3f97d43a7a9f1fb74f08673528
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/124201
Commit-Queue: Liam Appelbe <liama@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2019-11-06 17:46:32 +00:00
Alexander Markov 7ac22ac28f [vm/bytecode] Omit null stores into context when declaring a captured variable
Change-Id: I35c0de039021dd627e8d2604d37675d24c5ec089
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/122481
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2019-10-22 21:01:11 +00:00
Liam Appelbe 45358c5834 [vm] Implementation of NullCheck for bytecode
Bug: https://github.com/dart-lang/sdk/issues/38840
Change-Id: I56af108096355a0486d45f88e795908ce712db4b
Fixes: https://github.com/dart-lang/sdk/issues/38840
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/121904
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Liam Appelbe <liama@google.com>
2019-10-17 19:18:26 +00:00
Alexander Markov 20f9d4d456 [vm,bytecode] Omit initialization of delayed type arguments for non-generic closures
Delayed type arguments are only used by generic closure functions, so
their initialization can be omitted for non-generic closures.

This is the follow-up for 1f58504ee6.

Change-Id: I61b05a4a4e2af4d2d8a543f6eec985a47b811761
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/121924
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2019-10-17 17:53:50 +00:00
Alexander Markov 9e2ce9a773 [vm,bytecode] Avoid duplicated initializing StoreFieldTOS
This is the follow-up for 46cef9bfdd.
After that change, VM's optimizer (canonicalization) removes
initializing stores which store null, even if they're overwriting the
result of another initializing store. This causes incorrect behavior
in cases like this:

class A {
  int x = 3;
  A() : x = null {}
}

To accomodate for this change in the VM's optimizer, bytecode generator
should elide duplicate stores, similarly to AST-based flow graph
builder.

Fixes language_2/field_parameter_test in AOT mode with bytecode.

Change-Id: I9b1e25840f639d88bf62dc990f183878ecf1b59b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/121649
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2019-10-15 18:57:19 +00:00
Alexander Markov 8f679ab9f9 [vm,bytecode] Swap == operands in switch cases
For a switch statement

  switch(foo) {
    case c_1: ...
    ...
    case c_N: ...
  }

Bytecode was calling foo.operator==(c_i). This is less efficient than
c_i.operator==(foo), as c_i is a constant with a known actual type
and operator== can be always devirtualized and inlined.

Change-Id: I786ea193de1fa1830854602318e436f601296f5e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/121405
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Régis Crelier <regis@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2019-10-11 21:11:40 +00:00
Alexander Markov 62ee78eeec [vm,bytecode] Generate calls for causal-async-stacks more consistently
In order to support causal-async-stacks, the following synthetic calls
are inserted: _asyncStackTraceHelper, _setAsyncThreadStackTrace and
_clearAsyncThreadStackTrace.

_asyncStackTraceHelper is always generated in the async transformation.
_setAsyncThreadStackTrace and _clearAsyncThreadStackTrace are inserted
during bytecode generation (or in the flow graph builder in case of AST
pipeline). If bytecode generation options are set inconsistently with
--causal-async-stacks VM option, then it was possible that
_asyncStackTraceHelper was generated but other calls were not generated,
causing incorrect (full, non-truncated) async stack traces. This also
causes performance regression as collecting full stack traces takes
much more time.

This change makes generation of all these calls more consistent: if
causal async stacks are disabled during bytecode generation, then all
three calls are omitted. Also, in case these calls were generated and
present in bytecode, but VM option --causal-async-stacks is disabled,
then bytecode flow graph builder turns all these three calls into no-ops.

Change-Id: I93eb1d83c675ee093799bb8e37ca3d60a3c5c19d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/120927
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Régis Crelier <regis@google.com>
2019-10-09 22:10:21 +00:00
Alexander Markov 3bb32f6778 [vm/bytecode] Generate complex conditions more efficiently in bytecode
Change-Id: I7cbf3a91dc96843f10af9560a58269badbe31bac
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/109729
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Régis Crelier <regis@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2019-10-09 19:32:54 +00:00
Alexander Markov 2ca6bc29b3 [vm,bytecode] More efficient bytecode for calls through fields/getters
Previously, calls through field/getter were generated as dynamic calls
because InterfaceCall with field/getter target doesn't correctly
represent what such call should do. This results in a quite inefficient
code in AOT mode.

With this change, calls through fields/getters are decomposed into two
calls, while keeping the same order of evaluation.

Change-Id: Ieb33927c1b39d1b4d8eafb7bd542675820474068
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/120628
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Régis Crelier <regis@google.com>
2019-10-08 22:27:10 +00:00
Alexander Markov 1ed707703d [vm/bytecode] Mark try blocks generated for try/finally as synthetic
This matches behavior of AST-based flow graph builder. Debugger ignores
synthetic (is_generated) try blocks when it figures out if thrown
exception is unhandled, so in order to ignore all try/finally blocks
they should be marked as synthetic.

Fixes https://github.com/dart-lang/sdk/issues/38697

Change-Id: I06840362a255b500e1e9317af90a61bbdea2a310
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/119726
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Régis Crelier <regis@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2019-10-02 23:15:11 +00:00
Alexander Markov 5920048fa2 [vm,aot,bytecode] Handle direct-call metadata when generating bytecode
AOT transformations add vm.direct-call.metadata with devirtualization
information to AST nodes.

Bytecode generator should take this information into account when
generating bytecode in case of AOT. Bytecode format is extended with
CheckReceiverForNull and UncheckedDirectCall instructions, and
DirectCallViaDynamicForwarder constant pool entry in order to represent
devirtualized calls.

Change-Id: I697432ddd0b58d2d0413715132ba5e90eb606ec1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/119201
Reviewed-by: Régis Crelier <regis@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2019-10-01 00:20:48 +00:00
Dmitry Stefantsov 515a597710 [cfe] Remove Class.rawType
Bug: http://dartbug.com/38224
Change-Id: If0af5487b1d43125738575ee3e0fcd747db54fa9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/117546
Commit-Queue: Dmitry Stefantsov <dmitryas@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2019-09-19 10:42:10 +00:00
Alexander Markov 3e1154cb5b [vm/bytecode] Move CheckStack after function type arguments handling
When generating deopt info in SIMDBC mode (DeoptInfoBuilder::AddCopy,
DeoptInfoBuilder::ToCpuRegisterSource) kSpecialDbcRegister source
locations are not supported.

In order to avoid such deopt info, this change moves CheckStack bytecode
instruction after function type arguments handling is finished (function
type arguments handling uses arguments descriptor which resides in
kArgsDescriptorsReg special DBC register). This placement of CheckStack is
also more aligned with what AST-based flow graph builder generates.

Fixes lib_2/math/min_max_test with bytecode in dartk-reload-mac-release-simdbc64
configuration.

Change-Id: I7d9863b8290a78a6e24e5806cc5053d55c93ce5c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/117221
Reviewed-by: Régis Crelier <regis@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2019-09-13 23:03:55 +00:00
Alexander Markov 13a69b5631 [vm/bytecode] Replace ICData constant pool entries with DynamicCall
VM no longer relies on distinct ICData entries in constant pool, and
it no longer creates actual ICData objects.

This change introduces new DynamicCall constant pool entry which is
 * de-duplicated;
 * stores arguments descriptor inline instead of allocating a separate
   constant pool entry and referencing it by index;
 * reserves extra slot in constant pool (like other call constants), so
   we can eventually remove creation of extra UnlinkedCall objects.

Change-Id: I8d21954803ca5be5b6fc8335b700e8a9086245cf
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/116120
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Régis Crelier <regis@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2019-09-07 02:17:37 +00:00
Alexander Markov 4fbd758f9e [vm/bytecode] Optimize comparisons with null
BinaryTrees(RunTime): 72191.33325 us. -> 68058.06103333333 us.
(linux/x64, bytecode compiler enabled)

Issue: https://github.com/dart-lang/sdk/issues/36429

Change-Id: Ie5344d874f6b4afc5e8b6516fc6283d83963f17f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/115601
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Régis Crelier <regis@google.com>
2019-09-05 17:52:41 +00:00
Régis Crelier 5da853060c [vm/bytecode] Move prologue CheckStack opcode after closure context is copied.
The bytecode generator should not emit a CheckStack before the initial context
is properly setup. This fixes #38110.

Change-Id: I94000ebe698437d088c0e307a8735b11cfcd9c8f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/115066
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Régis Crelier <regis@google.com>
2019-08-30 21:22:29 +00:00
Dmitry Stefantsov d4342b9021 [cfe] Print Kernel's type-parameter types in more details in text
Change-Id: I10cb27cba22ce91eca4e5cceed53a2753c6d4573
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/114943
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2019-08-30 10:11:40 +00:00
Alexander Markov f255c0c8d3 [vm/bytecode] Revise PushStatic bytecode instruction
PushStatic instruction expects field object to be pushed onto the stack.
This is useless, as PushStatic also references field with its D operand.
This change replaces PushStatic instruction with LoadStatic which doesn't
take field object on the stack, so PushConstant/PushStatic pair is replaced
with a single LoadStatic instruction.

This change also enables constant propagation of values of injected CID
fields, which are not known at bytecode generation time.

Change-Id: Ifbdd3aea2aab338f6c9ec3e5728948c4d8541a4b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/112489
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Régis Crelier <regis@google.com>
2019-08-09 21:02:31 +00:00
Alexander Markov ac45ee7e63 [vm/bytecode] Support exactness tracking in bytecode
MicroClosureCreateTearoffClassSecondTime(RunTime) 3922 us -> 2030 us.

Issue: https://github.com/dart-lang/sdk/issues/36429
Change-Id: I3a6f93950a469969d82243fd1744d5a4f7fb1e78
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/111868
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2019-08-03 17:36:31 +00:00
Dmitry Stefantsov 20e4c74f7f [fasta][nnbd] Print NNBD type modifiers in Kernel's text representation
Change-Id: I48c43858094e2b7264a15be05238bfc3dadd5ecb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/108264
Commit-Queue: Dmitry Stefantsov <dmitryas@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2019-07-31 08:26:14 +00:00
Siva Annamalai d9287f4fe6 Reland "[dart] Enable constant-update-2018"
This reverts commit 83d2aaa072.

Reason for revert: Want to reenable const-update-2018 by default.

Original change's description:
> Revert "[dart] Enable constant-update-2018"
> 
> This reverts commit 9bbd3192f4.
> 
> Reason for revert: Reverting enabling of constant-update-2018 by default as some blocking issues were found that are breaking Flutter and preventing rolls of Dart into Flutter. Once the blocking issues are addressed and fixed this CL will be relanded.
> 
> Original change's description:
> > [dart] Enable constant-update-2018
> > 
> > Change-Id: Ib3942b4f6e336a02826305d9f81839333a5464a0
> > Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/106943
> > Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
> > Commit-Queue: Vyacheslav Egorov <vegorov@google.com>
> 
> TBR=paulberry@google.com,vegorov@google.com,athom@google.com,vsm@google.com,aadilmaan@google.com
> 
> # Not skipping CQ checks because original CL landed > 1 day ago.
> 
> Change-Id: I5796881412cec464f450ff3894ca253c58edc4a2
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/109308
> Reviewed-by: Siva Annamalai <asiva@google.com>
> Reviewed-by: Vijay Menon <vsm@google.com>

TBR=paulberry@google.com,vegorov@google.com,athom@google.com,vsm@google.com,asiva@google.com,aadilmaan@google.com

# Not skipping CQ checks because original CL landed > 1 day ago.

Change-Id: I06fbeef318706074c0efcfd42b459bf37c3c92e7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/109661
Reviewed-by: Siva Annamalai <asiva@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
2019-07-25 16:58:49 +00:00
Alexander Markov fedd74669a [vm/bytecode] Support multiple entry points when compiling from bytecode
DeltaBlueClosures +26.54%

Closes https://github.com/dart-lang/sdk/issues/36889
Issue: https://github.com/dart-lang/sdk/issues/36429

Change-Id: I8920c7985366a2c955a06013aa9f58763fcbced9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/109580
Reviewed-by: Régis Crelier <regis@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2019-07-20 00:05:23 +00:00
Alexander Markov f450cf399e [vm/bytecode] Add UncheckedClosureCall instruction
This improves performance of closure calls:
DeltaBlueClosures: +25.14%
DartMicroBenchMM.MaxLib +40.91%
DartMicroBenchMM.MinLib +42.58%

Change-Id: I13000e20b9433ce77bb2ba5209513de575656036
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/109220
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Régis Crelier <regis@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2019-07-17 21:05:44 +00:00
Siva Annamalai 83d2aaa072 Revert "[dart] Enable constant-update-2018"
This reverts commit 9bbd3192f4.

Reason for revert: Reverting enabling of constant-update-2018 by default as some blocking issues were found that are breaking Flutter and preventing rolls of Dart into Flutter. Once the blocking issues are addressed and fixed this CL will be relanded.

Original change's description:
> [dart] Enable constant-update-2018
> 
> Change-Id: Ib3942b4f6e336a02826305d9f81839333a5464a0
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/106943
> Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
> Commit-Queue: Vyacheslav Egorov <vegorov@google.com>

TBR=paulberry@google.com,vegorov@google.com,athom@google.com,vsm@google.com,aadilmaan@google.com

# Not skipping CQ checks because original CL landed > 1 day ago.

Change-Id: I5796881412cec464f450ff3894ca253c58edc4a2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/109308
Reviewed-by: Siva Annamalai <asiva@google.com>
Reviewed-by: Vijay Menon <vsm@google.com>
2019-07-16 22:30:36 +00:00
Vyacheslav Egorov 9bbd3192f4 [dart] Enable constant-update-2018
Change-Id: Ib3942b4f6e336a02826305d9f81839333a5464a0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/106943
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Commit-Queue: Vyacheslav Egorov <vegorov@google.com>
2019-07-12 12:32:34 +00:00
Alexander Markov 5042ff97c7 [vm/bytecode] Add async/async*/sync* attributes to closures
Change-Id: Ibb0f202ada840ee112f46d5db3d8f9459817c358
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/106730
Reviewed-by: Régis Crelier <regis@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2019-06-20 20:23:37 +00:00
Alexander Markov da8cb470cc [vm/bytecode] Represent classes, libraries, scripts and recursive types in bytecode
Size of a large application:
Before: 26628600
After: 21480120 (-19.3%)

Size of snapshots:

isolate_snapshot_framework.bin
Before: 9322496
After: 6782976 (-27.2%)

isolate_snapshot_product_framework.bin
Before: 9166848
After: 6602752 (-27.9%)

Regressions in tests:

1) Test language_2/type_alias_equality_test/04 fails similarly to default mode, as VM
does not implement comparison of function types according to the specification.
Previously this test was passing as function types were canonicalized in bytecode,
which was not always correct. This CL fixes the problem with canonicalization of
function types in bytecode and the test starts failing again.

2) Tests standalone_2/entrypoints_verification_test, standalone_2/io/test_extension_test,
standalone_2/io/test_extension_fail_test fail as native extensions are not supported
in bytecode yet. These tests start passing after df5e7aac17,
which switched bytecode tests to kernel service (on x64), because kernel service doesn't
drop ASTs. This CL switches from reading AST library declarations to bytecode even if
AST is not removed, so tests fail again.

Change-Id: I8b7ba44bfa49d0b1599b2509553ff7c831a4e244
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/104700
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Reviewed-by: Régis Crelier <regis@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2019-06-20 18:27:21 +00:00
Alexander Markov 68de477535 [vm/bytecode] Compact encoding of bytecode instructions (part 3/3)
Corresponding VM changes:
https://dart-review.googlesource.com/c/sdk/+/101062

On a large app, size of bytecode instructions:
Before: 12115384
After: 6282376 (-48.1%)

Total size of the app:
Before: 29790240
After: 23681504 (-20.5%)

Change-Id: Idd8f97e991236c25d663d1bcf18a51a53e73a2b7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/99400
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2019-05-08 17:33:15 +00:00
Alexander Markov 8924c18003 [vm/tests] Revert changes in pkg/vm unit tests after constant-update-2018 was disabled
Pkg/vm tests were adjusted after constant evaluation was enabled in the front-end.
As constant evaluation was reverted (4b7d256a06),
we also need to revert corresponding changes in pkg/vm unit tests.

Revert "[vm/bytecode] Update expectations for bytecode generator unit test"

This reverts commit 734c50cbf2.

Revert "[vm/aot/tfa] Update TFA tests after front-end starts evaluating constants"

This reverts commit 25cb45c02f.

Change-Id: I2fcc30571bec2dd904925724ddb7105567c7ecda
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/99782
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2019-04-19 18:12:21 +00:00
Alexander Markov 734c50cbf2 [vm/bytecode] Update expectations for bytecode generator unit test
This update is needed after constant-update-2018 is enabled in
e9ca6a5335

Closes https://github.com/dart-lang/sdk/issues/36601

Change-Id: I25f33e504f4df09a0d936fd11c7fa9c6236e4c78
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/99265
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2019-04-12 20:15:40 +00:00
Alexander Markov ebd13e891f [vm/bytecode] Add UncheckedInterfaceCall instruction
dart --use-bytecode-compiler NavierStokes.dart
Before: NavierStokes(RunTime): 8909.053017777778 us.
After: NavierStokes(RunTime): 7221.510314079423 us.

Issue: https://github.com/dart-lang/sdk/issues/36429
Issue: https://github.com/dart-lang/sdk/issues/36428

Change-Id: Ib1be4dd20cdc25e3b979a91a098f67a7bc00df8a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/98945
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Reviewed-by: Régis Crelier <regis@google.com>
2019-04-10 21:49:23 +00:00
Kevin Millikin b700223542 [cfe] Do not reset the VM async name generator
In the VM-specific async transformation, an index is used to generate
fresh temporary names for values that are live across an await.
Before it was always 0 when translating a statement because there are
no live values on entry or exit to a statement.

When translating statements nested inside block expressions there can
be live values, so the index should not be reset.

Closes https://github.com/dart-lang/sdk/issues/36466

Change-Id: I6103d75c25f312ab1538a7c0f8fee0fea9f01b27
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/98664
Commit-Queue: Kevin Millikin <kmillikin@google.com>
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
2019-04-05 09:00:24 +00:00
Alexander Markov 38dbddc90d [vm/bytecode] Add AllocateClosure bytecode
AllocateClosure bytecode is used to convey information about closure
function into an instance allocation site. This allows VM inliner to see
closure function very early at the optimization pipeline and enables
inlining of closure calls.

DeltaBlueClosures in JIT/bytecode mode (--use-bytecode-compiler):
Before: DeltaBlueClosures(RunTime): 1746.5404424083767 us.
After: DeltaBlueClosures(RunTime): 1291.4649496449324 us.

Issue: https://github.com/dart-lang/sdk/issues/36342
Issue: https://github.com/dart-lang/sdk/issues/36429
Issue: https://github.com/dart-lang/sdk/issues/36428
Change-Id: I6e94cdc2eb30110b0651a86bd2bdc40dcdd63207
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/98439
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2019-04-05 00:00:13 +00:00