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 2846 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 | 2864 #ifdef ENABLE_HEAP_PROTECTION |
2865 | 2865 |
2866 void Heap::Protect() { | 2866 void Heap::Protect() { |
2867 new_space_.Protect(); | 2867 if (HasBeenSetup()) { |
2868 map_space_->Protect(); | 2868 new_space_.Protect(); |
2869 old_pointer_space_->Protect(); | 2869 map_space_->Protect(); |
2870 old_data_space_->Protect(); | 2870 old_pointer_space_->Protect(); |
2871 code_space_->Protect(); | 2871 old_data_space_->Protect(); |
2872 lo_space_->Protect(); | 2872 code_space_->Protect(); |
| 2873 lo_space_->Protect(); |
| 2874 } |
2873 } | 2875 } |
2874 | 2876 |
2875 | 2877 |
2876 void Heap::Unprotect() { | 2878 void Heap::Unprotect() { |
2877 new_space_.Unprotect(); | 2879 if (HasBeenSetup()) { |
2878 map_space_->Unprotect(); | 2880 new_space_.Unprotect(); |
2879 old_pointer_space_->Unprotect(); | 2881 map_space_->Unprotect(); |
2880 old_data_space_->Unprotect(); | 2882 old_pointer_space_->Unprotect(); |
2881 code_space_->Unprotect(); | 2883 old_data_space_->Unprotect(); |
2882 lo_space_->Unprotect(); | 2884 code_space_->Unprotect(); |
| 2885 lo_space_->Unprotect(); |
| 2886 } |
2883 } | 2887 } |
2884 | 2888 |
2885 #endif | 2889 #endif |
2886 | 2890 |
2887 | 2891 |
2888 #ifdef DEBUG | 2892 #ifdef DEBUG |
2889 | 2893 |
2890 class PrintHandleVisitor: public ObjectVisitor { | 2894 class PrintHandleVisitor: public ObjectVisitor { |
2891 public: | 2895 public: |
2892 void VisitPointers(Object** start, Object** end) { | 2896 void VisitPointers(Object** start, Object** end) { |
(...skipping 457 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3350 #ifdef DEBUG | 3354 #ifdef DEBUG |
3351 bool Heap::GarbageCollectionGreedyCheck() { | 3355 bool Heap::GarbageCollectionGreedyCheck() { |
3352 ASSERT(FLAG_gc_greedy); | 3356 ASSERT(FLAG_gc_greedy); |
3353 if (Bootstrapper::IsActive()) return true; | 3357 if (Bootstrapper::IsActive()) return true; |
3354 if (disallow_allocation_failure()) return true; | 3358 if (disallow_allocation_failure()) return true; |
3355 return CollectGarbage(0, NEW_SPACE); | 3359 return CollectGarbage(0, NEW_SPACE); |
3356 } | 3360 } |
3357 #endif | 3361 #endif |
3358 | 3362 |
3359 } } // namespace v8::internal | 3363 } } // namespace v8::internal |
OLD | NEW |