Inline instance object hash code into object header on 64 bit.
64 bit objects have 32 bits of free space in the header word.
This is used for the hash code in string objects. We take it
for the default hash code on all objects that don't override
the hashCode getter.
This is both faster and a memory reduction. Eg it makes the
MegaHashCode part of the Megamorphic benchmark 6 times faster.
This is a reland of https://codereview.chromium.org/2954453002/
which fixes an issue that made script snapshots generated on
64 bit platforms incompatible with 32 bit VMs.
BUG=
R=vegorov@google.com
Review-Url: https://codereview.chromium.org/2965723002 .
We introduce a class KernelSyntheticExpression which can be used for
synthetic expressions introduced by the front end. It is used for
expressions that represent errors detected by the front end, and it is
also the base class for KernelComplexAssignment. By default, type
inference skips these synthetic expressions, inferring a type of
`dynamic`. (Note, however, that classes dervied from
KernelComplexAssignment override this behavior).
We also introduce a class KernelSyntheticStatement which behaves
similarly, but is used for statements rather than expressions,
e.g. the synthetic assignment introduced at the top of a "for" loop
whose loop variable is defined elsewhere.
Finally, we modify KernelTypeInferrer.inferFieldTopLevel() so that it
deliberatly infers `dynamic` for fields that lack an initializer.
Previously this behavior happened as a result of the hack in
KernelTypeInferrer.inferExpression which caused type inference to
infer `dynamic` for anything that didn't implement KernelExpression.
All of these changes should help pave the way for removing the
aforementioned hack.
R=scheglov@google.com
Review-Url: https://codereview.chromium.org/2968563002 .
This is intended for profiling, to ensure that type inference and type
promotion do not slow down compilation too much.
Currently the option is just plumbed through to the kernel Target
class since I'm not exactly sure how we'll want to enable/disable this
option; we can plumb it the rest of the way in a future CL.
R=ahe@google.com
Review-Url: https://codereview.chromium.org/2962913002 .
All variable declarations encountered by type inference are now of
type KernelVariableDeclaration, so we no longer need a hack to handle
ordinary VariableDeclaration objects.
Removing the hack avoids covering up bugs.
R=scheglov@google.com
Review-Url: https://codereview.chromium.org/2961723002 .
Note that no actual type inference needs to be performed, but we still
need to implement the _inferStatement() methods so that we can get rid
of the hack in KernelTypeInferrer.inferStatement. Also, we need to
call into the listener so that once this logic is hooked into
AstBuilder, analyzer will stay in sync with type inference.
R=scheglov@google.com
Review-Url: https://codereview.chromium.org/2962583002 .
I implemented the correct logic for both SuperPropertyGet and
DirectPropertyGet, since there are TODO comments in the code
indicating that the former will be replaced by the latter when
possible.
R=scheglov@google.com
Review-Url: https://codereview.chromium.org/2959823002 .
I implemented the correct logic for both SuperMethodInvocation and
DirectMethodInvocation, since there are TODO comments in the code
indicating that the former will be replaced by the latter when
possible.
R=scheglov@google.com
Review-Url: https://codereview.chromium.org/2954403002 .
Note that since the first argument of an assert statement may be
either of type `bool` or `() -> bool`, and the second argument may be
any object, no type context is passed down in downward inference; the
only inference we need to do is to recursively invoke
`inferExpression` to ensure that subexpressions are inferred properly.
R=scheglov@google.com
Review-Url: https://codereview.chromium.org/2959763002 .
Analyzer does not infer switch cases correctly (it uses an empty
context for the case expression, instead of the type of the switch
expression), so the tests are in inference_new.
R=scheglov@google.com
Review-Url: https://codereview.chromium.org/2953423002 .