diff --git a/pkg/vm_snapshot_analysis/CHANGELOG.md b/pkg/vm_snapshot_analysis/CHANGELOG.md index b3b4caf83e0..abce1fcef50 100644 --- a/pkg/vm_snapshot_analysis/CHANGELOG.md +++ b/pkg/vm_snapshot_analysis/CHANGELOG.md @@ -1,5 +1,10 @@ # Changelog +## 0.7.4 + +- Fix for flutter/flutter#128402 where an attempt to lookup the owner info +node for type testing stubs would cause a null check error. + ## 0.7.3-dev - Update the readme to document the current way to generate Dart AOT snapshots. diff --git a/pkg/vm_snapshot_analysis/lib/v8_profile.dart b/pkg/vm_snapshot_analysis/lib/v8_profile.dart index 8fbe4888ab7..7ad49a3a3a5 100644 --- a/pkg/vm_snapshot_analysis/lib/v8_profile.dart +++ b/pkg/vm_snapshot_analysis/lib/v8_profile.dart @@ -414,37 +414,30 @@ class _ProgramInfoBuilder { switch (node.type) { case 'Code': final owner = node['owner_']!; - if (owner.type != 'Type') { - final ownerNode = - owner.type == 'Null' ? program.stubs : getInfoNodeFor(owner)!; - if (owner.type == 'Function') { - // For normal functions we just attribute Code object and all - // objects dominated by it to the function itself. - return ownerNode; - } - - // For stubs we create a dummy functionNode that is going to own - // all objects dominated by it. - return makeInfoNode(node.index, - name: node.name, parent: ownerNode, type: NodeType.functionNode); + if (owner.type == 'Function') { + // For normal functions we just attribute Code object and all + // objects dominated by it to the function itself. + return getInfoNodeFor(owner)!; } - break; + // For all stub types, we create a dummy functionNode that is going to + // own all objects dominated by it. + final ownerNode = + owner.type == 'Class' ? getInfoNodeFor(owner)! : program.stubs; + return makeInfoNode(node.index, + name: node.name, parent: ownerNode, type: NodeType.functionNode); case 'Function': - if (node.name != '') { - var owner = node['owner_']!; + var owner = node['owner_']!; - // Artificial nodes may not have a data_ field. - var data = node['data_']; - if (data != null && data.type == 'ClosureData') { - owner = data['parent_function_']!; - } - return makeInfoNode(node.index, - name: node.name, - parent: getInfoNodeFor(owner)!, - type: NodeType.functionNode); + // Artificial nodes may not have a data_ field. + var data = node['data_']; + if (data != null && data.type == 'ClosureData') { + owner = data['parent_function_']!; } - break; + return makeInfoNode(node.index, + name: node.name, + parent: getInfoNodeFor(owner)!, + type: NodeType.functionNode); case 'PatchClass': return getInfoNodeFor(node['patched_class_']!); diff --git a/pkg/vm_snapshot_analysis/pubspec.yaml b/pkg/vm_snapshot_analysis/pubspec.yaml index c8c232c957d..acb63ac83f2 100644 --- a/pkg/vm_snapshot_analysis/pubspec.yaml +++ b/pkg/vm_snapshot_analysis/pubspec.yaml @@ -1,5 +1,5 @@ name: vm_snapshot_analysis -version: 0.7.3-dev +version: 0.7.4 description: Utilities for analysing AOT snapshot size. repository: https://github.com/dart-lang/sdk/tree/main/pkg/vm_snapshot_analysis