Commit Graph

2087 Commits

Author SHA1 Message Date
Aart Bik a1b7fad86a [dart/vm] Annotate _ByteDataView to reduce code size
Rationale:
Slava's excellent code size difference tools enables
very fine-grained analysis of the impact of changes.
This CL improves Flutter Gallery size by 18984 bytes.

+------------------------------------------------------+-----------------------------------------+--------------+
| Library                                              | Method                                  | Diff (Bytes) |
+------------------------------------------------------+-----------------------------------------+--------------+
| package:flutter/src/painting/decoration_image.dart   | paintImage                              |         +936 |
| dart:ui                                              | Paint.toString                          |         +592 |
| package:flutter/src/material/tab_indicator.dart      | _UnderlinePainter.paint                 |         +552 |
| package:flutter/src/material/progress_indicator.dart | _CircularProgressIndicatorPainter.paint |         +308 |
| package:flutter/src/services/message_codecs.dart     | StandardMessageCodec.readValueOfType    |         +172 |
| package:flutter/src/services/message_codecs.dart     | StandardMessageCodec.readValue          |          +60 |
| package:flutter/src/services/message_codecs.dart     | StandardMethodCodec.decodeEnvelope      |          +56 |
| package:flutter/src/services/message_codecs.dart     | StandardMethodCodec.decodeMethodCall    |          +56 |
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| package:flutter/src/widgets/semantics_debugger.dart  | _paint                                  |         -484 |
| dart:ui                                              | Paint.maskFilter=                       |         -568 |
| dart:ui                                              | Paint.colorFilter=                      |         -572 |
| package:flutter/src/painting/borders.dart            | paintBorder                             |         -656 |
| dart:ui                                              | _unpackPointerDataPacket                |         -744 |
| dart:ui                                              | Paint.isAntiAlias=                      |         -808 |
| dart:ui                                              | Paint.strokeCap=                        |         -812 |
| dart:ui                                              | Paint.filterQuality=                    |         -812 |
| dart:ui                                              | Paint.isAntiAlias                       |         -972 |
| dart:ui                                              | Paint.invertColors                      |         -976 |
+------------------------------------------------------+-----------------------------------------+--------------+
Total change -18984 bytes.

https://github.com/dart-lang/sdk/issues/35323

Change-Id: Iceeb820ed506794e1ac3e7c17f8f116a22bca742
Reviewed-on: https://dart-review.googlesource.com/c/90861
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Commit-Queue: Aart Bik <ajcbik@google.com>
2019-01-23 22:48:37 +00:00
Régis Crelier 27316cc97b Revert "[vm] Prevent access to non-annotated members through native API."
This reverts commit 0203243381.

Reason for revert: breaking several bots

Original change's description:
> [vm] Prevent access to non-annotated members through native API.
> 
> We will issue warnings and throw an API error when the native API is used to access members which were not appropriately
> annotated as entry-points, if the flag "--verify-entry-points" is passed.
> 
> Also, fixes Class::Invoke against fields (isn't allowed through native API but
> could be allowed with mirrors, and is inconsistent with Library::Invoke behavior).
> 
> I've checked locally that this would have caught the bug in
> "Wrap the user entrypoint function in a zone with native exception callback. (#7512)".
> 
> Change-Id: I617c71e1965457c956c97761359765bb9bb18c1c
> Cq-Include-Trybots: luci.dart.try:vm-kernel-optcounter-threshold-linux-release-x64-try, vm-kernel-precomp-linux-debug-x64-try, vm-kernel-precomp-linux-release-simarm-try, vm-kernel-precomp-linux-release-simarm64-try, vm-kernel-precomp-linux-release-x64-try, vm-kernel-precomp-mac-release-simarm64-try, vm-kernel-precomp-win-release-x64-try
> Reviewed-on: https://dart-review.googlesource.com/c/90060
> Commit-Queue: Samir Jindel <sjindel@google.com>
> Reviewed-by: Alexander Markov <alexmarkov@google.com>

TBR=alexmarkov@google.com,sjindel@google.com

Change-Id: I554b389780e4ba652183c044b040b0c524beb5c2
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Cq-Include-Trybots: luci.dart.try:vm-kernel-optcounter-threshold-linux-release-x64-try, vm-kernel-precomp-linux-debug-x64-try, vm-kernel-precomp-linux-release-simarm-try, vm-kernel-precomp-linux-release-simarm64-try, vm-kernel-precomp-linux-release-x64-try, vm-kernel-precomp-mac-release-simarm64-try, vm-kernel-precomp-win-release-x64-try
Reviewed-on: https://dart-review.googlesource.com/c/90841
Reviewed-by: Régis Crelier <regis@google.com>
Commit-Queue: Régis Crelier <regis@google.com>
2019-01-23 20:37:22 +00:00
Samir Jindel 0203243381 [vm] Prevent access to non-annotated members through native API.
We will issue warnings and throw an API error when the native API is used to access members which were not appropriately
annotated as entry-points, if the flag "--verify-entry-points" is passed.

