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

Unified Diff: src/runtime/runtime.h

Issue 1162503002: Implement Atomics API (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: add more symbols to anonymous namespace Created 5 years, 7 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/objects.h ('k') | src/runtime/runtime-atomics.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/runtime/runtime.h
diff --git a/src/runtime/runtime.h b/src/runtime/runtime.h
index bf72469827938844941b8adf52412022474b662a..ae8943e02b3998495a194ea5b0e114e9a32dadcf 100644
--- a/src/runtime/runtime.h
+++ b/src/runtime/runtime.h
@@ -53,6 +53,19 @@ namespace internal {
F(FastOneByteArrayJoin, 2, 1)
+#define FOR_EACH_INTRINSIC_ATOMICS(F) \
+ F(AtomicsCompareExchange, 4, 1) \
+ F(AtomicsLoad, 2, 1) \
+ F(AtomicsStore, 3, 1) \
+ F(AtomicsAdd, 3, 1) \
+ F(AtomicsSub, 3, 1) \
+ F(AtomicsAnd, 3, 1) \
+ F(AtomicsOr, 3, 1) \
+ F(AtomicsXor, 3, 1) \
+ F(AtomicsExchange, 3, 1) \
+ F(AtomicsIsLockFree, 1, 1)
+
+
#define FOR_EACH_INTRINSIC_CLASSES(F) \
F(ThrowNonMethodError, 0, 1) \
F(ThrowUnsupportedSuperError, 0, 1) \
@@ -654,6 +667,8 @@ namespace internal {
F(TypedArraySetFastCases, 3, 1) \
F(TypedArrayMaxSizeInHeap, 0, 1) \
F(IsTypedArray, 1, 1) \
+ F(IsSharedTypedArray, 1, 1) \
+ F(IsSharedIntegerTypedArray, 1, 1) \
F(DataViewInitialize, 4, 1) \
F(DataViewGetUint8, 3, 1) \
F(DataViewGetInt8, 3, 1) \
@@ -686,6 +701,7 @@ namespace internal {
#define FOR_EACH_INTRINSIC_RETURN_OBJECT(F) \
FOR_EACH_INTRINSIC_ARRAY(F) \
+ FOR_EACH_INTRINSIC_ATOMICS(F) \
FOR_EACH_INTRINSIC_CLASSES(F) \
FOR_EACH_INTRINSIC_COLLECTIONS(F) \
FOR_EACH_INTRINSIC_COMPILER(F) \
@@ -873,6 +889,8 @@ class Runtime : public AllStatic {
static MaybeHandle<JSArray> GetInternalProperties(Isolate* isolate,
Handle<Object>);
+
+ static bool AtomicIsLockFree(uint32_t size);
};
@@ -889,6 +907,29 @@ class DeclareGlobalsNativeFlag : public BitField<bool, 1, 1> {};
STATIC_ASSERT(LANGUAGE_END == 3);
class DeclareGlobalsLanguageMode : public BitField<LanguageMode, 2, 2> {};
+//---------------------------------------------------------------------------
+// Inline functions
+
+// Assume that 32-bit architectures don't have 64-bit atomic ops.
+// TODO(binji): can we do better here?
+#if V8_TARGET_ARCH_64_BIT && V8_HOST_ARCH_64_BIT
+
+#define ATOMICS_REQUIRE_LOCK_64_BIT 0
+
+inline bool Runtime::AtomicIsLockFree(uint32_t size) {
+ return size == 1 || size == 2 || size == 4 || size == 8;
+}
+
+#else
+
+#define ATOMICS_REQUIRE_LOCK_64_BIT 1
+
+inline bool Runtime::AtomicIsLockFree(uint32_t size) {
+ return size == 1 || size == 2 || size == 4;
+}
+
+#endif
+
} // namespace internal
} // namespace v8
« no previous file with comments | « src/objects.h ('k') | src/runtime/runtime-atomics.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698