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

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

Issue 2207643002: Narrow the scope of writable code to the forwarding phase of become instead of the whole isolate re… (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 | « runtime/vm/become.cc ('k') | no next file » | 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 445 matching lines...) Expand 10 before | Expand all | Expand 10 after
456 HashTables::New<UnorderedHashMap<LibraryMapTraits> >(4); 456 HashTables::New<UnorderedHashMap<LibraryMapTraits> >(4);
457 become_map_storage_ = 457 become_map_storage_ =
458 HashTables::New<UnorderedHashMap<BecomeMapTraits> >(4); 458 HashTables::New<UnorderedHashMap<BecomeMapTraits> >(4);
459 // Keep a separate array for enum mappings to avoid having to invoke 459 // Keep a separate array for enum mappings to avoid having to invoke
460 // hashCode on the instances. 460 // hashCode on the instances.
461 become_enum_mappings_ = GrowableObjectArray::New(Heap::kOld); 461 become_enum_mappings_ = GrowableObjectArray::New(Heap::kOld);
462 462
463 // Disable the background compiler while we are performing the reload. 463 // Disable the background compiler while we are performing the reload.
464 BackgroundCompiler::Disable(); 464 BackgroundCompiler::Disable();
465 465
466 if (FLAG_write_protect_code) {
467 // Disable code page write protection while we are reloading.
468 I->heap()->WriteProtectCode(false);
469 }
470
471 // Ensure all functions on the stack have unoptimized code. 466 // Ensure all functions on the stack have unoptimized code.
472 EnsuredUnoptimizedCodeForStack(); 467 EnsuredUnoptimizedCodeForStack();
473 // Deoptimize all code that had optimizing decisions that are dependent on 468 // Deoptimize all code that had optimizing decisions that are dependent on
474 // assumptions from field guards or CHA or deferred library prefixes. 469 // assumptions from field guards or CHA or deferred library prefixes.
475 // TODO(johnmccutchan): Deoptimizing dependent code here (before the reload) 470 // TODO(johnmccutchan): Deoptimizing dependent code here (before the reload)
476 // is paranoid. This likely can be moved to the commit phase. 471 // is paranoid. This likely can be moved to the commit phase.
477 DeoptimizeDependentCode(); 472 DeoptimizeDependentCode();
478 Checkpoint(); 473 Checkpoint();
479 474
480 Object& result = Object::Handle(thread->zone()); 475 Object& result = Object::Handle(thread->zone());
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
534 isolate()->set_last_reload_timestamp(reload_timestamp_); 529 isolate()->set_last_reload_timestamp(reload_timestamp_);
535 } else { 530 } else {
536 ReportReasonsForCancelling(); 531 ReportReasonsForCancelling();
537 Rollback(); 532 Rollback();
538 } 533 }
539 // ValidateReload mutates the direct subclass information and does 534 // ValidateReload mutates the direct subclass information and does
540 // not remove dead subclasses. Rebuild the direct subclass 535 // not remove dead subclasses. Rebuild the direct subclass
541 // information from scratch. 536 // information from scratch.
542 RebuildDirectSubclasses(); 537 RebuildDirectSubclasses();
543 538
544 if (FLAG_write_protect_code) {
545 // Re-enable code page write protection.
546 I->heap()->WriteProtectCode(true);
547 }
548
549 BackgroundCompiler::Enable(); 539 BackgroundCompiler::Enable();
550 540
551 reload_aborted_ = HasReasonsForCancelling(); 541 reload_aborted_ = HasReasonsForCancelling();
552 ReportOnJSON(js_); 542 ReportOnJSON(js_);
553 } 543 }
554 544
555 545
556 void IsolateReloadContext::ReportOnJSON(JSONStream* stream) { 546 void IsolateReloadContext::ReportOnJSON(JSONStream* stream) {
557 JSONObject jsobj(stream); 547 JSONObject jsobj(stream);
558 jsobj.AddProperty("type", "ReloadReport"); 548 jsobj.AddProperty("type", "ReloadReport");
(...skipping 1043 matching lines...) Expand 10 before | Expand all | Expand 10 after
1602 ASSERT(!super_cls.IsNull()); 1592 ASSERT(!super_cls.IsNull());
1603 super_cls.AddDirectSubclass(cls); 1593 super_cls.AddDirectSubclass(cls);
1604 } 1594 }
1605 } 1595 }
1606 } 1596 }
1607 } 1597 }
1608 1598
1609 #endif // !PRODUCT 1599 #endif // !PRODUCT
1610 1600
1611 } // namespace dart 1601 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/become.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698