Also, fixes Class::Invoke against fields (isn't allowed through native API but
could be allowed with mirrors, and is inconsistent with Library::Invoke behavior).

I've checked locally that this would have caught the bug in
"Wrap the user entrypoint function in a zone with native exception callback. (#7512)".

Change-Id: I617c71e1965457c956c97761359765bb9bb18c1c
Cq-Include-Trybots: luci.dart.try:vm-kernel-optcounter-threshold-linux-release-x64-try, vm-kernel-precomp-linux-debug-x64-try, vm-kernel-precomp-linux-release-simarm-try, vm-kernel-precomp-linux-release-simarm64-try, vm-kernel-precomp-linux-release-x64-try, vm-kernel-precomp-mac-release-simarm64-try, vm-kernel-precomp-win-release-x64-try
Reviewed-on: https://dart-review.googlesource.com/c/90060
Commit-Queue: Samir Jindel <sjindel@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2019-01-23 19:04:26 +00:00
Chinmay Garde ec6a7310c9 Allow embedders to get a closurized _startMainIsolate function.
Change-Id: Ib4b2654c60c02f137832e3898fd38b724c4e4dbc
Reviewed-on: https://dart-review.googlesource.com/c/90582
Commit-Queue: Chinmay Garde <chinmaygarde@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
2019-01-23 01:30:13 +00:00
Ryan Macnak 06a1e6e9e3 [vm] Enable timeline on Fuchsia even in product mode.
On Fuchsia, the timeline is accessed without involving the service isolate or vm-service.

Change-Id: Ia0d4e1ca252604e8fcef466a31e3d2a8b0912251
Reviewed-on: https://dart-review.googlesource.com/c/90100
Reviewed-by: Zach Anderson <zra@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2019-01-18 00:06:10 +00:00
Ryan Macnak 07f95e7761 Revert "[vm] Enable timeline on Fuchsia even in product mode."
This reverts commit 3f7b371f2c.

Reason for revert: Some modes failing to find new constant?

Original change's description:
> [vm] Enable timeline on Fuchsia even in product mode.
> 
> On Fuchsia, the timeline is accessed without involving the service isolate or vm-service.
> 
> Change-Id: I0d2351dcadcfc47835732235e1b8fafa8212f883
> Reviewed-on: https://dart-review.googlesource.com/c/89880
> Reviewed-by: Zach Anderson <zra@google.com>
> Commit-Queue: Ryan Macnak <rmacnak@google.com>

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

Change-Id: Ic03a78d14821e0361d54587f1f7510bc9ebfef1c
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/89942
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2019-01-17 00:39:39 +00:00
Ryan Macnak 3f7b371f2c [vm] Enable timeline on Fuchsia even in product mode.
On Fuchsia, the timeline is accessed without involving the service isolate or vm-service.

Change-Id: I0d2351dcadcfc47835732235e1b8fafa8212f883
Reviewed-on: https://dart-review.googlesource.com/c/89880
Reviewed-by: Zach Anderson <zra@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2019-01-16 22:55:51 +00:00
Ben Konyi 700254996f [ Observatory / Dartium ] Updated observatory documentation and tests to remove references to Dartium.
Change-Id: Ibc64b3371353850ff15153c06970a30e47a24888
Reviewed-on: https://dart-review.googlesource.com/c/89900
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
2019-01-16 20:28:21 +00:00
Samir Jindel 4d77c7b3a6 [vm] Remove redundant type-checks from core libraries.
In conjunction with previous revisions, this improves several Flutter microbenchmarks by 2-4%.

Change-Id: Ic864fd586dc57d87b80cebd6ceace0a8165fa82b
Reviewed-on: https://dart-review.googlesource.com/c/88702
Commit-Queue: Samir Jindel <sjindel@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2019-01-14 19:56:37 +00:00
Zichang Guo ec86471ccc Rephrase FormatException for int.parse
Change-Id: I9efc87ca83be6272005bf395b63495a8a99e4a1f
Reviewed-on: https://dart-review.googlesource.com/c/87985
Commit-Queue: Zichang Guo <zichangguo@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
2019-01-03 22:43:43 +00:00
Lasse R.H. Nielsen 5d85f113e8 Add constant map-based set implementation.
Change-Id: I3be60bdfea2b0f8c8238705d7f6a830147083b76
Reviewed-on: https://dart-review.googlesource.com/c/85704
Commit-Queue: Lasse R.H. Nielsen <lrn@google.com>
Reviewed-by: Aske Simon Christensen <askesc@google.com>
2019-01-03 14:47:28 +00:00
Régis Crelier 08492f41cd [VM Runtime] Removed 'IsMoreSpecificThan' support in the VM.
In Dart2, the type relation "is more specific than" is no different than "is
subtype of". Since Dart1 is not supported anymore, type checking in the runtime
can be simplified and cleaned up.

