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

Unified Diff: src/spaces.cc

Issue 164475: Push version 1.3.4 to trunk.... (Closed) Base URL: http://v8.googlecode.com/svn/trunk/
Patch Set: Created 11 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 | « src/spaces.h ('k') | src/uri.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/spaces.cc
===================================================================
--- src/spaces.cc (revision 2677)
+++ src/spaces.cc (working copy)
@@ -340,7 +340,18 @@
return true;
}
+bool MemoryAllocator::UncommitBlock(Address start, size_t size) {
+ ASSERT(start != NULL);
+ ASSERT(size > 0);
+ ASSERT(initial_chunk_ != NULL);
+ ASSERT(InInitialChunk(start));
+ ASSERT(InInitialChunk(start + size - 1));
+ if (!initial_chunk_->Uncommit(start, size)) return false;
+ Counters::memory_allocated.Decrement(size);
+ return true;
+}
+
Page* MemoryAllocator::InitializePagesInChunk(int chunk_id, int pages_in_chunk,
PagedSpace* owner) {
ASSERT(IsValidChunk(chunk_id));
@@ -1039,6 +1050,26 @@
#endif
+bool SemiSpace::Commit() {
+ ASSERT(!is_committed());
+ if (!MemoryAllocator::CommitBlock(start_, capacity_, executable())) {
+ return false;
+ }
+ committed_ = true;
+ return true;
+}
+
+
+bool SemiSpace::Uncommit() {
+ ASSERT(is_committed());
+ if (!MemoryAllocator::UncommitBlock(start_, capacity_)) {
+ return false;
+ }
+ committed_ = false;
+ return true;
+}
+
+
// -----------------------------------------------------------------------------
// SemiSpace implementation
@@ -1053,18 +1084,15 @@
// addresses.
capacity_ = initial_capacity;
maximum_capacity_ = maximum_capacity;
+ committed_ = false;
- if (!MemoryAllocator::CommitBlock(start, capacity_, executable())) {
- return false;
- }
-
start_ = start;
address_mask_ = ~(maximum_capacity - 1);
object_mask_ = address_mask_ | kHeapObjectTag;
object_expected_ = reinterpret_cast<uintptr_t>(start) | kHeapObjectTag;
+ age_mark_ = start_;
- age_mark_ = start_;
- return true;
+ return Commit();
}
@@ -1076,7 +1104,7 @@
bool SemiSpace::Grow() {
// Commit 50% extra space but only up to maximum capacity.
- int extra = capacity_/2;
+ int extra = RoundUp(capacity_ / 2, OS::AllocateAlignment());
if (capacity_ + extra > maximum_capacity_) {
extra = maximum_capacity_ - capacity_;
}
« no previous file with comments | « src/spaces.h ('k') | src/uri.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698