[pkg/vm_snapshot_analysis] Use program.stubs as owner for TTS stubs.

Also remove the '<anonymous signature>' check, since we stopped
generating function objects for function types before the current
minimum SDK version for the package.

Change-Id: I47c0522ae4ba778221ee98f93fdae8c22a57d688
Bug: https://github.com/flutter/flutter/issues/128402
Cq-Include-Trybots: luci.dart.try:pkg-linux-debug-try,pkg-linux-release-try,pkg-mac-release-arm64-try,pkg-win-release-try,pkg-mac-release-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/307860
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Tess Strickland <sstrickl@google.com>
This commit is contained in:
Tess Strickland
2023-06-08 11:48:58 +00:00
committed by Commit Queue
parent a731af1703
commit 766a2be5a4
3 changed files with 25 additions and 27 deletions
+5
View File
@@ -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.
+19 -26
View File
@@ -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 != '<anonymous signature>') {
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_']!);
+1 -1
View File
@@ -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