X-Git-Url: https://git.saurik.com/apple/javascriptcore.git/blobdiff_plain/2d39b0e377c0896910ee49ae70082ba665faf986..HEAD:/runtime/WriteBarrier.h diff --git a/runtime/WriteBarrier.h b/runtime/WriteBarrier.h index c5fe089..74fbe35 100644 --- a/runtime/WriteBarrier.h +++ b/runtime/WriteBarrier.h @@ -113,8 +113,7 @@ public: T** slot() { return reinterpret_cast(&m_cell); } - typedef T* (WriteBarrierBase::*UnspecifiedBoolType); - operator UnspecifiedBoolType*() const { return m_cell ? reinterpret_cast(1) : 0; } + explicit operator bool() const { return m_cell; } bool operator!() const { return !m_cell; } @@ -126,9 +125,7 @@ public: this->m_cell = reinterpret_cast(value); } -#if ENABLE(GC_VALIDATION) T* unvalidatedGet() const { return reinterpret_cast(static_cast(m_cell)); } -#endif private: JSCell* m_cell; @@ -167,8 +164,7 @@ public: int32_t* tagPointer() { return &bitwise_cast(&m_value)->asBits.tag; } int32_t* payloadPointer() { return &bitwise_cast(&m_value)->asBits.payload; } - typedef JSValue (WriteBarrierBase::*UnspecifiedBoolType); - operator UnspecifiedBoolType*() const { return get() ? reinterpret_cast(1) : 0; } + explicit operator bool() const { return !!get(); } bool operator!() const { return !get(); } private: @@ -201,6 +197,7 @@ public: } }; +enum UndefinedWriteBarrierTagType { UndefinedWriteBarrierTag }; template <> class WriteBarrier : public WriteBarrierBase { WTF_MAKE_FAST_ALLOCATED; public: @@ -208,6 +205,10 @@ public: { this->setWithoutWriteBarrier(JSValue()); } + WriteBarrier(UndefinedWriteBarrierTagType) + { + this->setWithoutWriteBarrier(jsUndefined()); + } WriteBarrier(VM& vm, const JSCell* owner, JSValue value) {