summaryrefslogtreecommitdiff
path: root/compiler/driver/compiler_driver_test.cc
diff options
context:
space:
mode:
authorVladimir Marko <vmarko@google.com>2019-03-04 10:18:31 +0000
committerVladimir Marko <vmarko@google.com>2019-03-05 12:37:30 +0000
commit815d5e5304a5b57db64d6829813a14e464d5c55f (patch)
tree7fac4adffcda366f4ee252e233828ebf2361f2b0 /compiler/driver/compiler_driver_test.cc
parentb1b2ca97651b1993e0a00a4543209419afbc6e64 (diff)
Refactor compiler tests around CompilerDriver.
Introduce CommonCompilerDriverTest and inherit that in tests that need to use CompilerDriver. This is in preparation for moving the CompilerDriver to dex2oat/. Test: m test-art-host-gtest Change-Id: I46cf0bc1df4327569eef5526eeab0781473173a1
Diffstat (limited to 'compiler/driver/compiler_driver_test.cc')
-rw-r--r--compiler/driver/compiler_driver_test.cc18
1 files changed, 16 insertions, 2 deletions
diff --git a/compiler/driver/compiler_driver_test.cc b/compiler/driver/compiler_driver_test.cc
index e73d0724c9..dd2b3abe14 100644
--- a/compiler/driver/compiler_driver_test.cc
+++ b/compiler/driver/compiler_driver_test.cc
@@ -24,7 +24,7 @@
#include "art_method-inl.h"
#include "base/casts.h"
#include "class_linker-inl.h"
-#include "common_compiler_test.h"
+#include "common_compiler_driver_test.h"
#include "compiler_callbacks.h"
#include "dex/dex_file.h"
#include "dex/dex_file_types.h"
@@ -40,7 +40,7 @@
namespace art {
-class CompilerDriverTest : public CommonCompilerTest {
+class CompilerDriverTest : public CommonCompilerDriverTest {
protected:
void CompileAllAndMakeExecutable(jobject class_loader) REQUIRES(!Locks::mutator_lock_) {
TimingLogger timings("CompilerDriverTest::CompileAllAndMakeExecutable", false, false);
@@ -77,6 +77,20 @@ class CompilerDriverTest : public CommonCompilerTest {
}
}
+ void MakeExecutable(ArtMethod* method) REQUIRES_SHARED(Locks::mutator_lock_) {
+ CHECK(method != nullptr);
+
+ const CompiledMethod* compiled_method = nullptr;
+ if (!method->IsAbstract()) {
+ mirror::DexCache* dex_cache = method->GetDeclaringClass()->GetDexCache();
+ const DexFile& dex_file = *dex_cache->GetDexFile();
+ compiled_method =
+ compiler_driver_->GetCompiledMethod(MethodReference(&dex_file,
+ method->GetDexMethodIndex()));
+ }
+ CommonCompilerTest::MakeExecutable(method, compiled_method);
+ }
+
void MakeDexFileExecutable(jobject class_loader, const DexFile& dex_file) {
ClassLinker* class_linker = Runtime::Current()->GetClassLinker();
for (size_t i = 0; i < dex_file.NumClassDefs(); i++) {