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

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

Issue 2997243002: Move all the isolate reload code under !defined(DART_PRECOMPILED_RUNTIME) (Closed)
Patch Set: Address code review comments. Created 3 years, 3 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/isolate_reload.h ('k') | runtime/vm/isolate_reload_test.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/compiler.h" 9 #include "vm/compiler.h"
10 #include "vm/dart_api_impl.h" 10 #include "vm/dart_api_impl.h"
11 #include "vm/hash_table.h" 11 #include "vm/hash_table.h"
12 #include "vm/isolate.h" 12 #include "vm/isolate.h"
13 #include "vm/kernel_reader.h" 13 #include "vm/kernel_reader.h"
14 #include "vm/log.h" 14 #include "vm/log.h"
15 #include "vm/object.h" 15 #include "vm/object.h"
16 #include "vm/object_store.h" 16 #include "vm/object_store.h"
17 #include "vm/parser.h" 17 #include "vm/parser.h"
18 #include "vm/runtime_entry.h" 18 #include "vm/runtime_entry.h"
19 #include "vm/safepoint.h" 19 #include "vm/safepoint.h"
20 #include "vm/service_event.h" 20 #include "vm/service_event.h"
21 #include "vm/stack_frame.h" 21 #include "vm/stack_frame.h"
22 #include "vm/thread.h" 22 #include "vm/thread.h"
23 #include "vm/timeline.h" 23 #include "vm/timeline.h"
24 #include "vm/visitor.h" 24 #include "vm/visitor.h"
25 25
26 namespace dart { 26 namespace dart {
27 27
28 DEFINE_FLAG(int, reload_every, 0, "Reload every N stack overflow checks.");
28 DEFINE_FLAG(bool, trace_reload, false, "Trace isolate reloading"); 29 DEFINE_FLAG(bool, trace_reload, false, "Trace isolate reloading");
30
31 #if !defined(PRODUCT) && !defined(DART_PRECOMPILED_RUNTIME)
29 DEFINE_FLAG(bool, 32 DEFINE_FLAG(bool,
30 trace_reload_verbose, 33 trace_reload_verbose,
31 false, 34 false,
32 "trace isolate reloading verbose"); 35 "trace isolate reloading verbose");
33 DEFINE_FLAG(bool, identity_reload, false, "Enable checks for identity reload."); 36 DEFINE_FLAG(bool, identity_reload, false, "Enable checks for identity reload.");
34 DEFINE_FLAG(int, reload_every, 0, "Reload every N stack overflow checks.");
35 DEFINE_FLAG(bool, reload_every_optimized, true, "Only from optimized code."); 37 DEFINE_FLAG(bool, reload_every_optimized, true, "Only from optimized code.");
36 DEFINE_FLAG(bool, 38 DEFINE_FLAG(bool,
37 reload_every_back_off, 39 reload_every_back_off,
38 false, 40 false,
39 "Double the --reload-every value after each reload."); 41 "Double the --reload-every value after each reload.");
40 DEFINE_FLAG(bool, 42 DEFINE_FLAG(bool,
41 reload_force_rollback, 43 reload_force_rollback,
42 false, 44 false,
43 "Force all reloads to fail and rollback."); 45 "Force all reloads to fail and rollback.");
44 DEFINE_FLAG(bool, 46 DEFINE_FLAG(bool,
45 check_reloaded, 47 check_reloaded,
46 false, 48 false,
47 "Assert that an isolate has reloaded at least once.") 49 "Assert that an isolate has reloaded at least once.")
48 #ifndef PRODUCT
49 50
50 #define I (isolate()) 51 #define I (isolate())
51 #define Z (thread->zone()) 52 #define Z (thread->zone())
52 53
53 #define TIMELINE_SCOPE(name) \ 54 #define TIMELINE_SCOPE(name) \
54 TimelineDurationScope tds##name(Thread::Current(), \ 55 TimelineDurationScope tds##name(Thread::Current(), \
55 Timeline::GetIsolateStream(), #name) 56 Timeline::GetIsolateStream(), #name)
56 57
57 InstanceMorpher::InstanceMorpher(Zone* zone, const Class& from, const Class& to) 58 InstanceMorpher::InstanceMorpher(Zone* zone, const Class& from, const Class& to)
58 : from_(Class::Handle(zone, from.raw())), 59 : from_(Class::Handle(zone, from.raw())),
(...skipping 420 matching lines...) Expand 10 before | Expand all | Expand 10 after
479 480
480 private: 481 private:
481 const Error& error_; 482 const Error& error_;
482 483
483 RawError* ToError() { return error_.raw(); } 484 RawError* ToError() { return error_.raw(); }
484 RawString* ToString() { 485 RawString* ToString() {
485 return String::NewFormatted("%s", error_.ToErrorCString()); 486 return String::NewFormatted("%s", error_.ToErrorCString());
486 } 487 }
487 }; 488 };
488 489
489 #if !defined(DART_PRECOMPILED_RUNTIME)
490 static intptr_t CommonSuffixLength(const char* a, const char* b) { 490 static intptr_t CommonSuffixLength(const char* a, const char* b) {
491 const intptr_t a_length = strlen(a); 491 const intptr_t a_length = strlen(a);
492 const intptr_t b_length = strlen(b); 492 const intptr_t b_length = strlen(b);
493 intptr_t a_cursor = a_length; 493 intptr_t a_cursor = a_length;
494 intptr_t b_cursor = b_length; 494 intptr_t b_cursor = b_length;
495 495
496 while ((a_cursor >= 0) && (b_cursor >= 0)) { 496 while ((a_cursor >= 0) && (b_cursor >= 0)) {
497 if (a[a_cursor] != b[b_cursor]) { 497 if (a[a_cursor] != b[b_cursor]) {
498 break; 498 break;
499 } 499 }
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after
684 Exceptions::PropagateError(Error::Cast(result)); 684 Exceptions::PropagateError(Error::Cast(result));
685 UNREACHABLE(); 685 UNREACHABLE();
686 } 686 }
687 } 687 }
688 688
689 // Other errors (e.g. a parse error) are captured by the reload system. 689 // Other errors (e.g. a parse error) are captured by the reload system.
690 if (result.IsError()) { 690 if (result.IsError()) {
691 FinalizeFailedLoad(Error::Cast(result)); 691 FinalizeFailedLoad(Error::Cast(result));
692 } 692 }
693 } 693 }
694 #else
695 // NOTE: This function returns *after* FinalizeLoading is called.
696 void IsolateReloadContext::Reload(bool force_reload,
697 const char* root_script_url,
698 const char* packages_url_) {}
699 #endif // !defined(DART_PRECOMPILED_RUNTIME)
700 694
701 void IsolateReloadContext::RegisterClass(const Class& new_cls) { 695 void IsolateReloadContext::RegisterClass(const Class& new_cls) {
702 const Class& old_cls = Class::Handle(OldClassOrNull(new_cls)); 696 const Class& old_cls = Class::Handle(OldClassOrNull(new_cls));
703 if (old_cls.IsNull()) { 697 if (old_cls.IsNull()) {
704 I->class_table()->Register(new_cls); 698 I->class_table()->Register(new_cls);
705 699
706 if (FLAG_identity_reload) { 700 if (FLAG_identity_reload) {
707 TIR_Print("Could not find replacement class for %s\n", 701 TIR_Print("Could not find replacement class for %s\n",
708 new_cls.ToCString()); 702 new_cls.ToCString());
709 UNREACHABLE(); 703 UNREACHABLE();
(...skipping 1175 matching lines...) Expand 10 before | Expand all | Expand 10 after
1885 super_type = cls.super_type(); 1879 super_type = cls.super_type();
1886 if (!super_type.IsNull() && !super_type.IsObjectType()) { 1880 if (!super_type.IsNull() && !super_type.IsObjectType()) {
1887 super_cls = cls.SuperClass(); 1881 super_cls = cls.SuperClass();
1888 ASSERT(!super_cls.IsNull()); 1882 ASSERT(!super_cls.IsNull());
1889 super_cls.AddDirectSubclass(cls); 1883 super_cls.AddDirectSubclass(cls);
1890 } 1884 }
1891 } 1885 }
1892 } 1886 }
1893 } 1887 }
1894 1888
1895 #endif // !PRODUCT 1889 #endif // !defined(PRODUCT) && !defined(DART_PRECOMPILED_RUNTIME)
1896 1890
1897 } // namespace dart 1891 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/isolate_reload.h ('k') | runtime/vm/isolate_reload_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698