[vm] Respect entry-point annotation on constructors during obfuscation.

Change-Id: Ia61d582fb6dd647b8fcab051b57ff08682076d9d
Cq-Include-Trybots: luci.dart.try:vm-kernel-optcounter-threshold-linux-release-x64-try, vm-kernel-precomp-linux-debug-x64-try, vm-kernel-precomp-linux-release-simarm-try, vm-kernel-precomp-linux-release-simarm64-try, vm-kernel-precomp-linux-release-x64-try, vm-kernel-precomp-mac-release-simarm64-try, vm-kernel-precomp-win-release-x64-try, vm-kernel-precomp-obfuscate-linux-release-x64-try
Reviewed-on: https://dart-review.googlesource.com/c/93225
Commit-Queue: Samir Jindel <sjindel@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
This commit is contained in:
Samir Jindel 2019-02-14 20:18:19 +00:00 committed by commit-bot@chromium.org
parent d1b15cc92c
commit 3b2144fa93
4 changed files with 8 additions and 23 deletions

View file

@ -49,6 +49,11 @@ class ObfuscationProhibitionsVisitor extends RecursiveVisitor {
klass.visitChildren(this);
}
@override
visitConstructor(Constructor ctor) {
_addIfEntryPoint(ctor.annotations, ctor.name.name, ctor);
}
@override
visitProcedure(Procedure proc) {
_addIfEntryPoint(proc.annotations, proc.name.name, proc);

View file

@ -18,26 +18,6 @@
bool isDartPrecompiledRuntime = true;
Dart_Handle GetCurrentLibrary() {
Dart_Handle libraries = Dart_GetLoadedLibraries();
CHECK(libraries);
intptr_t length = 0;
CHECK(Dart_ListLength(libraries, &length));
for (intptr_t i = 0; i < length; ++i) {
Dart_Handle library = Dart_ListGetAt(libraries, i);
CHECK(library);
Dart_Handle url = Dart_LibraryUrl(library);
CHECK(url);
const char* url_str;
CHECK(Dart_StringToCString(url, &url_str));
if (strstr(url_str, "entrypoints_verification_test")) {
return library;
}
}
fprintf(stderr, "Could not find current library!");
abort();
}
// Some invalid accesses are allowed in AOT since we don't retain @pragma
// annotations. Therefore we skip the negative tests in AOT.
#define FAIL(name, result) \
@ -101,7 +81,7 @@ void TestFields(Dart_Handle target) {
}
void RunTests(Dart_NativeArguments arguments) {
Dart_Handle lib = GetCurrentLibrary();
Dart_Handle lib = Dart_RootLibrary();
//////// Test allocation and constructor invocation.

View file

@ -225,5 +225,5 @@ io/socket_many_connections_test: Skip # Timeout
io/web_socket_compression_test: Skip # Timeout
io/web_socket_test: Skip # Timeout
[ $hot_reload || $hot_reload_rollback || $compiler != dartk && $compiler != dartkb && $compiler != dartkp || $compiler == dartkp && $system == windows ]
io/entrypoints_verification_test: Skip # Cannot run in precompiled Windows because the DLL is linked against dart.exe instead of dart_precompiled_runtime.exe.
[ $compiler != dartk && $compiler != dartkb && $compiler != dartkp || $compiler == dartkp && $system == windows ]
entrypoints_verification_test: SkipByDesign # Requires VM to run. Cannot run in precompiled Windows because the DLL is linked against dart.exe instead of dart_precompiled_runtime.exe.