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

Unified Diff: runtime/vm/parser.cc

Issue 1834763004: Track loading happening in parallel with background compilation and abort compilation if necessary. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: comments Created 4 years, 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/vm/object.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/parser.cc
diff --git a/runtime/vm/parser.cc b/runtime/vm/parser.cc
index 5220506471715723ec77beaa3932f6ef96c02b58..3e89badc93c04addb1777957561dbd15b1a2e474 100644
--- a/runtime/vm/parser.cc
+++ b/runtime/vm/parser.cc
@@ -491,6 +491,20 @@ void Parser::SetPosition(TokenPosition position) {
}
+// Set state and increments generational count so that thge background compiler
+// can detect if loading/top-level-parsing occured during compilation.
+class TopLevelParsingScope : public StackResource {
+ public:
+ explicit TopLevelParsingScope(Thread* thread) : StackResource(thread) {
+ isolate()->IncrTopLevelParsingCount();
+ }
+ ~TopLevelParsingScope() {
+ isolate()->DecrTopLevelParsingCount();
+ isolate()->IncrLoadingInvalidationGen();
+ }
+};
+
+
void Parser::ParseCompilationUnit(const Library& library,
const Script& script) {
Thread* thread = Thread::Current();
@@ -507,6 +521,7 @@ void Parser::ParseCompilationUnit(const Library& library,
}
#endif
+ TopLevelParsingScope scope(thread);
Parser parser(script, library, TokenPosition::kMinSource);
parser.ParseTopLevel();
}
« no previous file with comments | « runtime/vm/object.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698