[vm] Fix v8 snapshot profile issue with deferred libaries.
TEST=vm/dart/regress_flutter169921 Issue: https://github.com/flutter/flutter/issues/169921 Change-Id: I9a996dcc1213712e6545cf134b436d60ea76b71d Cq-Include-Trybots: luci.dart.try:vm-aot-linux-release-x64-try Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/453881 Reviewed-by: Slava Egorov <vegorov@google.com> Commit-Queue: Tess Strickland <sstrickl@google.com>
This commit is contained in:
committed by
Commit Queue
parent
505f08b49a
commit
5b69fdd521
@@ -0,0 +1,11 @@
|
||||
// Copyright (c) 2025, the Dart project authors. Please see the AUTHORS file
|
||||
// for details. All rights reserved. Use of this source code is governed by a
|
||||
// BSD-style license that can be found in the LICENSE file.
|
||||
|
||||
// Deferred library used by regress_flutter169921_program.dart.
|
||||
|
||||
@pragma('vm:never-inline')
|
||||
Object? foo(int v) {
|
||||
// Avoid unboxing on return by mixing int and String
|
||||
return v == 0 ? 0x8FFFFFFFFFFFFFFF : "";
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
// Copyright (c) 2025, the Dart project authors. Please see the AUTHORS file
|
||||
// for details. All rights reserved. Use of this source code is governed by a
|
||||
// BSD-style license that can be found in the LICENSE file.
|
||||
|
||||
// Program used by regress_flutter169921_test.dart.
|
||||
|
||||
import 'regress_flutter169921_deferred.dart' deferred as d;
|
||||
|
||||
void main() async {
|
||||
d.loadLibrary();
|
||||
print(d.foo(0));
|
||||
print(d.foo(1));
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
// Copyright (c) 2025, the Dart project authors. Please see the AUTHORS file
|
||||
// for details. All rights reserved. Use of this source code is governed by a
|
||||
// BSD-style license that can be found in the LICENSE file.
|
||||
|
||||
// Regression test for https://github.com/flutter/flutter/issues/169921.
|
||||
|
||||
// OtherResources=regress_flutter169921_program.dart
|
||||
// OtherResources=regress_flutter169921_deferred.dart
|
||||
|
||||
import "dart:io";
|
||||
|
||||
import 'package:expect/expect.dart';
|
||||
import 'package:path/path.dart' as path;
|
||||
|
||||
import 'use_flag_test_helper.dart';
|
||||
|
||||
main(List<String> args) async {
|
||||
if (!isAOTRuntime) {
|
||||
return; // Running in JIT: AOT binaries not available.
|
||||
}
|
||||
|
||||
if (Platform.isAndroid) {
|
||||
return; // SDK tree not available on the test device.
|
||||
}
|
||||
|
||||
// These are the tools we need to be available to run on a given platform:
|
||||
if (!File(platformDill).existsSync()) {
|
||||
throw "Cannot run test as $platformDill does not exist";
|
||||
}
|
||||
if (!await testExecutable(genSnapshot)) {
|
||||
throw "Cannot run test as $genSnapshot not available";
|
||||
}
|
||||
|
||||
await withTempDir('regress_flutter169921_test', (String tempDir) async {
|
||||
final cwDir = path.dirname(Platform.script.toFilePath());
|
||||
final script = path.join(cwDir, 'regress_flutter169921_program.dart');
|
||||
final scriptDill = path.join(tempDir, 'regress_flutter169921_program.dill');
|
||||
|
||||
await run(genKernel, <String>[
|
||||
'--aot',
|
||||
'--platform=$platformDill',
|
||||
'-o',
|
||||
scriptDill,
|
||||
script,
|
||||
]);
|
||||
|
||||
final manifest = path.join(tempDir, 'manifest.json');
|
||||
final profile = path.join(tempDir, 'profile.json');
|
||||
final snapshot = path.join(tempDir, 'snapshot.so');
|
||||
await run(genSnapshot, <String>[
|
||||
'--snapshot-kind=app-aot-elf',
|
||||
'--elf=$snapshot',
|
||||
'--loading-unit-manifest=$manifest',
|
||||
'--write-v8-snapshot-profile-to=$profile',
|
||||
scriptDill,
|
||||
]);
|
||||
|
||||
await runError(dartPrecompiledRuntime, [snapshot], printStderr: true);
|
||||
});
|
||||
}
|
||||
@@ -7765,6 +7765,11 @@ bool Serializer::CreateArtificialNodeIfNeeded(ObjectPtr obj) {
|
||||
type = "RecordType";
|
||||
break;
|
||||
};
|
||||
// Can appear in weakened constant hash tables.
|
||||
case kMintCid: {
|
||||
type = "Mint";
|
||||
break;
|
||||
}
|
||||
default:
|
||||
FATAL("Request to create artificial node for object with cid %d", cid);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user