Commit 296db16e authored by mlippautz's avatar mlippautz Committed by Commit bot

[heap] Make AlwaysAlloceScope thread-safe.

BUG=chromium:524425
LOG=N
R=mstarzinger@chromium.org

Review URL: https://codereview.chromium.org/1325173003

Cr-Commit-Position: refs/heads/master@{#30563}
parent b370f6d8
......@@ -749,12 +749,12 @@ void Heap::SetSetterStubDeoptPCOffset(int pc_offset) {
AlwaysAllocateScope::AlwaysAllocateScope(Isolate* isolate)
: heap_(isolate->heap()), daf_(isolate) {
heap_->always_allocate_scope_depth_++;
heap_->always_allocate_scope_count_.Increment(1);
}
AlwaysAllocateScope::~AlwaysAllocateScope() {
heap_->always_allocate_scope_depth_--;
heap_->always_allocate_scope_count_.Increment(-1);
}
......
......@@ -74,7 +74,7 @@ Heap::Heap()
maximum_committed_(0),
survived_since_last_expansion_(0),
survived_last_scavenge_(0),
always_allocate_scope_depth_(0),
always_allocate_scope_count_(0),
contexts_disposed_(0),
global_ic_age_(0),
scan_on_scavenge_pages_(0),
......
......@@ -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() {
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_;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment