- [x] Add three public fields to the "BoundVariable" service type: declarationTokenPos, visibleStartTokenPos, and visibleEndTokenPos. (naming suggestions welcome!)
- [x] Extend LocalVarDescriptors to hold the declaration token position (it already had the scope visibility boundaries).
- [x] Extend ContextScope to hold the declaration token position.
- [x] Add a unit test which verifies this works for local variables, function parameters, and closure captured variables.
Fixes https://github.com/dart-lang/sdk/issues/25569
BUG=
R=rmacnak@google.com
Review URL: https://codereview.chromium.org/2419013004 .
Catch block entries need to be considered when doing lazy deoptimization.
In addition to the return, also patch all catch entry blocks in a function scheduled for lazy deoptimization.
Also, move restoring the pool pointer to the jump-to-handler stub to simplify patching the catch entry.
BUG=#27419
R=rmacnak@google.com
Review URL: https://codereview.chromium.org/2357343003 .
Just like we do for local variables, add a debug step check (and
thus a breakpoint location) to global variable assignment if
the right side of the assignment has no possible breakpoint locations.
BUG=#27287
R=johnmccutchan@google.com
Review URL: https://codereview.chromium.org/2354773002 .
Consider code like
try {
something();
} finally {
assert(expr);
}
The compiler de-sugars this into
try {
something();
} catch (_) {
rethrow;
} finally {
assert(expr);
}
In unchecked mode this leaves an empty finally-block, but we would still
have the overhead of the try-catch. This CL avoids this unnecessary overhead
by making try-finally with an empty finally zero-cost.
BUG=#27274
R=rmacnak@google.com
Review URL: https://codereview.chromium.org/2322853003 .
We can have stores inlined in the optimizer that are not initializing stores.
Mark initializing stores in the parser instead to distinguish
initializing- and non-initializing stores more precisely.
BUG=
R=vegorov@google.com
Review URL: https://codereview.chromium.org/2112973002 .
When optimistically inlining is-checks and as-casts, we have to guard
again repeated speculative attempts.
Also, add result cid information for recognized factories.
BUG=#26607
R=rmacnak@google.com
Review URL: https://codereview.chromium.org/2035073002 .
In Flutter, this caused
RangeError (index): Index out of range: index should be less than null: 0
Uint32List.[]= (dart:typed_data)
_HashVMBase&MapMixin&&_LinkedHashMapMixin._insert (dart:collection-patch/compact_hash.dart)
This reverts commit 0ae4ae5033.
TBR=fschneider@google.com
Review URL: https://codereview.chromium.org/2023423002 .
Fourth(!) attempt. This CL fixes another instance where parsing a nested function modifies the parser state of the function that is being compiled.
When a local function gets compiled the second time, constant
expressions may not be parsed again, since the constant value
is found in the cache. If the expression refers to an outer
variable, it does not get captured correctly.
Fix: instead of parsing a local function repeatedly to capture
outer variables, use the local function’s context scope to mark
outer variables as captured. This fixes the bug, and makes the
compiler more efficient as well.
BUG= 26453
R=rmacnak@google.com
Review URL: https://codereview.chromium.org/2010283004 .
This reverts commit 4dca5d0e01.
It seems to cause at least one additional test failure:
Repro:
python tools/test.py -mrelease -asimarm64 --write-debug-log --write-test-outcome-log --copy-coredumps -cprecompiler -rdart_precompiled --exclude-suite pkg -t480 language/async_star_regression_fisk_test
BUG=
R=vegorov@google.com
Review URL: https://codereview.chromium.org/2004373004 .
Third attempt. A latent bug in finally block inlining
caused the previous crashes in optimized functions.
Fix is in https://codereview.chromium.org/2004883004/.
When a local function gets compiled the second time, constant
expressions may not be parsed again, since the constant value
is found in the cache. If the expression refers to an outer
variable, it does not get captured correctly.
Fix: instead of parsing a local function repeatedly to capture
outer variables, use the local function’s context scope to mark
outer variables as captured. This fixes the bug, and makes the
compiler more efficient as well.
BUG=26453
R=rmacnak@google.com
Review URL: https://codereview.chromium.org/2008043002 .
Most of the infrastructure is fixed to work with DBC stack layout:
- register allocator allocates DBC registers with the limitation that we allocate only 20 registers and bail out if anything needs spilling (there is no use implementing spilling on DBC because registers are memory locations themselves). We should be able to bump number of CPU registers on DBC up to 256 but this requires major surgery in some parts - so I postponed this;
- lazy deoptimization is implemented, eager deoptimization is not - because we don't emit any code that actually requires it. it's a minor change to support it once we have a target;
- stack scanning respects stack maps built by registers allocator;
We bailout from all unsupported instructions.
R=zra@google.com
Review URL: https://codereview.chromium.org/1992963002 .
The previous pattern was:
1. FP-relative load of the top of the stack
2. Push #1
3. Pop
4. Pop
5. Push #3
Where #5 was omitted when the value was unused.
The new pattern is:
1. Pop
2. Push #1
Where #2 is omitted when the value is unused.
R=fschneider@google.com
Review URL: https://codereview.chromium.org/1963683003 .
Second attempt, this time also capturing hidden variables
like 'this' in initializer lists. Original CL is
https://codereview.chromium.org/1980193002
When a local function gets compiled the second time, constant
expressions may not be parsed again, since the constant value
is found in the cache. If the expression refers to an outer
variable, it does not get captured correctly.
Fix: instead of parsing a local function repeatedly to capture
outer variables, use the local function’s context scope to mark
outer variables as captured. This fixes the bug, and makes the
compiler more efficient as well.
BUG=26453
R=rmacnak@google.com
Review URL: https://codereview.chromium.org/1986393002 .
When a local function gets compiled the second time, constant
expressions may not be parsed again, since the constant value
is found in the cache. If the expression refers to an outer
variable, it does not get captured correctly.
Fix: instead of parsing a local function repeatedly to capture
outer variables, use the local function’s context scope to mark
outer variables as captured. This fixes the bug, and makes the
compiler more efficient as well.
No wall-time improvement found when running dart2js, though.
BUG=26453
R=regis@google.com
Review URL: https://codereview.chromium.org/1980193002 .
With catch blocks appearing as additional function entry blocks,
there can be phis for the receiver (parameter 0).
This CL fixes the problem that the receiver type information
was lost in the presence of try-catch.
BUG=
R=vegorov@google.com
Review URL: https://codereview.chromium.org/1841073003 .
The stack overflow check on the back-branch of the loop must
be at the same context level as the (outer) loop block of
the for-loop.
Before this change, the stack check was recorded to be at a
token position that is outside of the loop block, which caused
a context mismatch on some stack traces when the debugger
or the observatory interrupted the isolate on that back
branch.
It is not practical to write a test for this, unfortunately.
BUG=25684
R=fschneider@google.com
Review URL: https://codereview.chromium.org/1768763002 .