From f2a33ff9cbc6d19943f1c7fbddd1f23d23975577 Mon Sep 17 00:00:00 2001 From: Andras Becsi Date: Wed, 11 Dec 2013 21:33:03 +0100 Subject: Update Chromium to branch 1650 (31.0.1650.63) Change-Id: I57d8c832eaec1eb2364e0a8e7352a6dd354db99f Reviewed-by: Jocelyn Turcotte --- chromium/v8/src/spaces.h | 51 +++++++++++++++++++++++++++++++++--------------- 1 file changed, 35 insertions(+), 16 deletions(-) (limited to 'chromium/v8/src/spaces.h') diff --git a/chromium/v8/src/spaces.h b/chromium/v8/src/spaces.h index b47452e421f..43f44a5c707 100644 --- a/chromium/v8/src/spaces.h +++ b/chromium/v8/src/spaces.h @@ -32,6 +32,7 @@ #include "hashmap.h" #include "list.h" #include "log.h" +#include "platform/mutex.h" #include "v8utils.h" namespace v8 { @@ -306,7 +307,7 @@ class MemoryChunk { } // Only works for addresses in pointer spaces, not data or code spaces. - static inline MemoryChunk* FromAnyPointerAddress(Address addr); + static inline MemoryChunk* FromAnyPointerAddress(Heap* heap, Address addr); Address address() { return reinterpret_cast
(this); } @@ -784,8 +785,9 @@ class Page : public MemoryChunk { // Maximum object size that fits in a page. Objects larger than that size // are allocated in large object space and are never moved in memory. This // also applies to new space allocation, since objects are never migrated - // from new space to large object space. - static const int kMaxNonCodeHeapObjectSize = kNonCodeObjectAreaSize; + // from new space to large object space. Takes double alignment into account. + static const int kMaxNonCodeHeapObjectSize = + kNonCodeObjectAreaSize - kPointerSize; // Page size mask. static const intptr_t kPageAlignmentMask = (1 << kPageSizeBits) - 1; @@ -1081,6 +1083,13 @@ class MemoryAllocator { return (Available() / Page::kPageSize) * Page::kMaxNonCodeHeapObjectSize; } + // Returns an indication of whether a pointer is in a space that has + // been allocated by this MemoryAllocator. + V8_INLINE bool IsOutsideAllocatedSpace(const void* address) const { + return address < lowest_ever_allocated_ || + address >= highest_ever_allocated_; + } + #ifdef DEBUG // Reports statistic info of the space. void ReportStatistics(); @@ -1103,6 +1112,8 @@ class MemoryAllocator { Executability executable, VirtualMemory* controller); + bool CommitMemory(Address addr, size_t size, Executability executable); + void FreeMemory(VirtualMemory* reservation, Executability executable); void FreeMemory(Address addr, size_t size, Executability executable); @@ -1148,10 +1159,10 @@ class MemoryAllocator { return CodePageAreaEndOffset() - CodePageAreaStartOffset(); } - MUST_USE_RESULT static bool CommitExecutableMemory(VirtualMemory* vm, - Address start, - size_t commit_size, - size_t reserved_size); + MUST_USE_RESULT bool CommitExecutableMemory(VirtualMemory* vm, + Address start, + size_t commit_size, + size_t reserved_size); private: Isolate* isolate_; @@ -1166,6 +1177,14 @@ class MemoryAllocator { // Allocated executable space size in bytes. size_t size_executable_; + // We keep the lowest and highest addresses allocated as a quick way + // of determining that pointers are outside the heap. The estimate is + // conservative, i.e. not all addrsses in 'allocated' space are allocated + // to our heap. The range is [lowest, highest[, inclusive on the low end + // and exclusive on the high end. + void* lowest_ever_allocated_; + void* highest_ever_allocated_; + struct MemoryAllocationCallbackRegistration { MemoryAllocationCallbackRegistration(MemoryAllocationCallback callback, ObjectSpace space, @@ -1188,6 +1207,11 @@ class MemoryAllocator { Page* InitializePagesInChunk(int chunk_id, int pages_in_chunk, PagedSpace* owner); + void UpdateAllocatedSpaceLimits(void* low, void* high) { + lowest_ever_allocated_ = Min(lowest_ever_allocated_, low); + highest_ever_allocated_ = Max(highest_ever_allocated_, high); + } + DISALLOW_IMPLICIT_CONSTRUCTORS(MemoryAllocator); }; @@ -1444,13 +1468,8 @@ class FreeListCategory { FreeListCategory() : top_(NULL), end_(NULL), - mutex_(OS::CreateMutex()), available_(0) {} - ~FreeListCategory() { - delete mutex_; - } - intptr_t Concatenate(FreeListCategory* category); void Reset(); @@ -1476,7 +1495,7 @@ class FreeListCategory { int available() const { return available_; } void set_available(int available) { available_ = available; } - Mutex* mutex() { return mutex_; } + Mutex* mutex() { return &mutex_; } #ifdef DEBUG intptr_t SumFreeList(); @@ -1486,7 +1505,7 @@ class FreeListCategory { private: FreeListNode* top_; FreeListNode* end_; - Mutex* mutex_; + Mutex mutex_; // Total available bytes in all blocks of this free list category. int available_; @@ -1756,8 +1775,8 @@ class PagedSpace : public Space { // Report code object related statistics void CollectCodeStatistics(); - static void ReportCodeStatistics(); - static void ResetCodeStatistics(); + static void ReportCodeStatistics(Isolate* isolate); + static void ResetCodeStatistics(Isolate* isolate); #endif bool was_swept_conservatively() { return was_swept_conservatively_; } -- cgit v1.2.1