Added a ClassInfo struct that stores bits for class, strict subclasses and strict subtypes.
This map is initialized empty and lazily computes the bits using the method computeClassInfo.
This function recursively traverses the class hierarchy only when needed, computes the bits on the fly and stores it.
Since the class hierarchy is a DAG, this recursive method terminates.
This map will also be used for some queries, which are now exercised in the new test
Change-Id: I0b8b0b34b5c7d5cc3c1608266c9795033351e650
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/160040
Reviewed-by: Stephen Adams <sra@google.com>
Commit-Queue: Christian Altamirano <coam@google.com>
Use abstract type of constant for BoolConstantTypeInformation
as the AbstractValueDomain may have something more precise than 'bool'
for a true/false constant.
Evaluate short-circuit `&&` and `||` for constant inputs.
This can occur with named and -Dxxx= defined constants.
TODO: we should consider adding a node like a guarded-phi to
select an input, with possible boolean conversions on inputs.
Change-Id: I7f54503db87f6a6d2034ca59c16b4f1ff69ebbb6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/159323
Reviewed-by: Christian Altamirano <coam@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Stephen Adams <sra@google.com>
native_test is set up so that it validates only one error per static
error. This CL allows multiple errors to be reported and validates
that all are reported.
Change-Id: I97e9abbfbd8273c0c436e44d08f5768eea3f7785
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/157663
Reviewed-by: Stephen Adams <sra@google.com>
Pass the CommonMasks abstract value domain instead of the JClosedWorld to TypeMask methods that need access to *their* abstract value domain. It is wrong to get the abstract value domain from the JClosedWorld because when we try to wrap abstract values, the abstract value domain in the JClosedWorld is the wrapper domain, not the domain being wrapped.
Change-Id: I5bbd0f4c56abe45714dd0a2657f73ef240efae0e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/155640
Commit-Queue: Christian Altamirano <coam@google.com>
Reviewed-by: Stephen Adams <sra@google.com>
The current implementation of this check is incorrect and produces false
negatives. Conservatively assuming that one type is always a potential
subtype of another is a simple fix to get this working.
The main downsides are that we may emit signatures and provide type
arguments to functions even when they're not needed because we no longer
statically deduce that a type check must fail. This may cause size
regressions.
I've added a TODO to add proper constraint solving per the local type
inference spec, but this is not currently a priority since no regression
is observed on large Google apps.
Change-Id: Ie5065596331c33a030e06e66481f258ef937e659
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/155544
Reviewed-by: Stephen Adams <sra@google.com>
Commit-Queue: Mayank Patke <fishythefish@google.com>
Account for the size of the a generative constructor factory.
The factory evaluates all the initializers up the inheritance/mixin chain,
allocates the object, and then calls all the constructors down the
inheritance chain. All this is missed by the old code looking at the
immediate constructor body, sometimes causing extremely large
constructors to be inlined.
Change-Id: I8803b0f4b4155dec0f7878fd5527c1dd507b9c80
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/153560
Commit-Queue: Stephen Adams <sra@google.com>
Reviewed-by: Mayank Patke <fishythefish@google.com>
This was noticed when running the benchmarks/Calls/dart/Calls.dart with
sound-null-safety.
The only fix that was needed is to swap the argument order, but I also changed
to add the type promotion to make these errors stand out statically.
Change-Id: If47b04596d2da9d30961705fd858f2f2ba2b12c9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/153062
Reviewed-by: Stephen Adams <sra@google.com>
Commit-Queue: Sigmund Cherem <sigmund@google.com>
On a per output-unit basis, repeated large strings are shared via a
`string$` pool.
TODOs:
- don't do it with strings passed to JS() code (they might need
to be property accesses).
- tweak thresholds, using different thresholds for slow/run-once code.
Change-Id: Ib14245d9d428e52fb2ca23f34fa533de97fa2208
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/136304
Reviewed-by: Joshua Litt <joshualitt@google.com>
Commit-Queue: Stephen Adams <sra@google.com>
When reducing the type promotion in case of assignment, the target
info wasn't correctly handling the reduction to the trivial state.
This caused an error in a following join computation.
Closes#42281
Change-Id: I2144f5401e9736308dc37147f7a5cb9ab1be8583
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/150935
Commit-Queue: Stephen Adams <sra@google.com>
Reviewed-by: Stephen Adams <sra@google.com>
Remove HInstructions related to old rti.
Some methods are still called 'fooNewRti'. These will be renamed 'foo'
at the very end of removing old rti.
Change-Id: I36fcc9d2d5bc19988e26fa5014c895f54b88900c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/150276
Reviewed-by: Joshua Litt <joshualitt@google.com>
Commit-Queue: Stephen Adams <sra@google.com>