blob: a2b3fe432faf7883e10864d21c25c2e802e62990 [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
Ian Rogersc7dd2952014-10-21 23:31:19 -070019#include "base/dumpable.h"
Andreas Gampe53c913b2014-08-12 23:19:23 -070020#include "backend.h"
21#include "frontend.h"
22#include "mir_graph.h"
23
24namespace art {
25
26CompilationUnit::CompilationUnit(ArenaPool* pool)
27 : compiler_driver(nullptr),
28 class_linker(nullptr),
29 dex_file(nullptr),
30 class_loader(nullptr),
31 class_def_idx(0),
32 method_idx(0),
Andreas Gampe53c913b2014-08-12 23:19:23 -070033 access_flags(0),
34 invoke_type(kDirect),
35 shorty(nullptr),
36 disable_opt(0),
37 enable_debug(0),
38 verbose(false),
39 compiler(nullptr),
40 instruction_set(kNone),
41 target64(false),
Andreas Gampe53c913b2014-08-12 23:19:23 -070042 compiler_flip_match(false),
43 arena(pool),
44 arena_stack(pool),
45 mir_graph(nullptr),
46 cg(nullptr),
47 timings("QuickCompiler", true, false),
48 print_pass(false) {
49}
50
51CompilationUnit::~CompilationUnit() {
Razvan A Lupusorubd25d4b2014-07-02 18:16:51 -070052 overridden_pass_options.clear();
Andreas Gampe53c913b2014-08-12 23:19:23 -070053}
54
55void CompilationUnit::StartTimingSplit(const char* label) {
56 if (compiler_driver->GetDumpPasses()) {
57 timings.StartTiming(label);
58 }
59}
60
61void CompilationUnit::NewTimingSplit(const char* label) {
62 if (compiler_driver->GetDumpPasses()) {
63 timings.EndTiming();
64 timings.StartTiming(label);
65 }
66}
67
68void CompilationUnit::EndTiming() {
69 if (compiler_driver->GetDumpPasses()) {
70 timings.EndTiming();
71 if (enable_debug & (1 << kDebugTimings)) {
72 LOG(INFO) << "TIMINGS " << PrettyMethod(method_idx, *dex_file);
73 LOG(INFO) << Dumpable<TimingLogger>(timings);
74 }
75 }
76}
77
78} // namespace art