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 1199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1210 THR_Print(" context level %d scope %d", var_info.index(), | 1210 THR_Print(" context level %d scope %d", var_info.index(), |
1211 var_info.scope_id); | 1211 var_info.scope_id); |
1212 } else if (kind == RawLocalVarDescriptors::kStackVar) { | 1212 } else if (kind == RawLocalVarDescriptors::kStackVar) { |
1213 THR_Print(" stack var '%s' offset %d", | 1213 THR_Print(" stack var '%s' offset %d", |
1214 var_name.ToCString(), var_info.index()); | 1214 var_name.ToCString(), var_info.index()); |
1215 } else { | 1215 } else { |
1216 ASSERT(kind == RawLocalVarDescriptors::kContextVar); | 1216 ASSERT(kind == RawLocalVarDescriptors::kContextVar); |
1217 THR_Print(" context var '%s' level %d offset %d", | 1217 THR_Print(" context var '%s' level %d offset %d", |
1218 var_name.ToCString(), var_info.scope_id, var_info.index()); | 1218 var_name.ToCString(), var_info.scope_id, var_info.index()); |
1219 } | 1219 } |
1220 THR_Print(" (valid %d-%d)\n", var_info.begin_pos, var_info.end_pos); | 1220 THR_Print(" (valid %s-%s)\n", var_info.begin_pos.ToCString(), |
| 1221 var_info.end_pos.ToCString()); |
1221 } | 1222 } |
1222 } | 1223 } |
1223 THR_Print("}\n"); | 1224 THR_Print("}\n"); |
1224 | 1225 |
1225 THR_Print("Exception Handlers for function '%s' {\n", function_fullname); | 1226 THR_Print("Exception Handlers for function '%s' {\n", function_fullname); |
1226 const ExceptionHandlers& handlers = | 1227 const ExceptionHandlers& handlers = |
1227 ExceptionHandlers::Handle(code.exception_handlers()); | 1228 ExceptionHandlers::Handle(code.exception_handlers()); |
1228 THR_Print("%s}\n", handlers.ToCString()); | 1229 THR_Print("%s}\n", handlers.ToCString()); |
1229 | 1230 |
1230 { | 1231 { |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1306 Zone* const zone = stack_zone.GetZone(); | 1307 Zone* const zone = stack_zone.GetZone(); |
1307 const bool trace_compiler = | 1308 const bool trace_compiler = |
1308 FLAG_trace_compiler || | 1309 FLAG_trace_compiler || |
1309 (FLAG_trace_optimizing_compiler && optimized); | 1310 (FLAG_trace_optimizing_compiler && optimized); |
1310 Timer per_compile_timer(trace_compiler, "Compilation time"); | 1311 Timer per_compile_timer(trace_compiler, "Compilation time"); |
1311 per_compile_timer.Start(); | 1312 per_compile_timer.Start(); |
1312 | 1313 |
1313 ParsedFunction* parsed_function = new(zone) ParsedFunction( | 1314 ParsedFunction* parsed_function = new(zone) ParsedFunction( |
1314 thread, Function::ZoneHandle(zone, function.raw())); | 1315 thread, Function::ZoneHandle(zone, function.raw())); |
1315 if (trace_compiler) { | 1316 if (trace_compiler) { |
1316 THR_Print("Compiling %s%sfunction: '%s' @ token %" Pd ", size %" Pd "\n", | 1317 const intptr_t token_size = function.end_token_pos().Pos() - |
| 1318 function.token_pos().Pos(); |
| 1319 THR_Print("Compiling %s%sfunction: '%s' @ token %s, size %" Pd "\n", |
1317 (osr_id == Compiler::kNoOSRDeoptId ? "" : "osr "), | 1320 (osr_id == Compiler::kNoOSRDeoptId ? "" : "osr "), |
1318 (optimized ? "optimized " : ""), | 1321 (optimized ? "optimized " : ""), |
1319 function.ToFullyQualifiedCString(), | 1322 function.ToFullyQualifiedCString(), |
1320 function.token_pos(), | 1323 function.token_pos().ToCString(), |
1321 (function.end_token_pos() - function.token_pos())); | 1324 token_size); |
1322 } | 1325 } |
1323 INC_STAT(thread, num_functions_compiled, 1); | 1326 INC_STAT(thread, num_functions_compiled, 1); |
1324 if (optimized) { | 1327 if (optimized) { |
1325 INC_STAT(thread, num_functions_optimized, 1); | 1328 INC_STAT(thread, num_functions_optimized, 1); |
1326 } | 1329 } |
1327 { | 1330 { |
1328 HANDLESCOPE(thread); | 1331 HANDLESCOPE(thread); |
1329 const int64_t num_tokens_before = STAT_VALUE(thread, num_tokens_consumed); | 1332 const int64_t num_tokens_before = STAT_VALUE(thread, num_tokens_consumed); |
1330 pipeline->ParseFunction(parsed_function); | 1333 pipeline->ParseFunction(parsed_function); |
1331 const int64_t num_tokens_after = STAT_VALUE(thread, num_tokens_consumed); | 1334 const int64_t num_tokens_after = STAT_VALUE(thread, num_tokens_consumed); |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1406 } | 1409 } |
1407 | 1410 |
1408 | 1411 |
1409 RawError* Compiler::CompileFunction(Thread* thread, | 1412 RawError* Compiler::CompileFunction(Thread* thread, |
1410 const Function& function) { | 1413 const Function& function) { |
1411 Isolate* isolate = thread->isolate(); | 1414 Isolate* isolate = thread->isolate(); |
1412 VMTagScope tagScope(thread, VMTag::kCompileUnoptimizedTagId); | 1415 VMTagScope tagScope(thread, VMTag::kCompileUnoptimizedTagId); |
1413 TIMELINE_FUNCTION_COMPILATION_DURATION(thread, "Function", function); | 1416 TIMELINE_FUNCTION_COMPILATION_DURATION(thread, "Function", function); |
1414 | 1417 |
1415 if (!isolate->compilation_allowed()) { | 1418 if (!isolate->compilation_allowed()) { |
1416 FATAL3("Precompilation missed function %s (%" Pd ", %s)\n", | 1419 FATAL3("Precompilation missed function %s (%s, %s)\n", |
1417 function.ToLibNamePrefixedQualifiedCString(), | 1420 function.ToLibNamePrefixedQualifiedCString(), |
1418 function.token_pos(), | 1421 function.token_pos().ToCString(), |
1419 Function::KindToCString(function.kind())); | 1422 Function::KindToCString(function.kind())); |
1420 } | 1423 } |
1421 | 1424 |
1422 CompilationPipeline* pipeline = | 1425 CompilationPipeline* pipeline = |
1423 CompilationPipeline::New(thread->zone(), function); | 1426 CompilationPipeline::New(thread->zone(), function); |
1424 | 1427 |
1425 const bool optimized = | 1428 const bool optimized = |
1426 FLAG_precompilation && function.IsOptimizable(); | 1429 FLAG_precompilation && function.IsOptimizable(); |
1427 | 1430 |
1428 return CompileFunctionHelper(pipeline, | 1431 return CompileFunctionHelper(pipeline, |
(...skipping 608 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2037 } | 2040 } |
2038 | 2041 |
2039 | 2042 |
2040 void BackgroundCompiler::EnsureInit(Thread* thread) { | 2043 void BackgroundCompiler::EnsureInit(Thread* thread) { |
2041 UNREACHABLE(); | 2044 UNREACHABLE(); |
2042 } | 2045 } |
2043 | 2046 |
2044 #endif // DART_PRECOMPILED_RUNTIME | 2047 #endif // DART_PRECOMPILED_RUNTIME |
2045 | 2048 |
2046 } // namespace dart | 2049 } // namespace dart |
OLD | NEW |