Reduce how often we call FindDexCache
Before host boot.oat -j4 optimizing compile:
real 1m17.792s
user 3m26.140s
sys 0m8.340s
After:
real 1m12.324s
user 3m22.718s
sys 0m8.320s
Change-Id: If18e9e79e06cdf1676692e5efacb682bf93889c3
diff --git a/compiler/optimizing/builder.h b/compiler/optimizing/builder.h
index d6b25ee..560ed86 100644
--- a/compiler/optimizing/builder.h
+++ b/compiler/optimizing/builder.h
@@ -40,7 +40,8 @@
const DexFile* dex_file,
CompilerDriver* driver,
OptimizingCompilerStats* compiler_stats,
- const uint8_t* interpreter_metadata)
+ const uint8_t* interpreter_metadata,
+ Handle<mirror::DexCache> dex_cache)
: arena_(graph->GetArena()),
branch_targets_(graph->GetArena(), 0),
locals_(graph->GetArena(), 0),
@@ -57,7 +58,8 @@
latest_result_(nullptr),
can_use_baseline_for_string_init_(true),
compilation_stats_(compiler_stats),
- interpreter_metadata_(interpreter_metadata) {}
+ interpreter_metadata_(interpreter_metadata),
+ dex_cache_(dex_cache) {}
// Only for unit testing.
HGraphBuilder(HGraph* graph, Primitive::Type return_type = Primitive::kPrimInt)
@@ -77,7 +79,8 @@
latest_result_(nullptr),
can_use_baseline_for_string_init_(true),
compilation_stats_(nullptr),
- interpreter_metadata_(nullptr) {}
+ interpreter_metadata_(nullptr),
+ dex_cache_(NullHandle<mirror::DexCache>()) {}
bool BuildGraph(const DexFile::CodeItem& code);
@@ -334,6 +337,9 @@
const uint8_t* interpreter_metadata_;
+ // Dex cache for dex_file_.
+ Handle<mirror::DexCache> dex_cache_;
+
DISALLOW_COPY_AND_ASSIGN(HGraphBuilder);
};