Change-Id: I8e95b9e47146315c9a6f6c29b732ecbeb4e9ae97
Reviewed-on: https://dart-review.googlesource.com/c/88221
Commit-Queue: Régis Crelier <regis@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
2019-01-03 00:41:20 +00:00
Alexander Aprelev 7d14785115 This relands "Load isolate from parent's kernel in Isolate.spawn calls.".
Original PR was reverted because it broke hot-reload bots. This CL adds steps to initialize kernel_service compiler for child isolate. Compiler is needed to support hot-reload request. Child isolate's compiler is created from full kernel file produced by main isolate's compiler. Changes since original PR are pkg/vm/bin/kernel_service.dart in pkg/vm/lib/incremental_compiler.dart.

Further this CL changes kernel fingerprint calculation for interface types so it calculates the hash of the canonical names themselves, rather than indices(that might change from one compilation to another).

This reverts commit 63fd8f63e6.

Change-Id: I6fe5b2ef99f209b32cd4087dfd1c8cac229c2d8b
Reviewed-on: https://dart-review.googlesource.com/c/87265
Commit-Queue: Alexander Aprelev <aam@google.com>
Reviewed-by: Liam Appelbe <liama@google.com>
2018-12-14 23:45:57 +00:00
Régis Crelier cb8c0ab8f5 [vm] Remove MixinAppType VM class and VM code supporting type resolution.
In Dart2, mixin application classes are generated by kernel and type resolution
is performed by kernel. In Dart1, using the VM parser, these tasks were done
during class and type finalization.

Change-Id: I927b1446d906ffd76ed9591c96e0d974df09f3bf
Reviewed-on: https://dart-review.googlesource.com/c/87025
Commit-Queue: Régis Crelier <regis@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2018-12-13 20:18:36 +00:00
Daco Harkes 14ff2110ce [vm] refactor native entry and native entry type arguments
Change-Id: I03efbbf4340de1c8f23c60854ed991671ca2b647
Reviewed-on: https://dart-review.googlesource.com/c/87077
Commit-Queue: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Samir Jindel <sjindel@google.com>
2018-12-13 19:29:26 +00:00
Régis Crelier 5f36c5f9d8 [vm] Delete BoundedType class in VM.
In Dart2, type bounds checking is either performed by the common front-end or
by explicitly generated code, but not by type finalization or runtime anymore,
as it was done in Dart1.
Consequently, the class BoundedType is not needed anymore, and malbounded or
malformed types are not seen by the runtime either.

Change-Id: I5d6e4c68d153d6730fa7ff7f6d9dcfa611299c16
Reviewed-on: https://dart-review.googlesource.com/c/86687
Commit-Queue: Régis Crelier <regis@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Samir Jindel <sjindel@google.com>
2018-12-10 23:15:27 +00:00
Ryan Macnak 07f43510a2 [vm] Fix some cases of dropped errors and confusion between Exceptions::PropagateError and LongJumpScope::Jump.
Assert against Exceptions::PropagateError skipping over LongJumpScopes and LongJumpScope::Jump skipping over exit frames.

Bug: https://github.com/dart-lang/sdk/issues/35224
Change-Id: I67004a73265882191cb1945cb5a049559b747e89
Reviewed-on: https://dart-review.googlesource.com/c/85411
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2018-12-05 18:57:02 +00:00
Liam Appelbe 63fd8f63e6 Revert "Load isolate from parent's kernel in Isolate.spawn calls."
This reverts commit e143a52531.

Reason for revert: Broke all the reload-kernel bots.

Original change's description:
> Load isolate from parent's kernel in Isolate.spawn calls.
> 
> Bug: https://github.com/dart-lang/sdk/issues/6610
> Change-Id: Icd6e1c5d6d4b64b611fc58333c051a8a9a50679d
> Reviewed-on: https://dart-review.googlesource.com/c/85724
> Commit-Queue: Liam Appelbe <liama@google.com>
> Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
> Reviewed-by: Ryan Macnak <rmacnak@google.com>

TBR=vegorov@google.com,rmacnak@google.com,asiva@google.com,liama@google.com

Change-Id: Ie9c305256da9b6478153b99502d0c63b0f43a3e6
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: https://github.com/dart-lang/sdk/issues/6610
Reviewed-on: https://dart-review.googlesource.com/c/86082
Reviewed-by: Liam Appelbe <liama@google.com>
Commit-Queue: Liam Appelbe <liama@google.com>
2018-12-04 20:26:24 +00:00
Liam Appelbe e143a52531 Load isolate from parent's kernel in Isolate.spawn calls.
Bug: https://github.com/dart-lang/sdk/issues/6610
Change-Id: Icd6e1c5d6d4b64b611fc58333c051a8a9a50679d
Reviewed-on: https://dart-review.googlesource.com/c/85724
Commit-Queue: Liam Appelbe <liama@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2018-12-04 18:02:55 +00:00
Martin Kustermann f5d1229081 Reland "[VM] Inline ClassID.getID() eagerly, extend pattern matching logic to recognize it, use it to special case ascii decoding"
This change extends/fixes the exiting "pattern recognition" which tries
to recognize the pattern

  v2 <- LoadClassIdInstr(v1)
  BranchIf v2 == IntegerConstant(cid)

