summaryrefslogtreecommitdiff
path: root/chromium/v8/src/execution/futex-emulation.cc
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@qt.io>2020-10-12 14:27:29 +0200
committerAllan Sandfeld Jensen <allan.jensen@qt.io>2020-10-13 09:35:20 +0000
commitc30a6232df03e1efbd9f3b226777b07e087a1122 (patch)
treee992f45784689f373bcc38d1b79a239ebe17ee23 /chromium/v8/src/execution/futex-emulation.cc
parent7b5b123ac58f58ffde0f4f6e488bcd09aa4decd3 (diff)
downloadqtwebengine-chromium-85-based.tar.gz
BASELINE: Update Chromium to 85.0.4183.14085-based
Change-Id: Iaa42f4680837c57725b1344f108c0196741f6057 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Diffstat (limited to 'chromium/v8/src/execution/futex-emulation.cc')
-rw-r--r--chromium/v8/src/execution/futex-emulation.cc32
1 files changed, 20 insertions, 12 deletions
diff --git a/chromium/v8/src/execution/futex-emulation.cc b/chromium/v8/src/execution/futex-emulation.cc
index 3f815e24ca1..6804f473091 100644
--- a/chromium/v8/src/execution/futex-emulation.cc
+++ b/chromium/v8/src/execution/futex-emulation.cc
@@ -89,11 +89,11 @@ Object WaitJsTranslateReturn(Isolate* isolate, Object res) {
int val = Smi::ToInt(res);
switch (val) {
case WaitReturnValue::kOk:
- return ReadOnlyRoots(isolate).ok();
+ return ReadOnlyRoots(isolate).ok_string();
case WaitReturnValue::kNotEqual:
- return ReadOnlyRoots(isolate).not_equal();
+ return ReadOnlyRoots(isolate).not_equal_string();
case WaitReturnValue::kTimedOut:
- return ReadOnlyRoots(isolate).timed_out();
+ return ReadOnlyRoots(isolate).timed_out_string();
default:
UNREACHABLE();
}
@@ -193,8 +193,9 @@ Object FutexEmulation::Wait(Isolate* isolate,
do { // Not really a loop, just makes it easier to break out early.
base::MutexGuard lock_guard(mutex_.Pointer());
- void* backing_store = array_buffer->backing_store();
-
+ std::shared_ptr<BackingStore> backing_store =
+ array_buffer->GetBackingStore();
+ DCHECK(backing_store);
FutexWaitListNode* node = isolate->futex_wait_list_node();
node->backing_store_ = backing_store;
node->wait_addr_ = addr;
@@ -204,7 +205,8 @@ Object FutexEmulation::Wait(Isolate* isolate,
// still holding the lock).
ResetWaitingOnScopeExit reset_waiting(node);
- T* p = reinterpret_cast<T*>(static_cast<int8_t*>(backing_store) + addr);
+ T* p = reinterpret_cast<T*>(
+ static_cast<int8_t*>(backing_store->buffer_start()) + addr);
if (*p != value) {
result = handle(Smi::FromInt(WaitReturnValue::kNotEqual), isolate);
callback_result = AtomicsWaitEvent::kNotEqual;
@@ -308,13 +310,16 @@ Object FutexEmulation::Wake(Handle<JSArrayBuffer> array_buffer, size_t addr,
DCHECK_LT(addr, array_buffer->byte_length());
int waiters_woken = 0;
- void* backing_store = array_buffer->backing_store();
+ std::shared_ptr<BackingStore> backing_store = array_buffer->GetBackingStore();
base::MutexGuard lock_guard(mutex_.Pointer());
FutexWaitListNode* node = wait_list_.Pointer()->head_;
while (node && num_waiters_to_wake > 0) {
- if (backing_store == node->backing_store_ && addr == node->wait_addr_ &&
- node->waiting_) {
+ std::shared_ptr<BackingStore> node_backing_store =
+ node->backing_store_.lock();
+ DCHECK(node_backing_store);
+ if (backing_store.get() == node_backing_store.get() &&
+ addr == node->wait_addr_ && node->waiting_) {
node->waiting_ = false;
node->cond_.NotifyOne();
if (num_waiters_to_wake != kWakeAll) {
@@ -332,15 +337,18 @@ Object FutexEmulation::Wake(Handle<JSArrayBuffer> array_buffer, size_t addr,
Object FutexEmulation::NumWaitersForTesting(Handle<JSArrayBuffer> array_buffer,
size_t addr) {
DCHECK_LT(addr, array_buffer->byte_length());
- void* backing_store = array_buffer->backing_store();
+ std::shared_ptr<BackingStore> backing_store = array_buffer->GetBackingStore();
base::MutexGuard lock_guard(mutex_.Pointer());
int waiters = 0;
FutexWaitListNode* node = wait_list_.Pointer()->head_;
while (node) {
- if (backing_store == node->backing_store_ && addr == node->wait_addr_ &&
- node->waiting_) {
+ std::shared_ptr<BackingStore> node_backing_store =
+ node->backing_store_.lock();
+ DCHECK(node_backing_store);
+ if (backing_store.get() == node_backing_store.get() &&
+ addr == node->wait_addr_ && node->waiting_) {
waiters++;
}