Skip to content

Commit 1fd04e5

Browse files
alexmarkovCommit Queue
authored andcommitted
[vm,dyn_modules] Support bytecode in RetainingPath::CollectPath
TEST=ci (vm/dart/isolates/closure_entrypoint_test) Change-Id: Idaf4339aa50882ed4c1bf6b7930de1d1249c3bc6 Cq-Include-Trybots: luci.dart.try:vm-aot-dyn-linux-debug-x64-try,vm-aot-dyn-linux-product-x64-try,vm-dyn-linux-debug-x64-try Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/442101 Commit-Queue: Alexander Markov <[email protected]> Reviewed-by: Alexander Aprelev <[email protected]>
1 parent 081a5ab commit 1fd04e5

File tree

1 file changed

+25
-13
lines changed

1 file changed

+25
-13
lines changed

runtime/vm/object_graph_copy.cc

Lines changed: 25 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1156,8 +1156,11 @@ class RetainingPath {
11561156
Context& context = Context::Handle(zone_);
11571157
Closure& closure = Closure::Handle(zone_);
11581158
Function& function = Function::Handle(zone_);
1159-
#if !defined(DART_PRECOMPILED_RUNTIME)
1159+
#if !defined(DART_PRECOMPILED_RUNTIME) && !defined(PRODUCT)
11601160
Code& code = Code::Handle(zone_);
1161+
#if defined(DART_DYNAMIC_MODULES)
1162+
Bytecode& bytecode = Bytecode::Handle(zone_);
1163+
#endif
11611164
LocalVarDescriptors& var_descriptors = LocalVarDescriptors::Handle(zone_);
11621165
String& name = String::Handle(zone_);
11631166
#endif
@@ -1202,21 +1205,30 @@ class RetainingPath {
12021205
if (object.IsInstance()) {
12031206
if (object.IsClosure()) {
12041207
closure ^= raw;
1205-
function ^= closure.function();
1208+
function = closure.function();
12061209
// Use function's class when looking for a library information.
1207-
klass ^= function.Owner();
1208-
#if defined(DART_PRECOMPILED_RUNTIME)
1210+
klass = function.Owner();
1211+
#if defined(DART_PRECOMPILED_RUNTIME) || defined(PRODUCT)
12091212
// Use function's name instead of closure's.
12101213
location = function.QualifiedUserVisibleNameCString();
1211-
#else // defined(DART_PRECOMPILED_RUNTIME) \
1212-
// Attempt to convert "instance <- Context+ <- Closure" into \
1213-
// "instance <- local var name in Closure".
1214-
if (!function.ForceOptimize()) {
1215-
function.EnsureHasCompiledUnoptimizedCode();
1214+
#else
1215+
// Attempt to convert "instance <- Context+ <- Closure" into
1216+
// "instance <- local var name in Closure".
1217+
if (function.is_declared_in_bytecode()) {
1218+
#if defined(DART_DYNAMIC_MODULES)
1219+
bytecode = function.GetBytecode();
1220+
var_descriptors = bytecode.GetLocalVarDescriptors();
1221+
#else
1222+
UNREACHABLE();
1223+
#endif // defined(DART_DYNAMIC_MODULES)
1224+
} else {
1225+
if (!function.ForceOptimize()) {
1226+
function.EnsureHasCompiledUnoptimizedCode();
1227+
}
1228+
code = function.unoptimized_code();
1229+
ASSERT(!code.IsNull());
1230+
var_descriptors = code.GetLocalVarDescriptors();
12161231
}
1217-
code ^= function.unoptimized_code();
1218-
ASSERT(!code.IsNull());
1219-
var_descriptors ^= code.GetLocalVarDescriptors();
12201232
for (intptr_t i = 0; i < var_descriptors.Length(); i++) {
12211233
UntaggedLocalVarDescriptors::VarInfo info;
12221234
var_descriptors.GetInfo(i, &info);
@@ -1233,7 +1245,7 @@ class RetainingPath {
12331245
break;
12341246
}
12351247
}
1236-
#endif // defined(DART_PRECOMPILED_RUNTIME)
1248+
#endif // defined(DART_PRECOMPILED_RUNTIME) || defined(PRODUCT)
12371249
} else {
12381250
// Attempt to find field name for the field that holds the
12391251
// [previous_object] instance.

0 commit comments

Comments
 (0)