Andreas Gampe | 53c913b | 2014-08-12 23:19:23 -0700 | [diff] [blame] | 1 | /* |
| 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 Rogers | c7dd295 | 2014-10-21 23:31:19 -0700 | [diff] [blame] | 19 | #include "base/dumpable.h" |
Andreas Gampe | 53c913b | 2014-08-12 23:19:23 -0700 | [diff] [blame] | 20 | #include "backend.h" |
| 21 | #include "frontend.h" |
| 22 | #include "mir_graph.h" |
| 23 | |
| 24 | namespace art { |
| 25 | |
| 26 | CompilationUnit::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 Gampe | 53c913b | 2014-08-12 23:19:23 -0700 | [diff] [blame] | 33 | 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 Gampe | 53c913b | 2014-08-12 23:19:23 -0700 | [diff] [blame] | 42 | 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 | |
| 51 | CompilationUnit::~CompilationUnit() { |
Razvan A Lupusoru | bd25d4b | 2014-07-02 18:16:51 -0700 | [diff] [blame] | 52 | overridden_pass_options.clear(); |
Andreas Gampe | 53c913b | 2014-08-12 23:19:23 -0700 | [diff] [blame] | 53 | } |
| 54 | |
| 55 | void CompilationUnit::StartTimingSplit(const char* label) { |
| 56 | if (compiler_driver->GetDumpPasses()) { |
| 57 | timings.StartTiming(label); |
| 58 | } |
| 59 | } |
| 60 | |
| 61 | void CompilationUnit::NewTimingSplit(const char* label) { |
| 62 | if (compiler_driver->GetDumpPasses()) { |
| 63 | timings.EndTiming(); |
| 64 | timings.StartTiming(label); |
| 65 | } |
| 66 | } |
| 67 | |
| 68 | void 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 |