1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
2 * vim: set ts=8 sts=4 et sw=4 tw=99:
3 * This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
7 #ifndef builtin_AtomicsObject_h
8 #define builtin_AtomicsObject_h
14 class AtomicsObject
: public JSObject
17 static const Class class_
;
18 static JSObject
* initClass(JSContext
* cx
, Handle
<GlobalObject
*> global
);
19 static bool toString(JSContext
* cx
, unsigned int argc
, jsval
* vp
);
21 static const int FutexOK
= 0;
23 // The error values must be negative because APIs such as futexWaitOrRequeue
24 // return a value that is either the number of tasks woken or an error code.
25 static const int FutexNotequal
= -1;
26 static const int FutexTimedout
= -2;
28 // Internal signals; negative for the same reason.
29 static const int FutexInterrupted
= -1000;
32 void atomics_fullMemoryBarrier();
34 bool atomics_compareExchange(JSContext
* cx
, unsigned argc
, Value
* vp
);
35 bool atomics_load(JSContext
* cx
, unsigned argc
, Value
* vp
);
36 bool atomics_store(JSContext
* cx
, unsigned argc
, Value
* vp
);
37 bool atomics_fence(JSContext
* cx
, unsigned argc
, Value
* vp
);
38 bool atomics_add(JSContext
* cx
, unsigned argc
, Value
* vp
);
39 bool atomics_sub(JSContext
* cx
, unsigned argc
, Value
* vp
);
40 bool atomics_and(JSContext
* cx
, unsigned argc
, Value
* vp
);
41 bool atomics_or(JSContext
* cx
, unsigned argc
, Value
* vp
);
42 bool atomics_xor(JSContext
* cx
, unsigned argc
, Value
* vp
);
43 bool atomics_futexWait(JSContext
* cx
, unsigned argc
, Value
* vp
);
44 bool atomics_futexWake(JSContext
* cx
, unsigned argc
, Value
* vp
);
45 bool atomics_futexWakeOrRequeue(JSContext
* cx
, unsigned argc
, Value
* vp
);
50 js_InitAtomicsClass(JSContext
* cx
, js::HandleObject obj
);
52 #endif /* builtin_AtomicsObject_h */