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

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

Issue 1881383004: Do not trigger background compilation while top level parsing in mutator thread (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: d 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 | « no previous file | no next file » | 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 1736 matching lines...) Expand 10 before | Expand all | Expand 10 after
1747 ASSERT(result); 1747 ASSERT(result);
1748 { 1748 {
1749 Thread* thread = Thread::Current(); 1749 Thread* thread = Thread::Current();
1750 StackZone stack_zone(thread); 1750 StackZone stack_zone(thread);
1751 Zone* zone = stack_zone.GetZone(); 1751 Zone* zone = stack_zone.GetZone();
1752 HANDLESCOPE(thread); 1752 HANDLESCOPE(thread);
1753 Function& function = Function::Handle(zone); 1753 Function& function = Function::Handle(zone);
1754 { MonitorLocker ml(queue_monitor_); 1754 { MonitorLocker ml(queue_monitor_);
1755 function = function_queue()->PeekFunction(); 1755 function = function_queue()->PeekFunction();
1756 } 1756 }
1757 while (running_ && !function.IsNull()) { 1757 while (running_ && !function.IsNull() && !isolate_->IsTopLevelParsing()) {
1758 // Check that we have aggregated and cleared the stats. 1758 // Check that we have aggregated and cleared the stats.
1759 ASSERT(thread->compiler_stats()->IsCleared()); 1759 ASSERT(thread->compiler_stats()->IsCleared());
1760 const Error& error = Error::Handle(zone, 1760 const Error& error = Error::Handle(zone,
1761 Compiler::CompileOptimizedFunction(thread, 1761 Compiler::CompileOptimizedFunction(thread,
1762 function, 1762 function,
1763 Compiler::kNoOSRDeoptId)); 1763 Compiler::kNoOSRDeoptId));
1764 // TODO(srdjan): We do not expect errors while compiling optimized 1764 // TODO(srdjan): We do not expect errors while compiling optimized
1765 // code, any errors should have been caught when compiling 1765 // code, any errors should have been caught when compiling
1766 // unoptimized code. Any issues while optimizing are flagged by 1766 // unoptimized code. Any issues while optimizing are flagged by
1767 // making the result invalid. 1767 // making the result invalid.
(...skipping 19 matching lines...) Expand all
1787 } 1787 }
1788 if (qelem != NULL) { 1788 if (qelem != NULL) {
1789 delete qelem; 1789 delete qelem;
1790 } 1790 }
1791 } 1791 }
1792 } 1792 }
1793 Thread::ExitIsolateAsHelper(); 1793 Thread::ExitIsolateAsHelper();
1794 { 1794 {
1795 // Wait to be notified when the work queue is not empty. 1795 // Wait to be notified when the work queue is not empty.
1796 MonitorLocker ml(queue_monitor_); 1796 MonitorLocker ml(queue_monitor_);
1797 while (function_queue()->IsEmpty() && running_) { 1797 while ((function_queue()->IsEmpty() || isolate_->IsTopLevelParsing())
1798 && running_) {
1798 ml.Wait(); 1799 ml.Wait();
1799 } 1800 }
1800 } 1801 }
1801 } // while running 1802 } // while running
1802 1803
1803 { 1804 {
1804 // Notify that the thread is done. 1805 // Notify that the thread is done.
1805 MonitorLocker ml_done(done_monitor_); 1806 MonitorLocker ml_done(done_monitor_);
1806 *done_ = true; 1807 *done_ = true;
1807 ml_done.Notify(); 1808 ml_done.Notify();
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after
2001 } 2002 }
2002 2003
2003 2004
2004 void BackgroundCompiler::EnsureInit(Thread* thread) { 2005 void BackgroundCompiler::EnsureInit(Thread* thread) {
2005 UNREACHABLE(); 2006 UNREACHABLE();
2006 } 2007 }
2007 2008
2008 #endif // DART_PRECOMPILED_RUNTIME 2009 #endif // DART_PRECOMPILED_RUNTIME
2009 2010
2010 } // namespace dart 2011 } // namespace dart
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698