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

Unified Diff: runtime/vm/parser.cc

Issue 944463002: Fix indentation of parser trace (several threads may compile at once). (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 5 years, 10 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 43883)
+++ runtime/vm/parser.cc (working copy)
@@ -69,7 +69,11 @@
#if defined(DEBUG)
class TraceParser : public ValueObject {
public:
- TraceParser(intptr_t token_pos, const Script& script, const char* msg) {
+ TraceParser(intptr_t token_pos,
+ const Script& script,
+ intptr_t* trace_indent,
+ const char* msg) {
+ indent_ = trace_indent;
if (FLAG_trace_parser) {
// Skips tracing of bootstrap libraries.
if (script.HasSource()) {
@@ -79,21 +83,26 @@
OS::Print("%s (line %" Pd ", col %" Pd ", token %" Pd ")\n",
msg, line, column, token_pos);
}
- indent_++;
+ (*indent_)++;
}
}
- ~TraceParser() { indent_--; }
+ ~TraceParser() {
+ if (FLAG_trace_parser) {
+ (*indent_)--;
+ ASSERT(*indent_ >= 0);
+ }
+ }
+
private:
void PrintIndent() {
- for (int i = 0; i < indent_; i++) { OS::Print(". "); }
+ for (intptr_t i = 0; i < *indent_; i++) { OS::Print(". "); }
}
- static int indent_;
+ intptr_t* indent_;
};
-int TraceParser::indent_ = 0;
#define TRACE_PARSER(s) \
- TraceParser __p__(this->TokenPos(), this->script_, s)
+ TraceParser __p__(this->TokenPos(), this->script_, &this->trace_indent_, s)
#else // not DEBUG
#define TRACE_PARSER(s)
@@ -326,7 +335,8 @@
try_blocks_list_(NULL),
last_used_try_index_(0),
unregister_pending_function_(false),
- async_temp_scope_(NULL) {
+ async_temp_scope_(NULL),
+ trace_indent_(0) {
ASSERT(tokens_iterator_.IsValid());
ASSERT(!library.IsNull());
}
@@ -358,7 +368,8 @@
try_blocks_list_(NULL),
last_used_try_index_(0),
unregister_pending_function_(false),
- async_temp_scope_(NULL) {
+ async_temp_scope_(NULL),
+ trace_indent_(0) {
ASSERT(tokens_iterator_.IsValid());
ASSERT(!current_function().IsNull());
EnsureExpressionTemp();
« 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