diff options
Diffstat (limited to 'deps/v8/src/handles/handles.h')
-rw-r--r-- | deps/v8/src/handles/handles.h | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/deps/v8/src/handles/handles.h b/deps/v8/src/handles/handles.h index 3512ecbfc7..6f45da8483 100644 --- a/deps/v8/src/handles/handles.h +++ b/deps/v8/src/handles/handles.h @@ -59,6 +59,8 @@ class HandleBase { V8_INLINE Address address() const { return bit_cast<Address>(location_); } // Returns the address to where the raw pointer is stored. + // TODO(leszeks): This should probably be a const Address*, to encourage using + // PatchValue for modifying the handle's value. V8_INLINE Address* location() const { SLOW_DCHECK(location_ == nullptr || IsDereferenceAllowed()); return location_; @@ -154,6 +156,13 @@ class Handle final : public HandleBase { // Location equality. bool equals(Handle<T> other) const { return address() == other.address(); } + // Patches this Handle's value, in-place, with a new value. All handles with + // the same location will see this update. + void PatchValue(T new_value) { + SLOW_DCHECK(location_ != nullptr && IsDereferenceAllowed()); + *location_ = new_value.ptr(); + } + // Provide function object for location equality comparison. struct equal_to { V8_INLINE bool operator()(Handle<T> lhs, Handle<T> rhs) const { |