| OLD | NEW |
| 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 #include "vm/compiler_stats.h" | 5 #include "vm/compiler_stats.h" |
| 6 | 6 |
| 7 #include "vm/flags.h" | 7 #include "vm/flags.h" |
| 8 #include "vm/log.h" | 8 #include "vm/log.h" |
| 9 #include "vm/object_graph.h" | 9 #include "vm/object_graph.h" |
| 10 #include "vm/object_store.h" | 10 #include "vm/object_store.h" |
| 11 #include "vm/timer.h" | 11 #include "vm/timer.h" |
| 12 | 12 |
| 13 | 13 |
| 14 namespace dart { | 14 namespace dart { |
| 15 | 15 |
| 16 DEFINE_FLAG(bool, compiler_stats, false, "Compiler stat counters."); | 16 DEFINE_FLAG(bool, compiler_stats, false, "Compiler stat counters."); |
| 17 DEFINE_FLAG(bool, compiler_benchmark, false, | 17 DEFINE_FLAG(bool, compiler_benchmark, false, |
| 18 "Compiler stat counters for benchmark."); | 18 "Compiler stat counters for benchmark."); |
| 19 | 19 |
| 20 | 20 |
| 21 class TokenStreamVisitor : public ObjectVisitor { | 21 class TokenStreamVisitor : public ObjectVisitor { |
| 22 public: | 22 public: |
| 23 explicit TokenStreamVisitor(CompilerStats* compiler_stats) | 23 explicit TokenStreamVisitor(CompilerStats* compiler_stats) |
| 24 : obj_(Object::Handle()), | 24 : obj_(Object::Handle()), |
| 25 stats_(compiler_stats) { | 25 stats_(compiler_stats) { |
| 26 } | 26 } |
| 27 | 27 |
| 28 void VisitObject(RawObject* raw_obj) { | 28 void VisitObject(RawObject* raw_obj) { |
| 29 if (raw_obj->IsFreeListElement()) { | 29 if (raw_obj->IsFreeListElement() || raw_obj->IsForwardingCorpse()) { |
| 30 return; | 30 return; |
| 31 } | 31 } |
| 32 obj_ = raw_obj; | 32 obj_ = raw_obj; |
| 33 if (obj_.GetClassId() == TokenStream::kClassId) { | 33 if (obj_.GetClassId() == TokenStream::kClassId) { |
| 34 TokenStream::Iterator tkit(Thread::Current()->zone(), | 34 TokenStream::Iterator tkit(Thread::Current()->zone(), |
| 35 TokenStream::Cast(obj_), | 35 TokenStream::Cast(obj_), |
| 36 TokenPosition::kMinSource, | 36 TokenPosition::kMinSource, |
| 37 TokenStream::Iterator::kNoNewlines); | 37 TokenStream::Iterator::kNoNewlines); |
| 38 Token::Kind kind = tkit.CurrentTokenKind(); | 38 Token::Kind kind = tkit.CurrentTokenKind(); |
| 39 while (kind != Token::kEOS) { | 39 while (kind != Token::kEOS) { |
| (...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 309 log.Print(" VarDesc size: %" Pd64 " KB\n", vardesc_size / 1024); | 309 log.Print(" VarDesc size: %" Pd64 " KB\n", vardesc_size / 1024); |
| 310 log.Flush(); | 310 log.Flush(); |
| 311 char* stats_text = text; | 311 char* stats_text = text; |
| 312 text = NULL; | 312 text = NULL; |
| 313 return stats_text; | 313 return stats_text; |
| 314 } | 314 } |
| 315 | 315 |
| 316 #endif // !PRODUCT | 316 #endif // !PRODUCT |
| 317 | 317 |
| 318 } // namespace dart | 318 } // namespace dart |
| OLD | NEW |