Skip to content

Commit 82559e2

Browse files
2ZeroSixCommit Queue
authored and
Commit Queue
committed
[vm] postpone creation of handles for show/hide lists
Closes #60473 GitOrigin-RevId: 4e731c9 Change-Id: I5dd9b179ff0ed4f546ca0fea16456ccda7545f10 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/420301 Reviewed-by: Ryan Macnak <[email protected]> Commit-Queue: Ryan Macnak <[email protected]>
1 parent 1dccb82 commit 82559e2

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

runtime/vm/kernel_loader.cc

+10-6
Original file line numberDiff line numberDiff line change
@@ -1124,8 +1124,6 @@ void KernelLoader::FinishTopLevelClassLoading(
11241124

11251125
void KernelLoader::LoadLibraryImportsAndExports(Library* library,
11261126
const Class& toplevel_class) {
1127-
GrowableObjectArray& show_list = GrowableObjectArray::Handle(Z);
1128-
GrowableObjectArray& hide_list = GrowableObjectArray::Handle(Z);
11291127
Array& show_names = Array::Handle(Z);
11301128
Array& hide_names = Array::Handle(Z);
11311129
Namespace& ns = Namespace::Handle(Z);
@@ -1153,8 +1151,8 @@ void KernelLoader::LoadLibraryImportsAndExports(Library* library,
11531151
}
11541152

11551153
// Prepare show and hide lists.
1156-
show_list = GrowableObjectArray::New(Heap::kOld);
1157-
hide_list = GrowableObjectArray::New(Heap::kOld);
1154+
GrowableObjectArray& show_list = GrowableObjectArray::Handle(Z);
1155+
GrowableObjectArray& hide_list = GrowableObjectArray::Handle(Z);
11581156
const intptr_t combinator_count = helper_.ReadListLength();
11591157
for (intptr_t c = 0; c < combinator_count; ++c) {
11601158
uint8_t flags = helper_.ReadFlags();
@@ -1163,20 +1161,26 @@ void KernelLoader::LoadLibraryImportsAndExports(Library* library,
11631161
String& show_hide_name =
11641162
H.DartSymbolObfuscate(helper_.ReadStringReference());
11651163
if ((flags & LibraryDependencyHelper::Show) != 0) {
1164+
if (show_list.IsNull()) {
1165+
show_list = GrowableObjectArray::New(Heap::kOld);
1166+
}
11661167
show_list.Add(show_hide_name, Heap::kOld);
11671168
} else {
1169+
if (hide_list.IsNull()) {
1170+
hide_list = GrowableObjectArray::New(Heap::kOld);
1171+
}
11681172
hide_list.Add(show_hide_name, Heap::kOld);
11691173
}
11701174
}
11711175
}
11721176

1173-
if (show_list.Length() > 0) {
1177+
if (!show_list.IsNull() && show_list.Length() > 0) {
11741178
show_names = Array::MakeFixedLength(show_list);
11751179
} else {
11761180
show_names = Array::null();
11771181
}
11781182

1179-
if (hide_list.Length() > 0) {
1183+
if (!hide_list.IsNull() && hide_list.Length() > 0) {
11801184
hide_names = Array::MakeFixedLength(hide_list);
11811185
} else {
11821186
hide_names = Array::null();

0 commit comments

Comments
 (0)