Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(683)

Unified Diff: src/runtime/runtime-futex.cc

Issue 2715223003: Revert "[SAB] Move Atomics builtins to C++" (Closed)
Patch Set: another CL to revert Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/runtime/runtime-atomics.cc ('k') | src/snapshot/natives.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/runtime/runtime-futex.cc
diff --git a/src/runtime/runtime-futex.cc b/src/runtime/runtime-futex.cc
index 5c2106e6859c4ea8aed6dda846ab2eb6405a60bb..b6582ffc7f937318e3be5666381c664fc73b9e14 100644
--- a/src/runtime/runtime-futex.cc
+++ b/src/runtime/runtime-futex.cc
@@ -17,6 +17,44 @@
namespace v8 {
namespace internal {
+RUNTIME_FUNCTION(Runtime_AtomicsWait) {
+ HandleScope scope(isolate);
+ DCHECK_EQ(4, args.length());
+ CONVERT_ARG_HANDLE_CHECKED(JSTypedArray, sta, 0);
+ CONVERT_SIZE_ARG_CHECKED(index, 1);
+ CONVERT_INT32_ARG_CHECKED(value, 2);
+ CONVERT_DOUBLE_ARG_CHECKED(timeout, 3);
+ CHECK(sta->GetBuffer()->is_shared());
+ CHECK_LT(index, NumberToSize(sta->length()));
+ CHECK_EQ(sta->type(), kExternalInt32Array);
+ CHECK(timeout == V8_INFINITY || !std::isnan(timeout));
+
+ if (!isolate->allow_atomics_wait()) {
+ THROW_NEW_ERROR_RETURN_FAILURE(
+ isolate, NewTypeError(MessageTemplate::kAtomicsWaitNotAllowed));
+ }
+
+ Handle<JSArrayBuffer> array_buffer = sta->GetBuffer();
+ size_t addr = (index << 2) + NumberToSize(sta->byte_offset());
+
+ return FutexEmulation::Wait(isolate, array_buffer, addr, value, timeout);
+}
+
+RUNTIME_FUNCTION(Runtime_AtomicsWake) {
+ HandleScope scope(isolate);
+ DCHECK_EQ(3, args.length());
+ CONVERT_ARG_HANDLE_CHECKED(JSTypedArray, sta, 0);
+ CONVERT_SIZE_ARG_CHECKED(index, 1);
+ CONVERT_UINT32_ARG_CHECKED(count, 2);
+ CHECK(sta->GetBuffer()->is_shared());
+ CHECK_LT(index, NumberToSize(sta->length()));
+ CHECK_EQ(sta->type(), kExternalInt32Array);
+
+ Handle<JSArrayBuffer> array_buffer = sta->GetBuffer();
+ size_t addr = (index << 2) + NumberToSize(sta->byte_offset());
+
+ return FutexEmulation::Wake(isolate, array_buffer, addr, count);
+}
RUNTIME_FUNCTION(Runtime_AtomicsNumWaitersForTesting) {
HandleScope scope(isolate);
« no previous file with comments | « src/runtime/runtime-atomics.cc ('k') | src/snapshot/natives.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698