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

Unified Diff: src/heap/heap.h

Issue 1325173003: [heap] Make AlwaysAllocateScope thread-safe. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@concurrency-support
Patch Set: Created 5 years, 3 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 | « no previous file | src/heap/heap.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/heap/heap.h
diff --git a/src/heap/heap.h b/src/heap/heap.h
index d74d9cff958dfc1e316b425f4138e662de11f345..6e3b4cfa7021034902863b85bacf9b407bcf23bd 100644
--- a/src/heap/heap.h
+++ b/src/heap/heap.h
@@ -10,6 +10,7 @@
#include "src/allocation.h"
#include "src/assert-scope.h"
+#include "src/atomic-utils.h"
#include "src/globals.h"
#include "src/heap/gc-idle-time-handler.h"
#include "src/heap/incremental-marking.h"
@@ -776,10 +777,7 @@ class Heap {
return old_generation_allocation_limit_;
}
- bool always_allocate() { return always_allocate_scope_depth_ != 0; }
- Address always_allocate_scope_depth_address() {
Michael Lippautz 2015/09/03 13:10:37 Don't even think about it...
- return reinterpret_cast<Address>(&always_allocate_scope_depth_);
- }
+ bool always_allocate() { return always_allocate_scope_count_.Value() != 0; }
Address* NewSpaceAllocationTopAddress() {
return new_space_.allocation_top_address();
@@ -2134,7 +2132,9 @@ class Heap {
// ... and since the last scavenge.
int survived_last_scavenge_;
- int always_allocate_scope_depth_;
+ // This is not the depth of nested AlwaysAllocateScope's but rather a single
+ // count, as scopes can be acquired from multiple tasks (read: threads).
+ AtomicValue always_allocate_scope_count_;
// For keeping track of context disposals.
int contexts_disposed_;
« no previous file with comments | « no previous file | src/heap/heap.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698