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

Unified Diff: runtime/vm/parser.cc

Issue 23819018: Fix data races caused by compiler stats counters in the parser. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 3 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/parser.h ('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
===================================================================
--- runtime/vm/parser.cc (revision 27120)
+++ runtime/vm/parser.cc (working copy)
@@ -64,7 +64,7 @@
indent_++;
}
}
- ~TraceParser() { indent_--; }
+ ~TraceParser() { if (FLAG_trace_parser) indent_--; }
private:
void PrintIndent() {
for (int i = 0; i < indent_; i++) { OS::Print(". "); }
@@ -345,7 +345,9 @@
void Parser::SetPosition(intptr_t position) {
if (position < TokenPos() && position != 0) {
- CompilerStats::num_tokens_rewind += (TokenPos() - position);
+ if (FLAG_compiler_stats) {
+ CompilerStats::num_tokens_rewind += (TokenPos() - position);
+ }
}
tokens_iterator_.SetCurrentPosition(position);
token_kind_ = Token::kILLEGAL;
@@ -368,14 +370,18 @@
ErrorMsg(TokenPos(), "%s", CurrentLiteral()->ToCString());
}
}
- CompilerStats::num_token_checks++;
+ if (FLAG_compiler_stats) {
+ CompilerStats::num_token_checks++;
+ }
return token_kind_;
}
Token::Kind Parser::LookaheadToken(int num_tokens) {
- CompilerStats::num_tokens_lookahead++;
- CompilerStats::num_token_checks++;
+ if (FLAG_compiler_stats) {
+ CompilerStats::num_tokens_lookahead++;
+ CompilerStats::num_token_checks++;
+ }
return tokens_iterator_.LookaheadTokenKind(num_tokens);
}
« no previous file with comments | « runtime/vm/parser.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698