Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, 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/isolate_reload.h" | 5 #include "vm/isolate_reload.h" |
| 6 | 6 |
| 7 #include "vm/become.h" | 7 #include "vm/become.h" |
| 8 #include "vm/bit_vector.h" | 8 #include "vm/bit_vector.h" |
| 9 #include "vm/code_generator.h" | 9 #include "vm/code_generator.h" |
| 10 #include "vm/compiler.h" | 10 #include "vm/compiler.h" |
| (...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 205 | 205 |
| 206 | 206 |
| 207 void ClassReasonForCancelling::AppendTo(JSONArray* array) { | 207 void ClassReasonForCancelling::AppendTo(JSONArray* array) { |
| 208 JSONObject jsobj(array); | 208 JSONObject jsobj(array); |
| 209 jsobj.AddProperty("type", "ReasonForCancelling"); | 209 jsobj.AddProperty("type", "ReasonForCancelling"); |
| 210 jsobj.AddProperty("class", from_); | 210 jsobj.AddProperty("class", from_); |
| 211 const String& message = String::Handle(ToString()); | 211 const String& message = String::Handle(ToString()); |
| 212 jsobj.AddProperty("message", message); | 212 jsobj.AddProperty("message", message); |
| 213 } | 213 } |
| 214 | 214 |
| 215 | |
| 215 RawError* IsolateReloadContext::error() const { | 216 RawError* IsolateReloadContext::error() const { |
| 216 ASSERT(has_error()); | 217 ASSERT(has_error()); |
| 217 // Report the first error to the surroundings. | 218 // Report the first error to the surroundings. |
| 218 const Error& error = | 219 const Error& error = |
| 219 Error::Handle(reasons_to_cancel_reload_.At(0)->ToError()); | 220 Error::Handle(reasons_to_cancel_reload_.At(0)->ToError()); |
| 220 OS::Print("[[%s]]\n", error.ToCString()); | |
| 221 return error.raw(); | 221 return error.raw(); |
| 222 } | 222 } |
| 223 | 223 |
| 224 | 224 |
| 225 class ScriptUrlSetTraits { | 225 class ScriptUrlSetTraits { |
| 226 public: | 226 public: |
| 227 static bool ReportStats() { return false; } | 227 static bool ReportStats() { return false; } |
| 228 static const char* Name() { return "ScriptUrlSetTraits"; } | 228 static const char* Name() { return "ScriptUrlSetTraits"; } |
| 229 | 229 |
| 230 static bool IsMatch(const Object& a, const Object& b) { | 230 static bool IsMatch(const Object& a, const Object& b) { |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 348 bool IsolateReloadContext::IsSameLibrary( | 348 bool IsolateReloadContext::IsSameLibrary( |
| 349 const Library& a_lib, const Library& b_lib) { | 349 const Library& a_lib, const Library& b_lib) { |
| 350 const String& a_lib_url = | 350 const String& a_lib_url = |
| 351 String::Handle(a_lib.IsNull() ? String::null() : a_lib.url()); | 351 String::Handle(a_lib.IsNull() ? String::null() : a_lib.url()); |
| 352 const String& b_lib_url = | 352 const String& b_lib_url = |
| 353 String::Handle(b_lib.IsNull() ? String::null() : b_lib.url()); | 353 String::Handle(b_lib.IsNull() ? String::null() : b_lib.url()); |
| 354 return a_lib_url.Equals(b_lib_url); | 354 return a_lib_url.Equals(b_lib_url); |
| 355 } | 355 } |
| 356 | 356 |
| 357 | 357 |
| 358 IsolateReloadContext::IsolateReloadContext(Isolate* isolate) | 358 IsolateReloadContext::IsolateReloadContext(Isolate* isolate, |
| 359 JSONStream* js) | |
| 359 : start_time_micros_(OS::GetCurrentMonotonicMicros()), | 360 : start_time_micros_(OS::GetCurrentMonotonicMicros()), |
| 360 reload_timestamp_(OS::GetCurrentTimeMillis()), | 361 reload_timestamp_(OS::GetCurrentTimeMillis()), |
| 361 isolate_(isolate), | 362 isolate_(isolate), |
| 362 reload_skipped_(false), | 363 reload_skipped_(false), |
| 364 js_(js), | |
| 363 saved_num_cids_(-1), | 365 saved_num_cids_(-1), |
| 364 saved_class_table_(NULL), | 366 saved_class_table_(NULL), |
| 365 num_saved_libs_(-1), | 367 num_saved_libs_(-1), |
| 366 instance_morphers_(), | 368 instance_morphers_(), |
| 367 reasons_to_cancel_reload_(), | 369 reasons_to_cancel_reload_(), |
| 368 cid_mapper_(), | 370 cid_mapper_(), |
| 369 modified_libs_(NULL), | 371 modified_libs_(NULL), |
| 370 script_uri_(String::null()), | 372 script_uri_(String::null()), |
| 371 error_(Error::null()), | 373 error_(Error::null()), |
| 372 old_classes_set_storage_(Array::null()), | 374 old_classes_set_storage_(Array::null()), |
| (...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 532 // information from scratch. | 534 // information from scratch. |
| 533 RebuildDirectSubclasses(); | 535 RebuildDirectSubclasses(); |
| 534 | 536 |
| 535 if (FLAG_write_protect_code) { | 537 if (FLAG_write_protect_code) { |
| 536 // Re-enable code page write protection. | 538 // Re-enable code page write protection. |
| 537 I->heap()->WriteProtectCode(true); | 539 I->heap()->WriteProtectCode(true); |
| 538 } | 540 } |
| 539 | 541 |
| 540 BackgroundCompiler::Enable(); | 542 BackgroundCompiler::Enable(); |
| 541 | 543 |
| 542 if (FLAG_trace_reload) { | 544 ReportOnJSON(js_); |
| 543 JSONStream stream; | |
| 544 ReportOnJSON(&stream); | |
| 545 OS::Print("\nJSON report:\n %s\n", stream.ToCString()); | |
| 546 } | |
| 547 } | 545 } |
| 548 | 546 |
| 549 | 547 |
| 550 void IsolateReloadContext::ReportOnJSON(JSONStream* stream) { | 548 void IsolateReloadContext::ReportOnJSON(JSONStream* stream) { |
| 551 JSONObject jsobj(stream); | 549 JSONObject jsobj(stream); |
| 552 jsobj.AddProperty("type", "Reload"); | 550 jsobj.AddProperty("type", "Reload"); |
|
turnidge
2016/08/01 17:24:24
ReloadReport or ReloadStatus.
| |
| 553 jsobj.AddProperty("succeeded", !HasReasonsForCancelling()); | 551 jsobj.AddProperty("succeeded", !HasReasonsForCancelling()); |
| 554 if (HasReasonsForCancelling()) { | 552 if (HasReasonsForCancelling()) { |
| 555 JSONArray array(&jsobj, "reasons"); | 553 JSONArray array(&jsobj, "reasons"); |
|
turnidge
2016/08/01 17:24:25
notices or messages?
| |
| 556 for (intptr_t i = 0; i < reasons_to_cancel_reload_.length(); i++) { | 554 for (intptr_t i = 0; i < reasons_to_cancel_reload_.length(); i++) { |
| 557 ReasonForCancelling* reason = reasons_to_cancel_reload_.At(i); | 555 ReasonForCancelling* reason = reasons_to_cancel_reload_.At(i); |
| 558 reason->AppendTo(&array); | 556 reason->AppendTo(&array); |
| 559 } | 557 } |
| 560 } else { | 558 } else { |
| 561 JSONArray array(&jsobj, "changes"); | 559 JSONArray array(&jsobj, "changes"); |
| 562 for (intptr_t i = 0; i < instance_morphers_.length(); i++) { | 560 for (intptr_t i = 0; i < instance_morphers_.length(); i++) { |
| 563 instance_morphers_.At(i)->AppendTo(&array); | 561 instance_morphers_.At(i)->AppendTo(&array); |
| 564 } | 562 } |
| 565 } | 563 } |
| (...skipping 1007 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1573 ASSERT(!super_cls.IsNull()); | 1571 ASSERT(!super_cls.IsNull()); |
| 1574 super_cls.AddDirectSubclass(cls); | 1572 super_cls.AddDirectSubclass(cls); |
| 1575 } | 1573 } |
| 1576 } | 1574 } |
| 1577 } | 1575 } |
| 1578 } | 1576 } |
| 1579 | 1577 |
| 1580 #endif // !PRODUCT | 1578 #endif // !PRODUCT |
| 1581 | 1579 |
| 1582 } // namespace dart | 1580 } // namespace dart |
| OLD | NEW |