summaryrefslogtreecommitdiff
path: root/compiler/optimizing/instruction_builder.cc
diff options
context:
space:
mode:
authorNicolas Geoffray <ngeoffray@google.com>2019-06-27 13:11:12 +0000
committerNicolas Geoffray <ngeoffray@google.com>2019-06-28 06:37:34 +0000
commita48c3dfcebece7ee4b893757b715319f0b5b1fa7 (patch)
treeeb846bcf242f7e9f4243196b5f4546b0a222cfa0 /compiler/optimizing/instruction_builder.cc
parent1459929a7e9ea96932b6c24597e1692b9b05606c (diff)
Revert "Revert "Make the JIT zygote memory shared.""
This reverts commit 2fef66b294417d447630f9d98de68227eef476d3. Bug: 119800099 Bug: 136110523 Reason for revert: Fixed webview_zygote case. Change-Id: Iaae8c999463d77b7b1e62b55458493bdbc97a104
Diffstat (limited to 'compiler/optimizing/instruction_builder.cc')
-rw-r--r--compiler/optimizing/instruction_builder.cc22
1 files changed, 14 insertions, 8 deletions
diff --git a/compiler/optimizing/instruction_builder.cc b/compiler/optimizing/instruction_builder.cc
index 5e7b57523f..f8f813e3fd 100644
--- a/compiler/optimizing/instruction_builder.cc
+++ b/compiler/optimizing/instruction_builder.cc
@@ -29,6 +29,7 @@
#include "driver/dex_compilation_unit.h"
#include "driver/compiler_options.h"
#include "imtable-inl.h"
+#include "jit/jit.h"
#include "mirror/dex_cache.h"
#include "oat_file.h"
#include "optimizing_compiler_stats.h"
@@ -1290,15 +1291,20 @@ bool HInstructionBuilder::IsInitialized(Handle<mirror::Class> cls) const {
// Check if the class will be initialized at runtime.
if (cls->IsInitialized()) {
Runtime* runtime = Runtime::Current();
- if (!runtime->IsAotCompiler()) {
+ if (runtime->IsAotCompiler()) {
+ // Assume loaded only if klass is in the boot image. App classes cannot be assumed
+ // loaded because we don't even know what class loader will be used to load them.
+ if (IsInBootImage(cls.Get(), code_generator_->GetCompilerOptions())) {
+ return true;
+ }
+ } else {
DCHECK(runtime->UseJitCompilation());
- // For JIT, the class cannot revert to an uninitialized state.
- return true;
- }
- // Assume loaded only if klass is in the boot image. App classes cannot be assumed
- // loaded because we don't even know what class loader will be used to load them.
- if (IsInBootImage(cls.Get(), code_generator_->GetCompilerOptions())) {
- return true;
+ if (Runtime::Current()->GetJit()->CanAssumeInitialized(
+ cls.Get(),
+ graph_->IsCompilingForSharedJitCode())) {
+ // For JIT, the class cannot revert to an uninitialized state.
+ return true;
+ }
}
}