OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 #include "vm/compiler.h" | 5 #include "vm/compiler.h" |
6 | 6 |
7 #include "vm/assembler.h" | 7 #include "vm/assembler.h" |
8 | 8 |
9 #include "vm/ast_printer.h" | 9 #include "vm/ast_printer.h" |
10 #include "vm/block_scheduler.h" | 10 #include "vm/block_scheduler.h" |
(...skipping 1231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1242 | 1242 |
1243 RawError* Compiler::CompileFunction(Thread* thread, | 1243 RawError* Compiler::CompileFunction(Thread* thread, |
1244 const Function& function) { | 1244 const Function& function) { |
1245 #ifdef DART_PRECOMPILER | 1245 #ifdef DART_PRECOMPILER |
1246 if (FLAG_precompiled_mode) { | 1246 if (FLAG_precompiled_mode) { |
1247 return Precompiler::CompileFunction(thread, function); | 1247 return Precompiler::CompileFunction(thread, function); |
1248 } | 1248 } |
1249 #endif | 1249 #endif |
1250 Isolate* isolate = thread->isolate(); | 1250 Isolate* isolate = thread->isolate(); |
1251 VMTagScope tagScope(thread, VMTag::kCompileUnoptimizedTagId); | 1251 VMTagScope tagScope(thread, VMTag::kCompileUnoptimizedTagId); |
1252 TIMELINE_FUNCTION_COMPILATION_DURATION(thread, "Function", function); | 1252 TIMELINE_FUNCTION_COMPILATION_DURATION(thread, "CompileFunction", function); |
1253 | 1253 |
1254 if (!isolate->compilation_allowed()) { | 1254 if (!isolate->compilation_allowed()) { |
1255 FATAL3("Precompilation missed function %s (%s, %s)\n", | 1255 FATAL3("Precompilation missed function %s (%s, %s)\n", |
1256 function.ToLibNamePrefixedQualifiedCString(), | 1256 function.ToLibNamePrefixedQualifiedCString(), |
1257 function.token_pos().ToCString(), | 1257 function.token_pos().ToCString(), |
1258 Function::KindToCString(function.kind())); | 1258 Function::KindToCString(function.kind())); |
1259 } | 1259 } |
1260 | 1260 |
1261 CompilationPipeline* pipeline = | 1261 CompilationPipeline* pipeline = |
1262 CompilationPipeline::New(thread->zone(), function); | 1262 CompilationPipeline::New(thread->zone(), function); |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1298 THR_Print("Ensure unoptimized code for %s\n", function.ToCString()); | 1298 THR_Print("Ensure unoptimized code for %s\n", function.ToCString()); |
1299 } | 1299 } |
1300 return Error::null(); | 1300 return Error::null(); |
1301 } | 1301 } |
1302 | 1302 |
1303 | 1303 |
1304 RawError* Compiler::CompileOptimizedFunction(Thread* thread, | 1304 RawError* Compiler::CompileOptimizedFunction(Thread* thread, |
1305 const Function& function, | 1305 const Function& function, |
1306 intptr_t osr_id) { | 1306 intptr_t osr_id) { |
1307 VMTagScope tagScope(thread, VMTag::kCompileOptimizedTagId); | 1307 VMTagScope tagScope(thread, VMTag::kCompileOptimizedTagId); |
1308 TIMELINE_FUNCTION_COMPILATION_DURATION(thread, | 1308 const char* event_name = IsBackgroundCompilation() |
1309 "OptimizedFunction", function); | 1309 ? "BackgroundCompileOptimizedFunction" |
| 1310 : "CompileOptimizedFunction"; |
| 1311 TIMELINE_FUNCTION_COMPILATION_DURATION(thread, event_name, function); |
1310 | 1312 |
1311 // Optimization must happen in non-mutator/Dart thread if background | 1313 // Optimization must happen in non-mutator/Dart thread if background |
1312 // compilation is on. OSR compilation still occurs in the main thread. | 1314 // compilation is on. OSR compilation still occurs in the main thread. |
1313 ASSERT((osr_id != kNoOSRDeoptId) || !FLAG_background_compilation || | 1315 ASSERT((osr_id != kNoOSRDeoptId) || !FLAG_background_compilation || |
1314 !thread->IsMutatorThread()); | 1316 !thread->IsMutatorThread()); |
1315 CompilationPipeline* pipeline = | 1317 CompilationPipeline* pipeline = |
1316 CompilationPipeline::New(thread->zone(), function); | 1318 CompilationPipeline::New(thread->zone(), function); |
1317 return CompileFunctionHelper(pipeline, | 1319 return CompileFunctionHelper(pipeline, |
1318 function, | 1320 function, |
1319 true, /* optimized */ | 1321 true, /* optimized */ |
(...skipping 557 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1877 } | 1879 } |
1878 | 1880 |
1879 | 1881 |
1880 void BackgroundCompiler::EnsureInit(Thread* thread) { | 1882 void BackgroundCompiler::EnsureInit(Thread* thread) { |
1881 UNREACHABLE(); | 1883 UNREACHABLE(); |
1882 } | 1884 } |
1883 | 1885 |
1884 #endif // DART_PRECOMPILED_RUNTIME | 1886 #endif // DART_PRECOMPILED_RUNTIME |
1885 | 1887 |
1886 } // namespace dart | 1888 } // namespace dart |
OLD | NEW |