Chromium Code Reviews| Index: runtime/vm/isolate.h |
| diff --git a/runtime/vm/isolate.h b/runtime/vm/isolate.h |
| index c2fc95554d71e231affe824e2d343fce1bd32818..0b3d4cc6292d1728492b55b99f628ad0e53166ab 100644 |
| --- a/runtime/vm/isolate.h |
| +++ b/runtime/vm/isolate.h |
| @@ -35,6 +35,7 @@ class HandleVisitor; |
| class Heap; |
| class ICData; |
| class IsolateProfilerData; |
| +class IsolateReloadContext; |
| class IsolateSpawnState; |
| class Log; |
| class MessageHandler; |
| @@ -47,12 +48,12 @@ class RawInstance; |
| class RawArray; |
| class RawContext; |
| class RawDouble; |
| +class RawError; |
| +class RawField; |
| class RawGrowableObjectArray; |
| class RawMint; |
| class RawObject; |
| class RawInteger; |
| -class RawError; |
| -class RawField; |
| class RawFloat32x4; |
| class RawInt32x4; |
| class RawUserTag; |
| @@ -91,6 +92,18 @@ class NoOOBMessageScope : public StackResource { |
| }; |
| +// Disallow isolate reload. |
| +class NoReloadScope : public StackResource { |
| + public: |
| + NoReloadScope(Isolate* isolate, Thread* thread); |
| + ~NoReloadScope(); |
| + |
| + private: |
| + Isolate* isolate_; |
| + DISALLOW_COPY_AND_ASSIGN(NoReloadScope); |
| +}; |
| + |
| + |
| class Isolate : public BaseIsolate { |
| public: |
| // Keep both these enums in sync with isolate_patch.dart. |
| @@ -150,6 +163,9 @@ class Isolate : public BaseIsolate { |
| return OFFSET_OF(Isolate, class_table_); |
| } |
| + // Prefers old classes when we are in the middle of a reload. |
| + RawClass* GetClassForHeapWalkAt(intptr_t cid); |
| + |
| static intptr_t ic_miss_code_offset() { |
| return OFFSET_OF(Isolate, ic_miss_code_); |
| } |
| @@ -237,6 +253,10 @@ class Isolate : public BaseIsolate { |
| // Marks all libraries as loaded. |
| void DoneLoading(); |
| + void DoneFinalizing(); |
| + |
| + void OnStackReload(); |
| + void ReloadSources(bool test_mode = false); |
| bool MakeRunnable(); |
| void Run(); |
| @@ -388,6 +408,22 @@ class Isolate : public BaseIsolate { |
| background_compiler_ = value; |
| } |
| + void enable_background_compiler() { |
| + background_compiler_disabled_count_--; |
| + if (background_compiler_disabled_count_ < 0) { |
| + FATAL("Mismatched number of calls to disable_background_compiler and " |
| + "enable_background_compiler."); |
| + } |
| + } |
| + |
| + void disable_background_compiler() { |
| + background_compiler_disabled_count_++; |
| + } |
| + |
| + bool is_background_compiler_disabled() const { |
| + return background_compiler_disabled_count_ > 0; |
| + } |
| + |
| void UpdateLastAllocationProfileAccumulatorResetTimestamp() { |
| last_allocationprofile_accumulator_reset_timestamp_ = |
| OS::GetCurrentTimeMillis(); |
| @@ -432,6 +468,22 @@ class Isolate : public BaseIsolate { |
| return &vm_tag_counters_; |
| } |
| + bool IsReloading() const { |
| + return reload_context_ != NULL; |
| + } |
| + |
| + IsolateReloadContext* reload_context() { |
| + return reload_context_; |
| + } |
| + |
| + bool HasAttemptedReload() const { |
| + return has_attempted_reload_; |
| + } |
| + |
| + bool CanReload() const; |
| + |
| + void ReportReloadError(const Error& error); |
| + |
| uword user_tag() const { |
| return user_tag_; |
| } |
| @@ -614,6 +666,7 @@ class Isolate : public BaseIsolate { |
| // running, and the visitor must not allocate. |
| void VisitObjectPointers(ObjectPointerVisitor* visitor, bool validate_frames); |
| + |
|
Ivan Posva
2016/05/16 20:58:59
Extra empty line.
Cutch
2016/05/17 18:03:52
Done.
|
| void set_user_tag(uword tag) { |
| user_tag_ = tag; |
| } |
| @@ -717,6 +770,7 @@ class Isolate : public BaseIsolate { |
| // Background compilation. |
| BackgroundCompiler* background_compiler_; |
| + intptr_t background_compiler_disabled_count_; |
| // We use 6 list entries for each pending service extension calls. |
| enum { |
| @@ -769,6 +823,11 @@ class Isolate : public BaseIsolate { |
| Monitor* spawn_count_monitor_; |
| intptr_t spawn_count_; |
| + // Has a reload ever been attempted? |
| + bool has_attempted_reload_; |
| + intptr_t no_reload_scope_depth_; // we can only reload when this is 0. |
| + IsolateReloadContext* reload_context_; |
| + |
| #define ISOLATE_METRIC_VARIABLE(type, variable, name, unit) \ |
| type metric_##variable##_; |
| ISOLATE_METRIC_LIST(ISOLATE_METRIC_VARIABLE); |
| @@ -795,12 +854,15 @@ class Isolate : public BaseIsolate { |
| REUSABLE_HANDLE_LIST(REUSABLE_FRIEND_DECLARATION) |
| #undef REUSABLE_FRIEND_DECLARATION |
| + friend class Become; // VisitObjectPointers |
| friend class GCMarker; // VisitObjectPointers |
| friend class SafepointHandler; |
| friend class Scavenger; // VisitObjectPointers |
| friend class ServiceIsolate; |
| friend class Thread; |
| friend class Timeline; |
| + friend class NoReloadScope; // reload_block |
| + |
| DISALLOW_COPY_AND_ASSIGN(Isolate); |
| }; |