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

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: d 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
« runtime/vm/isolate.h ('K') | « 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..fb74a733ff7aa0c8464ce562200f9ef8f7e210af 100644
--- a/runtime/vm/parser.cc
+++ b/runtime/vm/parser.cc
@@ -491,6 +491,24 @@ 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 ValueObject {
+ public:
+ explicit TopLevelParsingScope(Isolate* isolate) : isolate_(isolate) {
+ isolate_->set_top_level_parsing(true);
+ isolate_->IncrLoadingInvalidationGen();
+ }
+ ~TopLevelParsingScope() {
+ isolate_->set_top_level_parsing(false);
+ isolate_->IncrLoadingInvalidationGen();
+ }
siva 2016/03/28 17:20:14 Both constructor and destructor are incrementing t
srdjan 2016/03/28 19:54:54 I do not need to differentiate. The only informati
+
+ private:
+ Isolate* isolate_;
+};
+
+
void Parser::ParseCompilationUnit(const Library& library,
const Script& script) {
Thread* thread = Thread::Current();
@@ -507,6 +525,7 @@ void Parser::ParseCompilationUnit(const Library& library,
}
#endif
+ TopLevelParsingScope scope(thread->isolate());
Parser parser(script, library, TokenPosition::kMinSource);
parser.ParseTopLevel();
}
« runtime/vm/isolate.h ('K') | « runtime/vm/object.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698