Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(182)

Unified Diff: src/spaces.h

Issue 3161015: Tracks the usage of executable memory allocated by V8 and exposes the value t... (Closed) Base URL: http://v8.googlecode.com/svn/trunk/
Patch Set: '' Created 10 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | src/spaces.cc » ('j') | src/spaces.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/spaces.h
===================================================================
--- src/spaces.h (revision 5173)
+++ src/spaces.h (working copy)
@@ -197,6 +197,10 @@
inline void SetIsLargeObjectPage(bool is_large_object_page);
+ inline bool IsPageExecutable();
+
+ inline void SetIsPageExecutable(bool is_page_executable);
+
// Returns the offset of a given address to this page.
INLINE(int Offset(Address a)) {
int offset = static_cast<int>(a - address());
@@ -256,13 +260,16 @@
STATIC_CHECK(kRegionSize == kPageSize / kBitsPerInt);
enum PageFlag {
- IS_NORMAL_PAGE = 1 << 0,
- WAS_IN_USE_BEFORE_MC = 1 << 1,
+ IS_NORMAL_PAGE = 0,
+ WAS_IN_USE_BEFORE_MC,
// Page allocation watermark was bumped by preallocation during scavenge.
// Correct watermark can be retrieved by CachedAllocationWatermark() method
- WATERMARK_INVALIDATED = 1 << 2
+ WATERMARK_INVALIDATED,
+ IS_EXECUTABLE,
+ NUM_PAGE_FLAGS // Must be last
};
+ static const int kPageFlagMask = (1 << NUM_PAGE_FLAGS) - 1;
// To avoid an additional WATERMARK_INVALIDATED flag clearing pass during
// scavenge we just invalidate the watermark on each old space page after
@@ -291,7 +298,7 @@
inline void ClearGCFields();
- static const int kAllocationWatermarkOffsetShift = 3;
+ static const int kAllocationWatermarkOffsetShift = WATERMARK_INVALIDATED + 1;
static const int kAllocationWatermarkOffsetBits = kPageSizeBits + 1;
static const uint32_t kAllocationWatermarkOffsetMask =
((1 << kAllocationWatermarkOffsetBits) - 1) <<
@@ -557,7 +564,9 @@
static void* AllocateRawMemory(const size_t requested,
size_t* allocated,
Executability executable);
- static void FreeRawMemory(void* buf, size_t length);
+ static void FreeRawMemory(void* buf,
+ size_t length,
+ Executability executable);
// Returns the maximum available bytes of heaps.
static int Available() { return capacity_ < size_ ? 0 : capacity_ - size_; }
@@ -565,6 +574,9 @@
// Returns allocated spaces in bytes.
static int Size() { return size_; }
+ // Returns allocated executable spaces in bytes.
+ static int SizeExecutable() { return size_executable_; }
+
// Returns maximum available bytes that the old space can have.
static int MaxAvailable() {
return (Available() / Page::kPageSize) * Page::kObjectAreaSize;
@@ -628,6 +640,8 @@
// Allocated space size in bytes.
static int size_;
+ // Allocated executable space size in bytes.
+ static int size_executable_;
// The initial chunk of virtual memory.
static VirtualMemory* initial_chunk_;
@@ -2058,7 +2072,7 @@
LargeObjectChunk* next() { return next_; }
void set_next(LargeObjectChunk* chunk) { next_ = chunk; }
- size_t size() { return size_; }
+ size_t size() { return size_ & ~Page::kPageFlagMask; }
void set_size(size_t size_in_bytes) { size_ = size_in_bytes; }
// Returns the object in this chunk.
« no previous file with comments | « no previous file | src/spaces.cc » ('j') | src/spaces.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698