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