Version 2.15.0-199.0.dev
Merge commit '3aaad7817bf5cc1a6c5205a408be345dc9ec7154' into 'dev'
diff --git a/pkg/vm/lib/transformations/type_flow/analysis.dart b/pkg/vm/lib/transformations/type_flow/analysis.dart
index 625616f..089a4c9 100644
--- a/pkg/vm/lib/transformations/type_flow/analysis.dart
+++ b/pkg/vm/lib/transformations/type_flow/analysis.dart
@@ -550,8 +550,7 @@
TypeFlowAnalysis typeFlowAnalysis) {
final TFClass cls = receiver.cls;
- Member? target =
- (cls as _TFClassImpl).getDispatchTarget(selector, typeFlowAnalysis);
+ Member? target = (cls as _TFClassImpl).getDispatchTarget(selector);
if (target != null) {
if (kPrintTrace) {
@@ -948,9 +947,13 @@
/// exceeds this constant, then WideConeType approximation is used.
static const int maxAllocatedTypesInSetSpecializations = 128;
+ final _TFClassImpl? superclass;
final Set<_TFClassImpl> supertypes; // List of super-types including this.
final Set<_TFClassImpl> _allocatedSubtypes = new Set<_TFClassImpl>();
- final Map<Selector, Member> _dispatchTargets = <Selector, Member>{};
+ late final Map<Name, Member> _dispatchTargetsSetters =
+ _initDispatchTargets(true);
+ late final Map<Name, Member> _dispatchTargetsNonSetters =
+ _initDispatchTargets(false);
final _DependencyTracker dependencyTracker = new _DependencyTracker();
/// Flag indicating if this class has a noSuchMethod() method not inherited
@@ -958,7 +961,7 @@
/// Lazy initialized by ClassHierarchyCache.hasNonTrivialNoSuchMethod().
bool? hasNonTrivialNoSuchMethod;
- _TFClassImpl(int id, Class classNode, this.supertypes)
+ _TFClassImpl(int id, Class classNode, this.superclass, this.supertypes)
: super(id, classNode) {
supertypes.add(this);
}
@@ -1001,19 +1004,37 @@
_specializedConeType = null; // Reset cached specialization.
}
- Member? getDispatchTarget(
- Selector selector, TypeFlowAnalysis typeFlowAnalysis) {
- Member? target = _dispatchTargets[selector];
- if (target == null) {
- target = typeFlowAnalysis.hierarchyCache.hierarchy.getDispatchTarget(
- classNode, selector.name,
- setter: selector.isSetter);
- target ??= _DispatchableInvocation.kNoSuchMethodMarker;
- _dispatchTargets[selector] = target;
+ Map<Name, Member> _initDispatchTargets(bool setters) {
+ Map<Name, Member> targets;
+ final superclass = this.superclass;
+ if (superclass != null) {
+ targets = Map.from(setters
+ ? superclass._dispatchTargetsSetters
+ : superclass._dispatchTargetsNonSetters);
+ } else {
+ targets = {};
}
- return identical(target, _DispatchableInvocation.kNoSuchMethodMarker)
- ? null
- : target;
+ for (Field f in classNode.fields) {
+ if (!f.isStatic && !f.isAbstract) {
+ if (!setters || f.hasSetter) {
+ targets[f.name] = f;
+ }
+ }
+ }
+ for (Procedure p in classNode.procedures) {
+ if (!p.isStatic && !p.isAbstract) {
+ if (p.isSetter == setters) {
+ targets[p.name] = p;
+ }
+ }
+ }
+ return targets;
+ }
+
+ Member? getDispatchTarget(Selector selector) {
+ return (selector.isSetter
+ ? _dispatchTargetsSetters
+ : _dispatchTargetsNonSetters)[selector.name];
}
String dump() => "$this {supers: $supertypes}";
@@ -1127,7 +1148,10 @@
for (var sup in c.supers) {
supertypes.addAll(getTFClass(sup.classNode).supertypes);
}
- return new _TFClassImpl(++_classIdCounter, c, supertypes);
+ Class? superclassNode = c.superclass;
+ _TFClassImpl? superclass =
+ superclassNode != null ? getTFClass(superclassNode) : null;
+ return new _TFClassImpl(++_classIdCounter, c, superclass, supertypes);
}
ConcreteType addAllocatedClass(Class cl) {
diff --git a/tools/VERSION b/tools/VERSION
index 73ee50d..6e5e310 100644
--- a/tools/VERSION
+++ b/tools/VERSION
@@ -27,5 +27,5 @@
MAJOR 2
MINOR 15
PATCH 0
-PRERELEASE 198
+PRERELEASE 199
PRERELEASE_PATCH 0
\ No newline at end of file
diff --git a/tools/manage_deps.dart b/tools/manage_deps.dart
index 0d1e8b4..9c8e1c6 100755
--- a/tools/manage_deps.dart
+++ b/tools/manage_deps.dart
@@ -75,9 +75,9 @@
final branchName = argResults['branch'] ?? 'bump_$toUpdate';
final exists = runProcessForExitCode(
- ['git', 'show-ref', '--quiet', 'refs/head/$branchName'],
+ ['git', 'rev-parse', '--verify', branchName],
explanation: 'Checking if branch-name exists');
- if (exists != 0) {
+ if (exists == 0) {
print('Branch $branchName already exist - delete it?');
if (!prompt()) {
print('Ok - exiting');