Furthermore we start inlining the recognized `ClassID.getID` method very
early in the pipeline.  This allows the VM to recognize the above
pattern and insert redefinitions before the actual inlining pass.

Furthermore we special-case two very hot methods in utf8 decoding by
manually having two loops, one of which is guarded by a class-id check
against the _Uint8ArrayView class, which is most common.  (In the future
we would like to unify the typed data layouts so we no longer need to
use `ClassId.getID`, thereby also allowing non core library code to use
this).

This improves dart-aot by
  * 31%+ for a protobuf decoding benchmark we care about

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

Change-Id: I7181bbf096aabe303634fd3b2bff9cc96d69719c
Reviewed-on: https://dart-review.googlesource.com/c/85443
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2018-11-28 10:43:32 +00:00
William Hesse faafdb4b2f Revert "[VM] Inline ClassID.getID() eagerly, extend pattern matching logic to recognize it, use it to special case ascii decoding"
This reverts commit d7cf6959bb.

Reason for revert: This causes crashes on the vm-obfuscate builder at https://ci.chromium.org/p/dart/builders/luci.dart.ci.sandbox/vm-kernel-precomp-obfuscate-linux-release-x64
like

FAILED: dartkp-dart_precompiled release_x64 corelib_2/linked_hash_map_test
Expected: Pass
Actual: Crash
Unexpected compile error.

--- Command "vm_compile_to_kernel" (took 11.000189s):
DART_CONFIGURATION=ReleaseX64 /b/s/w/ir/cache/builder/sdk/pkg/vm/tool/gen_kernel --aot --platform=out/ReleaseX64/vm_platform_strong.dill -o /b/s/w/ir/cache/builder/sdk/out/ReleaseX64/generated_compilations/dartkp/tests_corelib_2_linked_hash_map_test/out.dill /b/s/w/ir/cache/builder/sdk/tests/corelib_2/linked_hash_map_test.dart --packages=/b/s/w/ir/cache/builder/sdk/.packages -Ddart.developer.causal_async_stacks=true

exit code:
0

--- Command "precompiler" (took 583ms):
DART_CONFIGURATION=ReleaseX64 out/ReleaseX64/gen_snapshot --snapshot-kind=app-aot-assembly --assembly=/b/s/w/ir/cache/builder/sdk/out/ReleaseX64/generated_compilations/dartkp/tests_corelib_2_linked_hash_map_test/out.S --obfuscate --sync-async --ignore-unrecognized-flags --packages=/b/s/w/ir/cache/builder/sdk/.packages /b/s/w/ir/cache/builder/sdk/out/ReleaseX64/generated_compilations/dartkp/tests_corelib_2_linked_hash_map_test/out.dill

exit code:
-6

stderr:
Warning: This VM has been configured to obfuscate symbol information which violates the Dart standard.
         See dartbug.com/30524 for more information.

===== CRASH =====
version=2.2.0-edge.83712405657ff736033380cb24b0bd5a62fc3692 (Tue Nov 27 16:56:07 2018 +0000) on "linux_x64"
si_signo=Segmentation fault(11), si_code=1, si_addr=0xd1400050e5f
Dumping native stack trace for thread 2b71
  [0x000056001fc426c7] Unknown symbol
  [0x000056001fc426c7] Unknown symbol
  [0x000056001fe5763d] Unknown symbol
  [0x000056001fe4c99c] Unknown symbol
  [0x000056001fe6166a] Unknown symbol
  [0x000056001fe59c0c] Unknown symbol
 

Original change's description:
> [VM] Inline ClassID.getID() eagerly, extend pattern matching logic to recognize it, use it to special case ascii decoding
> 
> This change extends/fixes the exiting "pattern recognition" which tries
> to recognize the pattern
> 
>   v2 <- LoadClassIdInstr(v1)
>   BranchIf v2 == IntegerConstant(cid)
> 
> Furthermore we start inlining the recognized `ClassID.getID` method very
> early in the pipeline.  This allows the VM to recognize the above
> pattern and insert redefinitions before the actual inlining pass.
> 
> Furthermore we special-case two very hot methods in utf8 decoding by
> manually having two loops, one of which is guarded by a class-id check
> against the _Uint8ArrayView class, which is most common.  (In the future
> we would like to unify the typed data layouts so we no longer need to
> use `ClassId.getID`, thereby also allowing non core library code to use
> this).
> 
> This improves dart-aot by
>   * 31%+ for a protobuf decoding benchmark we care about
> 
> 
> Issue https://github.com/dart-lang/sdk/issues/31954
> 
> Change-Id: Ia567b92b7e76ff28eda1726deaafda32732ed8f5
> Reviewed-on: https://dart-review.googlesource.com/c/85281
> Reviewed-by: Johnni Winther <johnniwinther@google.com>
> Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
> Reviewed-by: Jenny Messerly <jmesserly@google.com>
> Commit-Queue: Martin Kustermann <kustermann@google.com>

