diff --git a/src/env-inl.h b/src/env-inl.h index 0cc086ce4128fa..5f60c25d0518b7 100644 --- a/src/env-inl.h +++ b/src/env-inl.h @@ -232,39 +232,39 @@ inline void Environment::PopAsyncCallbackScope() { async_callback_scope_depth_--; } -inline Environment::ImmediateInfo::ImmediateInfo(v8::Isolate* isolate) +inline ImmediateInfo::ImmediateInfo(v8::Isolate* isolate) : fields_(isolate, kFieldsCount) {} inline AliasedBuffer& - Environment::ImmediateInfo::fields() { + ImmediateInfo::fields() { return fields_; } -inline uint32_t Environment::ImmediateInfo::count() const { +inline uint32_t ImmediateInfo::count() const { return fields_[kCount]; } -inline uint32_t Environment::ImmediateInfo::ref_count() const { +inline uint32_t ImmediateInfo::ref_count() const { return fields_[kRefCount]; } -inline bool Environment::ImmediateInfo::has_outstanding() const { +inline bool ImmediateInfo::has_outstanding() const { return fields_[kHasOutstanding] == 1; } -inline void Environment::ImmediateInfo::count_inc(uint32_t increment) { +inline void ImmediateInfo::count_inc(uint32_t increment) { fields_[kCount] += increment; } -inline void Environment::ImmediateInfo::count_dec(uint32_t decrement) { +inline void ImmediateInfo::count_dec(uint32_t decrement) { fields_[kCount] -= decrement; } -inline void Environment::ImmediateInfo::ref_count_inc(uint32_t increment) { +inline void ImmediateInfo::ref_count_inc(uint32_t increment) { fields_[kRefCount] += increment; } -inline void Environment::ImmediateInfo::ref_count_dec(uint32_t decrement) { +inline void ImmediateInfo::ref_count_dec(uint32_t decrement) { fields_[kRefCount] -= decrement; } @@ -435,7 +435,7 @@ inline AsyncHooks* Environment::async_hooks() { return &async_hooks_; } -inline Environment::ImmediateInfo* Environment::immediate_info() { +inline ImmediateInfo* Environment::immediate_info() { return &immediate_info_; } diff --git a/src/env.h b/src/env.h index f047a1f1c77eae..ed95c748ae7bd9 100644 --- a/src/env.h +++ b/src/env.h @@ -619,6 +619,29 @@ class AsyncCallbackScope { Environment* env_; }; +class ImmediateInfo { + public: + inline AliasedBuffer& fields(); + inline uint32_t count() const; + inline uint32_t ref_count() const; + inline bool has_outstanding() const; + inline void count_inc(uint32_t increment); + inline void count_dec(uint32_t decrement); + inline void ref_count_inc(uint32_t increment); + inline void ref_count_dec(uint32_t decrement); + + ImmediateInfo(const ImmediateInfo&) = delete; + ImmediateInfo& operator=(const ImmediateInfo&) = delete; + + private: + friend class Environment; // So we can call the constructor. + inline explicit ImmediateInfo(v8::Isolate* isolate); + + enum Fields { kCount, kRefCount, kHasOutstanding, kFieldsCount }; + + AliasedBuffer fields_; +}; + class Environment { public: Environment(const Environment&) = delete; @@ -628,36 +651,6 @@ class Environment { inline void PushAsyncCallbackScope(); inline void PopAsyncCallbackScope(); - class ImmediateInfo { - public: - inline AliasedBuffer& fields(); - inline uint32_t count() const; - inline uint32_t ref_count() const; - inline bool has_outstanding() const; - - inline void count_inc(uint32_t increment); - inline void count_dec(uint32_t decrement); - - inline void ref_count_inc(uint32_t increment); - inline void ref_count_dec(uint32_t decrement); - - ImmediateInfo(const ImmediateInfo&) = delete; - ImmediateInfo& operator=(const ImmediateInfo&) = delete; - - private: - friend class Environment; // So we can call the constructor. - inline explicit ImmediateInfo(v8::Isolate* isolate); - - enum Fields { - kCount, - kRefCount, - kHasOutstanding, - kFieldsCount - }; - - AliasedBuffer fields_; - }; - class TickInfo { public: inline AliasedBuffer& fields();