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

Unified Diff: src/heap-inl.h

Issue 15691017: Make assertion scopes thread safe. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 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
« src/api.cc ('K') | « src/heap.cc ('k') | src/heap-snapshot-generator.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/heap-inl.h
diff --git a/src/heap-inl.h b/src/heap-inl.h
index b71978baf545b42e3034c96d0c14e514e4cd42a9..f0861b2e7a9546eea1beb74d1991f81349e1f3d3 100644
--- a/src/heap-inl.h
+++ b/src/heap-inl.h
@@ -211,8 +211,7 @@ MaybeObject* Heap::CopyFixedDoubleArray(FixedDoubleArray* src) {
MaybeObject* Heap::AllocateRaw(int size_in_bytes,
AllocationSpace space,
AllocationSpace retry_space) {
- SLOW_ASSERT(!isolate_->optimizing_compiler_thread()->IsOptimizerThread());
- ASSERT(allocation_allowed_ && gc_state_ == NOT_IN_GC);
+ ASSERT(AllowHandleAllocation::IsAllowed() && gc_state_ == NOT_IN_GC);
ASSERT(space != NEW_SPACE ||
retry_space == OLD_POINTER_SPACE ||
retry_space == OLD_DATA_SPACE ||
@@ -642,21 +641,6 @@ Isolate* Heap::isolate() {
return __maybe_object__)
-#ifdef DEBUG
-
-inline bool Heap::allow_allocation(bool new_state) {
- bool old = allocation_allowed_;
- allocation_allowed_ = new_state;
- return old;
-}
-
-inline void Heap::set_allow_allocation(bool allocation_allowed) {
- allocation_allowed_ = allocation_allowed;
-}
-
-#endif
-
-
void ExternalStringTable::AddString(String* string) {
ASSERT(string->IsExternalString());
if (heap_->InNewSpace(string)) {
@@ -867,52 +851,6 @@ DisallowAllocationFailure::~DisallowAllocationFailure() {
}
-#ifdef DEBUG
-bool EnterAllocationScope(Isolate* isolate, bool allow_allocation) {
- bool active = !isolate->optimizing_compiler_thread()->IsOptimizerThread();
- bool last_state = isolate->heap()->IsAllocationAllowed();
- if (active) {
- // TODO(yangguo): Make HandleDereferenceGuard avoid isolate mutation in the
- // same way if running on the optimizer thread.
- isolate->heap()->set_allow_allocation(allow_allocation);
- }
- return last_state;
-}
-
-
-void ExitAllocationScope(Isolate* isolate, bool last_state) {
- bool active = !isolate->optimizing_compiler_thread()->IsOptimizerThread();
- if (active) {
- isolate->heap()->set_allow_allocation(last_state);
- }
-}
-
-
-AssertNoAllocation::AssertNoAllocation()
- : last_state_(EnterAllocationScope(ISOLATE, false)) {
-}
-
-AssertNoAllocation::~AssertNoAllocation() {
- ExitAllocationScope(ISOLATE, last_state_);
-}
-
-DisableAssertNoAllocation::DisableAssertNoAllocation()
- : last_state_(EnterAllocationScope(ISOLATE, true)) {
-}
-
-DisableAssertNoAllocation::~DisableAssertNoAllocation() {
- ExitAllocationScope(ISOLATE, last_state_);
-}
-#else
-
-AssertNoAllocation::AssertNoAllocation() { }
-AssertNoAllocation::~AssertNoAllocation() { }
-DisableAssertNoAllocation::DisableAssertNoAllocation() { }
-DisableAssertNoAllocation::~DisableAssertNoAllocation() { }
-
-#endif
-
-
} } // namespace v8::internal
#endif // V8_HEAP_INL_H_
« src/api.cc ('K') | « src/heap.cc ('k') | src/heap-snapshot-generator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698