TBR=vegorov@google.com,kustermann@google.com,jmesserly@google.com,johnniwinther@google.com,sra@google.com

Change-Id: I912b0768c32cbb00297ce48db29dbdbea44c14fa
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/85441
Reviewed-by: William Hesse <whesse@google.com>
Commit-Queue: William Hesse <whesse@google.com>
2018-11-27 18:15:36 +00:00
Liam Appelbe 8371240565 Reland https://dart-review.googlesource.com/c/sdk/+/84683
The timeout issue in app-kernel-linux-product-x64-try seems to have resolved itself.

Bug: https://github.com/dart-lang/sdk/issues/34895
Change-Id: If503aa4e63628c38d8ee86a5b6b5202ea953d6a8
Reviewed-on: https://dart-review.googlesource.com/c/85406
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Liam Appelbe <liama@google.com>
2018-11-27 16:56:07 +00:00
Martin Kustermann d7cf6959bb [VM] Inline ClassID.getID() eagerly, extend pattern matching logic to recognize it, use it to special case ascii decoding
This change extends/fixes the exiting "pattern recognition" which tries
to recognize the pattern

  v2 <- LoadClassIdInstr(v1)
  BranchIf v2 == IntegerConstant(cid)

Furthermore we start inlining the recognized `ClassID.getID` method very
early in the pipeline.  This allows the VM to recognize the above
pattern and insert redefinitions before the actual inlining pass.

Furthermore we special-case two very hot methods in utf8 decoding by
manually having two loops, one of which is guarded by a class-id check
against the _Uint8ArrayView class, which is most common.  (In the future
we would like to unify the typed data layouts so we no longer need to
use `ClassId.getID`, thereby also allowing non core library code to use
this).

This improves dart-aot by
  * 31%+ for a protobuf decoding benchmark we care about


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

Change-Id: Ia567b92b7e76ff28eda1726deaafda32732ed8f5
Reviewed-on: https://dart-review.googlesource.com/c/85281
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Reviewed-by: Jenny Messerly <jmesserly@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2018-11-27 13:14:27 +00:00
Martin Kustermann 0ef66e0f5c [VM] Add @pragma("vm:non-nullable-result-type") annotation
A field/function annotated with this pragma must be guaranteed to not
return `null` at runtime.

Make use of this non-nullable annotation in the VM's type propagator.

Annotates the "_TypedListView._typedData" field to ensure the VM knows it
returns a non-nullable _TypedListView.

Furthermore annotates methods on the integer implementation.  Those particular
methods are recognized methods with a "dynamic" return type.  This caused
the type propagator to use CompileType::Dynamic() as result type.  Since a
previous CL started to only utilize the annotated type if it is better than
"dynamic" more integer operations got handled in-line, though with null-checks.
Annotating those methods to return non-null improves the in-line handling of
integer operations.

This improves dart-aot

On arm7hf:
  SHA256: +5%, SHA: +6%, JsonObjectRoundTrip: +7%, ...

On arm8:
  SHA1: +28%, MD5: +25%, SHA256: +15%, TypedData.Int16ListViewBench: +18.5%, StringInterpolation: +18%, ...


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

Change-Id: Ia4263a37241a36c9dc35e8a48893297effa6f4b2
Reviewed-on: https://dart-review.googlesource.com/c/84421
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2018-11-22 16:18:27 +00:00
Martin Kustermann 2ebdf7c0f8 [VM] Ensure the _TypedListView.{offsetInBytes,length} fields are always initialized with _Smi's
Until now a typed data view was first constructed and then afterwards the
constructor body validated that the offsetInBytes/length are non-null
and in range.

This CL moves the range check to the call sites of the constructor,
thereby guarenteeing that we will never initialize the
_TypedListView.{offsetInBytes,length} fields with non-_Smi values. (The
views are constructed only within the "dart:typed_data" library.  Neither the
embedder nor the runtime construct them.)

Further more this CL removes the redundant _defaultIfNull() call, since
the call sites already handled the `length == null` case.

This CL also starts annotating _TypedListView.{offsetInBytes,length}
with @pragma("vm:exact-result-type", "dart:core#_Smi") to ensure any
[LoadFieldInstr] will have the right type attached, thereby avoiding any
null-checks and mint-handling.

This improves dart-aot

On arm7hf:
    MD5: +38%, SHA256: +87%, SHA1: +89% (plus various typed data microbenchmarks)
    JsonParseDefaultReviver/StringBuffer/StringIdiomatic/JsonParseCustomReviver: -5-8% (probably due to not inlining static calls, will find out)

On arm8:
    MD5: +6.5%, SHA256: +12%, SHA1: 3.6%, JsonUtf8RoundTrip: 8% (plus various typed data microbenchmarks)
    DeltaBlue: -6.7% (probably due to not inlining static calls, will find out)

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

Change-Id: I37c822e6879f5a2d17fd9650a68cf2eee4326b01
Reviewed-on: https://dart-review.googlesource.com/c/84241
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2018-11-22 14:02:27 +00:00
Ryan Macnak e1ffe76a36 [vm] Replace StubEntry with Code handles.
StubEntry was holding raw pointers across safepoints in several places in the compiler.

