Revision: 5464
Author: [email protected]
Date: Wed Sep 15 08:34:43 2010
Log: [Isolates] Make isolate tests pass on x64

* Instead of calling Space::identity() on deleted Space object
  store a pointer to the identity in the ChunkInfo so that it
  can be accessed even if the space has been destroyed.

BUG=
TEST=

Review URL: http://codereview.chromium.org/3336019
http://code.google.com/p/v8/source/detail?r=5464

Modified:
 /branches/experimental/isolates/src/spaces-inl.h
 /branches/experimental/isolates/src/spaces.cc
 /branches/experimental/isolates/src/spaces.h

=======================================
--- /branches/experimental/isolates/src/spaces-inl.h Wed Sep 1 10:01:38 2010 +++ /branches/experimental/isolates/src/spaces-inl.h Wed Sep 15 08:34:43 2010
@@ -311,6 +311,7 @@
   size_ = s;
   owner_ = o;
   executable_ = (o == NULL) ? NOT_EXECUTABLE : o->executable();
+  owner_identity_ = (o == NULL) ? FIRST_SPACE : o->identity();
 }


=======================================
--- /branches/experimental/isolates/src/spaces.cc       Fri Sep 10 11:52:02 2010
+++ /branches/experimental/isolates/src/spaces.cc       Wed Sep 15 08:34:43 2010
@@ -657,7 +657,7 @@
     COUNTERS->memory_allocated()->Decrement(static_cast<int>(c.size()));
   } else {
     LOG(DeleteEvent("PagedChunk", c.address()));
- ObjectSpace space = static_cast<ObjectSpace>(1 << c.owner()->identity());
+    ObjectSpace space = static_cast<ObjectSpace>(1 << c.owner_identity());
     size_t size = c.size();
     FreeRawMemory(c.address(), size, c.executable());
     PerformAllocationCallback(space, kAllocationActionFree, size);
=======================================
--- /branches/experimental/isolates/src/spaces.h        Fri Sep 10 11:52:02 2010
+++ /branches/experimental/isolates/src/spaces.h        Wed Sep 15 08:34:43 2010
@@ -686,7 +686,8 @@
     ChunkInfo() : address_(NULL),
                   size_(0),
                   owner_(NULL),
-                  executable_(NOT_EXECUTABLE) {}
+                  executable_(NOT_EXECUTABLE),
+                  owner_identity_(FIRST_SPACE) {}
     inline void init(Address a, size_t s, PagedSpace* o);
     Address address() { return address_; }
     size_t size() { return size_; }
@@ -694,12 +695,14 @@
     // We save executability of the owner to allow using it
     // when collecting stats after the owner has been destroyed.
     Executability executable() const { return executable_; }
+    AllocationSpace owner_identity() const { return owner_identity_; }

    private:
     Address address_;
     size_t size_;
     PagedSpace* owner_;
     Executability executable_;
+    AllocationSpace owner_identity_;
   };

   // Chunks_, free_chunk_ids_ and top_ act as a stack of free chunk ids.

--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev

Reply via email to