Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(68)

Side by Side Diff: runtime/vm/compiler.cc

Issue 1300033002: Fix compiler stats (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Remove dead code in parser Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | runtime/vm/compiler_stats.h » ('j') | runtime/vm/compiler_stats.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 712 matching lines...) Expand 10 before | Expand all | Expand 10 after
723 CSTAT_TIMER_SCOPE(thread, graphcompiler_timer); 723 CSTAT_TIMER_SCOPE(thread, graphcompiler_timer);
724 graph_compiler.CompileGraph(); 724 graph_compiler.CompileGraph();
725 pipeline->FinalizeCompilation(); 725 pipeline->FinalizeCompilation();
726 } 726 }
727 { 727 {
728 CSTAT_TIMER_SCOPE(thread, codefinalizer_timer); 728 CSTAT_TIMER_SCOPE(thread, codefinalizer_timer);
729 // CreateDeoptInfo uses the object pool and needs to be done before 729 // CreateDeoptInfo uses the object pool and needs to be done before
730 // FinalizeCode. 730 // FinalizeCode.
731 const Array& deopt_info_array = 731 const Array& deopt_info_array =
732 Array::Handle(zone, graph_compiler.CreateDeoptInfo(&assembler)); 732 Array::Handle(zone, graph_compiler.CreateDeoptInfo(&assembler));
733 INC_STAT(isolate, total_code_size, 733 INC_STAT(thread, total_code_size,
734 deopt_info_array.Length() * sizeof(uword)); 734 deopt_info_array.Length() * sizeof(uword));
735 const Code& code = Code::Handle( 735 const Code& code = Code::Handle(
736 Code::FinalizeCode(function, &assembler, optimized)); 736 Code::FinalizeCode(function, &assembler, optimized));
737 code.set_is_optimized(optimized); 737 code.set_is_optimized(optimized);
738 738
739 const Array& intervals = graph_compiler.inlined_code_intervals(); 739 const Array& intervals = graph_compiler.inlined_code_intervals();
740 INC_STAT(isolate, total_code_size, 740 INC_STAT(thread, total_code_size,
741 intervals.Length() * sizeof(uword)); 741 intervals.Length() * sizeof(uword));
742 code.SetInlinedIntervals(intervals); 742 code.SetInlinedIntervals(intervals);
743 743
744 const Array& inlined_id_array = 744 const Array& inlined_id_array =
745 Array::Handle(zone, graph_compiler.InliningIdToFunction()); 745 Array::Handle(zone, graph_compiler.InliningIdToFunction());
746 INC_STAT(isolate, total_code_size, 746 INC_STAT(thread, total_code_size,
747 inlined_id_array.Length() * sizeof(uword)); 747 inlined_id_array.Length() * sizeof(uword));
748 code.SetInlinedIdToFunction(inlined_id_array); 748 code.SetInlinedIdToFunction(inlined_id_array);
749 749
750 const Array& caller_inlining_id_map_array = 750 const Array& caller_inlining_id_map_array =
751 Array::Handle(zone, graph_compiler.CallerInliningIdMap()); 751 Array::Handle(zone, graph_compiler.CallerInliningIdMap());
752 INC_STAT(isolate, total_code_size, 752 INC_STAT(thread, total_code_size,
753 caller_inlining_id_map_array.Length() * sizeof(uword)); 753 caller_inlining_id_map_array.Length() * sizeof(uword));
754 code.SetInlinedCallerIdMap(caller_inlining_id_map_array); 754 code.SetInlinedCallerIdMap(caller_inlining_id_map_array);
755 755
756 graph_compiler.FinalizePcDescriptors(code); 756 graph_compiler.FinalizePcDescriptors(code);
757 code.set_deopt_info_array(deopt_info_array); 757 code.set_deopt_info_array(deopt_info_array);
758 758
759 graph_compiler.FinalizeStackmaps(code); 759 graph_compiler.FinalizeStackmaps(code);
760 graph_compiler.FinalizeVarDescriptors(code); 760 graph_compiler.FinalizeVarDescriptors(code);
761 graph_compiler.FinalizeExceptionHandlers(code); 761 graph_compiler.FinalizeExceptionHandlers(code);
762 graph_compiler.FinalizeStaticCallTargetsTable(code); 762 graph_compiler.FinalizeStaticCallTargetsTable(code);
(...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after
1045 ParsedFunction* parsed_function = new(zone) ParsedFunction( 1045 ParsedFunction* parsed_function = new(zone) ParsedFunction(
1046 thread, Function::ZoneHandle(zone, function.raw())); 1046 thread, Function::ZoneHandle(zone, function.raw()));
1047 if (FLAG_trace_compiler) { 1047 if (FLAG_trace_compiler) {
1048 ISL_Print("Compiling %s%sfunction: '%s' @ token %" Pd ", size %" Pd "\n", 1048 ISL_Print("Compiling %s%sfunction: '%s' @ token %" Pd ", size %" Pd "\n",
1049 (osr_id == Isolate::kNoDeoptId ? "" : "osr "), 1049 (osr_id == Isolate::kNoDeoptId ? "" : "osr "),
1050 (optimized ? "optimized " : ""), 1050 (optimized ? "optimized " : ""),
1051 function.ToFullyQualifiedCString(), 1051 function.ToFullyQualifiedCString(),
1052 function.token_pos(), 1052 function.token_pos(),
1053 (function.end_token_pos() - function.token_pos())); 1053 (function.end_token_pos() - function.token_pos()));
1054 } 1054 }
1055 INC_STAT(thread, num_functions_compiled, 1);
1056 if (optimized) {
1057 INC_STAT(thread, num_functions_optimized, 1);
1058 }
1055 { 1059 {
1056 HANDLESCOPE(thread); 1060 HANDLESCOPE(thread);
1061 const int64_t num_tokens_before = STAT_VALUE(thread, num_tokens_consumed);
1057 pipeline->ParseFunction(parsed_function); 1062 pipeline->ParseFunction(parsed_function);
1063 const int64_t num_tokens_after = STAT_VALUE(thread, num_tokens_consumed);
1064 INC_STAT(thread,
1065 num_func_tokens_compiled,
1066 num_tokens_after - num_tokens_before);
1058 } 1067 }
1059 1068
1060 const bool success = CompileParsedFunctionHelper(pipeline, 1069 const bool success = CompileParsedFunctionHelper(pipeline,
1061 parsed_function, 1070 parsed_function,
1062 optimized, 1071 optimized,
1063 osr_id); 1072 osr_id);
1064 if (!success) { 1073 if (!success) {
1065 if (optimized) { 1074 if (optimized) {
1066 ASSERT(!Compiler::always_optimize()); // Optimized is the only code. 1075 ASSERT(!Compiler::always_optimize()); // Optimized is the only code.
1067 // Optimizer bailed out. Disable optimizations and never try again. 1076 // Optimizer bailed out. Disable optimizations and never try again.
(...skipping 359 matching lines...) Expand 10 before | Expand all | Expand 10 after
1427 const Object& result = 1436 const Object& result =
1428 PassiveObject::Handle(isolate->object_store()->sticky_error()); 1437 PassiveObject::Handle(isolate->object_store()->sticky_error());
1429 isolate->object_store()->clear_sticky_error(); 1438 isolate->object_store()->clear_sticky_error();
1430 return result.raw(); 1439 return result.raw();
1431 } 1440 }
1432 UNREACHABLE(); 1441 UNREACHABLE();
1433 return Object::null(); 1442 return Object::null();
1434 } 1443 }
1435 1444
1436 } // namespace dart 1445 } // namespace dart
OLDNEW
« no previous file with comments | « no previous file | runtime/vm/compiler_stats.h » ('j') | runtime/vm/compiler_stats.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698