Commit Graph

157 Commits

Author SHA1 Message Date
Régis Crelier a290271dea [vm/bytecode] Throw should be 'debug checked', but not ReThrow.
Since both throw and rethrow statements share the same 'Throw' bytecode opcode
(differentiated by an operand), we make the opcode not implicitly 'debug
checked' anymore.
Instead, we emit a 'DebugCheck' opcode for the throw statement only.

This fixes the following test:
service/async_single_step_exception_test

Change-Id: I4e540ea0a640fda5365d51933ce4e5125548e2f2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/114754
Commit-Queue: Régis Crelier <regis@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2019-08-28 22:20:53 +00:00
Alexander Markov 6784bcb370 [vm/bytecode] Fix source position for catch clause
Fixes service/next_through_multi_catch_test with bytecode.

Change-Id: I095b3a784f3e59b64f493ec43b265a70f295a0f4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/114880
Reviewed-by: Régis Crelier <regis@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2019-08-28 18:19:51 +00:00
Alexander Markov 5cbcc88304 [vm/bytecode] Add DebugCheck for variable set with as-expression RHS
This emulates behavior of AST-based flow graph builder which would
insert DebugStepCheck if RHS is LoadLocal.
As-expression generated by AST-based flow graph builder results
in LoadLocal (unless it's casting to a top type).

Fixes service/next_through_is_and_as_test with bytecode.

Change-Id: Icb809d42daf2a4ebbad22bfa92bc737406144489
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/114740
Reviewed-by: Régis Crelier <regis@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2019-08-28 02:27:03 +00:00
Régis Crelier 726762c4bd [vm/bytecode] Remove source information from setAsyncThreadStackTrace in prolog.
Removing source information for this call prevents the debugger to set a
breakpoint in compiled bytecode on this call which occurs prior to the first
DebugStepCheck in the function.

However, this change uncovered a bug in debugging interpreted bytecode:
The first source range of an async_op function gets split into 3 ranges, with
the middle range specifying a NoSource token position. The debugger does not
set a breakpoint in the first range, because DebugCheck is not yet encountered,
which is correct, but it failed to look for another range (the 3rd one) with the
same token position.

Change-Id: I11dcc75d115cb57b37f62afd83c783cf563b63e0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/114700
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Régis Crelier <regis@google.com>
2019-08-27 22:45:52 +00:00
Alexander Markov f2ab9478ee [vm/bytecode] Avoid extra DebugCheck in variable declaration
The extra DebugCheck is skipped depending on the initializer expression,
similarly to VariableSet.

This matches how AST-based flow graph builder inserts DebugStepCheck for
VariableDeclaration.

Test: runtime/observatory/tests/service/async_star_step_out_test.dart
Change-Id: Id1b11813b533996e219891f416e7008a994dbc51
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/114593
Reviewed-by: Régis Crelier <regis@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2019-08-27 16:52:17 +00:00
Aske Simon Christensen d44ada3c52 [vm] Remove constant evaluator calls in the VM and bytecode generator.
These are unnecessary now that constant evaluation is performed as
part of the front-end transformations.

Change-Id: Ia7c47476ddd4d4b3d0483eb4e40cab7677ec5b7c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/112243
Commit-Queue: Aske Simon Christensen <askesc@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2019-08-27 14:07:55 +00:00
Aske Simon Christensen 497765f59f [vm] Move VM constant patching before constant evaluation.
This ensures that the VM host endian optimization described in
http://dartbug.com/32836 works properly after the explicit call to
the constant evaluator in the AOT compiler is removed.

Change-Id: I69424c7d27d113a70700a5cdad345bf632272ab6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/112083
Reviewed-by: Martin Kustermann <kustermann@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2019-08-27 14:07:55 +00:00
Alexander Markov e878bdafe9 [vm/bytecode] Add DebugCheck to stop at return statement before executing finally blocks
Fixes service/debugging_inlined_finally_test in bytecode mode.

Change-Id: I323c3db7a5c31b840d178daffa65d0281e072a21
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/114588
Reviewed-by: Régis Crelier <regis@google.com>
2019-08-26 23:52:30 +00:00
Alexander Markov da4e6eb6e3 [vm/bytecode] Correct source positions for for-in statements
Fixes service/next_through_for_each_loop_test in bytecode mode.

Change-Id: Ida3269f3ca6127b088855f173bd8a2e18faf884d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/114553
Reviewed-by: Régis Crelier <regis@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2019-08-26 22:03:08 +00:00
Alexander Markov a00a8df2d9 [vm/bytecode] Correct source positions for switch cases
This fixes the following tests in bytecode mode:
service/step_through_switch_test broke
service/step_through_switch_with_continue_test

Change-Id: I3f6f835185b9dae86e5ebebfdd4484b4d1cb6af0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/114549
Reviewed-by: Régis Crelier <regis@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2019-08-26 20:44:06 +00:00
Alexander Markov 524f78e6cb [vm/bytecode] Fix symbols for private parameter names
Fixes lib_2/mirrors/initializing_formals_test/03 test in bytecode mode.

Change-Id: I937b9f1d3651cbfb3ea7531105d21589f94e7961
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/114460
Reviewed-by: Régis Crelier <regis@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2019-08-23 23:36:18 +00:00
Alexander Markov 6ee9e67156 [vm/bytecode] Mark synthetic calls in source positions so debugger can skip them
Change-Id: I40ea385f650e04433ed404c51ee78e128f37445a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/114303
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Régis Crelier <regis@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2019-08-23 17:06:11 +00:00
Alexander Markov 5e428ed638 [vm/bytecode] Fixes for expression evaluation
* Set parent for TypeParameters created in createExpressionEvaluationComponent.

* Resolve references from bytecode to an expression evaluation class
  using real class. Expression evaluation class could be referenced
  from type parameters.

* Avoid registering expression evaluation classes in hierarchy. They
  shouldn't be discovered through direct subclasses or implementors,
  as expression evaluation classes don't have cids.

* Add :function_type_arguments_var local variable to bytecode local
  variables info, so expression evaluation can find function type
  arguments which are in scope.

Change-Id: I515431a989b4d02af4ecf90579931dd59d3acadd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/114182
Reviewed-by: Régis Crelier <regis@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2019-08-22 22:53:12 +00:00
Alexander Markov 3617c8d704 [vm/bytecode] Add missing DebugCheck to local function declaration
This debugger stop is generated by AST-based flow graph builder but
not covered by stopping at any particular bytecode instruction.

Change-Id: Id9c53cbbcda5ec589c7a24917fb9d79f5a27452b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/114183
Reviewed-by: Régis Crelier <regis@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2019-08-22 21:17:45 +00:00
Alexander Markov 9fda4c1101 [vm/bytecode] Avoid using closure call instructions if code coverage may be needed
This is a workaround to https://github.com/dart-lang/sdk/issues/37944.
Closure call instructions are not tracked by code coverage, so this change
avoids generating them in bytecode if incremental kernel compiler is used -
when vm-service is enabled with command-line option and code coverage
may be needed.

Change-Id: Ifb3bc5e90a9f8ccb04073994d761bc301bc274ab
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/114045
Reviewed-by: Régis Crelier <regis@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2019-08-22 00:28:34 +00:00
Alexander Markov 5e5313c8d6 [vm/bytecode] Keep unreachable code for code coverage
This change adds a bytecode generation option 'keep-unreachable-code' to
avoid eliminating unreachable code from constant conditions.
This option is enabled in kernel service.

If unreachable code is eliminated, then call instructions are not generated
and ICData objects are not created. Source code report is collected
using created ICData objects and will not flag the unreachable code as
not executed.

Change-Id: Ic73e19c653505e0dfab4648ab65ef6b90370e0b4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/113960
Reviewed-by: Régis Crelier <regis@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2019-08-21 02:28:44 +00:00
Alexander Markov 922c2bfbb0 [vm/bytecode] Include source info and asserts into platform with bytecode
* Include source positions, source text (if provided by front-end, which is
  controlled by a separate option) and assertions into platform with bytecode.
  Also use environment defines if provided.

* Omit bytecode for synthetic static fields '_redirecting#' injected
  by front-end, as they contain invalid AST nodes (taking tear-off of
  a constructor). This is needed to avoid emitting bytecode which cannot be
  loaded.

* Correctly merge source information such as source text and line numbers
  in bytecode generator if the script was originally created for an
  anonymous mixin application without such information.

* Always include import URIs into source information, even if other information is
  excluded (for members in anonymous mixin applications / noSuchMethod forwarders /
  forwarding stubs).

* Set native resolvers for vm/cc/PrintJSON test, as printing all objects to JSON
  involves collecting token positions, which may read bytecode from platform and
  need native resolvers to process native method entries.

Change-Id: I971e880c25439c0ec69db3a231a0085ccd5d15ad
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/113780
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Régis Crelier <regis@google.com>
2019-08-21 01:08:24 +00:00
Alexander Markov 513ef1dfe1 [vm/bytecode] Avoid using map().toList() in bytecode generator
Code map((x) => ...).toList() is less efficient compared to an explicit loop.
Replacing these code patterns with loops slightly improves bytecode generation
speed (dart2js 1271 -> 1188 ms).

Also, map with closure consumes more stack space which results in flaky
stack overflow errors in kernel service on a test with deeply nested constants.

Change-Id: If209fc28d521abcbad46b5b2c7cffefcf8cd0ecb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/113217
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Régis Crelier <regis@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2019-08-15 22:15:02 +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 ea9091b278 [vm/bytecode] Drop abstract and generate body for static external functions
Fixes crash in bytecode reader when trying to read body of
'abstract static external' function in test
co19_2/Language/Functions/External_Functions/not_connected_to_a_body_t01.

Change-Id: Ie60a6467a1b05aaf4c78baca50d67d29dfad3751
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/111984
Reviewed-by: Régis Crelier <regis@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2019-08-05 23:16:07 +00:00
Régis Crelier c923007f37 [vm/bytecode] Fixes and improvements in bytecode debugger.
Remove DebugCheck on Jump opcode.
Emit explicit DebugCheck bytecode instructions for VariableSet (see CL 111221).
Emit explicit DebugCheck bytecode instructions for VariableDeclaration.
Emit explicit DebugCheck bytecode instructions in _generateNonLocalControlTransfer before context is unwound.
Refactor prologue of async op functions, so that the same DebugCheck opcode is
encountered on every reentry.
Allow extra single steps when debugging bytecode in service tests.
Support context level calculation of compiled frames.
Adjust filter of synthetic variables in debugger.
Fix logic to skip single steps in bytecode prologue.

Change-Id: I1d6236c37af1aded0eebca1c3e3bb1978f7369dc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/111867
Commit-Queue: Régis Crelier <regis@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2019-08-05 17:54:17 +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
Alexander Markov aa650e53f5 [vm/bytecode] Emit explicit DebugCheck bytecode instructions for VariableSet
AST-based flow graph builder has a heuristic logic on when to generate
DebugStepCheck when assigning value to a variable. This logic depends on
right-hand side expression. In order to replicate the same behavior
with bytecode, bytecode generator would also implement this logic and
generate explicit DebugCheck instructions instead of stopping on every
StoreLocal/PopLocal/StoreContextVar.

Change-Id: Ic10180673a324db9216e34459d9c0afaca6a11e6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/111221
Reviewed-by: Régis Crelier <regis@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2019-08-03 01:34:45 +00:00
Alexander Markov 0a2fb22230 [vm/bytecode] Use simpleInstanceOf for rare types in bytecode
Corresponding change in the kernel AST flow graph builder:
https://dart-review.googlesource.com/c/sdk/+/110566.

Change-Id: Ia7c7d16824dc03eb0980b0b8aa28aa882d70c5b2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/110741
Reviewed-by: Régis Crelier <regis@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2019-07-29 17:30:16 +00:00
Ryan Macnak 9fe8865f4a [vm, bytecode] Implement ParameterMirror and enable mirror tests.
In particular, mirrors_reader_test no longer crashes.

Change-Id: I602e7d85755dafd943fe84d20831f0f35484b387
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/108968
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2019-07-25 00:04:02 +00:00
Alexander Markov 211190e7ec [vm/bytecode] Reuse ConstantEvaluator instance in bytecode generator
By reusing ConstantEvaluator instance among members we avoid
recalculating values of constant static fields.

Change-Id: I5c13489a353bf101cd4a01d5993e44842042c2d6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/109892
Reviewed-by: Régis Crelier <regis@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2019-07-22 20:43:30 +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
Régis Crelier 1ddb120eaa [vm/bytecode] Improve bytecode debugger.
While stepping, do not stop more than once in the same token range.
Adjusted tests expecting multiple stops at same location.
Fixed emitted source position of DebugCheck opcode in async op.
Ignore all possible breakpoint positions until the first DebugCheck opcode of
the function, so as to not stop in the prologue where arguments are not yet
accessible.
Fixed look up of context level in debugger.
Use receiver to look up async op closure in frame instead of named captured
variable.
Made StoreContextVar a 'debug checked' opcode.
Implemented rewind of interpreted frames.
Marked get_source_report_test as (temporarily) failing in status file.
Removed fixed and passing regression test from status file.

Change-Id: I9396d3cf4b6accc85753bb6d227b7c068acc8df7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/109558
Commit-Queue: Régis Crelier <regis@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2019-07-19 18:19:50 +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
Ryan Macnak c6bc0031f3 [vm, bytecode] Field initializer for schema changes.
Bug: https://github.com/dart-lang/sdk/issues/32299
Change-Id: Id6359ad36db183f4cdd091e7fd778c879e868d99
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/108901
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2019-07-15 22:58:16 +00:00
Alexander Markov 78a8f670eb [vm/bytecode] Initial support for bytecode generation in incremental compiler
This change adds support for bytecode generation in incremental compiler in
kernel service. Bytecode generation is performed as a post-processing step,
after delta components are merged.

Bytecode generation requires CoreTypes and ClassHierarchy, which cannot be
constructed using delta component from incremental compilation (as it doesn't
contain platform or previously compiled libraries). The solution is to obtain
CoreTypes and ClassHierarchy directly from incremental compiler.

Now the following tests work:
vm/cc/IsolateReload_KernelIncrementalCompile
vm/cc/IsolateReload_KernelIncrementalCompileAppAndLib

Change-Id: I34c5870b01850c057ace71a63f8effa5b010cfcf
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/108682
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
2019-07-12 20:45:26 +00:00
Vyacheslav Egorov e82ca2f366 [fasta] Unconditionally enable asserts in const constructors
Based on feedback from the language team (https://github.com/dart-lang/language/issues/447).

Removal of CompilerOptions.enableAsserts is pending cleanup in DDK.

Change-Id: Id515e91da3e31647941ce893b2cffc58894a1b1d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/108813
Commit-Queue: Vyacheslav Egorov <vegorov@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2019-07-12 15:42:43 +00:00
Alexander Markov 9503969664 [vm/bytecode] Add DebugCheck bytecode instruction
DebugCheck bytecode instruction is generated after parameter variables
are declared and copied into their locations in the prologue.
It helps debugger to stop in the beginning of a function at the point
where parameters can be inspected. It is generated only if
'--bytecode-options=debugger-stops' is specified.

Change-Id: I0f3b1ea8dc45d762a5dcee75b5d3a4ffc0b2a1b1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/108371
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Régis Crelier <regis@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2019-07-09 19:14:53 +00:00
Régis Crelier 307ca3f3b6 [vm/bytecode] Improve single stepping and breakpoint setting in bytecode.
Modified list of bytecodes that check for debug breaks (wip).
Make sure source positions are not interpreted as return addresses.
Fix skipping of bytecode stub frames when stepping.
Fix DEBUG_CHECK macro to call debugger twice for breakpoint and following step.
Various minor bug fixes and printing improvements.

Change-Id: I36713de0548d060eddb7cbfd6fadb05c731e881a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/108205
Commit-Queue: Régis Crelier <regis@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2019-07-09 17:08:39 +00:00
Alexander Markov f91089faaf [vm/bytecode] Add yield point markers to source positions
Issue: https://github.com/dart-lang/sdk/issues/36427
Change-Id: I384161fd27b977e05796666c9a1a1e336d4d6440
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/107572
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2019-06-28 17:13:51 +00:00
Alexander Markov 1eb113ba27 [vm/bytecode] Support native extensions
Change-Id: I224f740db674e20d643191605d0a7463bf85d39f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/107451
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2019-06-27 20:24:25 +00:00
Ryan Macnak 5c1d5444d6 [vm, bytecode] Fix some source position discrepancies.
Fix most cases of accessing metadata; parameter annotations still missing.

Change-Id: Ie78c3d817a86a656548cdc5775f837250a710095
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/106967
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Régis Crelier <regis@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2019-06-25 00:57:26 +00:00
Alexander Markov bc8b6fb94d [vm/bytecode] Fix last source position in a function
Change-Id: Id3b9c6476cc3745a39a7010b7ae09d2422467e31
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/107182
Reviewed-by: Régis Crelier <regis@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2019-06-24 19:25:07 +00:00
Alexander Markov 7c63999e74 [vm/bytecode] Correct scripts for members not from the script of enclosing class/library
This change ensures that fields and functions have correct script if their
script doesn't match script of enclosing class/library.

Change-Id: Icd598707fd8a3d8227b425ecbe3a9f6806c73d7a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/107060
Reviewed-by: Régis Crelier <regis@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2019-06-24 18:06:38 +00:00
Alexander Markov 37a25d9100 [vm/bytecode] Add a compile-time error if there are too many arguments.
Issue: https://github.com/dart-lang/sdk/issues/37305
Change-Id: I9dac7c1b7b49fca8531ca2bf83b1c309d8217969
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/106984
Reviewed-by: Aart Bik <ajcbik@google.com>
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2019-06-24 16:02:05 +00:00
Alexander Markov f6af8ccba8 [vm/bytecode] Consolidate bytecode generation options
As number of bytecode generation options grows, it becomes cumbersome
to add them and propagate from the place where they are parsed to
the place where they are used. In order to make it easier to
change and add new bytecode generation options, this CL introduces
BytecodeOptions class which consolidates all options for bytecode
generation. Also, command line options --emit-bytecode-*** are gathered
into a single multi-option --bytecode-options=opt1,opt2,...

Also, unused --use-future-bytecode-format option is cleaned up. If needed,
it could be easily re-introduced in the new BytecodeOptions.

Change-Id: I637bf28ceb4233ead2562afe7ad51c69a99f2d60
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/106965
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2019-06-21 20:31:38 +00:00
Alexander Markov 0ae10fa68d [vm/bytecode] Support --causal_async_stacks in bytecode generator
Also, standalone_2/causal_async_stack_test is updated to actually
test --causal_async_stacks after Dart 2 sync-async.

Change-Id: I28a7a281963828707461652f19494ff54bdd21c8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/106760
Commit-Queue: Alexander Markov <alexmarkov@google.com>
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 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 86ea9ad1e7 [vm/bytecode] Add source positions for more bytecode instructions
Also, correct source position for CheckStack instruction in the prologue of
a closure.

Change-Id: I175e5398296f17a1f67a223d45725206e65e0e8b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/105040
Reviewed-by: Régis Crelier <regis@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2019-06-05 21:06:56 +00:00
Alexander Markov 372b02d97f [vm/bytecode] Add information about local variables to bytecode
Change-Id: I22bbd3b7ea0cccc0a8d721c3766a80ae1c72060d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/87701
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Régis Crelier <regis@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2019-05-30 21:21:44 +00:00
Alexander Markov ec4d48e241 [vm/bytecode] Add starting and ending source positions for closures
Issue: https://github.com/dart-lang/sdk/issues/36427
Change-Id: Ib2f55504f9238036a9700f1e2672b4641536ab7c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/103480
Reviewed-by: Régis Crelier <regis@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2019-05-22 19:02:40 +00:00
Alexander Markov 477ad3c0ea [vm/bytecode] Eliminate asserts from bytecode unless --enable-asserts
Total size of a large app:
Before: 23681504
After: 23207344 (-463K/-2%)

Size of bytecode instructions:

Before: 6282376
After: 5981716 (-4.8%)
Change-Id: I57703616ecc91301c928672c83571482500dc365
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/101883
Reviewed-by: Régis Crelier <regis@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2019-05-09 20:41:21 +00:00
Alexander Markov e9bec21d13 [vm/bytecode] Cleanup after switching to compact bytecode instructions
Change-Id: Ie6ecdd88e8d1740c53cfb3fbc4b43f9e41c592b1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/101491
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2019-05-08 17:33:15 +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