Reviewers: Michael Lippautz,

Description:
[heap] Remove obsolete DisallowAllocationFailure scope.

This removes the DisallowAllocationFailure assertion scope which mostly
coincided with the AlwaysAllocateScope anyways. Access to the bitfield
in the Isolate was not synchronized and hence the AlwaysAllocateScope
was not thread-safe in debug mode, now it is.

R=mlippa...@chromium.org

Please review this at https://codereview.chromium.org/1319153006/

Base URL: https://chromium.googlesource.com/v8/v8.git@master

Affected files (+3, -16 lines):
  M src/assert-scope.h
  M src/assert-scope.cc
  M src/heap/heap.h
  M src/heap/heap-inl.h
  M src/isolate.cc


Index: src/assert-scope.cc
diff --git a/src/assert-scope.cc b/src/assert-scope.cc
index 6cc2e5a08176e77d946472dc43d5115fc823f9af..38527099667acc827a55f164af22ffda4d685307 100644
--- a/src/assert-scope.cc
+++ b/src/assert-scope.cc
@@ -145,8 +145,6 @@ template class PerIsolateAssertScope<JAVASCRIPT_EXECUTION_ASSERT, false>;
 template class PerIsolateAssertScope<JAVASCRIPT_EXECUTION_ASSERT, true>;
 template class PerIsolateAssertScope<JAVASCRIPT_EXECUTION_THROWS, false>;
 template class PerIsolateAssertScope<JAVASCRIPT_EXECUTION_THROWS, true>;
-template class PerIsolateAssertScope<ALLOCATION_FAILURE_ASSERT, false>;
-template class PerIsolateAssertScope<ALLOCATION_FAILURE_ASSERT, true>;
 template class PerIsolateAssertScope<DEOPTIMIZATION_ASSERT, false>;
 template class PerIsolateAssertScope<DEOPTIMIZATION_ASSERT, true>;
 template class PerIsolateAssertScope<COMPILATION_ASSERT, false>;
Index: src/assert-scope.h
diff --git a/src/assert-scope.h b/src/assert-scope.h
index 0f1e056fbac711ecc82e937a858e021f1a91574c..8757a329100588f9c9f0d9c15873a58b57def24f 100644
--- a/src/assert-scope.h
+++ b/src/assert-scope.h
@@ -29,7 +29,6 @@ enum PerThreadAssertType {
 enum PerIsolateAssertType {
   JAVASCRIPT_EXECUTION_ASSERT,
   JAVASCRIPT_EXECUTION_THROWS,
-  ALLOCATION_FAILURE_ASSERT,
   DEOPTIMIZATION_ASSERT,
   COMPILATION_ASSERT
 };
@@ -156,14 +155,6 @@ typedef PerIsolateAssertScope<JAVASCRIPT_EXECUTION_THROWS, false>
 typedef PerIsolateAssertScope<JAVASCRIPT_EXECUTION_THROWS, true>
     NoThrowOnJavascriptExecution;

-// Scope to document where we do not expect an allocation failure.
-typedef PerIsolateAssertScopeDebugOnly<ALLOCATION_FAILURE_ASSERT, false>
-    DisallowAllocationFailure;
-
-// Scope to introduce an exception to DisallowAllocationFailure.
-typedef PerIsolateAssertScopeDebugOnly<ALLOCATION_FAILURE_ASSERT, true>
-    AllowAllocationFailure;
-
 // Scope to document where we do not expect deoptimization.
 typedef PerIsolateAssertScopeDebugOnly<DEOPTIMIZATION_ASSERT, false>
     DisallowDeoptimization;
Index: src/heap/heap-inl.h
diff --git a/src/heap/heap-inl.h b/src/heap/heap-inl.h
index 36e56a0aba75e8e8e50b558d549885210c23d028..dbb3e95866f9426fed6e213ad9df7c8a855bcb5f 100644
--- a/src/heap/heap-inl.h
+++ b/src/heap/heap-inl.h
@@ -198,7 +198,7 @@ AllocationResult Heap::AllocateRaw(int size_in_bytes, AllocationSpace space,
   DCHECK(AllowHeapAllocation::IsAllowed());
   DCHECK(gc_state_ == NOT_IN_GC);
 #ifdef DEBUG
- if (FLAG_gc_interval >= 0 && AllowAllocationFailure::IsAllowed(isolate_) &&
+  if (FLAG_gc_interval >= 0 && !always_allocate() &&
       Heap::allocation_timeout_-- <= 0) {
     return AllocationResult::Retry(space);
   }
@@ -748,7 +748,7 @@ void Heap::SetSetterStubDeoptPCOffset(int pc_offset) {


 AlwaysAllocateScope::AlwaysAllocateScope(Isolate* isolate)
-    : heap_(isolate->heap()), daf_(isolate) {
+    : heap_(isolate->heap()) {
   heap_->always_allocate_scope_count_.Increment(1);
 }

Index: src/heap/heap.h
diff --git a/src/heap/heap.h b/src/heap/heap.h
index f451d4aaeec5ec17778c7f43969d26291747df46..aa08d449970b4f7f89cadcf037feff8dd72a848d 100644
--- a/src/heap/heap.h
+++ b/src/heap/heap.h
@@ -2426,9 +2426,7 @@ class AlwaysAllocateScope {
   inline ~AlwaysAllocateScope();

  private:
-  // Implicitly disable artificial allocation failures.
   Heap* heap_;
-  DisallowAllocationFailure daf_;
 };


Index: src/isolate.cc
diff --git a/src/isolate.cc b/src/isolate.cc
index d60a481c201bd6428d7f1c6efbd713587a2970b5..62005f4e4220564a86a3b97e4aae0e73a42770ca 100644
--- a/src/isolate.cc
+++ b/src/isolate.cc
@@ -2069,7 +2069,7 @@ bool Isolate::Init(Deserializer* des) {
   }

   // The initialization process does not handle memory exhaustion.
-  DisallowAllocationFailure disallow_allocation_failure(this);
+  AlwaysAllocateScope always_allocate(this);

   memory_allocator_ = new MemoryAllocator(this);
   code_range_ = new CodeRange(this);


--
--
v8-dev mailing list
v8-dev@googlegroups.com
http://groups.google.com/group/v8-dev
--- You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to v8-dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to