Bug: https://github.com/dart-lang/sdk/issues/34934
Change-Id: Id17cb7651f4d3508915c8cb90f5cb2353df6dac0
Reviewed-on: https://dart-review.googlesource.com/c/85040
Reviewed-by: Régis Crelier <regis@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2018-11-21 17:45:11 +00:00
asiva 0ca1c57593 Reland "[VM] Remove unused flags"
This is a reland of 1a4cff1bd4

Original change's description:
> [VM] Remove unused flags
> 
> Remove the following flags which are always ON
> --strong
> --reify_generic_functions
> 
> and these flags which are not applicable anymore
> --error-on-bad-override
> --error-on-bad-type
> --enable-type-checks
> 
> Change-Id: I6e1aeb68e663953f4ae49ca94ea0daa87b661900
> Reviewed-on: https://dart-review.googlesource.com/c/79431
> Commit-Queue: Siva Annamalai <asiva@google.com>
> Reviewed-by: Alexander Markov <alexmarkov@google.com>
> Reviewed-by: Régis Crelier <regis@google.com>

Change-Id: Ib4452c22fb05eed38820708abb648939e03b1df0
Reviewed-on: https://dart-review.googlesource.com/c/84923
Reviewed-by: Siva Annamalai <asiva@google.com>
2018-11-20 17:25:42 +00:00
Siva Annamalai f6c41ac3bc Revert "[VM] Remove unused flags"
This reverts commit 1a4cff1bd4.

Reason for revert: The precompiled arm bot failed a test.

Original change's description:
> [VM] Remove unused flags
> 
> Remove the following flags which are always ON
> --strong
> --reify_generic_functions
> 
> and these flags which are not applicable anymore
> --error-on-bad-override
> --error-on-bad-type
> --enable-type-checks
> 
> Change-Id: I6e1aeb68e663953f4ae49ca94ea0daa87b661900
> Reviewed-on: https://dart-review.googlesource.com/c/79431
> Commit-Queue: Siva Annamalai <asiva@google.com>
> Reviewed-by: Alexander Markov <alexmarkov@google.com>
> Reviewed-by: Régis Crelier <regis@google.com>

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

Change-Id: Ib0fe4f33c044047ef1cb31bca9d38591176b7d40
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/84883
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Siva Annamalai <asiva@google.com>
2018-11-20 07:32:11 +00:00
asiva 1a4cff1bd4 [VM] Remove unused flags
Remove the following flags which are always ON
--strong
--reify_generic_functions

and these flags which are not applicable anymore
--error-on-bad-override
--error-on-bad-type
--enable-type-checks

Change-Id: I6e1aeb68e663953f4ae49ca94ea0daa87b661900
Reviewed-on: https://dart-review.googlesource.com/c/79431
Commit-Queue: Siva Annamalai <asiva@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Régis Crelier <regis@google.com>
2018-11-20 06:41:06 +00:00
Liam Appelbe 0b46639335 Revert "Hide vmservice.cc behind PRODUCT macro."
This reverts commit 1def1f5007.

Reason for revert: <INSERT REASONING HERE>

Original change's description:
> Hide vmservice.cc behind PRODUCT macro.
> 
> This removes vmservice.cc from the flutter engine release binary, which saves a few kB.
> 
> Tested using tools/test.py in product mode. Verified the binary savings using run_binary_size_analysis.py
> 
> Bug: https://github.com/dart-lang/sdk/issues/34895
> Change-Id: I74d50d3e177842310e488072f35bc11d1c597036
> Reviewed-on: https://dart-review.googlesource.com/c/84683
> Reviewed-by: Ryan Macnak <rmacnak@google.com>
> Commit-Queue: Liam Appelbe <liama@google.com>

TBR=rmacnak@google.com,asiva@google.com,liama@google.com

Change-Id: I5df5882c8f4ec46480a89c2a6549e69ed83f5a2c
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: https://github.com/dart-lang/sdk/issues/34895
Reviewed-on: https://dart-review.googlesource.com/c/84832
Reviewed-by: Liam Appelbe <liama@google.com>
Commit-Queue: Liam Appelbe <liama@google.com>
2018-11-19 23:04:17 +00:00
Liam Appelbe 1def1f5007 Hide vmservice.cc behind PRODUCT macro.
This removes vmservice.cc from the flutter engine release binary, which saves a few kB.

Tested using tools/test.py in product mode. Verified the binary savings using run_binary_size_analysis.py

Bug: https://github.com/dart-lang/sdk/issues/34895
Change-Id: I74d50d3e177842310e488072f35bc11d1c597036
Reviewed-on: https://dart-review.googlesource.com/c/84683
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Liam Appelbe <liama@google.com>
2018-11-19 19:11:41 +00:00
Régis Crelier 61eea1f416 [VM runtime] Remove unused UnresolvedClass VM class.
Type resolution will be simplified in a later CL.

