Capture content of request/response.
Changes about this cl:
1. The body of request will be written used by methods of `IOSink`. Each
operation will emit a single event on the same timeline task. Add() will
accept List<int> and write() works with strings. The data will remain
the same as what user has passed. With that being said, data coming from
add() will show a list of integers and a string representation if
write() is used.
2. The timeline of `HttpClientResponse` will be a child timeline of
corresponding `HttpClientRequest`. It will be recorded only if parent
request is recorded and logging flag is still set. If the flag is on
after the request is sent, the response will not be monitored.
3. `HttpClientResponse` is simply a stream. The timeline starts when
the response is received. But it is possible that users doesn't
read the content and close the program. In this case, timeline never
gets a proper close event. To have a close event, users has to call
listen().
4. This also fixes verify_http_time_line_test.dart. It was broken
and not checking correct events because of a typo.
Bug: https://github.com/dart-lang/sdk/issues/42952
Change-Id: I884db6405264a3ad9a03cecc8f5445dad4fb3e31
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/157567
Commit-Queue: Zichang Guo <zichangguo@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
This CL performs the following checks in the invoke field dispatcher for
dynamic closure calls when lazy dispatchers are enabled:
* The provided function type arguments vector (if any) has the correct
length.
* No function type arguments should be provided if the closure has
delayed type arguments.
* All required arguments (positional in all modes, named in appropriate
null safety modes) have been provided by the caller.
* If there are optional positional arguments, an appropriate number
has been provided.
* If there are optional named arguments, their names are valid.
Since the runtime already handles checking the argument shapes when lazy
dispatchers are disabled, these checks are now completely removed from
closure bodies in all cases. Thus, the only remaining checks in closure
bodies are the type checks performed by AssertSubtype and
AssertAssignable when lazy dispatchers are enabled.
Changes in the Flutter Gallery:
* ARM7, release: -3.61% instructions, -2.19% total
* ARM7, sizeopt: -3.62% instructions, -2.55% total
* ARM8, release: -3.66% instructions, -1.98% total
* ARM8, sizeopt: -3.65% instructions, -2.37% total
Most of these changes are already exercised by existing tests such as
(but not limited to):
* corelib{,_2}/dynamic_nosuchmethod_test
* language{,_2}/call/call_test
* language{,_2}/closure/tearoff_dynamic_test
* language{,_2}/generic/function_bounds_test
* language{,_2}/parameter/named_with_conversions_test
* language{,_2}/vm/no_such_args_error_message_vm_test
I've added one test to specifically check the interaction between
dynamic calls and required named parameters. There is some coverage in
other NNBD tests, but those are not directly focused on testing this
specifically.
Other changes:
* Adds initial cached ranges for certain BinarySmiOp and ShiftIntegerOp
instructions when the RHS is a constant, to avoid false negatives for
deoptimization and throw checks prior to range analysis.
* Adds new slots for various Function fields.
* Adds the ability to define unboxed native slots, which are always
unboxed after retrieval even in unoptimized code. In the first
iteration, the backend only handles loads from Uint32 unboxed native
slots. Part of https://github.com/dart-lang/sdk/issues/42793.
* Removed the special handling for loading from non-nullable int fields
in AOT compilation. Instead, their treatment is unified with the
treatment of the new unboxed native fields, since the source field is
always unboxed and the result of the load is also always unboxed, as
code involving them is always optimized.
Bug: https://github.com/dart-lang/sdk/issues/40813
Change-Id: Ia02aa3e872c1fefd906fd67b55021ea1797556e4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/155604
Commit-Queue: Tess Strickland <sstrickl@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
This is refactoring that should help with protecting class functions lookup with locks.
This also fixes an issue where hot reload doesn't rebind "super" getters changed to functions - added test for that.
Change-Id: Ice6ebe7213ac9e7bf6b87e1122b642a23d0370ca
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/158502
Commit-Queue: Alexander Aprelev <aam@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
This is a reland of 501a7ae7b0
The change is re-landed as is, without any extra changes.
The change was reverted due to timeout on internal test (b/163882044),
but that timeout was actually not related to this particular change.
Original change's description:
> [vm/compiler] Infer type of LoadIndexed from array type
>
> After inlining we may have more accurate information about array being
> accessed. This change adds computation of type of LoadIndexed
> instruction based on the type of array being accessed.
>
> The computation is able to skip loading of GrowableArray.data.
> If array was loaded from a field, it takes static type of a field
> into account.
>
> Benchmarks with null safety in JIT mode on x64:
> ForInLoop +80-106%
> DeltaBlueIterators +15-31%
>
> Change-Id: Ia61aa761f4ccd4692e05fdac043f8a2a46f88f21
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/157823
> Reviewed-by: Ryan Macnak <rmacnak@google.com>
> Commit-Queue: Alexander Markov <alexmarkov@google.com>
Change-Id: Iae4fc5132f62fa2635159cbf9ec47636826e1402
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/158526
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
This adds a debugger mechanism to replace part of
--causal-async-stack's _asyncStackTraceHelper runtime entry.
It recognises async and async* functions and adds a synthetic
breakpoint on entry into the wrapped async_op, making sure we
don't get "synthetic" frames as we're stepping in and out of
the async code.
Change-Id: I1df6e6874de2fa9185f27a1a8873ad0071ad9fb6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/157480
Commit-Queue: Clement Skau <cskau@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
was overwritten by isolate initialization code
Fixes situation where the following command would fail due to the
dartdev kernel not being compiled with null-safety:
dart --strong-null-safety --enable-experiment=non-nullable run foo.dart
Change-Id: I7e7c980eb3274a51e64c031e6bfef8650b897b8b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/158345
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
This reverts commit d4b12d6b03.
Reason for revert: Breaks mockito mocks mocking null-safe classes from non-null-safe tests. I am not intending to submit it, just need a commit id of a revert
Original change's description:
> [VM/compiler] Do not load member signatures from kernel file in JIT mode.
>
> The number of CFE-generated member signatures can be quite large (see buganizer #162073826).
> CFE now provides a reference from member signatures to their origin (see https://dart-review.googlesource.com/c/sdk/+/157498).
>
> This CL bypasses loading of member signatures in JIT mode and uses their origin as target in interface calls. AOT mode is not modified.
>
> Fix the implementation of --print-classes flag.
>
> Change-Id: Ief3e4e58a67bc3321a55d184b3c62ce62cd78689
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/158145
> Reviewed-by: Alexander Markov <alexmarkov@google.com>
TBR=rmacnak@google.com,alexmarkov@google.com,regis@google.com
# Not skipping CQ checks because original CL landed > 1 day ago.
Change-Id: I775a11244cc971b7aade594aadf2394636c95a2e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/158387
Reviewed-by: Régis Crelier <regis@google.com>
Reviewed-by: Ivan Inozemtsev <iinozemtsev@google.com>
Commit-Queue: Régis Crelier <regis@google.com>
With --no-use-bare-instructions or with splitting, not all calls are pc-relative. We must replace the Function with its Code in the static call table before detaching the Function's code as part of removing Function objects.
Also handle WeakSerializationReferences in AssignLoadingUnitsCodeVisitor.
Bug: https://github.com/dart-lang/sdk/issues/41974
Change-Id: I29f9258c240f5a2b1b8dca52f74146dfe44d6401
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/158165
Reviewed-by: Tess Strickland <sstrickl@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
This reverts commit 501a7ae7b0.
Reason for revert: timeout on internal test, b/163882044
Original change's description:
> [vm/compiler] Infer type of LoadIndexed from array type
>
> After inlining we may have more accurate information about array being
> accessed. This change adds computation of type of LoadIndexed
> instruction based on the type of array being accessed.
>
> The computation is able to skip loading of GrowableArray.data.
> If array was loaded from a field, it takes static type of a field
> into account.
>
> Benchmarks with null safety in JIT mode on x64:
> ForInLoop +80-106%
> DeltaBlueIterators +15-31%
>
> Change-Id: Ia61aa761f4ccd4692e05fdac043f8a2a46f88f21
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/157823
> Reviewed-by: Ryan Macnak <rmacnak@google.com>
> Commit-Queue: Alexander Markov <alexmarkov@google.com>
TBR=vegorov@google.com,rmacnak@google.com,alexmarkov@google.com,askesc@google.com
# Not skipping CQ checks because original CL landed > 1 day ago.
Change-Id: I10f6488b85b310fae394b372a2682a8ef802316c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/158401
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
- Don't use PC-relative calls when calling between loading units.
- Sort the contents of the code cluster by loading unit, then by text offset.
- Handle binding PC-relatives calls and inserting trampolines per loading unit.
- Create one code order table per loading unit to implement PC -> Code lookup.
- Read code order tables directly, instead of copying into malloc'd memory.
--use_table_dispatch still not yet supported.
This slightly shrinks non-split binaries (~2% clustered part, 0.4% total snapshot) due to the new delta encoding when Code references Instructions.
Bug: https://github.com/dart-lang/sdk/issues/41974
Change-Id: I51052ebc7b4968b554897d1710135a6c41821302
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/157820
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Tess Strickland <sstrickl@google.com>
When class table is shared between isolates in isolate group it should be visited only once in (IsolateGroup/Isolate)::VisitObjectPointers.
Visiting it more than once degrades performance and potentially causes bugs since not all visitors are idempotent(GC-related).
Bug: b/163063081
Change-Id: If56fab2401ca7afe654754fead74cefa233327f6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/158020
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Alexander Aprelev <aam@google.com>
Also only shift as many bits as needed to fit nullability into the
serialized value in case additional type states or flags are added in
the future.
Change-Id: Ic821070971f77040e05d5aeb53a5a0ed85cc8d09
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/158180
Commit-Queue: Tess Strickland <sstrickl@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
In kernel files assertion conditions are specified as a range of source
positions. Sometimes source texts are not available and VM cannot
extract assertion condition text, so Script::GetSnippet returns null.
With null safety it is no longer valid to pass null as a non-nullable
argument '_failedAssertion' of _AssertionError._create constructor,
so we should provide a valid String. This change converts 'null'
assertion condition text to "<optimized out>", similarly to AOT mode.
Issue https://github.com/flutter/flutter/issues/63513
Issue https://github.com/dart-lang/sdk/issues/34586
Change-Id: I9c5791e98fdef358068f3f5ddc4cfe98e8c7ed36
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/158162
Reviewed-by: Régis Crelier <regis@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
The number of CFE-generated member signatures can be quite large (see buganizer #162073826).
CFE now provides a reference from member signatures to their origin (see https://dart-review.googlesource.com/c/sdk/+/157498).
This CL bypasses loading of member signatures in JIT mode and uses their origin as target in interface calls. AOT mode is not modified.
Fix the implementation of --print-classes flag.
Change-Id: Ief3e4e58a67bc3321a55d184b3c62ce62cd78689
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/158145
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Add information about the saved arguments descriptor for dispatcher
functions to Function::ToCString and information about both the
function kind and the saved arguments descriptor (when appropriate)
to the flow graph printer and the disassembler.
Change-Id: I41f5db2d80039cb397447eb9b9db47e60469b284
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/158007
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Commit-Queue: Tess Strickland <sstrickl@google.com>
Adds a member signature origin to member signatures and includes
an additional reference to these in MethodInvocation, PropertyGet,
PropertySet, etc.
This enables the VM to bypass the member signatures when loading the
AST.
Change-Id: I5cae11f4434bc052d0ba0acf0670dd002c6f3df1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/157498
Reviewed-by: Jens Johansen <jensj@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
After inlining we may have more accurate information about array being
accessed. This change adds computation of type of LoadIndexed
instruction based on the type of array being accessed.
The computation is able to skip loading of GrowableArray.data.
If array was loaded from a field, it takes static type of a field
into account.
Benchmarks with null safety in JIT mode on x64:
ForInLoop +80-106%
DeltaBlueIterators +15-31%
Change-Id: Ia61aa761f4ccd4692e05fdac043f8a2a46f88f21
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/157823
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
This is a reland of a528b19d2c
Updating the hash of the empty type argument vector in write-protected memory caused a crash in precomp mode.
The fix is to correctly initialize the hash so it does not need an update.
Original change's description:
> [VM/runtime] Fix computation of the hash of recursive types.
>
> When computing the hash of a type, only include the hashes of the type arguments corresponding to the type parameters of the type's class and not of the whole type argument vector, otherwise, the variable location of TypeRefs in the base class type arguments may result in different hashes.
>
> Add a regression test (this test was not failing in all configurations, since the issue becomes visible depending on the order in which types are loaded and finalized).
>
> This fixes issue https://github.com/dart-lang/sdk/issues/42954
>
> Small improvement: pick hash value 1 for a vector of dynamic types, so it can be cached and not recomputed repeatedly, which was the case with value 0.
>
> Change-Id: I3468952cbf61944a82cf8e00efbf4952bd831fbe
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/157563
> Reviewed-by: Alexander Markov <alexmarkov@google.com>
> Commit-Queue: Régis Crelier <regis@google.com>
Change-Id: I538b4538c69472e09b7bd745c6bd41023e1f154f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/157781
Commit-Queue: Régis Crelier <regis@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Generally, methods that take a *TextBuffer pointer do not care how the
internal buffer is allocated, and so they could be used for either if
both were subclasses of a base class that contained the printing
methods. This CL makes that base class, and now TextBuffer and
ZoneTextBuffer now share the exact same set of methods for printing to
the internal buffer.
Since the base class is in platform, this does mean dropping the
overload of AddString for Dart String objects that was part of
ZoneTextBuffer. Instead, this CL just adds an intermediate call to
ToCString() for the small number of callers that used the overload,
keeping the printing interface the same for both.
In addition, one use of TextBuffer that then re-allocated the buffer
contents into the zone manually has been replaced with a ZoneTextBuffer
instead.
Change-Id: I438a085e7e20d55d93987fd7f36afd636f95955f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/157741
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Tess Strickland <sstrickl@google.com>
Concrete cids are 16-bit unsigned values, but Slot::cid_ was erroneously
declared as a signed value - which causes issues in program with large
amount of classes once it flows into variables of larger signed types
(classid_t or intptr_t).
Fixes b/162922506
Fixed: 162922506
Change-Id: Id116273aa34dbf6886c352427cf4565fc5dc2293
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/157487
Commit-Queue: Vyacheslav Egorov <vegorov@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
This reverts commit a528b19d2c.
Reason for revert: Failures in precompiled mode.
Original change's description:
> [VM/runtime] Fix computation of the hash of recursive types.
>
> When computing the hash of a type, only include the hashes of the type arguments corresponding to the type parameters of the type's class and not of the whole type argument vector, otherwise, the variable location of TypeRefs in the base class type arguments may result in different hashes.
>
> Add a regression test (this test was not failing in all configurations, since the issue becomes visible depending on the order in which types are loaded and finalized).
>
> This fixes issue https://github.com/dart-lang/sdk/issues/42954
>
> Small improvement: pick hash value 1 for a vector of dynamic types, so it can be cached and not recomputed repeatedly, which was the case with value 0.
>
> Change-Id: I3468952cbf61944a82cf8e00efbf4952bd831fbe
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/157563
> Reviewed-by: Alexander Markov <alexmarkov@google.com>
> Commit-Queue: Régis Crelier <regis@google.com>
TBR=rmacnak@google.com,alexmarkov@google.com,asiva@google.com,regis@google.com
Change-Id: I904e7043fa175d03bb9af56a9346b097b883c7a0
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/157700
Reviewed-by: Régis Crelier <regis@google.com>
Commit-Queue: Régis Crelier <regis@google.com>
When computing the hash of a type, only include the hashes of the type arguments corresponding to the type parameters of the type's class and not of the whole type argument vector, otherwise, the variable location of TypeRefs in the base class type arguments may result in different hashes.
Add a regression test (this test was not failing in all configurations, since the issue becomes visible depending on the order in which types are loaded and finalized).
This fixes issue https://github.com/dart-lang/sdk/issues/42954
Small improvement: pick hash value 1 for a vector of dynamic types, so it can be cached and not recomputed repeatedly, which was the case with value 0.
Change-Id: I3468952cbf61944a82cf8e00efbf4952bd831fbe
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/157563
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Régis Crelier <regis@google.com>
Before null safety
try {
...
} catch (e) {
...
}
was translated to a try-catch block with 'dynamic' catch type.
VM has a special, more efficient handling of such catch-all try blocks.
Those try blocks were detected by comparing catch type with 'dynamic'.
With null safety front-end started to translate those try blocks
using non-nullable Object as a catch type. As a result, this disabled
all optimizations for catch-all try blocks in the VM.
This change extends detection of catch-all try blocks to handle both
dynamic and Object as catch types.
Improves ParserCombinators benchmark with null safety 12x in JIT mode,
15x in AOT mode. This benchmark is now on par with legacy (pre-NNBD)
version.
Change-Id: I128aa1599d8a6f979fc2e8535d0f5c934bf3a5ba
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/157565
Reviewed-by: Régis Crelier <regis@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
When converting InstanceCall to LoadField don't adjust deoptimization
environment because when we deoptimize from LoadField back to
InstanceCall we would expect to have receiver on the stack.
This is a different situation from LoadField to LoadField lazy
deoptimization in which case receiver should not be on the stack.
Regression test provided by Ryan.
Fixed: 42900
Change-Id: I6041ff02abf22a2bae0fdcd65d5b49ef8aec6204
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/157182
Commit-Queue: Vyacheslav Egorov <vegorov@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
In AOT mode, TFA turns optional arguments (named or positional) that are
always provided into required positional arguments and increases the
number of required arguments accordingly. Thus, from the standpoint of
the VM, whether it's reading in bytecode or kernel, these are just
regular fixed positional arguments. However, TFA originally left the
parameter flags alone for these parameters, so required named parameters
that were converted to positional arguments still had the required flag
set.
This CL does two things:
1. It fixes TFA to clear the required bit on a parameter if it is
converted from a named parameter to a required positional parameter.
2. It adds ASSERT()s and RELEASE_ASSERT()s on the VM side to ensure that
only named parameters have the required bit set.
Change-Id: I1c36d777a7e9e7d703bcc23ee1b798bffeffa29e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/157381
Commit-Queue: Tess Strickland <sstrickl@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Fixes the change in d7feab5a, which created a base definition for
BinaryIntegerOpInstr::InferRange from BinaryInt32OpInstr (which used
GetSmiRange to get the operand ranges) instead of BinaryInt64OpInstr
(which used the operand ranges directly).
Instead, just use GetInputRange to get an appropriate range based on
the representation of each input.
Change-Id: Ib62199ecc3ea3246fcf5deffc69285a15124f462
Bug: https://github.com/dart-lang/sdk/issues/42948
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/156906
Commit-Queue: Tess Strickland <sstrickl@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Aske Simon Christensen <askesc@google.com>
This assignment appears to have the intention of performing a comparison
and asserting that the opcode encountered was as expected, rather than
assigning it to be that particular opcode.
Change-Id: I21f3c00f414d4b191f85e9dcf4391a6dd7023495
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/157105
Auto-Submit: Drew Fisher <zarvox@google.com>
Reviewed-by: Aske Simon Christensen <askesc@google.com>
Commit-Queue: Aske Simon Christensen <askesc@google.com>