| 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 1230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1241 | 1241 |
| 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 NOT_IN_PRODUCT( |
| 1251 VMTagScope tagScope(thread, VMTag::kCompileUnoptimizedTagId); | 1252 VMTagScope tagScope(thread, VMTag::kCompileUnoptimizedTagId); |
| 1252 TIMELINE_FUNCTION_COMPILATION_DURATION(thread, "CompileFunction", function); | 1253 TIMELINE_FUNCTION_COMPILATION_DURATION(thread, "CompileFunction", function); |
| 1254 ) // !PRODUCT |
| 1253 | 1255 |
| 1254 if (!isolate->compilation_allowed()) { | 1256 if (!isolate->compilation_allowed()) { |
| 1255 FATAL3("Precompilation missed function %s (%s, %s)\n", | 1257 FATAL3("Precompilation missed function %s (%s, %s)\n", |
| 1256 function.ToLibNamePrefixedQualifiedCString(), | 1258 function.ToLibNamePrefixedQualifiedCString(), |
| 1257 function.token_pos().ToCString(), | 1259 function.token_pos().ToCString(), |
| 1258 Function::KindToCString(function.kind())); | 1260 Function::KindToCString(function.kind())); |
| 1259 } | 1261 } |
| 1260 | 1262 |
| 1261 CompilationPipeline* pipeline = | 1263 CompilationPipeline* pipeline = |
| 1262 CompilationPipeline::New(thread->zone(), function); | 1264 CompilationPipeline::New(thread->zone(), function); |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1297 if (FLAG_trace_compiler) { | 1299 if (FLAG_trace_compiler) { |
| 1298 THR_Print("Ensure unoptimized code for %s\n", function.ToCString()); | 1300 THR_Print("Ensure unoptimized code for %s\n", function.ToCString()); |
| 1299 } | 1301 } |
| 1300 return Error::null(); | 1302 return Error::null(); |
| 1301 } | 1303 } |
| 1302 | 1304 |
| 1303 | 1305 |
| 1304 RawError* Compiler::CompileOptimizedFunction(Thread* thread, | 1306 RawError* Compiler::CompileOptimizedFunction(Thread* thread, |
| 1305 const Function& function, | 1307 const Function& function, |
| 1306 intptr_t osr_id) { | 1308 intptr_t osr_id) { |
| 1309 NOT_IN_PRODUCT( |
| 1307 VMTagScope tagScope(thread, VMTag::kCompileOptimizedTagId); | 1310 VMTagScope tagScope(thread, VMTag::kCompileOptimizedTagId); |
| 1308 const char* event_name = IsBackgroundCompilation() | 1311 const char* event_name = IsBackgroundCompilation() |
| 1309 ? "BackgroundCompileOptimizedFunction" | 1312 ? "BackgroundCompileOptimizedFunction" |
| 1310 : "CompileOptimizedFunction"; | 1313 : "CompileOptimizedFunction"; |
| 1311 TIMELINE_FUNCTION_COMPILATION_DURATION(thread, event_name, function); | 1314 TIMELINE_FUNCTION_COMPILATION_DURATION(thread, event_name, function); |
| 1315 ) // !PRODUCT |
| 1312 | 1316 |
| 1313 // Optimization must happen in non-mutator/Dart thread if background | 1317 // Optimization must happen in non-mutator/Dart thread if background |
| 1314 // compilation is on. OSR compilation still occurs in the main thread. | 1318 // compilation is on. OSR compilation still occurs in the main thread. |
| 1315 ASSERT((osr_id != kNoOSRDeoptId) || !FLAG_background_compilation || | 1319 ASSERT((osr_id != kNoOSRDeoptId) || !FLAG_background_compilation || |
| 1316 !thread->IsMutatorThread()); | 1320 !thread->IsMutatorThread()); |
| 1317 CompilationPipeline* pipeline = | 1321 CompilationPipeline* pipeline = |
| 1318 CompilationPipeline::New(thread->zone(), function); | 1322 CompilationPipeline::New(thread->zone(), function); |
| 1319 return CompileFunctionHelper(pipeline, | 1323 return CompileFunctionHelper(pipeline, |
| 1320 function, | 1324 function, |
| 1321 true, /* optimized */ | 1325 true, /* optimized */ |
| (...skipping 557 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1879 } | 1883 } |
| 1880 | 1884 |
| 1881 | 1885 |
| 1882 void BackgroundCompiler::EnsureInit(Thread* thread) { | 1886 void BackgroundCompiler::EnsureInit(Thread* thread) { |
| 1883 UNREACHABLE(); | 1887 UNREACHABLE(); |
| 1884 } | 1888 } |
| 1885 | 1889 |
| 1886 #endif // DART_PRECOMPILED_RUNTIME | 1890 #endif // DART_PRECOMPILED_RUNTIME |
| 1887 | 1891 |
| 1888 } // namespace dart | 1892 } // namespace dart |
| OLD | NEW |