Change-Id: Ia610a5d06d381511ca48993dcc1cafbf205ca997
Reviewed-on: https://dart-review.googlesource.com/c/84552
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Régis Crelier <regis@google.com>
2018-11-16 00:09:29 +00:00
Lasse R.H. Nielsen 6596a305fd Optimize VM List's setAll method.
Change-Id: Id488c42b1274de8a3d6f551f726404c0724b684f
Reviewed-on: https://dart-review.googlesource.com/c/84423
Commit-Queue: Leaf Petersen <leafp@google.com>
Reviewed-by: Leaf Petersen <leafp@google.com>
Auto-Submit: Lasse R.H. Nielsen <lrn@google.com>
2018-11-15 19:08:09 +00:00
Régis Crelier f721d52163 [VM runtime] Introduce a new VM class Bytecode.
Allow pc_marker slot to hold a Code object or a new Bytecode object.

Change-Id: If11c1df6dafc5b1cfcce6f0322c36d1d68e86df9
Reviewed-on: https://dart-review.googlesource.com/c/82526
Commit-Queue: Régis Crelier <regis@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2018-11-14 02:48:03 +00:00
Kevin Moore bc03bd3805 Cleanup unused vars in VM patch files
Change-Id: Ibc548921113d979df5b0ed8eb7f6ad48a553fc86
Reviewed-on: https://dart-review.googlesource.com/c/84121
Commit-Queue: Kevin Moore <kevmoo@google.com>
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
2018-11-13 22:56:54 +00:00
Ryan Macnak 94f93f788a [vm] Remove Dart scanner.
Change-Id: I6435aef9574167dda71f7d15852e32e40d38e381
Reviewed-on: https://dart-review.googlesource.com/c/83224
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2018-11-09 00:13:26 +00:00
Ryan Macnak 30b0b9b723 [vm] Code size reductions:
- Remove dead Isolate::IsTopLevelParsing.
 - Remove dead TraceFunctionEntry/Exit.
 - Migrate more tracing flags to flag_list.h to allow code elimination in non-debug modes.
 - Require an explicit Zone parameter for CheckedHandles.
 - Remove side-effects from RuntimeEntry constructor.

out/ProductX64/exe.stripped/dart_precompiled_runtime 4063464 -> 4046952 (-16k)

Change-Id: Iffd3de25a03d2354cdecf2d79aa761c33ab08bd3
Reviewed-on: https://dart-review.googlesource.com/c/83120
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2018-11-08 02:02:39 +00:00
Ben Konyi fbe3b1ebc0 Reland "[ VM / Mirrors ] Added type checking to enforce strong mode semantics when using dart:mirrors"
Was reverted to temporarily fix issue #35009 for 2.1.

This reverts commit 65ffd0f7190f04dd0a8f94b7941e1ab706b0b084.

Change-Id: I71fe094b24f882cd942634557c9c43af06058842
Reviewed-on: https://dart-review.googlesource.com/c/83226
Reviewed-by: Siva Annamalai <asiva@google.com>
2018-11-06 23:59:29 +00:00
Ben Konyi 9c95624a63 Temporary revert to fix issue #35009 for 2.1. package:rpc relies on mirrors behaviour that is not valid for Dart 2, so these type checks cause the package to crash.
Revert "[ VM / Mirrors ] Added type checking to enforce strong mode semantics when using dart:mirrors"

This reverts commit 9f00eec55b.

Change-Id: I82ce07d388ba9402f20caf700815b39c9bc418f6
Reviewed-on: https://dart-review.googlesource.com/c/83225
Reviewed-by: Ben Konyi <bkonyi@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
2018-11-06 23:59:11 +00:00
Kevin Moore 475eaee3c2 Cleanup some dynamic/Object promotion confusion from 5226b5c307
And make tweaks to Uri and StreamController equality

Change-Id: I63f85f67209442684e50b7c2e0011531893f294e
Reviewed-on: https://dart-review.googlesource.com/c/82781
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
Commit-Queue: Kevin Moore <kevmoo@google.com>
2018-11-03 14:05:15 +00:00
Lasse R.H. Nielsen 5226b5c307 Remove some unnecessary dynamic invocations in the platform libraries.
Change-Id: Ia72033e37c4d8292eabd95aeff97e4cb29e81823
Reviewed-on: https://dart-review.googlesource.com/c/82204
Commit-Queue: Lasse R.H. Nielsen <lrn@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2018-11-02 11:32:03 +00:00
Ryan Macnak 7514ce941e [vm] Assert handles are only allocated when the thread is preventing safepoints.
Threads in the native or blocked states don't prevent safepoints, so they may run concurrently with a safepoint operation like GC. It is not safe for handles to be allocated while the GC is visiting them, so these threads must not allocate handles. Assert only threads in the VM or generated states, which prevent safepoints until they check in, may allocate handles. (Generated code does not allocate handles, but leaf runtime entries remain in the generated state.)

