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

Unified Diff: src/heap.cc

Issue 151152: Create a separate space for global property cells (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 11 years, 6 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/heap.h ('k') | src/heap-inl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/heap.cc
===================================================================
--- src/heap.cc (revision 2321)
+++ src/heap.cc (working copy)
@@ -64,6 +64,7 @@
OldSpace* Heap::old_data_space_ = NULL;
OldSpace* Heap::code_space_ = NULL;
MapSpace* Heap::map_space_ = NULL;
+GlobalPropertyCellSpace* Heap::global_property_cell_space_ = NULL;
LargeObjectSpace* Heap::lo_space_ = NULL;
static const int kMinimumPromotionLimit = 2*MB;
@@ -121,7 +122,8 @@
old_pointer_space_->Capacity() +
old_data_space_->Capacity() +
code_space_->Capacity() +
- map_space_->Capacity();
+ map_space_->Capacity() +
+ global_property_cell_space_->Capacity();
}
@@ -132,7 +134,8 @@
old_pointer_space_->Available() +
old_data_space_->Available() +
code_space_->Available() +
- map_space_->Available();
+ map_space_->Available() +
+ global_property_cell_space_->Available();
}
@@ -141,6 +144,7 @@
old_data_space_ != NULL &&
code_space_ != NULL &&
map_space_ != NULL &&
+ global_property_cell_space_ != NULL &&
lo_space_ != NULL;
}
@@ -371,6 +375,8 @@
return code_space_->Available() >= requested_size;
case MAP_SPACE:
return map_space_->Available() >= requested_size;
+ case GLOBAL_PROPERTY_CELL_SPACE:
+ return global_property_cell_space_->Available() >= requested_size;
case LO_SPACE:
return lo_space_->Available() >= requested_size;
}
@@ -1008,7 +1014,7 @@
Object* Heap::AllocatePartialMap(InstanceType instance_type,
int instance_size) {
- Object* result = AllocateRawMap(Map::kSize);
+ Object* result = AllocateRawMap();
if (result->IsFailure()) return result;
// Map::cast cannot be used due to uninitialized map field.
@@ -1022,7 +1028,7 @@
Object* Heap::AllocateMap(InstanceType instance_type, int instance_size) {
- Object* result = AllocateRawMap(Map::kSize);
+ Object* result = AllocateRawMap();
if (result->IsFailure()) return result;
Map* map = reinterpret_cast<Map*>(result);
@@ -2685,6 +2691,8 @@
code_space_->ReportStatistics();
PrintF("Map space : ");
map_space_->ReportStatistics();
+ PrintF("Global property cell space : ");
+ global_property_cell_space_->ReportStatistics();
PrintF("Large object space : ");
lo_space_->ReportStatistics();
PrintF(">>>>>> ========================================= >>>>>>\n");
@@ -2705,6 +2713,7 @@
old_data_space_->Contains(addr) ||
code_space_->Contains(addr) ||
map_space_->Contains(addr) ||
+ global_property_cell_space_->Contains(addr) ||
lo_space_->SlowContains(addr));
}
@@ -2729,6 +2738,8 @@
return code_space_->Contains(addr);
case MAP_SPACE:
return map_space_->Contains(addr);
+ case GLOBAL_PROPERTY_CELL_SPACE:
+ return global_property_cell_space_->Contains(addr);
case LO_SPACE:
return lo_space_->SlowContains(addr);
}
@@ -2964,6 +2975,7 @@
+ old_data_space_->Size()
+ code_space_->Size()
+ map_space_->Size()
+ + global_property_cell_space_->Size()
+ lo_space_->Size();
}
@@ -3041,6 +3053,14 @@
// enough to hold at least a page will cause it to allocate.
if (!map_space_->Setup(NULL, 0)) return false;
+ // Initialize global property cell space.
+ global_property_cell_space_ =
+ new GlobalPropertyCellSpace(kMaxMapSpaceSize, GLOBAL_PROPERTY_CELL_SPACE);
+ if (global_property_cell_space_ == NULL) return false;
+ // Setting up a paged space without giving it a virtual memory range big
+ // enough to hold at least a page will cause it to allocate.
+ if (!global_property_cell_space_->Setup(NULL, 0)) return false;
+
// The large object code space may contain code or data. We set the memory
// to be non-executable here for safety, but this means we need to enable it
// explicitly when allocating large code objects.
@@ -3093,6 +3113,12 @@
map_space_ = NULL;
}
+ if (global_property_cell_space_ != NULL) {
+ global_property_cell_space_->TearDown();
+ delete global_property_cell_space_;
+ global_property_cell_space_ = NULL;
+ }
+
if (lo_space_ != NULL) {
lo_space_->TearDown();
delete lo_space_;
@@ -3104,7 +3130,8 @@
void Heap::Shrink() {
- // Try to shrink map, old, and code spaces.
+ // Try to shrink global property cell, map, old, and code spaces.
+ global_property_cell_space_->Shrink();
map_space_->Shrink();
old_pointer_space_->Shrink();
old_data_space_->Shrink();
@@ -3117,6 +3144,7 @@
void Heap::Protect() {
if (HasBeenSetup()) {
new_space_.Protect();
+ global_property_cell_space_->Protect();
map_space_->Protect();
old_pointer_space_->Protect();
old_data_space_->Protect();
@@ -3129,6 +3157,7 @@
void Heap::Unprotect() {
if (HasBeenSetup()) {
new_space_.Unprotect();
+ global_property_cell_space_->Unprotect();
map_space_->Unprotect();
old_pointer_space_->Unprotect();
old_data_space_->Unprotect();
@@ -3262,6 +3291,9 @@
case MAP_SPACE:
iterator_ = new HeapObjectIterator(Heap::map_space());
break;
+ case GLOBAL_PROPERTY_CELL_SPACE:
+ iterator_ = new HeapObjectIterator(Heap::global_property_cell_space());
+ break;
case LO_SPACE:
iterator_ = new LargeObjectIterator(Heap::lo_space());
break;
« no previous file with comments | « src/heap.h ('k') | src/heap-inl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698