When a script is not in the vm heap, we now cache compile time
constants on the script object itself. During isolate reload we may
have both an old and a new version of a script being compiled at the
same time and they need to cache their constants separately. This
also means that compile time constants from old scripts can be
collected when the script is collected, which is good.
When a script is in the vm heap, we continue to use the old system of
employing a shared per-isolate cache stored in the object store.
Closes#26833
BUG=
R=fschneider@google.com, johnmccutchan@google.com
Review URL: https://codereview.chromium.org/2126393003 .
- [x] Add a NoReloadScope to `Parser::RunStaticFieldInitializer`
- [x] Add a NoReloadScope to `Parser::EvaluateConstConstructorCall`
- [x] Add a NoReloadScope to `Parser::Interpolate`
- [x] Add a NoReloadScope to `Parser::EvaluateConstExpr`
Fixes#26837R=fschneider@google.com
Review URL: https://codereview.chromium.org/2135683002 .
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 parsing a field initializer expression or mixin fields,
the current_class must be the mixin application class, not the
mixin class. This is necessary so that type arguments are
resolved in the correct scope class.
Dart2js fails the new regression test language/regress_18713.
Filed issue #26743.
BUG=18713
R=regis@google.com
Review URL: https://codereview.chromium.org/2085003002 .
Thess place were forgotten when changing all allocations in the background
compiler to old-space. New-space allocation is not allowed in the background
compiler thread.
I added assert to places that should only be reachable during unoptimized compilation.
BUG=#26669
R=asiva@google.com
Review URL: https://codereview.chromium.org/2056813002 .
In switch statements, ‘continue L’ jumps can refer to a label
that the compiler hasn’t seen yet. The label is tentatively
to be in the innermost switch statement, but may later
be moved to an outer switch statement. The compiler must
make sure that the correct finally blocks are inlined in front
of these jumps.
BUG=26577, 25310
R=regis@google.com
Review URL: https://codereview.chromium.org/2030763002 .
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 .
The parser copies blocks of finally clauses to every return
or jump statement that can break out of enclosing try statements.
This change makes sure that only enclosing try statements in the
same function are considered.
BUG=
R=fschneider@google.com
Review URL: https://codereview.chromium.org/2004883004 .
Rework how we check guarded state consistency in background compiler.
Background compiler was storing original fields inside guarded fields list. This caused a race during inlining when inliner would copy guarded fields one by one from the callee function into the caller, because ParsedFunction::AddToGuardedFields looks at the guarded_cid to filter out those fields that should not be guarded.
As a result if some guarded field transitioned to unguarded (kDynamicCid) after callee graph construction but before list of guarded fields were copied then AddToGuardedFields would simply skip that field because it now has guarded_cid() == kDynamicCid.
We fix this race by always placing copies into the list of guarded fields and unwrapping them only in FinalizeCode.
Placing the copies also allows us to simplify a lot of code that was trying to verify guarded state consistency before committing the generated optimized code - now that we store copies in the list we can just compare their state to the originals and abort if the state is different.
Additionally fix deduplication check that was comparing original fields with copies - resulting in adding the same field into the list multiple times.
Add an assertion that verifies that we are not trying to access guarded_cid of original field from background compiler.
R=fschneider@google.com
BUG=
Review URL: https://codereview.chromium.org/2006793002 .
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 .
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 .
This is a cut of the work that Todd and I collaborated on in the reload branch.
In this CL, we've dropped the loader port hacks, in other words, on stack reloading in the standalone embedder does not work yet.
- [x] Support for hot reloading of isolate source code
- [x] Unit test harness and many tests
- [x] Service protocol and Observatory support
- [x] Product build does not include support for hot reloading.
R=rmacnak@google.com
Review URL: https://codereview.chromium.org/1965823002 .
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 .
Static initializers were compiled without any optimizations. They are only
executed once, but the optimizer can potentially extract static type information
and may also produce a bit smaller code. (7K size savings when compiling dart2js -- i.e. < 0.1%)
This CL enables optimizations for them. The space savings
are not great, but I still think it's nicer to only have
optimized code when precompiling, instead of a mixture of
unoptimized and optimized.
Also, fix printing disassembly for initializers, and insert additional assertions.
BUG=
R=rmacnak@google.com
Review URL: https://codereview.chromium.org/1958913003 .
- Ensure the uniqueness of private keys without having to
search the existing key space.
- Pass a thread parameter where useful to library methods.
BUG=
Review URL: https://codereview.chromium.org/1947393003 .
- Add a zone parameter to TokenStream::Iterator
- Add IsXXXX() functions in raw_object.h using GetClassId()
- Modify
- Function::owner
- Function::origin
- Type::IsMalformed
- Type::IsMalbounded
- Type::error
to not create a Handle in the common path
R=regis@google.com
Review URL: https://codereview.chromium.org/1952023002 .
Initializer expressions are evaluated only once. Therefore, do not store
constant expressions in the constant cache, since they will never be
used again.
Except: when generating a stack trace and accessing the local variables
in a the stack frame of an initializer expression (static final getter function),
the constant will have to be recomputed instead of retrieved from the cache.
This CL also disables the stacktrace_every stress flag while a stack trace
is being collected, to avoid recursive requests for stack traces.
BUG=
R=rmacnak@google.com
Review URL: https://codereview.chromium.org/1934733002 .
Add mirror regression test.
Adjust expectation of a mirror test.
Fix parser to mark current class as typedef before parsing signature.
Fix canonicalization of typedef function types (a typedef class can be the scope
class of more than one function type, even if not generic).
R=rmacnak@google.com
Review URL: https://codereview.chromium.org/1890013002 .