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

Unified Diff: runtime/vm/isolate_reload.h

Issue 2201093002: Make all reload zone allocations use the same zone (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: rasd 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/vm/isolate.cc ('k') | runtime/vm/isolate_reload.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/isolate_reload.h
diff --git a/runtime/vm/isolate_reload.h b/runtime/vm/isolate_reload.h
index 36cfc508b4cd762072baf04968552dcb1938d62e..d260768170c4b218953411d6a879a49cf10cdae8 100644
--- a/runtime/vm/isolate_reload.h
+++ b/runtime/vm/isolate_reload.h
@@ -52,7 +52,7 @@ class UpdateClassesVisitor;
class InstanceMorpher : public ZoneAllocated {
public:
- InstanceMorpher(const Class& from, const Class& to);
+ InstanceMorpher(Zone* zone, const Class& from, const Class& to);
virtual ~InstanceMorpher() {}
// Called on each instance that needs to be morphed.
@@ -93,7 +93,7 @@ class InstanceMorpher : public ZoneAllocated {
class ReasonForCancelling : public ZoneAllocated {
public:
- ReasonForCancelling() {}
+ explicit ReasonForCancelling(Zone* zone) {}
virtual ~ReasonForCancelling() {}
// Reports a reason for cancelling reload.
@@ -117,8 +117,8 @@ class ReasonForCancelling : public ZoneAllocated {
// Abstract class for also capturing the from_ and to_ class.
class ClassReasonForCancelling : public ReasonForCancelling {
public:
- ClassReasonForCancelling(const Class& from, const Class& to)
- : from_(from), to_(to) { }
+ ClassReasonForCancelling(Zone* zone, const Class& from, const Class& to)
+ : ReasonForCancelling(zone), from_(from), to_(to) { }
void AppendTo(JSONArray* array);
@@ -130,32 +130,36 @@ class ClassReasonForCancelling : public ReasonForCancelling {
class IsolateReloadContext {
public:
- explicit IsolateReloadContext(Isolate* isolate, JSONStream* js);
+ explicit IsolateReloadContext(Isolate* isolate,
+ JSONStream* js);
~IsolateReloadContext();
- void StartReload(bool force_reload);
- void FinishReload();
- void AbortReload(const Error& error);
+ void Reload(bool force_reload);
- RawLibrary* saved_root_library() const;
-
- RawGrowableObjectArray* saved_libraries() const;
-
- // Report back through the observatory channels.
- void ReportError(const Error& error);
- void ReportSuccess();
+ // All zone allocated objects must be allocated from this zone.
+ Zone* zone() const { return zone_; }
bool reload_skipped() const { return reload_skipped_; }
-
- bool has_error() const { return HasReasonsForCancelling(); }
+ bool reload_aborted() const { return reload_aborted_; }
RawError* error() const;
-
int64_t reload_timestamp() const { return reload_timestamp_; }
+ static Dart_FileModifiedCallback file_modified_callback() {
+ return file_modified_callback_;
+ }
+ static void SetFileModifiedCallback(Dart_FileModifiedCallback callback) {
+ file_modified_callback_ = callback;
+ }
+
static bool IsSameField(const Field& a, const Field& b);
static bool IsSameLibrary(const Library& a_lib, const Library& b_lib);
static bool IsSameClass(const Class& a, const Class& b);
+ private:
+ RawLibrary* saved_root_library() const;
+
+ RawGrowableObjectArray* saved_libraries() const;
+
RawClass* FindOriginalClass(const Class& cls);
bool IsDirty(const Library& lib);
@@ -193,14 +197,14 @@ class IsolateReloadContext {
return !instance_morphers_.is_empty();
}
- static Dart_FileModifiedCallback file_modified_callback() {
- return file_modified_callback_;
- }
- static void SetFileModifiedCallback(Dart_FileModifiedCallback callback) {
- file_modified_callback_ = callback;
- }
+ // NOTE: FinalizeLoading will be called *before* Reload() returns.
+ void FinalizeLoading();
+ void AbortReload(const Error& error);
+
+ // Report back through the observatory channels.
+ void ReportError(const Error& error);
+ void ReportSuccess();
- private:
void set_saved_root_library(const Library& value);
void set_saved_libraries(const GrowableObjectArray& value);
@@ -248,10 +252,14 @@ class IsolateReloadContext {
void ResetMegamorphicCaches();
void InvalidateWorld();
+ // The zone used for all reload related allocations.
+ Zone* zone_;
+
int64_t start_time_micros_;
int64_t reload_timestamp_;
Isolate* isolate_;
bool reload_skipped_;
+ bool reload_aborted_;
JSONStream* js_;
intptr_t saved_num_cids_;
@@ -323,7 +331,10 @@ class IsolateReloadContext {
friend class Isolate;
friend class Class; // AddStaticFieldMapping, AddEnumBecomeMapping.
+ friend class Library;
friend class ObjectLocator;
+ friend class MarkFunctionsForRecompilation; // IsDirty.
+ friend class ReasonForCancelling;
static Dart_FileModifiedCallback file_modified_callback_;
};
« 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