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

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

Issue 2164703003: Fix for use-after-free of reload context (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: s/test_mode/dont_delete_reload_context/, simplifications Created 4 years, 5 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.cc ('k') | runtime/vm/isolate_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 #ifndef VM_ISOLATE_RELOAD_H_ 5 #ifndef VM_ISOLATE_RELOAD_H_
6 #define VM_ISOLATE_RELOAD_H_ 6 #define VM_ISOLATE_RELOAD_H_
7 7
8 #include "vm/globals.h" 8 #include "vm/globals.h"
9 #include "vm/growable_array.h" 9 #include "vm/growable_array.h"
10 #include "vm/log.h" 10 #include "vm/log.h"
(...skipping 28 matching lines...) Expand all
39 class RawGrowableObjectArray; 39 class RawGrowableObjectArray;
40 class RawLibrary; 40 class RawLibrary;
41 class RawObject; 41 class RawObject;
42 class RawString; 42 class RawString;
43 class ObjectPointerVisitor; 43 class ObjectPointerVisitor;
44 class ObjectStore; 44 class ObjectStore;
45 class UpdateClassesVisitor; 45 class UpdateClassesVisitor;
46 46
47 class IsolateReloadContext { 47 class IsolateReloadContext {
48 public: 48 public:
49 explicit IsolateReloadContext(Isolate* isolate, bool test_mode = false); 49 explicit IsolateReloadContext(Isolate* isolate);
50 ~IsolateReloadContext(); 50 ~IsolateReloadContext();
51 51
52 void StartReload(); 52 void StartReload();
53 void FinishReload(); 53 void FinishReload();
54 void AbortReload(const Error& error); 54 void AbortReload(const Error& error);
55 55
56 RawLibrary* saved_root_library() const; 56 RawLibrary* saved_root_library() const;
57 57
58 RawGrowableObjectArray* saved_libraries() const; 58 RawGrowableObjectArray* saved_libraries() const;
59 59
60 void ReportError(const Error& error); 60 void ReportError(const Error& error);
61 void ReportError(const String& error_msg); 61 void ReportError(const String& error_msg);
62 void ReportSuccess(); 62 void ReportSuccess();
63 63
64 bool has_error() const { return has_error_; } 64 bool has_error() const { return has_error_; }
65 RawError* error() const { return error_; } 65 RawError* error() const { return error_; }
66 bool test_mode() const { return test_mode_; }
67 66
68 static bool IsSameField(const Field& a, const Field& b); 67 static bool IsSameField(const Field& a, const Field& b);
69 static bool IsSameLibrary(const Library& a_lib, const Library& b_lib); 68 static bool IsSameLibrary(const Library& a_lib, const Library& b_lib);
70 static bool IsSameClass(const Class& a, const Class& b); 69 static bool IsSameClass(const Class& a, const Class& b);
71 70
72 RawClass* FindOriginalClass(const Class& cls); 71 RawClass* FindOriginalClass(const Class& cls);
73 72
74 bool IsDirty(const Library& lib); 73 bool IsDirty(const Library& lib);
75 74
76 // Prefers old classes when we are in the middle of a reload. 75 // Prefers old classes when we are in the middle of a reload.
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 void ClearReplacedObjectBits(); 122 void ClearReplacedObjectBits();
124 123
125 // atomic_install: 124 // atomic_install:
126 void MarkAllFunctionsForRecompilation(); 125 void MarkAllFunctionsForRecompilation();
127 void ResetUnoptimizedICsOnStack(); 126 void ResetUnoptimizedICsOnStack();
128 void ResetMegamorphicCaches(); 127 void ResetMegamorphicCaches();
129 void InvalidateWorld(); 128 void InvalidateWorld();
130 129
131 int64_t start_time_micros_; 130 int64_t start_time_micros_;
132 Isolate* isolate_; 131 Isolate* isolate_;
133 bool test_mode_;
134 bool has_error_; 132 bool has_error_;
135 133
136 intptr_t saved_num_cids_; 134 intptr_t saved_num_cids_;
137 RawClass** saved_class_table_; 135 RawClass** saved_class_table_;
138 136
139 intptr_t num_saved_libs_; 137 intptr_t num_saved_libs_;
140 struct LibraryInfo { 138 struct LibraryInfo {
141 bool dirty; 139 bool dirty;
142 }; 140 };
143 MallocGrowableArray<LibraryInfo> library_infos_; 141 MallocGrowableArray<LibraryInfo> library_infos_;
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
176 RawGrowableObjectArray* saved_libraries_; 174 RawGrowableObjectArray* saved_libraries_;
177 RawObject** to() { return reinterpret_cast<RawObject**>(&saved_libraries_); } 175 RawObject** to() { return reinterpret_cast<RawObject**>(&saved_libraries_); }
178 176
179 friend class Isolate; 177 friend class Isolate;
180 friend class Class; // AddStaticFieldMapping, AddEnumBecomeMapping. 178 friend class Class; // AddStaticFieldMapping, AddEnumBecomeMapping.
181 }; 179 };
182 180
183 } // namespace dart 181 } // namespace dart
184 182
185 #endif // VM_ISOLATE_RELOAD_H_ 183 #endif // VM_ISOLATE_RELOAD_H_
OLDNEW
« no previous file with comments | « runtime/vm/isolate.cc ('k') | runtime/vm/isolate_reload.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698