Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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/source_report.h" | 5 #include "vm/source_report.h" |
| 6 | 6 |
| 7 #include "vm/compiler.h" | 7 #include "vm/compiler.h" |
| 8 #include "vm/isolate.h" | 8 #include "vm/isolate.h" |
| 9 #include "vm/object.h" | 9 #include "vm/object.h" |
| 10 #include "vm/object_store.h" | 10 #include "vm/object_store.h" |
| (...skipping 375 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 386 PrintProfileData(&range, profile_function); | 386 PrintProfileData(&range, profile_function); |
| 387 } | 387 } |
| 388 } | 388 } |
| 389 } | 389 } |
| 390 | 390 |
| 391 | 391 |
| 392 void SourceReport::VisitLibrary(JSONArray* jsarr, const Library& lib) { | 392 void SourceReport::VisitLibrary(JSONArray* jsarr, const Library& lib) { |
| 393 Class& cls = Class::Handle(zone()); | 393 Class& cls = Class::Handle(zone()); |
| 394 Array& functions = Array::Handle(zone()); | 394 Array& functions = Array::Handle(zone()); |
| 395 Function& func = Function::Handle(zone()); | 395 Function& func = Function::Handle(zone()); |
| 396 Script& script = Script::Handle(zone()); | |
| 396 ClassDictionaryIterator it(lib, ClassDictionaryIterator::kIteratePrivate); | 397 ClassDictionaryIterator it(lib, ClassDictionaryIterator::kIteratePrivate); |
| 397 while (it.HasNext()) { | 398 while (it.HasNext()) { |
| 398 cls = it.GetNextClass(); | 399 cls = it.GetNextClass(); |
| 400 if (!cls.is_finalized()) { | |
| 401 if (compile_mode_ == kForceCompile) { | |
| 402 const Error& err = Error::Handle(cls.EnsureIsFinalized(thread())); | |
| 403 if (!err.IsNull()) { | |
| 404 // This class will get an error when finalized. Skip it. | |
|
rmacnak
2016/04/25 23:28:34
We don't report errors with kForceCompile? If we r
| |
| 405 continue; | |
| 406 } | |
| 407 } else { | |
| 408 // Emit one range for the whole uncompiled class. | |
| 409 script = cls.script(); | |
| 410 const TokenPosition begin_pos = cls.token_pos(); | |
| 411 const TokenPosition end_pos = cls.ComputeEndTokenPos(); | |
| 412 | |
| 413 JSONObject range(jsarr); | |
| 414 range.AddProperty("scriptIndex", GetScriptIndex(script)); | |
| 415 range.AddProperty("startPos", begin_pos); | |
| 416 range.AddProperty("endPos", end_pos); | |
| 417 range.AddProperty("compiled", false); | |
| 418 } | |
| 419 } | |
| 420 | |
| 399 functions = cls.functions(); | 421 functions = cls.functions(); |
| 400 for (int i = 0; i < functions.Length(); i++) { | 422 for (int i = 0; i < functions.Length(); i++) { |
| 401 func ^= functions.At(i); | 423 func ^= functions.At(i); |
| 402 VisitFunction(jsarr, func); | 424 VisitFunction(jsarr, func); |
| 403 } | 425 } |
| 404 } | 426 } |
| 405 } | 427 } |
| 406 | 428 |
| 407 | 429 |
| 408 void SourceReport::VisitClosures(JSONArray* jsarr) { | 430 void SourceReport::VisitClosures(JSONArray* jsarr) { |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 446 VisitClosures(&ranges); | 468 VisitClosures(&ranges); |
| 447 } | 469 } |
| 448 | 470 |
| 449 // Print the script table. | 471 // Print the script table. |
| 450 JSONArray scripts(&report, "scripts"); | 472 JSONArray scripts(&report, "scripts"); |
| 451 PrintScriptTable(&scripts); | 473 PrintScriptTable(&scripts); |
| 452 } | 474 } |
| 453 | 475 |
| 454 | 476 |
| 455 } // namespace dart | 477 } // namespace dart |
| OLD | NEW |