Revision: 16468
Author:   [email protected]
Date:     Mon Sep  2 11:39:23 2013 UTC
Log:      revert thread isolate in PreallocatedStorageAllocationPolicy

This reverts 16467 for breaking windows build

[email protected]

BUG=

Review URL: https://codereview.chromium.org/23824005
http://code.google.com/p/v8/source/detail?r=16468

Modified:
 /branches/bleeding_edge/src/allocation-inl.h
 /branches/bleeding_edge/src/allocation.h
 /branches/bleeding_edge/src/isolate.cc
 /branches/bleeding_edge/src/list.h
 /branches/bleeding_edge/src/string-stream.cc
 /branches/bleeding_edge/src/zone.h
 /branches/bleeding_edge/test/cctest/test-list.cc

=======================================
--- /branches/bleeding_edge/src/allocation-inl.h Mon Sep 2 11:20:42 2013 UTC +++ /branches/bleeding_edge/src/allocation-inl.h Mon Sep 2 11:39:23 2013 UTC
@@ -35,12 +35,12 @@


 void* PreallocatedStorageAllocationPolicy::New(size_t size) {
-  return isolate_->PreallocatedStorageNew(size);
+  return Isolate::Current()->PreallocatedStorageNew(size);
 }


 void PreallocatedStorageAllocationPolicy::Delete(void* p) {
-  return isolate_->PreallocatedStorageDelete(p);
+  return Isolate::Current()->PreallocatedStorageDelete(p);
 }


=======================================
--- /branches/bleeding_edge/src/allocation.h    Mon Sep  2 11:20:42 2013 UTC
+++ /branches/bleeding_edge/src/allocation.h    Mon Sep  2 11:39:23 2013 UTC
@@ -104,7 +104,6 @@
 // and free. Used as the default policy for lists.
 class FreeStoreAllocationPolicy {
  public:
-  typedef FreeStoreAllocationPolicy Deleter;
   INLINE(void* New(size_t size)) { return Malloced::New(size); }
   INLINE(static void Delete(void* p)) { Malloced::Delete(p); }
 };
@@ -132,21 +131,9 @@
 };


