blob: 909c995c329134a0ced4584d8f451fce5f51e6d2 [file] [log] [blame]
Andreas Gampe53c913b2014-08-12 23:19:23 -07001/*
2 * Copyright (C) 2014 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17#include "compiler_ir.h"
18
19#include "backend.h"
20#include "frontend.h"
21#include "mir_graph.h"
22
23namespace art {
24
25CompilationUnit::CompilationUnit(ArenaPool* pool)
26 : compiler_driver(nullptr),
27 class_linker(nullptr),
28 dex_file(nullptr),
29 class_loader(nullptr),
30 class_def_idx(0),
31 method_idx(0),
Andreas Gampe53c913b2014-08-12 23:19:23 -070032 access_flags(0),
33 invoke_type(kDirect),
34 shorty(nullptr),
35 disable_opt(0),
36 enable_debug(0),
37 verbose(false),
38 compiler(nullptr),
39 instruction_set(kNone),
40 target64(false),
Andreas Gampe53c913b2014-08-12 23:19:23 -070041 compiler_flip_match(false),
42 arena(pool),
43 arena_stack(pool),
44 mir_graph(nullptr),
45 cg(nullptr),
46 timings("QuickCompiler", true, false),
47 print_pass(false) {
48}
49
50CompilationUnit::~CompilationUnit() {
Razvan A Lupusorubd25d4b2014-07-02 18:16:51 -070051 overridden_pass_options.clear();
Andreas Gampe53c913b2014-08-12 23:19:23 -070052}
53
54void CompilationUnit::StartTimingSplit(const char* label) {
55 if (compiler_driver->GetDumpPasses()) {
56 timings.StartTiming(label);
57 }
58}
59
60void CompilationUnit::NewTimingSplit(const char* label) {
61 if (compiler_driver->GetDumpPasses()) {
62 timings.EndTiming();
63 timings.StartTiming(label);
64 }
65}
66
67void CompilationUnit::EndTiming() {
68 if (compiler_driver->GetDumpPasses()) {
69 timings.EndTiming();
70 if (enable_debug & (1 << kDebugTimings)) {
71 LOG(INFO) << "TIMINGS " << PrettyMethod(method_idx, *dex_file);
72 LOG(INFO) << Dumpable<TimingLogger>(timings);
73 }
74 }
75}
76
77} // namespace art