summaryrefslogtreecommitdiff
path: root/deps/v8/src/handles
diff options
context:
space:
mode:
Diffstat (limited to 'deps/v8/src/handles')
-rw-r--r--deps/v8/src/handles/handles.cc2
-rw-r--r--deps/v8/src/handles/handles.h9
2 files changed, 10 insertions, 1 deletions
diff --git a/deps/v8/src/handles/handles.cc b/deps/v8/src/handles/handles.cc
index a03a619922..85072a375a 100644
--- a/deps/v8/src/handles/handles.cc
+++ b/deps/v8/src/handles/handles.cc
@@ -43,7 +43,7 @@ bool HandleBase::IsDereferenceAllowed() const {
}
LocalHeap* local_heap = LocalHeap::Current();
- if (V8_UNLIKELY(local_heap)) {
+ if (FLAG_local_heaps && local_heap) {
// Local heap can't access handles when parked
if (!local_heap->IsHandleDereferenceAllowed()) return false;
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 {