Bug: https://github.com/dart-lang/sdk/issues/34883
Change-Id: I1a211778f7ef96b53a2405f0ee9dde7871b122b6
Reviewed-on: https://dart-review.googlesource.com/c/81540
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2018-10-31 19:51:52 +00:00
Lasse Reichstein Holst Nielsen 26121608a1 Make DateTime not assume arguments are instances of the same class.
The current DateTime class takes DateTime objects as arguments,
and then tries to access private members.
That does not work if someone else implements the DateTime interface.

Fixes #34962

BUG= http://dartbug.com/34962

Change-Id: I7191fe42f5b6efc1c7da5ed8e22b892b18f872f7
Reviewed-on: https://dart-review.googlesource.com/c/81828
Reviewed-by: Leaf Petersen <leafp@google.com>
Reviewed-by: Stephen Adams <sra@google.com>
Commit-Queue: Lasse R.H. Nielsen <lrn@google.com>
2018-10-31 07:29:48 +00:00
Alexander Markov 346f5369e4 [vm] Cleanup _int64 marker interface
Closes https://github.com/dart-lang/sdk/issues/34955

Change-Id: I7323e17374bfdc11d7869e4713c2818927bc4c71
Reviewed-on: https://dart-review.googlesource.com/c/81880
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Auto-Submit: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Zach Anderson <zra@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2018-10-29 23:01:44 +00:00
Samir Jindel e23acaaf90 [vm/aot] Fix obfuscation.
Test Plan:

Make vm-kernel-precomp-obfuscate-linux-release-x64-try green, ensuring status file changes
reflect design gaps and not bugs.

Tested locally that obfuscated Flutter Gallery runs.

Change-Id: Ifcdc334de58f43c310e15b58dbcf6fe1597206f2
Cq-Include-Trybots: luci.dart.try:vm-kernel-precomp-obfuscate-linux-release-x64-try
Reviewed-on: https://dart-review.googlesource.com/c/81009
Commit-Queue: Samir Jindel <sjindel@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2018-10-26 13:00:33 +00:00
Siva Annamalai b82c1f979f Revert "[VM] Fix for issue 34839 - Dart_Cleanup may hang while shutting down"
This reverts commit 89c845eba2.

Reason for revert: Seems to cause ASAN failures

Original change's description:
> [VM] Fix for issue 34839 - Dart_Cleanup may hang while shutting down
>      the service isolate.
> 
>      The service isolate request for shutdown uses a Dart level message
>      for exiting the isolate, this shuts down the isolate but does not
>      completely bring the isolate down if there are some open ports. We
>      have a timer isolate started in the VM isolate and if the shutdown
>      happens soon enough this port is still open.
> 
> Change-Id: Icfa07c91b8692eb76ba8502063cf6f5cf04832a5
> Reviewed-on: https://dart-review.googlesource.com/c/81200
> Reviewed-by: Ryan Macnak <rmacnak@google.com>
> Commit-Queue: Siva Annamalai <asiva@google.com>

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

Change-Id: I0fd4472d277a380b739e602aa3910cc1f96ed89e
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/81223
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Siva Annamalai <asiva@google.com>
2018-10-23 04:41:13 +00:00
asiva 89c845eba2 [VM] Fix for issue 34839 - Dart_Cleanup may hang while shutting down
the service isolate.

     The service isolate request for shutdown uses a Dart level message
     for exiting the isolate, this shuts down the isolate but does not
     completely bring the isolate down if there are some open ports. We
     have a timer isolate started in the VM isolate and if the shutdown
     happens soon enough this port is still open.

Change-Id: Icfa07c91b8692eb76ba8502063cf6f5cf04832a5
Reviewed-on: https://dart-review.googlesource.com/c/81200
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Siva Annamalai <asiva@google.com>
2018-10-23 03:00:00 +00:00
Ben Konyi 9f00eec55b [ VM / Mirrors ] Added type checking to enforce strong mode semantics when using dart:mirrors
Fixes issue #32232

Change-Id: Id6c9ea8e72bb66c77a2817f20c33bb405cb4c310
Reviewed-on: https://dart-review.googlesource.com/c/79081
Commit-Queue: Ben Konyi <bkonyi@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
Auto-Submit: Ben Konyi <bkonyi@google.com>
2018-10-13 16:27:40 +00:00
Ryan Macnak 22190e4d79 [vm] In IsolateMirror.loadUri, note that a kernel file at a URI may not contain any library with that URI.
Prefer the "root" library of the kernel file when available.

Change-Id: Ied8d6b00a358e5f3893fa6b9ed49c4b058152c09
Reviewed-on: https://dart-review.googlesource.com/c/79429
Reviewed-by: Zach Anderson <zra@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2018-10-12 18:06:03 +00:00
Ryan Macnak 662ff7f112 [vm] Remove TokenStream, TokenValue, CompilerStats.
(CompilerStats timers have been replaced with the timeline events.)

Change-Id: Iddcb752c085de9762eb802371b6d2905fa608a76
Reviewed-on: https://dart-review.googlesource.com/c/79086
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2018-10-10 21:39:45 +00:00