Reviewers: Dmitry Titov, Vitaly,
Description:
[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=
Please review this at http://codereview.chromium.org/3336019/show
Affected files:
M src/spaces-inl.h
M src/spaces.h
M src/spaces.cc
Index: src/spaces-inl.h
diff --git a/src/spaces-inl.h b/src/spaces-inl.h
index
66c0245c56d35a836cbf30bff77cba23ad5d83a4..f0e2f88dbc7bad0fc0f0ff9deaf9563910710457
100644
--- a/src/spaces-inl.h
+++ b/src/spaces-inl.h
@@ -311,6 +311,7 @@ void MemoryAllocator::ChunkInfo::init(Address a, size_t
s, PagedSpace* o) {
size_ = s;
owner_ = o;
executable_ = (o == NULL) ? NOT_EXECUTABLE : o->executable();
+ owner_identity_ = (o == NULL) ? FIRST_SPACE : o->identity();
}
Index: src/spaces.cc
diff --git a/src/spaces.cc b/src/spaces.cc
index
9bd18744fe9c767c9a49e617f5a8d3a183a0f1d5..b23976214e3320a163a7e4728db11f01d55be977
100644
--- a/src/spaces.cc
+++ b/src/spaces.cc
@@ -657,7 +657,7 @@ void MemoryAllocator::DeleteChunk(int chunk_id) {
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);
Index: src/spaces.h
diff --git a/src/spaces.h b/src/spaces.h
index
147d68201d0d771d01b05654b7aff4c180202609..3e0858afc26f5c830ac00ba2efdd4557272b1f2f
100644
--- a/src/spaces.h
+++ b/src/spaces.h
@@ -683,7 +683,8 @@ class MemoryAllocator {
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_; }
@@ -691,12 +692,14 @@ class MemoryAllocator {
// 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