Chromium Code Reviews| 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(); |
| } |