Index: runtime/vm/heap.cc |
=================================================================== |
--- runtime/vm/heap.cc (revision 40250) |
+++ runtime/vm/heap.cc (working copy) |
@@ -37,6 +37,7 @@ |
"Trigger pretenuring when this many percent are promoted."); |
DEFINE_FLAG(int, pretenure_interval, 10, |
"Back off pretenuring after this many cycles."); |
+DEFINE_FLAG(bool, pretenure_all, false, "Global pretenuring (for testing)."); |
Heap::Heap(Isolate* isolate, |
intptr_t max_new_gen_semi_words, |
@@ -393,16 +394,31 @@ |
} |
-uword Heap::TopAddress() { |
- return reinterpret_cast<uword>(new_space_->TopAddress()); |
+uword Heap::TopAddress(Heap::Space space) { |
+ if (space == kNew) { |
+ return reinterpret_cast<uword>(new_space_->TopAddress()); |
+ } else { |
+ ASSERT(space == kPretenured); |
Ivan Posva
2014/09/19 18:45:55
Please add a TODO to the definition of kPretenured
koda
2014/09/19 20:48:29
Done.
|
+ return reinterpret_cast<uword>(old_space_->TopAddress()); |
+ } |
} |
-uword Heap::EndAddress() { |
- return reinterpret_cast<uword>(new_space_->EndAddress()); |
+uword Heap::EndAddress(Heap::Space space) { |
+ if (space == kNew) { |
+ return reinterpret_cast<uword>(new_space_->EndAddress()); |
+ } else { |
+ ASSERT(space == kPretenured); |
+ return reinterpret_cast<uword>(old_space_->EndAddress()); |
+ } |
} |
+Heap::Space Heap::SpaceForAllocation(intptr_t cid) const { |
+ return FLAG_pretenure_all ? kPretenured : kNew; |
+} |
+ |
+ |
void Heap::Init(Isolate* isolate, |
intptr_t max_new_gen_words, |
intptr_t max_old_gen_words) { |