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

Unified Diff: runtime/vm/atomic_linux.h

Issue 1580813003: Use atomic operations to increment/decrement memory usage counts as multiple threads could be alloc… (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: self-code-review Created 4 years, 11 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
Index: runtime/vm/atomic_linux.h
diff --git a/runtime/vm/atomic_linux.h b/runtime/vm/atomic_linux.h
index 1150857c1b79685545578e5c7d27f32a424f17d9..0103b532e90bb14faba03d4d5ed729359a3c4a75 100644
--- a/runtime/vm/atomic_linux.h
+++ b/runtime/vm/atomic_linux.h
@@ -21,11 +21,23 @@ inline uintptr_t AtomicOperations::FetchAndIncrement(uintptr_t* p) {
}
+inline uintptr_t AtomicOperations::FetchAndIncrementBy(intptr_t* p,
+ intptr_t value) {
+ return __sync_fetch_and_add(p, value);
+}
+
+
inline uintptr_t AtomicOperations::FetchAndDecrement(uintptr_t* p) {
return __sync_fetch_and_sub(p, 1);
}
+inline uintptr_t AtomicOperations::FetchAndDecrementBy(intptr_t* p,
+ intptr_t value) {
+ return __sync_fetch_and_sub(p, value);
+}
+
+
#if !defined(USING_SIMULATOR)
inline uword AtomicOperations::CompareAndSwapWord(uword* ptr,
uword old_value,
« no previous file with comments | « runtime/vm/atomic_android.h ('k') | runtime/vm/atomic_macos.h » ('j') | runtime/vm/pages.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698