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

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

Issue 1879033002: Print messages when aborting background compilation (--trace-compiler); turn on background compilat… (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: add timeline info Created 4 years, 8 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 | « runtime/vm/compiler.h ('k') | runtime/vm/flag_list.h » ('j') | no next file with comments »
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 639 matching lines...) Expand 10 before | Expand all | Expand 10 after
650 (function.deoptimization_counter() < 650 (function.deoptimization_counter() <
651 FLAG_max_deoptimization_counter_threshold)); 651 FLAG_max_deoptimization_counter_threshold));
652 652
653 // 'Freeze' ICData in background compilation so that it does not 653 // 'Freeze' ICData in background compilation so that it does not
654 // change while compiling. 654 // change while compiling.
655 const bool clone_ic_data = Compiler::IsBackgroundCompilation(); 655 const bool clone_ic_data = Compiler::IsBackgroundCompilation();
656 function.RestoreICDataMap(ic_data_array, clone_ic_data); 656 function.RestoreICDataMap(ic_data_array, clone_ic_data);
657 657
658 if (Compiler::IsBackgroundCompilation() && 658 if (Compiler::IsBackgroundCompilation() &&
659 (function.ic_data_array() == Array::null())) { 659 (function.ic_data_array() == Array::null())) {
660 Compiler::AbortBackgroundCompilation(Thread::kNoDeoptId); 660 Compiler::AbortBackgroundCompilation(Thread::kNoDeoptId,
661 "RestoreICDataMap: ICData array cleared.");
661 } 662 }
662 if (FLAG_print_ic_data_map) { 663 if (FLAG_print_ic_data_map) {
663 for (intptr_t i = 0; i < ic_data_array->length(); i++) { 664 for (intptr_t i = 0; i < ic_data_array->length(); i++) {
664 if ((*ic_data_array)[i] != NULL) { 665 if ((*ic_data_array)[i] != NULL) {
665 THR_Print("%" Pd " ", i); 666 THR_Print("%" Pd " ", i);
666 FlowGraphPrinter::PrintICData(*(*ic_data_array)[i]); 667 FlowGraphPrinter::PrintICData(*(*ic_data_array)[i]);
667 } 668 }
668 } 669 }
669 } 670 }
670 } 671 }
(...skipping 389 matching lines...) Expand 10 before | Expand all | Expand 10 after
1060 // instruction object, since the creation of instruction object 1061 // instruction object, since the creation of instruction object
1061 // changes code page access permissions (makes them temporary not 1062 // changes code page access permissions (makes them temporary not
1062 // executable). 1063 // executable).
1063 { 1064 {
1064 SafepointOperationScope safepoint_scope(thread()); 1065 SafepointOperationScope safepoint_scope(thread());
1065 // Do not Garbage collect during this stage and instead allow the 1066 // Do not Garbage collect during this stage and instead allow the
1066 // heap to grow. 1067 // heap to grow.
1067 NoHeapGrowthControlScope no_growth_control; 1068 NoHeapGrowthControlScope no_growth_control;
1068 if (!isolate()->background_compiler()->is_running()) { 1069 if (!isolate()->background_compiler()->is_running()) {
1069 // The background compiler is being stopped. 1070 // The background compiler is being stopped.
1070 Compiler::AbortBackgroundCompilation(Thread::kNoDeoptId); 1071 Compiler::AbortBackgroundCompilation(Thread::kNoDeoptId,
1072 "Background compilation is being stopped");
1071 } 1073 }
1072 FinalizeCompilation(&assembler, &graph_compiler, flow_graph); 1074 FinalizeCompilation(&assembler, &graph_compiler, flow_graph);
1073 } 1075 }
1074 if (isolate()->heap()->NeedsGarbageCollection()) { 1076 if (isolate()->heap()->NeedsGarbageCollection()) {
1075 isolate()->heap()->CollectAllGarbage(); 1077 isolate()->heap()->CollectAllGarbage();
1076 } 1078 }
1077 } 1079 }
1078 } 1080 }
1079 // Mark that this isolate now has compiled code. 1081 // Mark that this isolate now has compiled code.
1080 isolate()->set_has_compiled_code(true); 1082 isolate()->set_has_compiled_code(true);
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
1188 1190
1189 1191
1190 CompileParsedFunctionHelper helper(parsed_function, optimized, osr_id); 1192 CompileParsedFunctionHelper helper(parsed_function, optimized, osr_id);
1191 1193
1192 if (Compiler::IsBackgroundCompilation()) { 1194 if (Compiler::IsBackgroundCompilation()) {
1193 if (isolate->IsTopLevelParsing() || 1195 if (isolate->IsTopLevelParsing() ||
1194 (loading_invalidation_gen_at_start != 1196 (loading_invalidation_gen_at_start !=
1195 isolate->loading_invalidation_gen())) { 1197 isolate->loading_invalidation_gen())) {
1196 // Loading occured while parsing. We need to abort here because state 1198 // Loading occured while parsing. We need to abort here because state
1197 // changed while compiling. 1199 // changed while compiling.
1198 Compiler::AbortBackgroundCompilation(Thread::kNoDeoptId); 1200 Compiler::AbortBackgroundCompilation(Thread::kNoDeoptId,
1201 "Invalidated state during parsing because of script loading");
1199 } 1202 }
1200 } 1203 }
1201 1204
1202 const bool success = helper.Compile(pipeline); 1205 const bool success = helper.Compile(pipeline);
1203 if (success) { 1206 if (success) {
1204 if (!optimized) { 1207 if (!optimized) {
1205 function.set_was_compiled(true); 1208 function.set_was_compiled(true);
1206 } 1209 }
1207 } else { 1210 } else {
1208 if (optimized) { 1211 if (optimized) {
(...skipping 363 matching lines...) Expand 10 before | Expand all | Expand 10 after
1572 Thread* const thread = Thread::Current(); 1575 Thread* const thread = Thread::Current();
1573 const Object& result = PassiveObject::Handle(thread->sticky_error()); 1576 const Object& result = PassiveObject::Handle(thread->sticky_error());
1574 thread->clear_sticky_error(); 1577 thread->clear_sticky_error();
1575 return result.raw(); 1578 return result.raw();
1576 } 1579 }
1577 UNREACHABLE(); 1580 UNREACHABLE();
1578 return Object::null(); 1581 return Object::null();
1579 } 1582 }
1580 1583
1581 1584
1582 void Compiler::AbortBackgroundCompilation(intptr_t deopt_id) { 1585 void Compiler::AbortBackgroundCompilation(intptr_t deopt_id, const char* msg) {
1583 if (FLAG_trace_compiler) { 1586 if (FLAG_trace_compiler) {
1584 THR_Print("ABORT background compilation\n"); 1587 THR_Print("ABORT background compilation: %s\n", msg);
1588 }
1589 TimelineStream* stream = Timeline::GetCompilerStream();
1590 ASSERT(stream != NULL);
1591 TimelineEvent* event = stream->StartEvent();
1592 if (event != NULL) {
1593 event->Instant("AbortBackgroundCompilation");
1594 event->SetNumArguments(1);
1595 event->CopyArgument(0, "reason", msg);
1596 event->Complete();
1585 } 1597 }
1586 ASSERT(Compiler::IsBackgroundCompilation()); 1598 ASSERT(Compiler::IsBackgroundCompilation());
1587 Thread::Current()->long_jump_base()->Jump( 1599 Thread::Current()->long_jump_base()->Jump(
1588 deopt_id, Object::background_compilation_error()); 1600 deopt_id, Object::background_compilation_error());
1589 } 1601 }
1590 1602
1591 1603
1592 // C-heap allocated background compilation queue element. 1604 // C-heap allocated background compilation queue element.
1593 class QueueElement { 1605 class QueueElement {
1594 public: 1606 public:
(...skipping 365 matching lines...) Expand 10 before | Expand all | Expand 10 after
1960 return DartEntry::InvokeFunction(initializer, Object::empty_array()); 1972 return DartEntry::InvokeFunction(initializer, Object::empty_array());
1961 } 1973 }
1962 1974
1963 1975
1964 RawObject* Compiler::ExecuteOnce(SequenceNode* fragment) { 1976 RawObject* Compiler::ExecuteOnce(SequenceNode* fragment) {
1965 UNREACHABLE(); 1977 UNREACHABLE();
1966 return Object::null(); 1978 return Object::null();
1967 } 1979 }
1968 1980
1969 1981
1970 void Compiler::AbortBackgroundCompilation(intptr_t deopt_id) { 1982 void Compiler::AbortBackgroundCompilation(intptr_t deopt_id, const char* msg) {
1971 UNREACHABLE(); 1983 UNREACHABLE();
1972 } 1984 }
1973 1985
1974 1986
1975 void BackgroundCompiler::CompileOptimized(const Function& function) { 1987 void BackgroundCompiler::CompileOptimized(const Function& function) {
1976 UNREACHABLE(); 1988 UNREACHABLE();
1977 } 1989 }
1978 1990
1979 1991
1980 void BackgroundCompiler::VisitPointers(ObjectPointerVisitor* visitor) { 1992 void BackgroundCompiler::VisitPointers(ObjectPointerVisitor* visitor) {
1981 UNREACHABLE(); 1993 UNREACHABLE();
1982 } 1994 }
1983 1995
1984 1996
1985 void BackgroundCompiler::Stop(BackgroundCompiler* task) { 1997 void BackgroundCompiler::Stop(BackgroundCompiler* task) {
1986 UNREACHABLE(); 1998 UNREACHABLE();
1987 } 1999 }
1988 2000
1989 2001
1990 void BackgroundCompiler::EnsureInit(Thread* thread) { 2002 void BackgroundCompiler::EnsureInit(Thread* thread) {
1991 UNREACHABLE(); 2003 UNREACHABLE();
1992 } 2004 }
1993 2005
1994 #endif // DART_PRECOMPILED_RUNTIME 2006 #endif // DART_PRECOMPILED_RUNTIME
1995 2007
1996 } // namespace dart 2008 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/compiler.h ('k') | runtime/vm/flag_list.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698