OLD | NEW |
1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 2843 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2854 | 2854 |
2855 void Heap::Shrink() { | 2855 void Heap::Shrink() { |
2856 // Try to shrink map, old, and code spaces. | 2856 // Try to shrink map, old, and code spaces. |
2857 map_space_->Shrink(); | 2857 map_space_->Shrink(); |
2858 old_pointer_space_->Shrink(); | 2858 old_pointer_space_->Shrink(); |
2859 old_data_space_->Shrink(); | 2859 old_data_space_->Shrink(); |
2860 code_space_->Shrink(); | 2860 code_space_->Shrink(); |
2861 } | 2861 } |
2862 | 2862 |
2863 | 2863 |
| 2864 #ifdef ENABLE_HEAP_PROTECTION |
| 2865 |
| 2866 void Heap::Protect() { |
| 2867 new_space_.Protect(); |
| 2868 map_space_->Protect(); |
| 2869 old_pointer_space_->Protect(); |
| 2870 old_data_space_->Protect(); |
| 2871 code_space_->Protect(); |
| 2872 lo_space_->Protect(); |
| 2873 } |
| 2874 |
| 2875 |
| 2876 void Heap::Unprotect() { |
| 2877 new_space_.Unprotect(); |
| 2878 map_space_->Unprotect(); |
| 2879 old_pointer_space_->Unprotect(); |
| 2880 old_data_space_->Unprotect(); |
| 2881 code_space_->Unprotect(); |
| 2882 lo_space_->Unprotect(); |
| 2883 } |
| 2884 |
| 2885 #endif |
| 2886 |
| 2887 |
2864 #ifdef DEBUG | 2888 #ifdef DEBUG |
2865 | 2889 |
2866 class PrintHandleVisitor: public ObjectVisitor { | 2890 class PrintHandleVisitor: public ObjectVisitor { |
2867 public: | 2891 public: |
2868 void VisitPointers(Object** start, Object** end) { | 2892 void VisitPointers(Object** start, Object** end) { |
2869 for (Object** p = start; p < end; p++) | 2893 for (Object** p = start; p < end; p++) |
2870 PrintF(" handle %p to %p\n", p, *p); | 2894 PrintF(" handle %p to %p\n", p, *p); |
2871 } | 2895 } |
2872 }; | 2896 }; |
2873 | 2897 |
(...skipping 452 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3326 #ifdef DEBUG | 3350 #ifdef DEBUG |
3327 bool Heap::GarbageCollectionGreedyCheck() { | 3351 bool Heap::GarbageCollectionGreedyCheck() { |
3328 ASSERT(FLAG_gc_greedy); | 3352 ASSERT(FLAG_gc_greedy); |
3329 if (Bootstrapper::IsActive()) return true; | 3353 if (Bootstrapper::IsActive()) return true; |
3330 if (disallow_allocation_failure()) return true; | 3354 if (disallow_allocation_failure()) return true; |
3331 return CollectGarbage(0, NEW_SPACE); | 3355 return CollectGarbage(0, NEW_SPACE); |
3332 } | 3356 } |
3333 #endif | 3357 #endif |
3334 | 3358 |
3335 } } // namespace v8::internal | 3359 } } // namespace v8::internal |
OLD | NEW |