-class Isolate;
-
-
-class PreallocatedStorageAllocationPolicy {
- public:
-  typedef PreallocatedStorageAllocationPolicy Deleter;
-  INLINE(explicit PreallocatedStorageAllocationPolicy(Isolate* isolate))
-    : isolate_(isolate) { }
-  INLINE(PreallocatedStorageAllocationPolicy(
-      const PreallocatedStorageAllocationPolicy& policy))
-    : isolate_(policy.isolate_) { }
+struct PreallocatedStorageAllocationPolicy {
   INLINE(void* New(size_t size));
-  INLINE(void Delete(void* ptr));
- private:
-  Isolate* isolate_;
+  INLINE(static void Delete(void* ptr));
 };


=======================================
--- /branches/bleeding_edge/src/isolate.cc      Mon Sep  2 11:20:42 2013 UTC
+++ /branches/bleeding_edge/src/isolate.cc      Mon Sep  2 11:39:23 2013 UTC
@@ -2059,7 +2059,7 @@
   delete eternal_handles_;
   eternal_handles_ = NULL;

-  DebugObjectCache::Delete(string_stream_debug_object_cache_);
+  delete string_stream_debug_object_cache_;
   string_stream_debug_object_cache_ = NULL;

   delete external_reference_table_;
=======================================
--- /branches/bleeding_edge/src/list.h  Mon Sep  2 11:20:42 2013 UTC
+++ /branches/bleeding_edge/src/list.h  Mon Sep  2 11:39:23 2013 UTC
@@ -48,15 +48,13 @@
 // template <typename T,
// class AllocationPolicy = FreeStoreAllocationPolicy> class List;
 template <typename T, class AllocationPolicy>
-class List : private AllocationPolicy::Deleter {
+class List {
  public:
-  explicit List(AllocationPolicy allocator = AllocationPolicy())
-    : AllocationPolicy::Deleter(allocator) {
+  explicit List(AllocationPolicy allocator = AllocationPolicy()) {
     Initialize(0, allocator);
   }
   INLINE(explicit List(int capacity,
-                       AllocationPolicy allocator = AllocationPolicy()))
-    : AllocationPolicy::Deleter(allocator) {
+                       AllocationPolicy allocator = AllocationPolicy())) {
     Initialize(capacity, allocator);
   }
   INLINE(~List()) { DeleteData(data_); }
@@ -73,20 +71,13 @@
     return allocator.New(static_cast<int>(size));
   }
   INLINE(void operator delete(void* p)) {
-    AllocationPolicy::Deleter::Delete(p);
+    AllocationPolicy::Delete(p);
   }

   // Please the MSVC compiler.  We should never have to execute this.
   INLINE(void operator delete(void* p, AllocationPolicy allocator)) {
     UNREACHABLE();
   }
-
-  // Delete via the instance Deleter
-  static void Delete(List* p) {
-    if (p == NULL) return;
-    p->~List();
-    p->AllocationPolicy::Deleter::Delete(p);
-  }

   // Returns a reference to the element at index i.  This reference is
   // not safe to use after operations that can change the list's
@@ -188,7 +179,7 @@
     return static_cast<T*>(allocator.New(n * sizeof(T)));
   }
   INLINE(void DeleteData(T* data))  {
-    this->AllocationPolicy::Deleter::Delete(data);
+    AllocationPolicy::Delete(data);
   }

   // Increase the capacity of a full list, and add an element.
=======================================
--- /branches/bleeding_edge/src/string-stream.cc Mon Sep 2 11:20:42 2013 UTC +++ /branches/bleeding_edge/src/string-stream.cc Mon Sep 2 11:39:23 2013 UTC
@@ -204,9 +204,7 @@
     }
     if (debug_object_cache->length() < kMentionedObjectCacheMaxSize) {
       Add("#%d#", debug_object_cache->length());
-      HeapObject* ho = HeapObject::cast(o);
-      PreallocatedStorageAllocationPolicy policy(ho->GetIsolate());
-      debug_object_cache->Add(ho, policy);
+      debug_object_cache->Add(HeapObject::cast(o));
     } else {
       Add("@%p", o);
     }
@@ -301,9 +299,8 @@
   Isolate* isolate = Isolate::Current();
   isolate->set_string_stream_current_security_token(NULL);
   if (isolate->string_stream_debug_object_cache() == NULL) {
-    PreallocatedStorageAllocationPolicy policy(isolate);
     isolate->set_string_stream_debug_object_cache(
-        new(policy) DebugObjectCache(policy));
+        new List<HeapObject*, PreallocatedStorageAllocationPolicy>(0));
   }
   isolate->string_stream_debug_object_cache()->Clear();
 }
=======================================
--- /branches/bleeding_edge/src/zone.h  Mon Sep  2 11:20:42 2013 UTC
+++ /branches/bleeding_edge/src/zone.h  Mon Sep  2 11:39:23 2013 UTC
@@ -174,11 +174,6 @@
 // structures to allocate themselves and their elements in the Zone.
 struct ZoneAllocationPolicy {
  public:
-  class Deleter {
-   public:
-    INLINE(explicit Deleter(const ZoneAllocationPolicy&)) {}
-    INLINE(static void Delete(void *pointer)) { }
-  };
   explicit ZoneAllocationPolicy(Zone* zone) : zone_(zone) { }
   INLINE(void* New(size_t size));
   INLINE(static void Delete(void *pointer)) { }
=======================================
--- /branches/bleeding_edge/test/cctest/test-list.cc Mon Sep 2 11:20:42 2013 UTC +++ /branches/bleeding_edge/test/cctest/test-list.cc Mon Sep 2 11:39:23 2013 UTC
@@ -35,8 +35,6 @@
 // Use a testing allocator that clears memory before deletion.
 class ZeroingAllocationPolicy {
  public:
-  typedef ZeroingAllocationPolicy Deleter;
-
   void* New(size_t size) {
     // Stash the size in the first word to use for Delete.
     size_t true_size = size + sizeof(size_t);

--
--
v8-dev mailing list
[email protected]
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 [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to