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

Side by Side Diff: runtime/vm/isolate_reload.cc

Issue 2200233002: Fix top level parse error reload test (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 4 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 unified diff | Download patch
« no previous file with comments | « no previous file | runtime/vm/object_reload.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 184 matching lines...) Expand 10 before | Expand all | Expand 10 after
195 RawString* ReasonForCancelling::ToString() { 195 RawString* ReasonForCancelling::ToString() {
196 UNREACHABLE(); 196 UNREACHABLE();
197 return NULL; 197 return NULL;
198 } 198 }
199 199
200 200
201 void ReasonForCancelling::AppendTo(JSONArray* array) { 201 void ReasonForCancelling::AppendTo(JSONArray* array) {
202 JSONObject jsobj(array); 202 JSONObject jsobj(array);
203 jsobj.AddProperty("type", "ReasonForCancelling"); 203 jsobj.AddProperty("type", "ReasonForCancelling");
204 const String& message = String::Handle(ToString()); 204 const String& message = String::Handle(ToString());
205 jsobj.AddProperty("message", message); 205 jsobj.AddProperty("message", message.ToCString());
206 } 206 }
207 207
208 208
209 void ClassReasonForCancelling::AppendTo(JSONArray* array) { 209 void ClassReasonForCancelling::AppendTo(JSONArray* array) {
210 JSONObject jsobj(array); 210 JSONObject jsobj(array);
211 jsobj.AddProperty("type", "ReasonForCancelling"); 211 jsobj.AddProperty("type", "ReasonForCancelling");
212 jsobj.AddProperty("class", from_); 212 jsobj.AddProperty("class", from_);
213 const String& message = String::Handle(ToString()); 213 const String& message = String::Handle(ToString());
214 jsobj.AddProperty("message", message); 214 jsobj.AddProperty("message", message.ToCString());
215 } 215 }
216 216
217 217
218 RawError* IsolateReloadContext::error() const { 218 RawError* IsolateReloadContext::error() const {
219 ASSERT(reload_aborted()); 219 ASSERT(reload_aborted());
220 // Report the first error to the surroundings. 220 // Report the first error to the surroundings.
221 const Error& error = 221 const Error& error =
222 Error::Handle(reasons_to_cancel_reload_.At(0)->ToError()); 222 Error::Handle(reasons_to_cancel_reload_.At(0)->ToError());
223 return error.raw(); 223 return error.raw();
224 } 224 }
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after
479 479
480 Dart_Handle retval = 480 Dart_Handle retval =
481 (I->library_tag_handler())(Dart_kScriptTag, 481 (I->library_tag_handler())(Dart_kScriptTag,
482 Api::NewHandle(thread, Library::null()), 482 Api::NewHandle(thread, Library::null()),
483 Api::NewHandle(thread, root_lib_url.raw())); 483 Api::NewHandle(thread, root_lib_url.raw()));
484 result = Api::UnwrapHandle(retval); 484 result = Api::UnwrapHandle(retval);
485 } 485 }
486 if (result.IsError()) { 486 if (result.IsError()) {
487 const Error& error = Error::Cast(result); 487 const Error& error = Error::Cast(result);
488 AddReasonForCancelling(new Aborted(zone_, error)); 488 AddReasonForCancelling(new Aborted(zone_, error));
489 // We call report on JSON here because we won't ever execute
490 // FinalizeLoading.
491 ReportOnJSON(js_);
489 } 492 }
490 } 493 }
491 494
492 495
493 void IsolateReloadContext::RegisterClass(const Class& new_cls) { 496 void IsolateReloadContext::RegisterClass(const Class& new_cls) {
494 const Class& old_cls = Class::Handle(OldClassOrNull(new_cls)); 497 const Class& old_cls = Class::Handle(OldClassOrNull(new_cls));
495 if (old_cls.IsNull()) { 498 if (old_cls.IsNull()) {
496 I->class_table()->Register(new_cls); 499 I->class_table()->Register(new_cls);
497 500
498 if (FLAG_identity_reload) { 501 if (FLAG_identity_reload) {
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
530 } else { 533 } else {
531 ReportReasonsForCancelling(); 534 ReportReasonsForCancelling();
532 Rollback(); 535 Rollback();
533 } 536 }
534 // ValidateReload mutates the direct subclass information and does 537 // ValidateReload mutates the direct subclass information and does
535 // not remove dead subclasses. Rebuild the direct subclass 538 // not remove dead subclasses. Rebuild the direct subclass
536 // information from scratch. 539 // information from scratch.
537 RebuildDirectSubclasses(); 540 RebuildDirectSubclasses();
538 541
539 BackgroundCompiler::Enable(); 542 BackgroundCompiler::Enable();
540
541 reload_aborted_ = HasReasonsForCancelling();
542 ReportOnJSON(js_);
543 } 543 }
544 544
545 545
546 void IsolateReloadContext::ReportOnJSON(JSONStream* stream) { 546 void IsolateReloadContext::ReportOnJSON(JSONStream* stream) {
547 JSONObject jsobj(stream); 547 JSONObject jsobj(stream);
548 jsobj.AddProperty("type", "ReloadReport"); 548 jsobj.AddProperty("type", "ReloadReport");
549 jsobj.AddProperty("success", !HasReasonsForCancelling()); 549 jsobj.AddProperty("success", !HasReasonsForCancelling());
550 { 550 {
551 JSONObject details(&jsobj, "details"); 551 JSONObject details(&jsobj, "details");
552 if (HasReasonsForCancelling()) { 552 if (HasReasonsForCancelling()) {
(...skipping 553 matching lines...) Expand 10 before | Expand all | Expand 10 after
1106 void IsolateReloadContext::PostCommit() { 1106 void IsolateReloadContext::PostCommit() {
1107 TIMELINE_SCOPE(PostCommit); 1107 TIMELINE_SCOPE(PostCommit);
1108 set_saved_root_library(Library::Handle()); 1108 set_saved_root_library(Library::Handle());
1109 set_saved_libraries(GrowableObjectArray::Handle()); 1109 set_saved_libraries(GrowableObjectArray::Handle());
1110 InvalidateWorld(); 1110 InvalidateWorld();
1111 TIR_Print("---- DONE COMMIT\n"); 1111 TIR_Print("---- DONE COMMIT\n");
1112 } 1112 }
1113 1113
1114 1114
1115 void IsolateReloadContext::AddReasonForCancelling(ReasonForCancelling* reason) { 1115 void IsolateReloadContext::AddReasonForCancelling(ReasonForCancelling* reason) {
1116 reload_aborted_ = true;
1116 reasons_to_cancel_reload_.Add(reason); 1117 reasons_to_cancel_reload_.Add(reason);
1117 } 1118 }
1118 1119
1119 1120
1120 void IsolateReloadContext::AddInstanceMorpher(InstanceMorpher* morpher) { 1121 void IsolateReloadContext::AddInstanceMorpher(InstanceMorpher* morpher) {
1121 instance_morphers_.Add(morpher); 1122 instance_morphers_.Add(morpher);
1122 cid_mapper_.Insert(morpher); 1123 cid_mapper_.Insert(morpher);
1123 } 1124 }
1124 1125
1125 1126
(...skipping 466 matching lines...) Expand 10 before | Expand all | Expand 10 after
1592 ASSERT(!super_cls.IsNull()); 1593 ASSERT(!super_cls.IsNull());
1593 super_cls.AddDirectSubclass(cls); 1594 super_cls.AddDirectSubclass(cls);
1594 } 1595 }
1595 } 1596 }
1596 } 1597 }
1597 } 1598 }
1598 1599
1599 #endif // !PRODUCT 1600 #endif // !PRODUCT
1600 1601
1601 } // namespace dart 1602 } // namespace dart
OLDNEW
« no previous file with comments | « no previous file | runtime/vm/object_reload.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698